
    j@                     x   d dl Z d dlZddlmZmZ ddlmZmZ ddlm	Z	m
Z
 ddlmZmZ ddlmZmZ ddlmZmZ dd	lmZmZ dd
lmZmZ ddlmZ ddlmZmZ ddlm Z m!Z! ddl"m#Z# ddl$m%Z%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z.m/Z/ ddl0m1Z1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z7m8Z8 ddl9m:Z:m;Z; ddl<m=Z=m>Z> ddl?m@Z@mAZA ddlBmCZCmDZD ddlEmFZFmGZG ddlHmIZImJZJ ddlKmLZLmMZM ddlNmOZOmPZP ddlQmRZRmSZS ddlTmUZUmVZV dd lWmXZXmYZY dd!lZm[Z[m\Z\ dd"l]m^Z^m_Z_ dd#l`maZambZb  G d$ d%      Zc G d& d'      Zddd(d)e j                  ef   d*e#d+effd,Zgy)-    N   )AgentConfigsClientAsyncAgentConfigsClient)AlertsClientAsyncAlertsClient)AnnotationQueuesClientAsyncAnnotationQueuesClient)AsyncAttachmentsClientAttachmentsClient)#AsyncAutomationRuleEvaluatorsClientAutomationRuleEvaluatorsClient)AsyncChatCompletionsClientChatCompletionsClient)AsyncCheckClientCheckClient)AsyncClientWrapperSyncClientWrapper)RequestOptions)AsyncDashboardsClientDashboardsClient)AsyncDatasetsClientDatasetsClient)OpikApiEnvironment)AsyncExperimentsClientExperimentsClient)AsyncFeedbackDefinitionsClientFeedbackDefinitionsClient)AsyncGuardrailsClientGuardrailsClient)AsyncLlmProviderKeyClientLlmProviderKeyClient)AsyncManualEvaluationClientManualEvaluationClient)AsyncOllamaClientOllamaClient)AsyncOllieStateClientOllieStateClient)!AsyncOpenTelemetryIngestionClientOpenTelemetryIngestionClient)AsyncOptimizationsClientOptimizationsClient)AsyncProjectsClientProjectsClient)AsyncPromptsClientPromptsClient)AsyncRawOpikApi
RawOpikApi)AsyncRedirectClientRedirectClient)AsyncRunnersClientRunnersClient)AsyncServiceTogglesClientServiceTogglesClient)AsyncSpansClientSpansClient)AsyncSystemUsageClientSystemUsageClient)AsyncTracesClientTracesClient)AsyncWelcomeWizardClientWelcomeWizardClient)AsyncWorkspacePermissionsClientWorkspacePermissionsClient)AsyncWorkspacesClientWorkspacesClientc                      e Zd ZdZdej
                  dddddddej                  e   dedej                  e   dej                  e   d	ej                  e	   d
ej                  e
   dej                  ej                     fdZedefd       Zdddej                  e   dej                  ej$                     fdZdddej                  e   dej                  ej$                     fdZy)OpikApia8  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    base_url : typing.Optional[str]
        The base url to use for requests from the client.

    environment : OpikApiEnvironment
        The environment to use for requests from the client. from .environment import OpikApiEnvironment

        Defaults to OpikApiEnvironment.DEFAULT



    api_key : typing.Optional[str]
    workspace_name : typing.Optional[str]
    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.Client]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from Opik import OpikApi
    client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
    NTbase_urlenvironmentapi_keyworkspace_nametimeoutfollow_redirectshttpx_clientrG   rH   rI   rJ   rK   rL   rM   c          	      6   ||n|dn|j                   j                  }t        t        ||      ||||n.|t	        j
                  ||      nt	        j
                  |      |      | _        t        | j                        | _        t        | j                        | _
        t        | j                        | _        t        | j                        | _        t        | j                        | _        t#        | j                        | _        t'        | j                        | _        t+        | j                        | _        t/        | j                        | _        t3        | j                        | _        t7        | j                        | _        t;        | j                        | _        t?        | j                        | _         tC        | j                        | _"        tG        | j                        | _$        tK        | j                        | _&        tO        | j                        | _(        tS        | j                        | _*        tW        | j                        | _,        t[        | j                        | _.        t_        | j                        | _0        tc        | j                        | _2        tg        | j                        | _4        tk        | j                        | _6        to        | j                        | _8        ts        | j                        | _:        tw        | j                        | _<        t{        | j                        | _>        t        | j                        | _@        t        | j                        | _B        y N<   rG   rH   )rK   rL   )rK   )rG   rI   rJ   rM   rK   )client_wrapper)CrK   readr   _get_base_urlhttpxClient_client_wrapperr1   _raw_clientr;   system_usager   agent_configsr   alertsr   annotation_queuesr   attachmentsr   checkr   automation_rule_evaluatorsr   chat_completionsr   
dashboardsr   datasetsr   experimentsr   feedback_definitionsr   
guardrailsr!   llm_provider_keyr5   runnersr#   manual_evaluationr%   ollamar'   ollie_stater)   open_telemetry_ingestionr+   optimizationsr-   projectsr/   promptsr7   service_togglesr9   spansr=   tracesr?   welcome_wizardrA   workspace_permissionsrC   
workspacesr3   redirect	selfrG   rH   rI   rJ   rK   rL   rM   _defaulted_timeouts	            m/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/rest_api/client.py__init__zOpikApi.__init__J   s    *Gl6JP\PdPdPiPi 	  1"H+N)' &  + &8K[\&89&
 
 &T5I5IJ-T=Q=QR/t?S?ST"$2F2FG!7tG[G[!\,D<P<PQ 0D0DE
*HX\XlXl*m' 5TEYEY Z*$:N:NO&d6J6JK,D<P<PQ$=TMaMa$b!*$:N:NO 4DDXDX Y$D4H4HI!7tG[G[!\"$2F2FG+4;O;OP(DTXThTh(i%0@T@TU&d6J6JK$D4H4HI34CWCWX 0D0DE
"$2F2FG1AUAUV%?tOcOc%d"*$:N:NO&d6J6JK    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawOpikApi
        rX   rw   s    ry   with_raw_responsezOpikApi.with_raw_response        r{   request_optionsr   c                R    | j                   j                  |      }|j                  S )a  
        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Optional[typing.Any]
            default response

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.is_alive()
        r   rX   is_alivedatarw   r   	_responses      ry   r   zOpikApi.is_alive   s'    $ $$--o-N	~~r{   c                R    | j                   j                  |      }|j                  S )a  
        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Optional[typing.Any]
            default response

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.version()
        r   rX   versionr   r   s      ry   r   zOpikApi.version   s'    $ $$,,_,M	~~r{   )__name__
__module____qualname____doc__r   DEFAULTtypingOptionalstrfloatboolrU   rV   rz   propertyr1   r   r   Anyr   r    r{   ry   rE   rE   )   s:   F *.*<*D*D(,/3*.266:6L //#&6L (	6L
 %6L ,6L '6L !//$/6L ooell36Lp  :     NR 6??>+J V\VeVeflfpfpVq * MQ &//.*I U[UdUdekeoeoUp r{   rE   c                      e Zd ZdZdej
                  dddddddej                  e   dedej                  e   dej                  e   d	ej                  e	   d
ej                  e
   dej                  ej                     fdZedefd       Zdddej                  e   dej                  ej$                     fdZdddej                  e   dej                  ej$                     fdZy)AsyncOpikApiaG  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    base_url : typing.Optional[str]
        The base url to use for requests from the client.

    environment : OpikApiEnvironment
        The environment to use for requests from the client. from .environment import OpikApiEnvironment

        Defaults to OpikApiEnvironment.DEFAULT



    api_key : typing.Optional[str]
    workspace_name : typing.Optional[str]
    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.AsyncClient]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from Opik import AsyncOpikApi
    client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
    NTrF   rG   rH   rI   rJ   rK   rL   rM   c          	      6   ||n|dn|j                   j                  }t        t        ||      ||||n.|t	        j
                  ||      nt	        j
                  |      |      | _        t        | j                        | _        t        | j                        | _
        t        | j                        | _        t        | j                        | _        t        | j                        | _        t#        | j                        | _        t'        | j                        | _        t+        | j                        | _        t/        | j                        | _        t3        | j                        | _        t7        | j                        | _        t;        | j                        | _        t?        | j                        | _         tC        | j                        | _"        tG        | j                        | _$        tK        | j                        | _&        tO        | j                        | _(        tS        | j                        | _*        tW        | j                        | _,        t[        | j                        | _.        t_        | j                        | _0        tc        | j                        | _2        tg        | j                        | _4        tk        | j                        | _6        to        | j                        | _8        ts        | j                        | _:        tw        | j                        | _<        t{        | j                        | _>        t        | j                        | _@        t        | j                        | _B        y rO   )CrK   rS   r   rT   rU   AsyncClientrW   r0   rX   r:   rY   r   rZ   r   r[   r	   r\   r
   r]   r   r^   r   r_   r   r`   r   ra   r   rb   r   rc   r   rd   r   re   r    rf   r4   rg   r"   rh   r$   ri   r&   rj   r(   rk   r*   rl   r,   rm   r.   rn   r6   ro   r8   rp   r<   rq   r>   rr   r@   rs   rB   rt   r2   ru   rv   s	            ry   rz   zAsyncOpikApi.__init__   s    *Gl6JP\PdPdPiPi 	  2"H+N)' &  + ""+=P`a""+=>&
 
 +$:N:NO2$BVBVW4DDXDXY't7K7KL!<DL`L`!a1AUAUV%T5I5IJ
*M]a]q]q*r' :$J^J^ _/t?S?ST+4;O;OP1AUAUV$BRVRfRf$g!/t?S?ST 9I]I] ^)9M9MN!<DL`L`!a't7K7KL0@T@TU(IY]YmYm(n%5TEYEYZ+4;O;OP)9M9MN8H\H\]%T5I5IJ
't7K7KL6dFZFZ[%DTXThTh%i"/t?S?ST+4;O;OPr{   r|   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawOpikApi
        r~   r   s    ry   r   zAsyncOpikApi.with_raw_response  r   r{   r   r   c                n   K   | j                   j                  |       d{   }|j                  S 7 w)a  
        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Optional[typing.Any]
            default 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.is_alive()
        asyncio.run(main())
        r   Nr   r   s      ry   r   zAsyncOpikApi.is_alive  s4     * **33O3TT	~~ U    535c                n   K   | j                   j                  |       d{   }|j                  S 7 w)a  
        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Optional[typing.Any]
            default 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.version()
        asyncio.run(main())
        r   Nr   r   s      ry   r   zAsyncOpikApi.version4  s4     * **22?2SS	~~ Tr   )r   r   r   r   r   r   r   r   r   r   r   rU   r   rz   r   r0   r   r   r   r   r   r   r{   ry   r   r      s<   F *.*<*D*D(,/3*.26;?6Q //#&6Q (	6Q
 %6Q ,6Q '6Q !//$/6Q ooe&7&786Qp  ?     TX 1P \b\k\klrlvlv\w 0 SW 0O [a[j[jkqkuku[v r{   r   )rG   rG   rH   r|   c                 <    | | S ||j                   S t        d      )NzEPlease pass in either base_url or environment to construct the client)value	ExceptionrQ   s     ry   rT   rT   M  s+    		    _``r{   )hr   rU   agent_configs.clientr   r   alerts.clientr   r   annotation_queues.clientr   r	   attachments.clientr
   r   !automation_rule_evaluators.clientr   r   chat_completions.clientr   r   check.clientr   r   core.client_wrapperr   r   core.request_optionsr   dashboards.clientr   r   datasets.clientr   r   rH   r   experiments.clientr   r   feedback_definitions.clientr   r   guardrails.clientr   r   llm_provider_key.clientr    r!   manual_evaluation.clientr"   r#   ollama.clientr$   r%   ollie_state.clientr&   r'   open_telemetry_ingestion.clientr(   r)   optimizations.clientr*   r+   projects.clientr,   r-   prompts.clientr.   r/   
raw_clientr0   r1   redirect.clientr2   r3   runners.clientr4   r5   service_toggles.clientr6   r7   spans.clientr8   r9   system_usage.clientr:   r;   traces.clientr<   r=   welcome_wizard.clientr>   r?   workspace_permissions.clientr@   rA   workspaces.clientrB   rC   rE   r   r   r   rT   r   r{   ry   <module>r      s      M : Y I r V 7 F 0 F @ + I b F T Y : G l O @ = 3 @ = S 7 J : P e FL L^R Rj 7; avs3 aI[ a`c ar{   