
    UEj                     0   d Z ddlmZmZmZmZ ddlmZmZm	Z	 ddl
mZmZ ddlmZmZ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Zd	dlmZmZmZmZm Z m!Z!m"Z"  G d de      Z# G d d      Z$ G d d      Z% G d de      Z& G d d      Z' G d d      Z(y
)zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )errorsmodelstypesutils)AfterParseErrorContextHookContextResponseContext)AsyncBaseSDKBaseSDK)OptionalNullableUNSETagentsinteractions)agent	agenttool)get_security_from_envresponse_helpers)unmarshal_json_response    N)AnyIterableListMappingOptionalUnioncastc                   >   e Zd Zed        Zed        Zdddddddddddddee   dee   dee   dee   d	ee   d
eee	e
j                     e	e
j                     f      deeej                  ej                  f      deeeef      deeeef      deeeef      deeeej(                  f      dej,                  fdZdddddddddee   dee   dee   dee   deeeef      deeeef      deeeej(                  f      dej2                  fdZddddddedee   deeeef      deeeef      deeeej(                  f      dej,                  fdZddddddedee   deeeef      deeeef      deeeej(                  f      dej:                  fdZy)Agentsc                     t        |       S N)AgentsWithRawResponseselfs    O/var/www/html/qr/venv/lib/python3.12/site-packages/google/genai/_gaos/agents.pywith_raw_responsezAgents.with_raw_response   s    $T**    c                     t        |       S r    )AgentsWithStreamingResponser"   s    r$   with_streaming_responsezAgents.with_streaming_response#   s    *400r&   Napi_versionid
base_agentsystem_instructiondescriptiontoolsbase_environmentextra_headersextra_query
extra_bodytimeoutr+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   returnc                N  
 d}d}t         }d}|}| j                  |      }|| j                  j                  }||}n| j	                  ||      }t        j                  |t        j                  ||||t        j                  |t        t        t        j                              t        j                  |t        t        j                                       t        j                   |      \  }}| j#                  dd||ddddd||	t        j$                  | j                  j&                  j(                  	      | j                  j*                  
fd
d|      }|t         k(  rb| j                  j,                  t         ur| j                  j,                  }n/t        j.                  dt        j0                  dddd      dd      }d}t3        |t        j.                        r|g df}d }t5        | j                  |xs dddt7        | j                  j*                  t8        j:                        t=        |d            }| j?                  ||d |dk(  |      }|dk7  rm|dk(  rt        j@                  nt        jB                  }tE        tF         |||d| tI        |      | j                  jJ                  jM                  d                   S 	  ||      S # tN        $ rB}t        jP                  | j                  jJ                  d   tI        |      ||       Y d}~yd}~ww xY w)!d  Creates a new Agent (Typed version for SDK).

        :param api_version: Which version of the API to use.
        :param id: The unique identifier for the agent.
        :param base_agent: The base agent to extend.
        :param system_instruction: System instruction for the agent.
        :param description: Agent description for developers to quickly read and understand.
        :param tools: The tools available to the agent.
        :param base_environment: The environment configuration for the agent.
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param extra_body: Additional JSON object fields to merge into request bodies.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr,   r-   r.   r/   r0   r1   r+   bodyPOST/{api_version}/agentsT
user-agentapplication/jsonr+   c                  j    t        j                  j                  dddt        j                         S NFjson)r4   r   serialize_request_bodyr;   r   Agentr4   requests   r$   <lambda>zAgents.create.<locals>.<lambda>{   '    (D(DeUFFLLZ) r&   methodpathbase_urlurl_variablesrH   request_body_requiredrequest_has_path_paramsrequest_has_query_paramsuser_agent_headeraccept_header_valuehttp_headersextra_query_params_globalssecurityget_serialized_bodyallow_empty_value
timeout_msattempt-count-backoff  @     0u     max_retries4084094295XXc                    t        j                  | dd      r,t        j                  |       }t        j                  d| |      t        j                  | dd      r,t        j                  |       }t        j                  d| |      t        j                  | dd      rt        t        j                  | d      S t        j                  d	|       
N4XX*zAPI error occurredrh   defaultr?   F)validatezUnexpected response receivedr   match_responsestream_to_textr   GenAiDefaultErrorr   r   rF   http_reshttp_res_texts     r$   _speakeasy_parse_responsez0Agents.create.<locals>._speakeasy_parse_response       ##HeS9 % 4 4X >..((M  ##HeS9 % 4 4X >..((M  ##Hi9KL.v||XPUVV**+I8TTr&    CreateAgentsyncmode	executionconfigrN   operation_idoauth2_scopessecurity_sourceresponsec                 2    t        j                  ddg|       S Nrk   rh   r   match_status_codescs    r$   rI   zAgents.create.<locals>.<lambda>       5+C+CUENTU+V r&   	streaminghook_ctxrH   is_error_status_codestreamretry_configparsedbuffered_hooksrawparserr|   
client_refr   hooks))r   _coerce_timeout_mssdk_configurationr[   _get_urlr   CreateAgentRequestr   rF   r   get_pydantic_modelr   r   	AgentToolBaseEnvironmentr   consume_response_mode_build_requestCreateAgentGlobalsglobalsr+   rX   r   RetryConfigBackoffStrategy
isinstancer   r   r   Securityr	   
do_requestStreamedAPIResponseAPIResponser   r   r   __dict__get	Exceptionraise_parse_errorr#   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   rN   rO   retries
server_urlrU   r[   _speakeasy_response_modereqr   rv   _speakeasy_hook_ctxrt   _speakeasy_response_cls
parse_exc_rH   s             `               @r$   createzAgents.create'   s(   H 7<
$,,W5
//::J!!H}}X}=H++#%#5'..uhtFDTDT?U6VW!&!9!9$hv/E/E&F"	
 2B1W1W2
. , !!('"&$(%)* 2%*.. 22::FF ++44! #!+ " 
0 e%%22%?00==+++))#tQ> !	 gu001#%ABL	U  *))^&1&&// %*BfU	
 ??(!V+{:% # 
 $x/ ,{: !44%11 $
 ' 4##34GH0099==hG
 
	,X66 	..&&//9&':;	 	s   K 	L$"8LL$r+   	page_size
page_tokenparentr2   r3   r5   r   r   r   c                `   d}d}	t         }
d}|}| j                  |      }|| j                  j                  }||}n| j	                  ||	      }t        j                  ||||      }t        j                  |      \  }}| j                  dd||	|ddddd||t        j                  | j                  j                  j                  	      | j                  j                  d|
      }|
t         k(  rb| j                  j                  t         ur| j                  j                  }
n/t        j                   dt        j"                  dddd      dd      }
d}t%        |
t        j                         r|
g df}d }t'        | j                  |xs dddt)        | j                  j                  t*        j,                        t/        |d            }| j1                  ||d |dk(  |      }|dk7  rm|dk(  rt        j2                  nt        j4                  }t7        t8         |||d| t;        |      | j                  j<                  j?                  d                  S 	  ||      S # t@        $ rB}t        jB                  | j                  j<                  d   t;        |      ||       Y d}~yd}~ww xY w)   Lists all Agents.

        :param api_version: Which version of the API to use.
        :param page_size:
        :param page_token:
        :param parent:
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr+   r   r   r   GETr=   FTr>   r?   r@   rL   rM   rN   rO   rH   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rd   c                    t        j                  | dd      r,t        j                  |       }t        j                  d| |      t        j                  | dd      r,t        j                  |       }t        j                  d| |      t        j                  | dd      rt        t        j                  | d      S t        j                  d	|       rj   )r   rp   rq   r   rr   r   r   AgentListResponsers   s     r$   rv   z.Agents.list.<locals>._speakeasy_parse_response  s    ##HeS9 % 4 4X >..((M  ##HeS9 % 4 4X >..((M  ##Hi9KL.,,h  **+I8TTr&   rx   
ListAgentsrz   r{   r~   c                 2    t        j                  ddg|       S r   r   r   s    r$   rI   zAgents.list.<locals>.<lambda>=  r   r&   r   r   r   r   r   r   )"r   r   r   r[   r   r   ListAgentsRequestr   r   r   ListAgentsGlobalsr   r+   rX   r   r   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r#   r+   r   r   r   r2   r3   r5   rN   rO   r   r   rU   r[   rH   r   r   r   rv   r   rt   r   r   s                          r$   listzAgents.list   s   * 7<
$,,W5
//::J!!H}}X}=H**#!	
 2B1W1W2
. , !!('"'$(%)* 2%*-- 22::FF ++44"!% " 
* e%%22%?00==+++))#tQ> !	 gu001#%ABL	U$ *))^%1&&// %*BfU	
 ??(!V+{:% # 
 $x/ ,{: !44%11 $
 ' 4##34GH0099==hG
 
	,X66 	..&&//9&':;	 	s   I" "	J-+8J((J-r+   r2   r3   r5   c                \   d}d}t         }d}	|}
| j                  |      }|| j                  j                  }|	|	}n| j	                  ||      }t        j                  ||      }t        j                  |
      \  }}
| j                  dd|||ddddd|
|t        j                  | j                  j                  j                  	      | j                  j                  d|
      }|t         k(  rb| j                  j                  t         ur| j                  j                  }n/t        j                   dt        j"                  dddd      dd      }d}t%        |t        j                         r|g df}d }t'        | j                  |xs dddt)        | j                  j                  t*        j,                        t/        |d            }| j1                  ||d |dk(  |      }|dk7  rm|dk(  rt        j2                  nt        j4                  }t7        t8         |||d| t;        |      | j                  j<                  j?                  d                  S 	  ||      S # t@        $ rB}t        jB                  | j                  j<                  d   t;        |      ||       Y d}~yd}~ww xY w) u  Gets a specific Agent.

        :param id:
        :param api_version: Which version of the API to use.
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr+   r,   r   /{api_version}/agents/{id}FTr>   r?   r@   r   r\   r]   r^   r_   r`   ra   rb   rd   c                    t        j                  | dd      r,t        j                  |       }t        j                  d| |      t        j                  | dd      r,t        j                  |       }t        j                  d| |      t        j                  | dd      rt        t        j                  | d      S t        j                  d	|       rj   ro   rs   s     r$   rv   z-Agents.get.<locals>._speakeasy_parse_response  rw   r&   rx   GetAgentrz   r{   r~   c                 2    t        j                  ddg|       S r   r   r   s    r$   rI   zAgents.get.<locals>.<lambda>  r   r&   r   r   r   r   r   r   )"r   r   r   r[   r   r   GetAgentRequestr   r   r   GetAgentGlobalsr   r+   rX   r   r   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r#   r,   r+   r2   r3   r5   rN   rO   r   r   rU   r[   rH   r   r   r   rv   r   rt   r   r   s                        r$   r   z
Agents.get\  s   " 7<
$,,W5
//::J!!H}}X}=H((#

 2B1W1W2
. , !!-'"'$(%)* 2%*++ 22::FF ++44"!% " 
* e%%22%?00==+++))#tQ> !	 gu001#%ABL	U  *))^#1&&// %*BfU	
 ??(!V+{:% # 
 $x/ ,{: !44%11 $
 ' 4##34GH0099==hG
 
	,X66 	..&&//9&':;	 	   I   	J+)8J&&J+c                \   d}d}t         }d}	|}
| j                  |      }|| j                  j                  }|	|	}n| j	                  ||      }t        j                  ||      }t        j                  |
      \  }}
| j                  dd|||ddddd|
|t        j                  | j                  j                  j                  	      | j                  j                  d|
      }|t         k(  rb| j                  j                  t         ur| j                  j                  }n/t        j                   dt        j"                  dddd      dd      }d}t%        |t        j                         r|g df}d }t'        | j                  |xs dddt)        | j                  j                  t*        j,                        t/        |d            }| j1                  ||d |dk(  |      }|dk7  rm|dk(  rt        j2                  nt        j4                  }t7        t8         |||d| t;        |      | j                  j<                  j?                  d                  S 	  ||      S # t@        $ rB}t        jB                  | j                  j<                  d   t;        |      ||       Y d}~yd}~ww xY w) p  Deletes an Agent.

        :param id:
        :param api_version: Which version of the API to use.
        :param extra_headers: Additional headers to set or replace on requests.
        :param extra_query: Additional query parameters to append to requests.
        :param timeout: Override the default request timeout configuration for this method in seconds
        Nr   DELETEr   FTr>   r?   r@   r   r\   r]   r^   r_   r`   ra   rb   rd   c                    t        j                  | dd      r,t        j                  |       }t        j                  d| |      t        j                  | dd      r,t        j                  |       }t        j                  d| |      t        j                  | dd      rt        t        j                  | d      S t        j                  d	|       rj   )r   rp   rq   r   rr   r   r   Emptyrs   s     r$   rv   z0Agents.delete.<locals>._speakeasy_parse_response.  s    ##HeS9 % 4 4X >..((M  ##HeS9 % 4 4X >..((M  ##Hi9KL. &&5  **+I8TTr&   rx   DeleteAgentrz   r{   r~   c                 2    t        j                  ddg|       S r   r   r   s    r$   rI   zAgents.delete.<locals>.<lambda>M  r   r&   r   r   r   r   r   r   )"r   r   r   r[   r   r   DeleteAgentRequestr   r   r   DeleteAgentGlobalsr   r+   rX   r   r   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r   s                        r$   deletezAgents.delete  s   " 7<
$,,W5
//::J!!H}}X}=H++#

 2B1W1W2
. , !!-'"'$(%)* 2%*.. 22::FF ++44"!% " 
* e%%22%?00==+++))#tQ> !	 gu001#%ABL	U$ *))^&1&&// %*BfU	
 ??(!V+{:% # 
 $x/ ,{: !44%11 $
 ' 4##34GH0099==hG
 
	,X66 	..&&//9&':;	 	r   __name__
__module____qualname__propertyr%   r)   r   strr   r   agents_agenttoolr   AgentToolParamagents_agentr   BaseEnvironmentParamr   r   floathttpxTimeoutr   rF   r   intr   r   r   r   r   r    r&   r$   r   r      sQ   + + 1 1 &* $(,0%)  5937269=)d c]d SM	d
 SMd %SMd c]d )334)889;
d #,..0Q0QQR
d"  S 12#d$ gc3h/0%d& WS#X./'d( %u}} 456)d* 
+dR &*#'$( $59379=M c]M C=	M
 SMM M  S 12M gc3h/0M %u}} 456M 
	!	!Mf &*59379=EE c]	E
  S 12E gc3h/0E %u}} 456E 
EV &*59379=GG c]	G
  S 12G gc3h/0G %u}} 456G 
		Gr&   r   c                       e Zd ZdeddfdZy)r!   sdkr6   Nc                 :   || _         t        j                  |j                  d      | _        t        j                  |j                  d      | _        t        j                  |j
                  d      | _        t        j                  |j                  d      | _        y Nr2   )_sdkr   to_raw_response_wrapperr   r   r   r   r#   r   s     r$   __init__zAgentsWithRawResponse.__init__n  sq    	&>>JJ
 %<<SXXW	#;;CGG_U&>>JJ
r&   r   r   r   r   r   r   r&   r$   r!   r!   m  s    	
F 	
t 	
r&   r!   c                       e Zd ZdeddfdZy)r(   r   r6   Nc                 :   || _         t        j                  |j                  d      | _        t        j                  |j                  d      | _        t        j                  |j
                  d      | _        t        j                  |j                  d      | _        y r   )r   r   to_streamed_response_wrapperr   r   r   r   r   s     r$   r   z$AgentsWithStreamingResponse.__init__{  s{    	&CCJJ
 %AAHHo
	 $@@GG_
 'CCJJ
r&   r   r   r&   r$   r(   r(   z  s    
F 
t 
r&   r(   c                   >   e Zd Zed        Zed        Zdddddddddddddee   dee   dee   dee   d	ee   d
eee	e
j                     e	e
j                     f      deeej                  ej                  f      deeeef      deeeef      deeeef      deeeej(                  f      dej,                  fdZdddddddddee   dee   dee   dee   deeeef      deeeef      deeeej(                  f      dej2                  fdZddddddedee   deeeef      deeeef      deeeej(                  f      dej,                  fdZddddddedee   deeeef      deeeef      deeeej(                  f      dej:                  fdZy)AsyncAgentsc                     t        |       S r    )AsyncAgentsWithRawResponser"   s    r$   r%   zAsyncAgents.with_raw_response  s    )$//r&   c                     t        |       S r    ) AsyncAgentsWithStreamingResponser"   s    r$   r)   z#AsyncAgents.with_streaming_response  s    /55r&   Nr*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   c                8  
K   d}d}t         }d}|}| j                  |      }|| j                  j                  }||}n| j	                  ||      }t        j                  |t        j                  ||||t        j                  |t        t        t        j                              t        j                  |t        t        j                                       t        j                   |      \  }}| j#                  dd||ddddd||	t        j$                  | j                  j&                  j(                  	      | j                  j*                  
fd
d|      }|t         k(  rb| j                  j,                  t         ur| j                  j,                  }n/t        j.                  dt        j0                  dddd      dd      }d}t3        |t        j.                        r|g df}d }t5        | j                  |xs dddt7        | j                  j*                  t8        j:                        t=        |d            }| j?                  ||d |dk(  |       d{   }|dk7  r|dk(  rt        j@                  nt        jB                  }tE        tF         |||d| tI        |      | j                  jJ                  jM                  d      | j                  jJ                  jM                  d       !            S 	  ||       d{   S 7 7 # tN        $ r{}t        jP                  | j                  jJ                  jM                  d       | j                  jJ                  jM                  d      tI        |      ||       d{  7   Y d}~yd}~ww xY ww)"r8   Nr9   r:   r<   r=   Tr>   r?   r@   c                  j    t        j                  j                  dddt        j                         S rB   rD   rG   s   r$   rI   z$AsyncAgents.create.<locals>.<lambda>  rJ   r&   rK   r\   r]   r^   r_   r`   ra   rb   rd   c                   K   t        j                  | dd      r4t        j                  |        d {   }t        j                  d| |      t        j                  | dd      r4t        j                  |        d {   }t        j                  d| |      t        j                  | dd      rt        t        j                  | d      S t        j                  d	|       7 7 fwrj   r   rp   stream_to_text_asyncr   rr   r   r   rF   rs   s     r$   rv   z5AsyncAgents.create.<locals>._speakeasy_parse_response       ##HeS9&+&@&@&J J..((M  ##HeS9&+&@&@&J J..((M  ##Hi9KL.v||XPUVV**+I8TT !K
 !K#   0C&C"A
C&=C$>A%C&$C&rx   ry   asyncr{   r~   c                 2    t        j                  ddg|       S r   r   r   s    r$   rI   z$AsyncAgents.create.<locals>.<lambda>  r   r&   r   r   r   r   r   _async_hooksr   r   r|   r   r   r   async_hooks))r   r   r   r[   r   r   r   r   rF   r   r   r   r   r   r   r   r   _build_request_asyncr   r   r+   rX   r   r   r   r   r   r   r   r   r	   do_request_asyncAsyncStreamedAPIResponseAsyncAPIResponser   r   r   r   r   r   raise_parse_error_asyncr   s             `               @r$   r   zAsyncAgents.create  s    H 7<
$,,W5
//::J!!H}}X}=H++#%#5'..uhtFDTDT?U6VW!&!9!9$hv/E/E&F"	
 2B1W1W2
. , ''('"&$(%)* 2%*.. 22::FF ++44! #!+ ( 
0 e%%22%?00==+++))#tQ> !	 gu001#%ABL	U  *))^&1&&// %*BgV	
 ..(!V+{:% / 
 
 $x/ ,{: !99%66 $
 ' 4##34GH0099==hG $ 6 6 ? ? C CN S 		28<<<5
4 = 	"::&&//33NC&&//33H=&':;  	s\   IN#L$BN?L 
LL NL 	NA+NN
NNNNr   r   r   r   c                J  K   d}d}	t         }
d}|}| j                  |      }|| j                  j                  }||}n| j	                  ||	      }t        j                  ||||      }t        j                  |      \  }}| j                  dd||	|ddddd||t        j                  | j                  j                  j                  	      | j                  j                  d|
      }|
t         k(  rb| j                  j                  t         ur| j                  j                  }
n/t        j                   dt        j"                  dddd      dd      }
d}t%        |
t        j                         r|
g df}d }t'        | j                  |xs dddt)        | j                  j                  t*        j,                        t/        |d            }| j1                  ||d |dk(  |       d{   }|dk7  r|dk(  rt        j2                  nt        j4                  }t7        t8         |||d| t;        |      | j                  j<                  j?                  d      | j                  j<                  j?                  d                   S 	  ||       d{   S 7 7 # t@        $ r{}t        jB                  | j                  j<                  j?                  d      | j                  j<                  j?                  d      t;        |      ||       d{  7   Y d}~yd}~ww xY ww)!r   Nr   r   r=   FTr>   r?   r@   r   r\   r]   r^   r_   r`   ra   rb   rd   c                   K   t        j                  | dd      r4t        j                  |        d {   }t        j                  d| |      t        j                  | dd      r4t        j                  |        d {   }t        j                  d| |      t        j                  | dd      rt        t        j                  | d      S t        j                  d	|       7 7 fwrj   )r   rp   r  r   rr   r   r   r   rs   s     r$   rv   z3AsyncAgents.list.<locals>._speakeasy_parse_response  s     ##HeS9&+&@&@&J J..((M  ##HeS9&+&@&@&J J..((M  ##Hi9KL.,,h  **+I8TT !K
 !Kr  rx   r   r  r{   r~   c                 2    t        j                  ddg|       S r   r   r   s    r$   rI   z"AsyncAgents.list.<locals>.<lambda>  r   r&   r   r   r   r   r   r	  r
  )"r   r   r   r[   r   r   r   r   r   r  r   r   r+   rX   r   r   r   r   r   r   r   r   r   r	   r  r  r  r   r   r   r   r   r   r  r   s                          r$   r   zAsyncAgents.list<  s)    * 7<
$,,W5
//::J!!H}}X}=H**#!	
 2B1W1W2
. , ''('"'$(%)* 2%*-- 22::FF ++44"!% ( 
* e%%22%?00==+++))#tQ> !	 gu001#%ABL	U$ *))^%1&&// %*BgV	
 ..(!V+{:% / 
 
 $x/ ,{: !99%66 $
 ' 4##34GH0099==hG $ 6 6 ? ? C CN S 		28<<<5
4 = 	"::&&//33NC&&//33H=&':;  	s\   G*L#,J-BL#J JJ L#J 	L %A+LLLL#L  L#r   c                F  K   d}d}t         }d}	|}
| j                  |      }|| j                  j                  }|	|	}n| j	                  ||      }t        j                  ||      }t        j                  |
      \  }}
| j                  dd|||ddddd|
|t        j                  | j                  j                  j                  	      | j                  j                  d|
      }|t         k(  rb| j                  j                  t         ur| j                  j                  }n/t        j                   dt        j"                  dddd      dd      }d}t%        |t        j                         r|g df}d }t'        | j                  |xs dddt)        | j                  j                  t*        j,                        t/        |d            }| j1                  ||d |dk(  |       d{   }|dk7  r|dk(  rt        j2                  nt        j4                  }t7        t8         |||d| t;        |      | j                  j<                  j?                  d      | j                  j<                  j?                  d                   S 	  ||       d{   S 7 7 # t@        $ r{}t        jB                  | j                  j<                  j?                  d      | j                  j<                  j?                  d      t;        |      ||       d{  7   Y d}~yd}~ww xY ww)!r   Nr   r   r   FTr>   r?   r@   r   r\   r]   r^   r_   r`   ra   rb   rd   c                   K   t        j                  | dd      r4t        j                  |        d {   }t        j                  d| |      t        j                  | dd      r4t        j                  |        d {   }t        j                  d| |      t        j                  | dd      rt        t        j                  | d      S t        j                  d	|       7 7 fwrj   r  rs   s     r$   rv   z2AsyncAgents.get.<locals>._speakeasy_parse_response  r  r  rx   r   r  r{   r~   c                 2    t        j                  ddg|       S r   r   r   s    r$   rI   z!AsyncAgents.get.<locals>.<lambda>5  r   r&   r   r   r   r   r   r	  r
  )"r   r   r   r[   r   r   r   r   r   r  r   r   r+   rX   r   r   r   r   r   r   r   r   r   r	   r  r  r  r   r   r   r   r   r   r  r   s                        r$   r   zAsyncAgents.get  s#    " 7<
$,,W5
//::J!!H}}X}=H((#

 2B1W1W2
. , ''-'"'$(%)* 2%*++ 22::FF ++44"!% ( 
* e%%22%?00==+++))#tQ> !	 gu001#%ABL	U  *))^#1&&// %*BgV	
 ..(!V+{:% / 
 
 $x/ ,{: !99%66 $
 ' 4##34GH0099==hG $ 6 6 ? ? C CN S 		28<<<5
4 = 	"::&&//33NC&&//33H=&':;  	\   G(L!*J+BL!J JJ L!J 	L#A+LLLL!LL!c                F  K   d}d}t         }d}	|}
| j                  |      }|| j                  j                  }|	|	}n| j	                  ||      }t        j                  ||      }t        j                  |
      \  }}
| j                  dd|||ddddd|
|t        j                  | j                  j                  j                  	      | j                  j                  d|
      }|t         k(  rb| j                  j                  t         ur| j                  j                  }n/t        j                   dt        j"                  dddd      dd      }d}t%        |t        j                         r|g df}d }t'        | j                  |xs dddt)        | j                  j                  t*        j,                        t/        |d            }| j1                  ||d |dk(  |       d{   }|dk7  r|dk(  rt        j2                  nt        j4                  }t7        t8         |||d| t;        |      | j                  j<                  j?                  d      | j                  j<                  j?                  d                   S 	  ||       d{   S 7 7 # t@        $ r{}t        jB                  | j                  j<                  j?                  d      | j                  j<                  j?                  d      t;        |      ||       d{  7   Y d}~yd}~ww xY ww)!r   Nr   r   r   FTr>   r?   r@   r   r\   r]   r^   r_   r`   ra   rb   rd   c                   K   t        j                  | dd      r4t        j                  |        d {   }t        j                  d| |      t        j                  | dd      r4t        j                  |        d {   }t        j                  d| |      t        j                  | dd      rt        t        j                  | d      S t        j                  d	|       7 7 fwrj   )r   rp   r  r   rr   r   r   r   rs   s     r$   rv   z5AsyncAgents.delete.<locals>._speakeasy_parse_response  s     ##HeS9&+&@&@&J J..((M  ##HeS9&+&@&@&J J..((M  ##Hi9KL. &&5  **+I8TT !K
 !Kr  rx   r   r  r{   r~   c                 2    t        j                  ddg|       S r   r   r   s    r$   rI   z$AsyncAgents.delete.<locals>.<lambda>  r   r&   r   r   r   r   r   r	  r
  )"r   r   r   r[   r   r   r   r   r   r  r   r   r+   rX   r   r   r   r   r   r   r   r   r   r	   r  r  r  r   r   r   r   r   r   r  r   s                        r$   r   zAsyncAgents.deleteV  s#    " 7<
$,,W5
//::J!!H}}X}=H++#

 2B1W1W2
. , ''-'"'$(%)* 2%*.. 22::FF ++44"!% ( 
* e%%22%?00==+++))#tQ> !	 gu001#%ABL	U$ *))^&1&&// %*BgV	
 ..(!V+{:% / 
 
 $x/ ,{: !99%66 $
 ' 4##34GH0099==hG $ 6 6 ? ? C CN S 		28<<<5
4 = 	"::&&//33NC&&//33H=&':;  	r  r   r   r&   r$   r   r     sQ   0 0 6 6 &* $(,0%)  5937269=)f c]f SM	f
 SMf %SMf c]f )334)889;
f #,..0Q0QQR
f"  S 12#f$ gc3h/0%f& WS#X./'f( %u}} 456)f* 
+fV &*#'$( $59379=O c]O C=	O
 SMO O  S 12O gc3h/0O %u}} 456O 
	!	!Oj &*59379=GG c]	G
  S 12G gc3h/0G %u}} 456G 
GZ &*59379=II c]	I
  S 12I gc3h/0I %u}} 456I 
		Ir&   r   c                       e Zd ZdeddfdZy)r   r   r6   Nc                 :   || _         t        j                  |j                  d      | _        t        j                  |j                  d      | _        t        j                  |j
                  d      | _        t        j                  |j                  d      | _        y r   )r   r   async_to_raw_response_wrapperr   r   r   r   r   s     r$   r   z#AsyncAgentsWithRawResponse.__init__  s{    	&DDJJ
 %BBHHo
	 $AAGG_
 'DDJJ
r&   r   r   r   r   r   r   r&   r$   r   r         
K 
D 
r&   r   c                       e Zd ZdeddfdZy)r   r   r6   Nc                 :   || _         t        j                  |j                  d      | _        t        j                  |j                  d      | _        t        j                  |j
                  d      | _        t        j                  |j                  d      | _        y r   )r   r   "async_to_streamed_response_wrapperr   r   r   r   r   s     r$   r   z)AsyncAgentsWithStreamingResponse.__init__  s{    	&IIJJ
 %GGHHo
	 $FFGG_
 'IIJJ
r&   r  r   r&   r$   r   r     r  r&   r   ))__doc__rx   r   r   r   r   r   r   r   r	   basesdkr
   r   r   r   r   r   types.agentsr   r   r   r   r   r   utils.unmarshal_json_responser   r   typingr   r   r   r   r   r   r   r   r!   r(   r   r   r   r   r&   r$   <module>r(     s{   " H * * H H * @ @ N : B  F F FL	W L	^

 


 
"T	, T	n
 
"
 
r&   