
    jP_                         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mZ  e j"                  e j$                  d      Z G d d      Z G d d      Zy)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)AgentBlueprintPublic)AgentBlueprintWrite)AgentConfigEnv)BlueprintPageHistory   )AsyncRawAgentConfigsClientRawAgentConfigsClient.c                      e Zd ZdefdZedefd       Zeeeddde	de
j                  e   d	e
j                  e   d
e
j                  e   de
j                  e   ddfdZdddede
j                  e   de
j                  e   ddfdZddddedede
j                  e   de
j                  e   def
dZdddededede
j                  e   ddf
dZdddedede
j                  e   ddfdZddddede
j                  e   de
j                  e   defdZddddedede
j                  e   de
j                  e   def
dZdddddede
j                  e   de
j                  e   de
j                  e   def
dZdddede
j                  e   defdZddddede
j                  e   de
j                  e   defd Zy)!AgentConfigsClient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/agent_configs/client.py__init__zAgentConfigsClient.__init__   s    0O    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawAgentConfigsClient
        r   r   s    r   with_raw_responsez$AgentConfigsClient.with_raw_response        r   N
project_idproject_nameidrequest_options	blueprintr    r!   r"   r#   c                Z    | j                   j                  |||||      }|j                  S )aJ  
        Creates a new optimizer config with initial blueprint, or adds a new blueprint to existing config

        Parameters
        ----------
        blueprint : AgentBlueprintWrite

        project_id : typing.Optional[str]
            Project ID. Either project_id or project_name must be provided

        project_name : typing.Optional[str]
            Project name. Either project_id or project_name must be provided

        id : typing.Optional[str]
            Agent config ID. Generated automatically if not provided

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import AgentBlueprintWrite
        from Opik import AgentConfigValueWrite
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.create_agent_config(blueprint=AgentBlueprintWrite(type="blueprint", values=[AgentConfigValueWrite(key='key', type="string", )], ), )
        r$   r    r!   r"   r#   r   create_agent_configdatar   r$   r    r!   r"   r#   	_responses          r   r(   z&AgentConfigsClient.create_agent_config    s;    P $$88!%+ 9 
	 ~~r   r#   envsc                V    | j                   j                  |||      }|j                  S )a  
        Creates or updates environment-to-blueprint mappings

        Parameters
        ----------
        project_id : str

        envs : typing.Sequence[AgentConfigEnv]

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        from Opik import AgentConfigEnv
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.create_or_update_envs(project_id='project_id', envs=[AgentConfigEnv(env_name='env_name', blueprint_id='blueprint_id', )], )
        r    r-   r#   r   create_or_update_envsr)   r   r    r-   r#   r+   s        r   r1   z(AgentConfigsClient.create_or_update_envsQ   s2    < $$::!o ; 
	 ~~r   mask_idr#   env_namer4   c                X    | j                   j                  ||||      }|j                  S )a  
        Retrieves the blueprint associated with a specific environment

        Parameters
        ----------
        env_name : str

        project_id : str

        mask_id : typing.Optional[str]

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

        Returns
        -------
        AgentBlueprintPublic
            Blueprint retrieved

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.get_blueprint_by_env(env_name='env_name', project_id='project_id', )
        r3   r   get_blueprint_by_envr)   r   r5   r    r4   r#   r+   s         r   r8   z'AgentConfigsClient.get_blueprint_by_envt   s5    B $$99j'? : 
	 ~~r   blueprint_namec                X    | j                   j                  ||||      }|j                  S )a  
        Sets an environment to point to a blueprint identified by name

        Parameters
        ----------
        env_name : str

        project_id : str

        blueprint_name : str

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.set_env_by_blueprint_name(env_name='env_name', project_id='project_id', blueprint_name='blueprint_name', )
        r:   r#   r   set_env_by_blueprint_namer)   r   r5   r    r:   r#   r+   s         r   r>   z,AgentConfigsClient.set_env_by_blueprint_name   s6    @ $$>>jQ` ? 
	 ~~r   c                V    | j                   j                  |||      }|j                  S )a1  
        Soft-deletes an environment by setting its ended_at timestamp

        Parameters
        ----------
        env_name : str

        project_id : str

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.delete_env(env_name='env_name', project_id='project_id', )
        r,   r   
delete_envr)   r   r5   r    r#   r+   s        r   rB   zAgentConfigsClient.delete_env   s,    2 $$//*Ve/f	~~r   blueprint_idc                V    | j                   j                  |||      }|j                  S )aV  
        Retrieves a specific blueprint by its ID

        Parameters
        ----------
        blueprint_id : str

        mask_id : typing.Optional[str]

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

        Returns
        -------
        AgentBlueprintPublic
            Blueprint retrieved

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.get_blueprint_by_id(blueprint_id='blueprint_id', )
        r3   r   get_blueprint_by_idr)   r   rD   r4   r#   r+   s        r   rG   z&AgentConfigsClient.get_blueprint_by_id   s,    < $$88whw8x	~~r   namec                X    | j                   j                  ||||      }|j                  S )a  
        Retrieves a specific blueprint by its name within a project

        Parameters
        ----------
        project_id : str

        name : str

        mask_id : typing.Optional[str]

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

        Returns
        -------
        AgentBlueprintPublic
            Blueprint retrieved

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.get_blueprint_by_name(project_id='project_id', name='name', )
        r3   r   get_blueprint_by_namer)   r   r    rI   r4   r#   r+   s         r   rL   z(AgentConfigsClient.get_blueprint_by_name   s5    B $$::g ; 
	 ~~r   pagesizer#   rO   rP   c                X    | j                   j                  ||||      }|j                  S )a}  
        Retrieves paginated blueprint history for a project

        Parameters
        ----------
        project_id : str

        page : typing.Optional[int]

        size : typing.Optional[int]

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

        Returns
        -------
        BlueprintPageHistory
            History retrieved

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.get_blueprint_history(project_id='project_id', )
        rN   r   get_blueprint_historyr)   r   r    rO   rP   r#   r+   s         r   rS   z(AgentConfigsClient.get_blueprint_history"  s5    B $$::To ; 
	 ~~r   c                T    | j                   j                  ||      }|j                  S )aC  
        Retrieves only the changes (delta) introduced in a specific blueprint

        Parameters
        ----------
        blueprint_id : str

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

        Returns
        -------
        AgentBlueprintPublic
            Delta retrieved

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.get_delta_by_id(blueprint_id='blueprint_id', )
        r,   r   get_delta_by_idr)   r   rD   r#   r+   s       r   rW   z"AgentConfigsClient.get_delta_by_idH  s*    0 $$44\Sb4c	~~r   c                V    | j                   j                  |||      }|j                  S )aU  
        Retrieves the latest blueprint for a project

        Parameters
        ----------
        project_id : str

        mask_id : typing.Optional[str]

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

        Returns
        -------
        AgentBlueprintPublic
            Blueprint retrieved

        Examples
        --------
        from Opik import OpikApi
        client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        client.agent_configs.get_latest_blueprint(project_id='project_id', )
        r3   r   get_latest_blueprintr)   r   r    r4   r#   r+   s        r   r[   z'AgentConfigsClient.get_latest_blueprintc  s,    < $$99*ggv9w	~~r   )__name__
__module____qualname__r   r   propertyr   r   OMITr   typingOptionalstrr   r(   Sequencer	   r1   r   r8   r>   rB   rG   rL   intr
   rS   rW   r[    r   r   r   r      s   P*; P  #8     ,0-1#';?/ '/ OOC(	/
 ooc*/ OOC /  8/ 
/l <@! ! oon-	!
  8! 
!P )-;?$$ $
 %$  8$ 
$X <@## #
 #  8# 
#L ei),BH//R`Ba	@ )-;? %	
  8 
L )-;?$$ $
 %$  8$ 
$T &*%);?$$ ooc"	$
 ooc"$  8$ 
$N X\5;__^5T	> )-;? %	
  8 
r   r   c                      e Zd ZdefdZedefd       Zeeeddde	de
j                  e   d	e
j                  e   d
e
j                  e   de
j                  e   ddfdZdddede
j                  e   de
j                  e   ddfdZddddedede
j                  e   de
j                  e   def
dZdddededede
j                  e   ddf
dZdddedede
j                  e   ddfdZddddede
j                  e   de
j                  e   defdZddddedede
j                  e   de
j                  e   def
dZdddddede
j                  e   de
j                  e   de
j                  e   def
dZdddede
j                  e   defdZddddede
j                  e   de
j                  e   defd Zy)!AsyncAgentConfigsClientr   c                &    t        |      | _        y r   )r   r   r   s     r   r   z AsyncAgentConfigsClient.__init__  s    5^Tr   r   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawAgentConfigsClient
        r   r   s    r   r   z)AsyncAgentConfigsClient.with_raw_response  r   r   Nr   r$   r    r!   r"   r#   c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a  
        Creates a new optimizer config with initial blueprint, or adds a new blueprint to existing config

        Parameters
        ----------
        blueprint : AgentBlueprintWrite

        project_id : typing.Optional[str]
            Project ID. Either project_id or project_name must be provided

        project_name : typing.Optional[str]
            Project name. Either project_id or project_name must be provided

        id : typing.Optional[str]
            Agent config ID. Generated automatically if not provided

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import AgentBlueprintWrite
        from Opik import AgentConfigValueWrite
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.agent_configs.create_agent_config(blueprint=AgentBlueprintWrite(type="blueprint", values=[AgentConfigValueWrite(key='key', type="string", )], ), )
        asyncio.run(main())
        r&   Nr'   r*   s          r   r(   z+AsyncAgentConfigsClient.create_agent_config  sI     V **>>!%+ ? 
 
	 ~~
s   $979r,   r-   c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a  
        Creates or updates environment-to-blueprint mappings

        Parameters
        ----------
        project_id : str

        envs : typing.Sequence[AgentConfigEnv]

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

        Returns
        -------
        None

        Examples
        --------
        from Opik import AsyncOpikApi
        from Opik import AgentConfigEnv
        import asyncio
        client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
        async def main() -> None:
            await client.agent_configs.create_or_update_envs(project_id='project_id', envs=[AgentConfigEnv(env_name='env_name', blueprint_id='blueprint_id', )], )
        asyncio.run(main())
        r/   Nr0   r2   s        r   r1   z-AsyncAgentConfigsClient.create_or_update_envs  sB     B **@@!o A 
 
	 ~~
   "757r3   r5   r4   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Retrieves the blueprint associated with a specific environment

        Parameters
        ----------
        env_name : str

        project_id : str

        mask_id : typing.Optional[str]

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

        Returns
        -------
        AgentBlueprintPublic
            Blueprint retrieved

        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.agent_configs.get_blueprint_by_env(env_name='env_name', project_id='project_id', )
        asyncio.run(main())
        r3   Nr7   r9   s         r   r8   z,AsyncAgentConfigsClient.get_blueprint_by_env  sD     H **??j'? @ 
 
	 ~~
   #868r:   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Sets an environment to point to a blueprint identified by name

        Parameters
        ----------
        env_name : str

        project_id : str

        blueprint_name : str

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

        Returns
        -------
        None

        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.agent_configs.set_env_by_blueprint_name(env_name='env_name', project_id='project_id', blueprint_name='blueprint_name', )
        asyncio.run(main())
        r<   Nr=   r?   s         r   r>   z1AsyncAgentConfigsClient.set_env_by_blueprint_name  sE     F **DDjQ` E 
 
	 ~~
rp   c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a  
        Soft-deletes an environment by setting its ended_at timestamp

        Parameters
        ----------
        env_name : str

        project_id : str

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

        Returns
        -------
        None

        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.agent_configs.delete_env(env_name='env_name', project_id='project_id', )
        asyncio.run(main())
        r,   NrA   rC   s        r   rB   z"AsyncAgentConfigsClient.delete_env?  s9     8 **55h
\k5ll	~~ mrn   rD   c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a  
        Retrieves a specific blueprint by its ID

        Parameters
        ----------
        blueprint_id : str

        mask_id : typing.Optional[str]

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

        Returns
        -------
        AgentBlueprintPublic
            Blueprint retrieved

        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.agent_configs.get_blueprint_by_id(blueprint_id='blueprint_id', )
        asyncio.run(main())
        r3   NrF   rH   s        r   rG   z+AsyncAgentConfigsClient.get_blueprint_by_id^  sA     B **>>'? ? 
 
	 ~~
rn   rI   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Retrieves a specific blueprint by its name within a project

        Parameters
        ----------
        project_id : str

        name : str

        mask_id : typing.Optional[str]

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

        Returns
        -------
        AgentBlueprintPublic
            Blueprint retrieved

        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.agent_configs.get_blueprint_by_name(project_id='project_id', name='name', )
        asyncio.run(main())
        r3   NrK   rM   s         r   rL   z-AsyncAgentConfigsClient.get_blueprint_by_name  sD     H **@@g A 
 
	 ~~
rp   rN   rO   rP   c                t   K   | j                   j                  ||||       d{   }|j                  S 7 w)a  
        Retrieves paginated blueprint history for a project

        Parameters
        ----------
        project_id : str

        page : typing.Optional[int]

        size : typing.Optional[int]

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

        Returns
        -------
        BlueprintPageHistory
            History retrieved

        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.agent_configs.get_blueprint_history(project_id='project_id', )
        asyncio.run(main())
        rN   NrR   rT   s         r   rS   z-AsyncAgentConfigsClient.get_blueprint_history  sD     H **@@To A 
 
	 ~~
rp   c                p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  
        Retrieves only the changes (delta) introduced in a specific blueprint

        Parameters
        ----------
        blueprint_id : str

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

        Returns
        -------
        AgentBlueprintPublic
            Delta retrieved

        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.agent_configs.get_delta_by_id(blueprint_id='blueprint_id', )
        asyncio.run(main())
        r,   NrV   rX   s       r   rW   z'AsyncAgentConfigsClient.get_delta_by_id  s7     6 **::<Yh:ii	~~ js   !646c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)a  
        Retrieves the latest blueprint for a project

        Parameters
        ----------
        project_id : str

        mask_id : typing.Optional[str]

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

        Returns
        -------
        AgentBlueprintPublic
            Blueprint retrieved

        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.agent_configs.get_latest_blueprint(project_id='project_id', )
        asyncio.run(main())
        r3   NrZ   r\   s        r   r[   z,AsyncAgentConfigsClient.get_latest_blueprint  sB     B **?? @ 
 
	 ~~
rn   )r]   r^   r_   r   r   r`   r   r   ra   r   rb   rc   rd   r   r(   re   r	   r1   r   r8   r>   rB   rG   rL   rf   r
   rS   rW   r[   rg   r   r   ri   ri     s   U*< U  #=     ,0-1#';?2 '2 OOC(	2
 ooc*2 OOC 2  82 
2r <@$ $ oon-	$
  8$ 
$V )-;?'' '
 %'  8' 
'^ <@&& &
 &  8& 
&R ei),BH//R`Ba	F )-;?$$ %	$
  8$ 
$V )-;?'' '
 %'  8' 
'Z &*%);?'' ooc"	'
 ooc"'  8' 
'T X\5;__^5T	D )-;?$$ %	$
  8$ 
$r   ri   )rb   core.client_wrapperr   r   core.request_optionsr   types.agent_blueprint_publicr   types.agent_blueprint_writer   types.agent_config_envr	   types.blueprint_page_historyr
   
raw_clientr   r   castAnyra   r   ri   rg   r   r   <module>r      sP     G 1 ? = 3 ? I v{{6::s#q qhS Sr   