
    b6i                        d dl Z d dl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 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  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/m0Z0 ddl1m2Z2 ddl3m4Z4  e jj                  e jl                  d      Z7 G d d      Z8 G d  d!      Z9y)"    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)UnprocessableEntityError)+AdhocAgentConfigOverrideForTestRequestModel)!AgentPlatformSettingsRequestModel)#AgentSimulatedChatTestResponseModel)AgentSortBy)AgentWorkflowRequestModel)#ConversationSimulationSpecification)ConversationalConfig)CreateAgentResponseModel)GetAgentResponseModel)GetAgentsPageResponseModel)#GetTestSuiteInvocationResponseModel)HttpValidationError)PromptEvaluationCriteria)SingleTestRunRequestModel)SortDirection   )EBodyPatchesAnAgentSettingsV1ConvaiAgentsAgentIdPatchProcedureRefsItem.c                   F   e Zd ZdefdZeeeeddd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e   fdZdddddedej                  e   dej                  e   d
ej                  e   dee   f
dZddded
ej                  e   ded   fdZdeeeeeeedd	d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j                  e      d
ej                  e   dee   fdZdddddddddd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   d
ej                  e   dee   fd Zedd!dedej                  e   d
ej                  e   dee   fd"Zeedd#ded$ed%ej                  ej                  e      d&ej                  e   d
ej                  e   dee   fd'Z eedd#ded$ed%ej                  ej                  e      d&ej                  e   d
ej                  e   ded   fd(Z!eedd)ded*ej                  e"   d+ej                  e#   dej                  e   d
ej                  e   dee$   fd,Z%y)-RawAgentsClientclient_wrapperc                    || _         y N_client_wrapperselfr"   s     y/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/conversational_ai/agents/raw_client.py__init__zRawAgentsClient.__init__&   
    -    Nplatform_settingsworkflownametagsrequest_optionsconversation_configr.   r/   r0   r1   r2   returnc                L   | j                   j                  j                  ddt        |t        d      t        |t
        d      t        |t        d      ||dddi|t              }	 d	|j                  cxk  rd
k  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt        t!        |j"                        t        j                  t$        t        t$        |j                                           |j                         }	t)        |j                  t!        |j"                        |	      # t&        $ r6 t)        |j                  t!        |j"                        |j*                        w xY w)a  
        Create an agent from a config object

        Parameters
        ----------
        conversation_config : ConversationalConfig
            Conversation configuration for an agent

        platform_settings : typing.Optional[AgentPlatformSettingsRequestModel]
            Platform settings for the agent are all settings that aren't related to the conversation orchestration and content.

        workflow : typing.Optional[AgentWorkflowRequestModel]
            Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools.

        name : typing.Optional[str]
            A name to make the agent easier to find

        tags : typing.Optional[typing.Sequence[str]]
            Tags to help classify and filter the agent

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

        Returns
        -------
        HttpResponse[CreateAgentResponseModel]
            Successful Response
        v1/convai/agents/createPOSTwriteobject_
annotation	directionr3   r.   r/   r0   r1   content-typeapplication/jsonmethodjsonheadersr2   omit   ,  type_r:   responsedata  rC   bodystatus_coderC   rN   )r&   httpx_clientrequestr   r   r   r   OMITrP   typingcastr   r   rB   r	   r   dictrC   r   r   r   text
r(   r3   r.   r/   r0   r1   r2   	_response_data_response_jsons
             r)   createzRawAgentsClient.create)   s   L ((55==%'N/<P\c( &M-:[gn& D$1JV]   2 ,) > 
	,	ti++1c1,"6 ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   )AE$ A4E$ $?F#
version_id	branch_idr2   agent_idr^   r_   c                   | j                   j                  j                  dt        |       d||d|      }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  d	k(  rUt        t        |j                        t        j                  t        t        t        |j                                     
      |j                         }t!        |j                  t        |j                        |      # t        $ r6 t!        |j                  t        |j                        |j"                        w xY w)a0  
        Retrieve config for an agent

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        version_id : typing.Optional[str]
            The ID of the agent version to use

        branch_id : typing.Optional[str]
            The ID of the branch to use

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

        Returns
        -------
        HttpResponse[GetAgentResponseModel]
            Successful Response
        v1/convai/agents/GETr^   r_   rA   paramsr2   rE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   rP   rT   rU   r   r   rB   r	   r   rV   rC   r   r   r   rW   r(   r`   r^   r_   r2   rY   rZ   r[   s           r)   getzRawAgentsClient.get   sO   < ((55== 0 :;<(& , > 
		ti++1c1)"3 ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD5 A4D5 5?E4r2   c                x   | j                   j                  j                  dt        |       d|      }	 d|j                  cxk  rdk  rn nt        |d      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         	            
      |j                         }t        |j                  t        |j                        |      # t        $ r6 t        |j                  t        |j                        |j                         w xY w)aF  
        Delete an agent

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

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

        Returns
        -------
        HttpResponse[None]
        rb   DELETErA   r2   rE   rF   NrI   rL   rG   rM   rO   )r&   rQ   rR   r
   rP   r	   r   rV   rC   rT   rU   r   r   rB   r   r   rW   r(   r`   r2   rY   r[   s        r)   deletezRawAgentsClient.delete   s     ((55== 0 :;<+ > 
	
	ti++1c1#YTBB$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   $C: A4C: :?D9	r_   r3   r.   r/   r0   r1   version_descriptionprocedure_refsr2   rp   rq   c       	            | j                   j                  j                  dt        |       dd|it	        |t
        d      t	        |t        d      t	        |t        d      |||t	        |	t        j                  t           d      dddi|
t        	      }	 d
|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j!                                     }t#        ||      S |j                  dk(  rUt%        t'        |j(                        t        j                  t*        t        t*        |j!                                           |j!                         }t/        |j                  t'        |j(                        |      # t,        $ r6 t/        |j                  t'        |j(                        |j0                        w xY w)a  
        Patches an Agent settings

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        branch_id : typing.Optional[str]
            The ID of the branch to use

        conversation_config : typing.Optional[ConversationalConfig]
            Conversation configuration for an agent

        platform_settings : typing.Optional[AgentPlatformSettingsRequestModel]
            Platform settings for the agent are all settings that aren't related to the conversation orchestration and content.

        workflow : typing.Optional[AgentWorkflowRequestModel]
            Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools.

        name : typing.Optional[str]
            A name to make the agent easier to find

        tags : typing.Optional[typing.Sequence[str]]
            Tags to help classify and filter the agent

        version_description : typing.Optional[str]
            Description for this version when publishing changes (only applicable for versioned agents)

        procedure_refs : typing.Optional[typing.Sequence[BodyPatchesAnAgentSettingsV1ConvaiAgentsAgentIdPatchProcedureRefsItem]]
            List of procedure refs used for this agent version.

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

        Returns
        -------
        HttpResponse[GetAgentResponseModel]
            Successful Response
        rb   PATCHr_   r8   r9   r3   r.   r/   r0   r1   rp   rq   r>   r?   rA   rf   rB   rC   r2   rD   rE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   r   r   r   r   rT   Sequencer   rS   rP   rU   r   r   rB   r	   r   rV   rC   r   r   r   rW   r(   r`   r_   r3   r.   r/   r0   r1   rp   rq   r2   rY   rZ   r[   s                 r)   updatezRawAgentsClient.update   s   p ((55== 0 :;<Y (O/<P\c( &M-:[gn& D$1JV] ':"I*%/tu%#(  2 ,; > 
	>	ti++1c1)"3 ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AF 7A4F ?G	page_sizesearcharchivedshow_only_owned_agentssort_directionsort_bycursorr2   rz   r{   r|   r}   r~   r   r   c                   | j                   j                  j                  dd|||||||d|      }		 d|	j                  cxk  rdk  rGn nDt	        j
                  t        t        t        |	j                                     }
t        |	|
      S |	j                  d	k(  rUt        t        |	j                        t	        j
                  t        t        t        |	j                                     
      |	j                         }t        |	j                  t        |	j                        |      # t        $ r6 t        |	j                  t        |	j                        |	j                         w xY w)a]  
        Returns a list of your agents and their metadata.

        Parameters
        ----------
        page_size : typing.Optional[int]
            How many Agents to return at maximum. Can not exceed 100, defaults to 30.

        search : typing.Optional[str]
            Search by agents name.

        archived : typing.Optional[bool]
            Filter agents by archived status

        show_only_owned_agents : typing.Optional[bool]
            If set to true, the endpoint will omit any agents that were shared with you by someone else and include only the ones you own

        sort_direction : typing.Optional[SortDirection]
            The direction to sort the results

        sort_by : typing.Optional[AgentSortBy]
            The field to sort the results by

        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

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

        Returns
        -------
        HttpResponse[GetAgentsPageResponseModel]
            Successful Response
        v1/convai/agentsrc   rz   r{   r|   r}   r~   r   r   re   rE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   rP   rT   rU   r   r   rB   r	   r   rV   rC   r   r   r   rW   r(   rz   r{   r|   r}   r~   r   r   r2   rY   rZ   r[   s               r)   listzRawAgentsClient.listY  sQ   \ ((55==& $*@"0"  , > 
		ti++1c1."8 ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD. A4D. .?E-r0   r2   c                   | j                   j                  j                  dt        |       ddd|iddi|t              }	 d|j
                  cxk  rd	k  rGn nDt        j                  t        t        t        |j                         
            }t        ||      S |j
                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         
                  |j                         }t#        |j
                  t        |j                        |      # t         $ r6 t#        |j
                  t        |j                        |j$                        w xY w)a  
        Create a new agent by duplicating an existing one

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        name : typing.Optional[str]
            A name to make the agent easier to find

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

        Returns
        -------
        HttpResponse[CreateAgentResponseModel]
            Successful Response
        rb   
/duplicater7   r0   r>   r?   r@   rE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   rS   rP   rT   rU   r   r   rB   r	   r   rV   rC   r   r   r   rW   r(   r`   r0   r2   rY   rZ   r[   s          r)   	duplicatezRawAgentsClient.duplicate  s`   4 ((55== 0 :;:F  2 , > 
		ti++1c1,"6 ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AD= A4D= =?E<extra_evaluation_criterianew_turns_limitr2   simulation_specificationr   r   c                d   | j                   j                  j                  dt        |       ddt	        |t
        d      t	        |t        j                  t           d      |dddi|t        	      }	 d
|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt!        t#        |j$                        t        j                  t&        t        t&        |j                                           |j                         }t+        |j                  t#        |j$                        |      # t(        $ r6 t+        |j                  t#        |j$                        |j,                        w xY w)a\  
        Run a conversation between the agent and a simulated user.

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        simulation_specification : ConversationSimulationSpecification
            A specification detailing how the conversation should be simulated

        extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]]
            A list of evaluation criteria to test

        new_turns_limit : typing.Optional[int]
            Maximum number of new turns to generate in the conversation simulation

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

        Returns
        -------
        HttpResponse[AgentSimulatedChatTestResponseModel]
            Successful Response
        rb   /simulate-conversationr7   r8   r9   r   r   r   r>   r?   r@   rE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   r   r   rT   rv   r   rS   rP   rU   r   r   rB   r	   r   rV   rC   r   r   r   rW   	r(   r`   r   r   r   r2   rY   rZ   r[   s	            r)   simulate_conversationz%RawAgentsClient.simulate_conversation  s   D ((55== 0 :;;QR,S4Adpw- .U5%/GH%.
 $3
  2 ,% > 
	(	ti++1c17"A ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	t   5AE0 A4E0 0?F/c                   | j                   j                  j                  dt        |       ddt	        |t
        d      t	        |t        j                  t           d      |dddi|t        	      }	 d
|j                  cxk  rdk  rn nt        |d      S |j                  dk(  rUt        t        |j                        t        j                  t         t#        t         |j%                                           |j%                         }t)        |j                  t        |j                        |      # t&        $ r6 t)        |j                  t        |j                        |j*                        w xY w)a  
        Run a conversation between the agent and a simulated user and stream back the response. Response is streamed back as partial lists of messages that should be concatenated and once the conversation has complete a single final message with the conversation analysis will be sent.

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        simulation_specification : ConversationSimulationSpecification
            A specification detailing how the conversation should be simulated

        extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]]
            A list of evaluation criteria to test

        new_turns_limit : typing.Optional[int]
            Maximum number of new turns to generate in the conversation simulation

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

        Returns
        -------
        HttpResponse[None]
        rb   /simulate-conversation/streamr7   r8   r9   r   r>   r?   r@   rE   rF   NrI   rL   rG   rM   rO   )r&   rQ   rR   r
   r   r   rT   rv   r   rS   rP   r	   r   rV   rC   rU   r   r   rB   r   r   rW   r(   r`   r   r   r   r2   rY   r[   s           r)   simulate_conversation_streamz,RawAgentsClient.simulate_conversation_stream?  si   B ((55== 0 :;;XY,S4Adpw- .U5%/GH%.
 $3
  2 ,% > 
	(	ti++1c1#YTBB$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   5$D9 A4D9 9?E8agent_config_overrider_   r2   testsr   c                d   | j                   j                  j                  dt        |       ddt	        |t
        j                  t           d      t	        |t        d      |dddi|t        	      }	 d
|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt!        t#        |j$                        t        j                  t&        t        t&        |j                                           |j                         }t+        |j                  t#        |j$                        |      # t(        $ r6 t+        |j                  t#        |j$                        |j,                        w xY w)a  
        Run selected tests on the agent with provided configuration. If the agent configuration is provided, it will be used to override default agent configuration.

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        tests : typing.Sequence[SingleTestRunRequestModel]
            List of tests to run on the agent

        agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel]
            Configuration overrides to use for testing. If not provided, the agent's default configuration will be used.

        branch_id : typing.Optional[str]
            ID of the branch to run the tests on. If not provided, the tests will be run on the agent default configuration.

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

        Returns
        -------
        HttpResponse[GetTestSuiteInvocationResponseModel]
            Successful Response
        rb   
/run-testsr7   r8   r9   r   r   r_   r>   r?   r@   rE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   r   rT   rv   r   r   rS   rP   rU   r   r   rB   r	   r   rV   rC   r   r   r   rW   	r(   r`   r   r   r_   r2   rY   rZ   r[   s	            r)   	run_testszRawAgentsClient.run_tests  s   D ((55== 0 :;:F@!foo>W.Xdk *Q1J%*
 '
  2 ,% > 
	(	ti++1c17"A ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	tr   )&__name__
__module____qualname__r   r*   rS   r   rT   Optionalr   r   strrv   r   r	   r   r\   r   rh   rn   r   rx   intboolr   r   r   r   r   r   r   r   r   r   r   r   r   r    r,   r)   r!   r!   %   s3   .*; . QU?C%)6:;?Tp 2Tp "??+LM	Tp
 //";<Tp ooc"Tp oofooc23Tp  8Tp 
.	/Tpt ,0*.;??p?p OOC(	?p
 ??3'?p  8?p 
+	,?pB [_ &ps &p8W &pcoptcu &pX +/EIPT?C%)6:48 ;?opop ??3'	op
 $__-ABop "??+LMop //";<op ooc"op oofooc23op $__S1op OOab
op  8op 
+	,oph +/'+*.8<9=04'+;?Tp ??3'Tp $	Tp
 //$'Tp !' 5Tp 6Tp -Tp $Tp  8Tp 
0	1Tpt &*;?>p>p ooc"	>p
  8>p 
.	/>pJ ae04;?NpNp #F	Np
 $*??6??C[3\#]Np  -Np  8Np 
9	:Npj ae04;?FpFp #F	Fp
 $*??6??C[3\#]Fp  -Fp  8Fp 
d	FpZ _c*.;?NpNp 89	Np
  &/Z[Np ??3'Np  8Np 
9	:Npr,   r!   c                   F   e Zd ZdefdZeeeeddd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e   fdZdddddedej                  e   dej                  e   d
ej                  e   dee   f
dZddded
ej                  e   ded   fdZdeeeeeeedd	d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j                  e      d
ej                  e   dee   fdZdddddddddd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   d
ej                  e   dee   fd Zedd!dedej                  e   d
ej                  e   dee   fd"Zeedd#ded$ed%ej                  ej                  e      d&ej                  e   d
ej                  e   dee   fd'Z eedd#ded$ed%ej                  ej                  e      d&ej                  e   d
ej                  e   ded   fd(Z!eedd)ded*ej                  e"   d+ej                  e#   dej                  e   d
ej                  e   dee$   fd,Z%y)-AsyncRawAgentsClientr"   c                    || _         y r$   r%   r'   s     r)   r*   zAsyncRawAgentsClient.__init__  r+   r,   Nr-   r3   r.   r/   r0   r1   r2   r4   c                j  K   | j                   j                  j                  ddt        |t        d      t        |t
        d      t        |t        d      ||dddi|t               d	{   }	 d
|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt        t!        |j"                        t        j                  t$        t        t$        |j                                           |j                         }	t)        |j                  t!        |j"                        |	      7 # t&        $ r6 t)        |j                  t!        |j"                        |j*                        w xY ww)a  
        Create an agent from a config object

        Parameters
        ----------
        conversation_config : ConversationalConfig
            Conversation configuration for an agent

        platform_settings : typing.Optional[AgentPlatformSettingsRequestModel]
            Platform settings for the agent are all settings that aren't related to the conversation orchestration and content.

        workflow : typing.Optional[AgentWorkflowRequestModel]
            Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools.

        name : typing.Optional[str]
            A name to make the agent easier to find

        tags : typing.Optional[typing.Sequence[str]]
            Tags to help classify and filter the agent

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

        Returns
        -------
        AsyncHttpResponse[CreateAgentResponseModel]
            Successful Response
        r6   r7   r8   r9   r=   r>   r?   r@   NrE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r   r   r   r   rS   rP   rT   rU   r   r   rB   r   r   rV   rC   r   r   r   rW   rX   s
             r)   r\   zAsyncRawAgentsClient.create  s    L ..;;CC%'N/<P\c( &M-:[gn& D$1JV]   2 ,) D 
 
	,	ti++1c1,"6 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo]
X  	ty'<'<d9K\K\F]dmdrdrss	ts8   A+F3-E..F33AE1 F3A4E1 ,F31?F00F3r]   r`   r^   r_   c                  K   | j                   j                  j                  dt        |       d||d|       d{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||	      S |j                  d
k(  rUt        t        |j                        t        j                  t        t        t        |j                                           |j                         }t!        |j                  t        |j                        |      7 # t        $ r6 t!        |j                  t        |j                        |j"                        w xY ww)a5  
        Retrieve config for an agent

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        version_id : typing.Optional[str]
            The ID of the agent version to use

        branch_id : typing.Optional[str]
            The ID of the branch to use

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

        Returns
        -------
        AsyncHttpResponse[GetAgentResponseModel]
            Successful Response
        rb   rc   rd   re   NrE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   rP   rT   rU   r   r   rB   r   r   rV   rC   r   r   r   rW   rg   s           r)   rh   zAsyncRawAgentsClient.get2  s^    < ..;;CC 0 :;<(& , D 
 
		ti++1c1)"3 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooC
>  	ty'<'<d9K\K\F]dmdrdrss	ts5   <FD?FAE F A4E ,F?FFri   c                  K   | j                   j                  j                  dt        |       d|       d{   }	 d|j                  cxk  rdk  rn nt        |d      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         	            
      |j                         }t        |j                  t        |j                        |      7 # t        $ r6 t        |j                  t        |j                        |j                         w xY ww)aK  
        Delete an agent

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

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

        Returns
        -------
        AsyncHttpResponse[None]
        rb   rk   rl   NrE   rF   rI   rL   rG   rM   rO   )r&   rQ   rR   r
   rP   r   r   rV   rC   rT   rU   r   r   rB   r   r   rW   rm   s        r)   rn   zAsyncRawAgentsClient.deletes  s(    $ ..;;CC 0 :;<+ D 
 
	
	ti++1c1()$GG$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo-
(  	ty'<'<d9K\K\F]dmdrdrss	ts4   8EDE $D $E%A4D ,E?EEro   rp   rq   c       	           K   | j                   j                  j                  dt        |       dd|it	        |t
        d      t	        |t        d      t	        |t        d      |||t	        |	t        j                  t           d      dddi|
t        	       d
{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j!                                     }t#        ||      S |j                  dk(  rUt%        t'        |j(                        t        j                  t*        t        t*        |j!                                           |j!                         }t/        |j                  t'        |j(                        |      7 # t,        $ r6 t/        |j                  t'        |j(                        |j0                        w xY ww)a  
        Patches an Agent settings

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        branch_id : typing.Optional[str]
            The ID of the branch to use

        conversation_config : typing.Optional[ConversationalConfig]
            Conversation configuration for an agent

        platform_settings : typing.Optional[AgentPlatformSettingsRequestModel]
            Platform settings for the agent are all settings that aren't related to the conversation orchestration and content.

        workflow : typing.Optional[AgentWorkflowRequestModel]
            Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools.

        name : typing.Optional[str]
            A name to make the agent easier to find

        tags : typing.Optional[typing.Sequence[str]]
            Tags to help classify and filter the agent

        version_description : typing.Optional[str]
            Description for this version when publishing changes (only applicable for versioned agents)

        procedure_refs : typing.Optional[typing.Sequence[BodyPatchesAnAgentSettingsV1ConvaiAgentsAgentIdPatchProcedureRefsItem]]
            List of procedure refs used for this agent version.

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

        Returns
        -------
        AsyncHttpResponse[GetAgentResponseModel]
            Successful Response
        rb   rs   r_   r8   r9   rt   r>   r?   ru   NrE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   r   r   r   r   rT   rv   r   rS   rP   rU   r   r   rB   r   r   rV   rC   r   r   r   rW   rw   s                 r)   rx   zAsyncRawAgentsClient.update  s    p ..;;CC 0 :;<Y (O/<P\c( &M-:[gn& D$1JV] ':"I*%/tu%#(  2 ,; D 
 
	>	ti++1c1)"3 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooo
j  	ty'<'<d9K\K\F]dmdrdrss	ts8   BG%F  G%%AF#  G%A4F# 5,G%#?G""G%ry   rz   r{   r|   r}   r~   r   r   c                  K   | j                   j                  j                  dd|||||||d|       d{   }		 d|	j                  cxk  rdk  rGn nDt	        j
                  t        t        t        |	j                                     }
t        |	|
	      S |	j                  d
k(  rUt        t        |	j                        t	        j
                  t        t        t        |	j                                           |	j                         }t        |	j                  t        |	j                        |      7 # t        $ r6 t        |	j                  t        |	j                        |	j                         w xY ww)ab  
        Returns a list of your agents and their metadata.

        Parameters
        ----------
        page_size : typing.Optional[int]
            How many Agents to return at maximum. Can not exceed 100, defaults to 30.

        search : typing.Optional[str]
            Search by agents name.

        archived : typing.Optional[bool]
            Filter agents by archived status

        show_only_owned_agents : typing.Optional[bool]
            If set to true, the endpoint will omit any agents that were shared with you by someone else and include only the ones you own

        sort_direction : typing.Optional[SortDirection]
            The direction to sort the results

        sort_by : typing.Optional[AgentSortBy]
            The field to sort the results by

        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

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

        Returns
        -------
        AsyncHttpResponse[GetAgentsPageResponseModel]
            Successful Response
        r   rc   r   re   NrE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   rP   rT   rU   r   r   rB   r   r   rV   rC   r   r   r   rW   r   s               r)   r   zAsyncRawAgentsClient.list  sa    \ ..;;CC& $*@"0"  , D 
 
		ti++1c1."8 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooM
H  	ty'<'<d9K\K\F]dmdrdrss	ts4   5E=D8E=AD; E=A4D; ,E=;?E::E=r   c                  K   | j                   j                  j                  dt        |       ddd|iddi|t               d{   }	 d	|j
                  cxk  rd
k  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j
                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                                           |j                         }t#        |j
                  t        |j                        |      7 # t         $ r6 t#        |j
                  t        |j                        |j$                        w xY ww)a  
        Create a new agent by duplicating an existing one

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        name : typing.Optional[str]
            A name to make the agent easier to find

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

        Returns
        -------
        AsyncHttpResponse[CreateAgentResponseModel]
            Successful Response
        rb   r   r7   r0   r>   r?   r@   NrE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   rS   rP   rT   rU   r   r   rB   r   r   rV   rC   r   r   r   rW   r   s          r)   r   zAsyncRawAgentsClient.duplicated  sp    4 ..;;CC 0 :;:F  2 , D 
 
		ti++1c1,"6 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooI
D  	ty'<'<d9K\K\F]dmdrdrss	ts8   AFEFAE
 'F(A4E
 ,F
?F		Fr   r   r   r   c                  K   | j                   j                  j                  dt        |       ddt	        |t
        d      t	        |t        j                  t           d      |dddi|t        	       d
{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt!        t#        |j$                        t        j                  t&        t        t&        |j                                           |j                         }t+        |j                  t#        |j$                        |      7 # t(        $ r6 t+        |j                  t#        |j$                        |j,                        w xY ww)aa  
        Run a conversation between the agent and a simulated user.

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        simulation_specification : ConversationSimulationSpecification
            A specification detailing how the conversation should be simulated

        extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]]
            A list of evaluation criteria to test

        new_turns_limit : typing.Optional[int]
            Maximum number of new turns to generate in the conversation simulation

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

        Returns
        -------
        AsyncHttpResponse[AgentSimulatedChatTestResponseModel]
            Successful Response
        rb   r   r7   r8   r9   r   r>   r?   r@   NrE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   r   r   rT   rv   r   rS   rP   rU   r   r   rB   r   r   rV   rC   r   r   r   rW   r   s	            r)   r   z*AsyncRawAgentsClient.simulate_conversation  s    D ..;;CC 0 :;;QR,S4Adpw- .U5%/GH%.
 $3
  2 ,% D 
 
	(	ti++1c17"A ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooY
T  	ty'<'<d9K\K\F]dmdrdrss	t8   A7F?9E::F??AE= F?A4E= ,F?=?F<<F?c                  K   | j                   j                  j                  dt        |       ddt	        |t
        d      t	        |t        j                  t           d      |dddi|t        	       d
{   }	 d|j                  cxk  rdk  rn nt        |d
      S |j                  dk(  rUt        t        |j                        t        j                  t         t#        t         |j%                                           |j%                         }t)        |j                  t        |j                        |      7 # t&        $ r6 t)        |j                  t        |j                        |j*                        w xY ww)a  
        Run a conversation between the agent and a simulated user and stream back the response. Response is streamed back as partial lists of messages that should be concatenated and once the conversation has complete a single final message with the conversation analysis will be sent.

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        simulation_specification : ConversationSimulationSpecification
            A specification detailing how the conversation should be simulated

        extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]]
            A list of evaluation criteria to test

        new_turns_limit : typing.Optional[int]
            Maximum number of new turns to generate in the conversation simulation

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

        Returns
        -------
        AsyncHttpResponse[None]
        rb   r   r7   r8   r9   r   r>   r?   r@   NrE   rF   rI   rL   rG   rM   rO   )r&   rQ   rR   r
   r   r   rT   rv   r   rS   rP   r   r   rV   rC   rU   r   r   rB   r   r   rW   r   s           r)   r   z1AsyncRawAgentsClient.simulate_conversation_stream  sy    B ..;;CC 0 :;;XY,S4Adpw- .U5%/GH%.
 $3
  2 ,% D 
 
	(	ti++1c1()$GG$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooK
F  	ty'<'<d9K\K\F]dmdrdrss	ts7   A7F9E:F?$E #F$A4E ,F?FFr   r   r   c                  K   | j                   j                  j                  dt        |       ddt	        |t
        j                  t           d      t	        |t        d      |dddi|t        	       d
{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||      S |j                  dk(  rUt!        t#        |j$                        t        j                  t&        t        t&        |j                                           |j                         }t+        |j                  t#        |j$                        |      7 # t(        $ r6 t+        |j                  t#        |j$                        |j,                        w xY ww)a   
        Run selected tests on the agent with provided configuration. If the agent configuration is provided, it will be used to override default agent configuration.

        Parameters
        ----------
        agent_id : str
            The id of an agent. This is returned on agent creation.

        tests : typing.Sequence[SingleTestRunRequestModel]
            List of tests to run on the agent

        agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel]
            Configuration overrides to use for testing. If not provided, the agent's default configuration will be used.

        branch_id : typing.Optional[str]
            ID of the branch to run the tests on. If not provided, the tests will be run on the agent default configuration.

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

        Returns
        -------
        AsyncHttpResponse[GetTestSuiteInvocationResponseModel]
            Successful Response
        rb   r   r7   r8   r9   r   r>   r?   r@   NrE   rF   rG   rI   rL   rM   rO   )r&   rQ   rR   r
   r   rT   rv   r   r   rS   rP   rU   r   r   rB   r   r   rV   rC   r   r   r   rW   r   s	            r)   r   zAsyncRawAgentsClient.run_tests<  s    D ..;;CC 0 :;:F@!foo>W.Xdk *Q1J%*
 '
  2 ,% D 
 
	(	ti++1c17"A ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooY
T  	ty'<'<d9K\K\F]dmdrdrss	tr   )&r   r   r   r   r*   rS   r   rT   r   r   r   r   rv   r   r   r   r\   r   rh   rn   r   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r,   r)   r   r     s4   .*< . QU?C%)6:;?Tp 2Tp "??+LM	Tp
 //";<Tp ooc"Tp oofooc23Tp  8Tp 
3	4Tpt ,0*.;??p?p OOC(	?p
 ??3'?p  8?p 
0	1?pD TX(p(p171P(p	4	 (p\ +/EIPT?C%)6:48 ;?opop ??3'	op
 $__-ABop "??+LMop //";<op ooc"op oofooc23op $__S1op OOab
op  8op 
0	1oph +/'+*.8<9=04'+;?Tp ??3'Tp $	Tp
 //$'Tp !' 5Tp 6Tp -Tp $Tp  8Tp 
5	6Tpt &*;?>p>p ooc"	>p
  8>p 
3	4>pJ ae04;?NpNp #F	Np
 $*??6??C[3\#]Np  -Np  8Np 
>	?Npj ae04;?FpFp #F	Fp
 $*??6??C[3\#]Fp  -Fp  8Fp 
4	 FpZ _c*.;?NpNp 89	Np
  &/Z[Np ??3'Np  8Np 
>	?Npr,   r   ):rT   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.jsonable_encoderr
   core.request_optionsr   core.serializationr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr   8types.adhoc_agent_config_override_for_test_request_modelr   +types.agent_platform_settings_request_modelr   .types.agent_simulated_chat_test_response_modelr   types.agent_sort_byr   "types.agent_workflow_request_modelr   +types.conversation_simulation_specificationr   types.conversational_configr   !types.create_agent_response_modelr   types.get_agent_response_modelr   $types.get_agents_page_response_modelr   .types.get_test_suite_invocation_response_modelr   types.http_validation_errorr    types.prompt_evaluation_criteriar   #types.single_test_run_request_modelr   types.sort_directionr   Ytypes.body_patches_an_agent_settings_v_1_convai_agents_agent_id_patch_procedure_refs_itemr   rU   AnyrS   r!   r   r   r,   r)   <module>r      s     ( & H A 5 2 I 7 I s \ a . K ^ ? I C N a > H L 1
 v{{6::s#p
p p
pfr
p r
pr,   