
    j)                         d dl Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZ  e j.                  e j0                  d      Z G d d      Z G d d      Zy)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)ChatCompletionResponse)Function)FunctionCall)Message)ResponseFormat)StreamOptions)Tool   )AsyncRawChatCompletionsClientRawChatCompletionsClient.c            7       n   e Zd ZdefdZedefd       Zeeeeeeeeeeeeeeeeeeeeeeeeeddde	j                  e   de	j                  e	j                  e      d	e	j                  e   d
e	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e	j                  e      de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e	j$                  eef      de	j                  e   de	j                  e   de	j                  e   de	j                  e	j                  e      de	j                  e	j$                  ee	j                  e	j*                     f      de	j                  e   de	j                  e   de	j                  e	j$                  eef      de	j                  e   de	j                  e   de	j                  e	j                  e      de	j                  e   d e	j                  e   def6d!Zy)"ChatCompletionsClientclient_wrapperc                &    t        |      | _        y N)r   )r   _raw_clientselfr   s     ~/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/rest_api/chat_completions/client.py__init__zChatCompletionsClient.__init__   s    3>R    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawChatCompletionsClient
        r   r   s    r   with_raw_responsez'ChatCompletionsClient.with_raw_response        r   Nmodelmessagestemperaturetop_pnstreamstream_optionsstop
max_tokensmax_completion_tokenspresence_penaltyfrequency_penalty
logit_biasuserresponse_formatseedtoolstool_choiceparallel_tool_callsstoremetadatareasoning_effortservice_tier	functionsfunction_callrequest_optionsr#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   c                    | j                   j                  |||||||||	|
||||||||||||||||      }|j                  S )a  
        Create chat completions

        Parameters
        ----------
        model : typing.Optional[str]

        messages : typing.Optional[typing.Sequence[Message]]

        temperature : typing.Optional[float]

        top_p : typing.Optional[float]

        n : typing.Optional[int]

        stream : typing.Optional[bool]

        stream_options : typing.Optional[StreamOptions]

        stop : typing.Optional[typing.Sequence[str]]

        max_tokens : typing.Optional[int]

        max_completion_tokens : typing.Optional[int]

        presence_penalty : typing.Optional[float]

        frequency_penalty : typing.Optional[float]

        logit_bias : typing.Optional[typing.Dict[str, int]]

        user : typing.Optional[str]

        response_format : typing.Optional[ResponseFormat]

        seed : typing.Optional[int]

        tools : typing.Optional[typing.Sequence[Tool]]

        tool_choice : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]

        parallel_tool_calls : typing.Optional[bool]

        store : typing.Optional[bool]

        metadata : typing.Optional[typing.Dict[str, str]]

        reasoning_effort : typing.Optional[str]

        service_tier : typing.Optional[str]

        functions : typing.Optional[typing.Sequence[Function]]

        function_call : typing.Optional[FunctionCall]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ChatCompletionResponse
            Chat completions response

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.chat_completions.create_chat_completions()
        r"   r   create_chat_completionsdatar   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   	_responses                               r   r?   z-ChatCompletionsClient.create_chat_completions#   sz    F $$<<#)!"7-/!+# 3-%'+5 = 
	8 ~~r   )__name__
__module____qualname__r   r   propertyr   r    OMITtypingOptionalstrSequencer
   floatintboolr   Dictr   r   Anyr   r	   r   r   r?    r   r   r   r      s   S*; S  #;     '+>B.2(,"&(,9=6:+/6:3748=A%);?%)8<VZ59'+;?15-1@D7;;?9 s# //&//'":;	
 __U+ u% ??3 % 6 oofooc23 OOC(  &s3 !//%0 "??51 OOFKKS$9:  ooc"!"  8#$ ooc"%& vt45'( __V[[foofjj6Q1Q%RS)* $__T2+, t$-. //&++c3h"78/0 !//#.12 ooc*34 ??6??8#<=56 |478  89: 
 ;r   r   c            7       n   e Zd ZdefdZedefd       Zeeeeeeeeeeeeeeeeeeeeeeeeeddde	j                  e   de	j                  e	j                  e      d	e	j                  e   d
e	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e	j                  e      de	j                  e   de	j                  e   de	j                  e   de	j                  e   de	j                  e	j$                  eef      de	j                  e   de	j                  e   de	j                  e   de	j                  e	j                  e      de	j                  e	j$                  ee	j                  e	j*                     f      de	j                  e   de	j                  e   de	j                  e	j$                  eef      de	j                  e   de	j                  e   de	j                  e	j                  e      de	j                  e   d e	j                  e   def6d!Zy)"AsyncChatCompletionsClientr   c                &    t        |      | _        y r   )r   r   r   s     r   r   z#AsyncChatCompletionsClient.__init__   s    8Wr   r   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawChatCompletionsClient
        r   r   s    r   r    z,AsyncChatCompletionsClient.with_raw_response   r!   r   Nr"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   c                   K   | j                   j                  |||||||||	|
||||||||||||||||       d{   }|j                  S 7 w)aS  
        Create chat completions

        Parameters
        ----------
        model : typing.Optional[str]

        messages : typing.Optional[typing.Sequence[Message]]

        temperature : typing.Optional[float]

        top_p : typing.Optional[float]

        n : typing.Optional[int]

        stream : typing.Optional[bool]

        stream_options : typing.Optional[StreamOptions]

        stop : typing.Optional[typing.Sequence[str]]

        max_tokens : typing.Optional[int]

        max_completion_tokens : typing.Optional[int]

        presence_penalty : typing.Optional[float]

        frequency_penalty : typing.Optional[float]

        logit_bias : typing.Optional[typing.Dict[str, int]]

        user : typing.Optional[str]

        response_format : typing.Optional[ResponseFormat]

        seed : typing.Optional[int]

        tools : typing.Optional[typing.Sequence[Tool]]

        tool_choice : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]

        parallel_tool_calls : typing.Optional[bool]

        store : typing.Optional[bool]

        metadata : typing.Optional[typing.Dict[str, str]]

        reasoning_effort : typing.Optional[str]

        service_tier : typing.Optional[str]

        functions : typing.Optional[typing.Sequence[Function]]

        function_call : typing.Optional[FunctionCall]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ChatCompletionResponse
            Chat completions response

        Examples
        --------
        from Opik import AsyncOpikApi
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.chat_completions.create_chat_completions()
        asyncio.run(main())
        r"   Nr>   rA   s                               r   r?   z2AsyncChatCompletionsClient.create_chat_completions   s     L **BB#)!"7-/!+# 3-%'+5 C 
 
	8 ~~9
s   9AAA)rC   rD   rE   r   r   rF   r   r    rG   rH   rI   rJ   rK   r
   rL   rM   rN   r   rO   r   r   rP   r   r	   r   r   r?   rQ   r   r   rS   rS      s   X*< X  #@     '+>B.2(,"&(,9=6:+/6:3748=A%);?%)8<VZ59'+;?15-1@D7;;?9B s#B //&//'":;	B
 __U+B u%B ??3B %B 6B oofooc23B OOC(B  &s3B !//%0B "??51B OOFKKS$9:B  ooc"!B"  8#B$ ooc"%B& vt45'B( __V[[foofjj6Q1Q%RS)B* $__T2+B, t$-B. //&++c3h"78/B0 !//#.1B2 ooc*3B4 ??6??8#<=5B6 |47B8  89B: 
 ;Br   rS   )rH   core.client_wrapperr   r   core.request_optionsr   types.chat_completion_responser   types.functionr   types.function_callr	   types.messager
   types.response_formatr   types.stream_optionsr   
types.toolr   
raw_clientr   r   castrP   rG   r   rS   rQ   r   r   <module>rb      sY     G 1 C % . # 2 0  O v{{6::s#N NbQ Qr   