
    _j                    D   S SK Jr  S SKrS SKJrJrJr  S SKJrJ	r	  S SK
r
SSKJrJr  SSKJr  SSKJrJrJrJrJrJrJrJr  SS	KJrJrJr  SS
KJr  SSKJ r   SSK!J"r"J#r#  SSKJ$r$  SSK%J&r&J'r'J(r(  SSK)J*r*J+r+J,r,J-r-J.r.J/r/  SSK0J1r1J2r2  SSK3J4r4  S)S jr5S*S jr6S+S jr7S,S jr8S-S jr9\(       a,  SSK:J;r;J<r<J=r=J>r>  SSK?J@r@JArA  SSKBJCrCJDrD  SSKEJFrFJGrG  SSKHJIrIJJrJ  / SQrK " S S\'5      rL " S S \(5      rM " S! S"5      rN " S# S$5      rO " S% S&5      rP " S' S(5      rQ\LrR\MrSg).    )annotationsN)TYPE_CHECKINGAnyMapping)Selfoverride   )
_constants_exceptionsQuerystring)OmitHeadersTimeoutNotGiven	TransportProxiesTypesRequestOptions	not_given)is_givenis_mapping_tget_async_library)cached_property)__version__)StreamAsyncStream)APIStatusError)DEFAULT_MAX_RETRIESSyncAPIClientAsyncAPIClient)
TokenCacheInMemoryConfigAccessTokenAuthCredentialsFileAccessTokenProviderdefault_credentials)&warn_env_static_shadows_auto_discovery(warn_explicit_static_shadows_credentials)"_has_auto_discoverable_credentialsc                2    [        U 5      [        [        4;   $ )a   True only for the base ``Anthropic`` / ``AsyncAnthropic`` classes, not subclasses.

Subclasses (``AnthropicAWS``, ``AnthropicFoundry``) have their own auth paths
and must not run the credential chain or forward ``credentials`` through their
``__init__`` (which doesn't accept the kwarg).
)type	AnthropicAsyncAnthropic)clients    F/home/rurouni/.local/lib/python3.13/site-packages/anthropic/_client.py_is_base_clientr0   6   s     <I~666    c                4    [        U SS5      nUb  U" 5         gg)zPRelease any resources owned by a credential provider, if it exposes ``close()``.closeN)getattr)credentialsr3   s     r/   _close_credentialsr6   @   s     K$/E r1   c                P    [        U SS5      n[        U5      (       a	  U" U5        gg)uy  If the credential provider supports ``bind_base_url``, pass it the
client's resolved ``base_url`` so the token exchange and API calls hit
the same deployment without the caller passing the URL twice.

Providers without the hook (plain callables, custom impls) are left
untouched and MUST resolve their own token-exchange ``base_url`` — the
client does not second-guess them.
bind_base_urlN)r4   callable)r5   base_urlbinds      r/   _bind_credentials_base_urlr<   G   s'     ;6D~~X r1   c                F    Uc  gU b  [        S5        Ub  [        S5        gg)zWarn when an explicit ``api_key=`` / ``auth_token=`` argument shadows
an explicit ``credentials=`` provider. Call *after* any copy-inheritance
merging so the params reflect the resolved values.Napi_key
auth_token)r(   r>   r?   r5   s      r/   _warn_explicit_shadowrA   U   s.     0;0> r1   c                    [        5       (       d  gU b/  [        R                  R                  S5      (       a  [	        S5        Ub1  [        R                  R                  S5      (       a  [	        S5        ggg)af  Warn when an ``ANTHROPIC_API_KEY`` / ``ANTHROPIC_AUTH_TOKEN`` from the
environment is set alongside signals that would normally drive profile /
federation auto-discovery (``ANTHROPIC_PROFILE``, a ``configs/`` directory,
or the workload-identity env trio). Per the credential-precedence spec,
the static credential wins and auto-discovery is silently skipped.NANTHROPIC_API_KEYANTHROPIC_AUTH_TOKEN)r)   osenvirongetr'   r>   r?   s     r/   _warn_env_shadowrI   a   s]     .//rzz~~.ABB./BC"**..1G"H"H./EF #Ir1   )betamodelsmessagescompletions)ModelsAsyncModels)Beta	AsyncBeta)CompletionsAsyncCompletions)MessagesAsyncMessages)r   r   r   r   r,   r-   ClientAsyncClientc                    ^  \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S	'   S
\S'   \R                  r\R                  rSSSSSSS\\	SSSS\S.                             S#U 4S jjjr
\S$S j5       r\S%S j5       r\S&S j5       r\S'S j5       r\S(S j5       r\S)S j5       r\\S*S j5       5       r\\S+S j5       5       r\S+S j5       r\S+S j5       r\\S,U 4S jj5       5       r\S-S j5       r\\S.S j5       5       r\S/U 4S jj5       r\S0U 4S jj5       rSS\SSSS\S\SSSS0 S.                               S1S  jjr\r\        S2S! j5       rS"r U =r!$ )3r,      
str | Noner>   r?   webhook_keyAccessTokenProvider | Noner5   TokenCache | None_token_cacheAccessTokenAuth | None_custom_authNFr>   r?   r5   configprofiler[   r:   timeoutmax_retriesdefault_headersdefault_queryhttp_client_strict_response_validationr^   c                 > USL=(       d%    USL=(       d    USL=(       d    USL=(       d    USLnU(       d>  [         R                  R                  S5      n[         R                  R                  S5      nXl        X l        Uc  [         R                  R                  S5      nX`l        Uc  [         R                  R                  S5      nUSLnUc  Sn[         R                  R                  S5      nUbu  0 nUR                  S5       HF  nUR                  S	5      nUS
:  d  M  UUS-   S R                  5       UUSU R                  5       '   MH     0 UE[        U
5      (       a  U
O0 En
0 nUb\  Uc  Ub  [        S5      e[        [        U5      5      nUnUR                  5       nU(       d  UR                  (       a  UR                  nOPUbM  Ub  [        S5      e[        US9nUnUR                  5       nU(       d  UR                  (       a  UR                  nUcp  Ucm  Ucj  [!        U 5      (       aZ  [#        U(       a  [%        U5      OSS9nUb<  UR&                  nUR                  nU(       d  UR(                  (       a  UR(                  n[+        U[%        U5      5        X0l        [/        XUS9  [1        XS9  [3        U[4        5      (       d  Xl        OUb  [9        U5      OSU l        U R6                  b  [;        U R6                  5      OSU l        U(       a  0 UEU
=(       d    0 En
[>        TU ]  [B        UU	UUU
UUS9  [D        U l#        g)u  Construct a new synchronous Anthropic client instance.

Credentials are resolved in the following order (first match wins):

1. Explicit constructor arguments — ``api_key=``, ``auth_token=``,
   ``credentials=``, ``config=``, or ``profile=``. When any of these
   is passed, environment variables are not consulted for credentials.
2. ``ANTHROPIC_API_KEY`` / ``ANTHROPIC_AUTH_TOKEN`` environment
   variables.
3. ``ANTHROPIC_PROFILE`` environment variable — loads the named
   profile from ``<config_dir>/configs/<profile>.json``.
4. Workload identity federation environment variables —
   ``ANTHROPIC_IDENTITY_TOKEN[_FILE]`` +
   ``ANTHROPIC_FEDERATION_RULE_ID`` + ``ANTHROPIC_ORGANIZATION_ID``.
5. The active profile on disk — the profile named by
   ``<config_dir>/active_config``, or ``default``.

``credentials=``, ``config=``, and ``profile=`` are mutually exclusive.

If a static credential is supplied alongside a credentials provider
(``credentials=`` / ``config=`` / ``profile=``), or if
``ANTHROPIC_API_KEY`` / ``ANTHROPIC_AUTH_TOKEN`` is set alongside a
profile or federation configuration, the static credential takes
precedence and a one-shot warning is logged on the ``anthropic``
logger.
NrC   rD   ANTHROPIC_WEBHOOK_SIGNING_KEYANTHROPIC_BASE_URLhttps://api.anthropic.comANTHROPIC_CUSTOM_HEADERS
:r   r	   =Pass at most one of `credentials=`, `config=`, or `profile=`.rc   r:   r@   rH   versionr:   re   rd   rh   custom_headerscustom_queryri   )$rE   rF   rG   r>   r?   r[   splitfindstripr   	TypeErrorr"   dictextra_headersresolved_base_urlr$   r0   r&   strproviderr:   r<   r5   rA   rI   
isinstancer   r^   r!   r#   r`   super__init__r   r   _default_stream_clsselfr>   r?   r5   rb   rc   r[   r:   rd   re   rf   rg   rh   ri   r^   has_explicit_credentialbase_url_is_explicitcustom_headers_envparsedlinecoloncredential_headers	in_memory
creds_fileresult	__class__s                            r/   r   Anthropic.__init__   s(   v 4 #%#$&# T!# d" 	  'jjnn%89G(>?J$ **..)HIK&zz~~&:;H
  (t32HZZ^^,FG)%'F*006		#A:37	3D3J3J3LF4<--/0 7 gf|O?\?\ObdfO .0&'*= _``&tF|4I#K!*!8!8!:'I,G,G$66 & _``(9J$K!+!9!9!;'J,H,H%777?z7Io^bNcNc(8#h-QlmF!$oo%+%9%9"+%H";H>&gR]^@,11 ,;F;R
; 7X\DBFBSBSB_OD,=,=>eiO!3O8M2OO 	##*&(C 	 		
 $* r1   c                    SSK Jn  U" U 5      $ )Nr	   )rR   )resources.completionsrR   )r   rR   s     r/   rM   Anthropic.completions#  s    64  r1   c                    SSK Jn  U" U 5      $ )Nr	   )rT   )resources.messagesrT   )r   rT   s     r/   rL   Anthropic.messages)  s    0~r1   c                    SSK Jn  U" U 5      $ )Nr	   )rN   )resources.modelsrN   )r   rN   s     r/   rK   Anthropic.models/  s    ,d|r1   c                    SSK Jn  U" U 5      $ )Nr	   )rP   )resources.betarP   )r   rP   s     r/   rJ   Anthropic.beta5  s    (Dzr1   c                    [        U 5      $ N)AnthropicWithRawResponser   s    r/   with_raw_responseAnthropic.with_raw_response;  s    '--r1   c                    [        U 5      $ r   )AnthropicWithStreamedResponser   s    r/   with_streaming_response!Anthropic.with_streaming_response?      ,T22r1   c                    [        SS9$ Nbrackets)array_formatr   r   s    r/   qsAnthropic.qsC       
33r1   c                6    0 U R                   EU R                  E$ r   _api_key_auth_bearer_authr   s    r/   auth_headersAnthropic.auth_headersH        ;$$$:(9(9::r1   c                ,    U R                   nUc  0 $ SU0$ N	X-Api-Keyr>   r   r>   s     r/   r   Anthropic._api_key_authM       ,,?IW%%r1   c                2    U R                   nUc  0 $ SSU 30$ NAuthorizationzBearer r?   r   r?   s     r/   r   Anthropic._bearer_authT  *     __
I7:,!788r1   c                >   > 0 [         TU ]  ESSS.EU R                  E$ )Nfalse
2023-06-01zX-Stainless-Asynczanthropic-version)r   rf   _custom_headersr   r   s    r/   rf   Anthropic.default_headersa  s5    
g%
!(!-
 ""	
 	
r1   c                   U R                   b-  UR                  S5      (       d  UR                  S5      (       d  g UR                  S5      (       d  UR                  S5      (       a  g UR                  S5      (       d$  [        UR                  S5      [        5      (       a  g UR                  S5      (       d$  [        UR                  S5      [        5      (       a  g [	        S5      eNr   r   z"Could not resolve authentication method. Expected one of api_key, auth_token, or credentials to be set. Or for one of the `X-Api-Key` or `Authorization` headers to be explicitly omitted"r^   rG   r   r   r{   r   headersrv   s      r/   _validate_headersAnthropic._validate_headersk  s     ([1I1IRYR]R]^mRnRn;;''7;;{+C+C;;{##z.2D2D[2QSW'X'X;;'':n6H6H6Y[_+`+` J
 	
r1   c                    U R                   $ r   r`   r   s    r/   custom_authAnthropic.custom_auth          r1   c                   > UR                   S:X  aQ  U R                  bD  U R                  R                  5         UR                  R                  R                  S5      S:X  a  g[        TU ]  U5      $ N  zx-stainless-retry-count0Tstatus_coder^   
invalidaterequestr   rG   r   _should_retryr   responser   s     r/   r   Anthropic._should_retry  c     3&4+<+<+H((*''++,EF#Mw$X..r1   c                L   > [         TU ]  5         [        U R                  5        g r   r   r3   r6   r5   r   s    r/   r3   Anthropic.close  s    4++,r1   r>   r?   r5   rb   rc   r[   r:   rd   rh   re   rf   set_default_headersrg   set_default_query_extra_kwargsc                  Ub  Ub  [        S5      eUb  Ub  [        S5      eU R                  nUb  0 UEUEnOUb  UnU R                  nUb  0 UEUEnOUb  UnU	=(       d    U R                  n	Ub*  [	        U[
        5      (       a  Ub  [        S5      eSU0UEnOUb'  [	        U[
        5      (       d  [        S5      eSU0UEnOa[	        U[
        5      (       a  U R                  OUnUb;  [        U 5      (       a+  SU0UEn[	        U[
        5      (       a  SU R                  0UEnU R                  " S	U=(       d    U R                  U=(       d    U R                  U=(       d    U R                  U=(       d    U R                  [	        U[
        5      (       a  U R                  OUU	[!        U
5      (       a  U
OU R"                  UUS.	UD6$ 
zn
Create a new client instance re-using the same options given to the current client with optional overriding.
zPThe `default_headers` and `set_default_headers` arguments are mutually exclusivezLThe `default_query` and `set_default_query` arguments are mutually exclusiverq   rb   rc   r5   r^   )	r>   r?   r[   r:   rd   rh   re   rf   rg    
ValueErrorr   _custom_query_clientr   r   r{   r5   r0   r^   r   r>   r?   r[   r:   rd   r   re   r   r>   r?   r5   rb   rc   r[   r:   rd   rh   re   rf   r   rg   r   r   r   paramsresolved_credentialss                      r/   copyAnthropic.copy     , &+>+Jopp$):)Fkll&&&44O4G ,)G##$00-0F*&F!1T\\k8448K _``%v??M k844 _``&A=AM7A+x7X7X4#3#3^i #/OD4I4I!.0D V V k844%3T5F5F$X-$XM~~ 
+t||!4T__#7t'7'7.$.w$A$ADLLw#'/'<'<$BRBR# 
 
 	
r1   c                  UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R
                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S	:X  a  [        R                  " XUS9$ UR                   S
:X  a  [        R                  " XUS9$ UR                   S:  a  [        R                  " XUS9$ [        XUS9$ Ni  )r   bodyr   i  i  i  i  i  i  i  i  r   r   BadRequestErrorAuthenticationErrorPermissionDeniedErrorNotFoundErrorConflictErrorRequestTooLargeErrorUnprocessableEntityErrorRateLimitErrorOverloadedErrorInternalServerErrorr   r   err_msgr   r   s       r/   _make_status_errorAnthropic._make_status_error  b    3&..wPTUU3&227TXYY3&44WVZ[[3&,,WdSS3&,,WdSS3&33GUYZZ3&77Y]^^3&--gtTT3&..wPTUU3&227TXYYgtDDr1   r`   r   r^   r>   r?   r5   r[   )r>   rZ   r?   rZ   r5   r\   rb   Mapping[str, Any] | Nonerc   rZ   r[   rZ   r:   str | httpx.URL | Nonerd   !float | Timeout | None | NotGivenre   intrf   Mapping[str, str] | Nonerg   Mapping[str, object] | Nonerh   httpx.Client | Noneri   boolr^   TokenCache | None | NotGivenreturnNone)r  rR   )r  rT   )r  rN   )r  rP   )r  r   )r  r   r  r   r  zdict[str, str]r  zdict[str, str | Omit]r   r   rv   r   r  r  r  zhttpx.Auth | Noner   httpx.Responser  r  r  r  ) r>   rZ   r?   rZ   r5   %AccessTokenProvider | None | NotGivenrb   r  rc   rZ   r[   rZ   r:   r  rd   r  rh   r  re   int | NotGivenrf   r  r   r  rg   r  r   r  r   Mapping[str, Any]r  r   r	  r   r   objectr   r  r  r   "__name__
__module____qualname____firstlineno____annotations__r
   HUMAN_PROMPT	AI_PROMPTr   r   r   r   rM   rL   rK   rJ   r   r   propertyr   r   r   r   r   rf   r   r   r   r3   r   with_optionsr
  __static_attributes____classcell__r   s   @r/   r,   r,      s   ++##(( **L$$I
 #!%26+/""&+/5>.4859 ,0 -25>7P* P* 	P*
 0P* )P* P*  P* )P* 3P* P* 2P* 3P*" )#P*4 &*5P*6 37P*8 
9P* P*d ! !
  
  
  
 . . 3 3 4  4 ;  ; & & 
9 
9 
  
 
 
4 !  ! / / - - #!%=F+/""&+/5>+/&/488<599=+-#G
 G
 	G

 ;G
 )G
 G
  G
 )G
 3G
 )G
 $G
 2G
 6G
 3G
  7!G
" )#G
$ 
%G
V L$E$E 	$E
 !$E 
$E $Er1   r,   c                    ^  \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S	'   S
\S'   \R                  r\R                  rSSSSSSS\\	SSSS\S.                             S#U 4S jjjr
\S$S j5       r\S%S j5       r\S&S j5       r\S'S j5       r\S(S j5       r\S)S j5       r\\S*S j5       5       r\\S+S j5       5       r\S+S j5       r\S+S j5       r\\S,U 4S jj5       5       r\S-S j5       r\\S.S j5       5       r\S/U 4S jj5       r\S0U 4S jj5       rSS\SSSS\S\SSSS0 S.                               S1S  jjr\r\        S2S! j5       rS"r U =r!$ )3r-   i  rZ   r>   r?   r[   r\   r5   r]   r^   r_   r`   NFra   c                 > USL=(       d%    USL=(       d    USL=(       d    USL=(       d    USLnU(       d>  [         R                  R                  S5      n[         R                  R                  S5      nXl        X l        Uc  [         R                  R                  S5      nX`l        Uc  [         R                  R                  S5      nUSLnUc  Sn[         R                  R                  S5      nUbu  0 nUR                  S5       HF  nUR                  S	5      nUS
:  d  M  UUS-   S R                  5       UUSU R                  5       '   MH     0 UE[        U
5      (       a  U
O0 En
0 nUb\  Uc  Ub  [        S5      e[        [        U5      5      nUnUR                  5       nU(       d  UR                  (       a  UR                  nOPUbM  Ub  [        S5      e[        US9nUnUR                  5       nU(       d  UR                  (       a  UR                  nUcp  Ucm  Ucj  [!        U 5      (       aZ  [#        U(       a  [%        U5      OSS9nUb<  UR&                  nUR                  nU(       d  UR(                  (       a  UR(                  n[+        U[%        U5      5        X0l        [/        XUS9  [1        XS9  [3        U[4        5      (       d  Xl        OUb  [9        U5      OSU l        U R6                  b  [;        U R6                  5      OSU l        U(       a  0 UEU
=(       d    0 En
[>        TU ]  [B        UU	UUU
UUS9  [D        U l#        g)u  Construct a new async AsyncAnthropic client instance.

Credentials are resolved in the following order (first match wins):

1. Explicit constructor arguments — ``api_key=``, ``auth_token=``,
   ``credentials=``, ``config=``, or ``profile=``. When any of these
   is passed, environment variables are not consulted for credentials.
2. ``ANTHROPIC_API_KEY`` / ``ANTHROPIC_AUTH_TOKEN`` environment
   variables.
3. ``ANTHROPIC_PROFILE`` environment variable — loads the named
   profile from ``<config_dir>/configs/<profile>.json``.
4. Workload identity federation environment variables —
   ``ANTHROPIC_IDENTITY_TOKEN[_FILE]`` +
   ``ANTHROPIC_FEDERATION_RULE_ID`` + ``ANTHROPIC_ORGANIZATION_ID``.
5. The active profile on disk — the profile named by
   ``<config_dir>/active_config``, or ``default``.

``credentials=``, ``config=``, and ``profile=`` are mutually exclusive.

If a static credential is supplied alongside a credentials provider
(``credentials=`` / ``config=`` / ``profile=``), or if
``ANTHROPIC_API_KEY`` / ``ANTHROPIC_AUTH_TOKEN`` is set alongside a
profile or federation configuration, the static credential takes
precedence and a one-shot warning is logged on the ``anthropic``
logger.
NrC   rD   rk   rl   rm   rn   ro   rp   r   r	   rq   rr   rs   r@   rH   rt   )$rE   rF   rG   r>   r?   r[   rx   ry   rz   r   r{   r"   r|   r}   r~   r$   r0   r&   r   r   r:   r<   r5   rA   rI   r   r   r^   r!   r#   r`   r   r   r   r   r   r   s                            r/   r   AsyncAnthropic.__init__#  s(   v 4 #%#$&# T!# d" 	  'jjnn%89G(>?J$ **..)HIK&zz~~&:;H
  (t32HZZ^^,FG)%'F*006		#A:37	3D3J3J3LF4<--/0 7 gf|O?\?\ObdfO .0&'*= _``&tF|4I#K!*!8!8!:'I,G,G$66 & _``(9J$K!+!9!9!;'J,H,H%777?z7Io^bNcNc(8#h-QlmF!$oo%+%9%9"+%H";H>&gR]^@,11 ,;F;R
; 7X\DBFBSBSB_OD,=,=>eiO!3O8M2OO 	##*&(C 	 		
 $/ r1   c                    SSK Jn  U" U 5      $ )Nr	   )rS   )r   rS   )r   rS   s     r/   rM   AsyncAnthropic.completions  s    ;%%r1   c                    SSK Jn  U" U 5      $ )Nr	   )rU   )r   rU   )r   rU   s     r/   rL   AsyncAnthropic.messages  s    5T""r1   c                    SSK Jn  U" U 5      $ )Nr	   )rO   )r   rO   )r   rO   s     r/   rK   AsyncAnthropic.models  s    14  r1   c                    SSK Jn  U" U 5      $ )Nr	   )rQ   )r   rQ   )r   rQ   s     r/   rJ   AsyncAnthropic.beta  s    -r1   c                    [        U 5      $ r   )AsyncAnthropicWithRawResponser   s    r/   r    AsyncAnthropic.with_raw_response  r   r1   c                    [        U 5      $ r   )"AsyncAnthropicWithStreamedResponser   s    r/   r   &AsyncAnthropic.with_streaming_response  s    1$77r1   c                    [        SS9$ r   r   r   s    r/   r   AsyncAnthropic.qs  r   r1   c                6    0 U R                   EU R                  E$ r   r   r   s    r/   r   AsyncAnthropic.auth_headers  r   r1   c                ,    U R                   nUc  0 $ SU0$ r   r   r   s     r/   r   AsyncAnthropic._api_key_auth  r   r1   c                2    U R                   nUc  0 $ SSU 30$ r   r   r   s     r/   r   AsyncAnthropic._bearer_auth  r   r1   c                T   > 0 [         TU ]  ES[        5        3SS.EU R                  E$ )Nzasync:r   r   )r   rf   r   r   r   s    r/   rf   AsyncAnthropic.default_headers  sA    
g%
#)*;*=)>!?!-
 ""	
 	
r1   c                   U R                   b-  UR                  S5      (       d  UR                  S5      (       d  g UR                  S5      (       d  UR                  S5      (       a  g UR                  S5      (       d$  [        UR                  S5      [        5      (       a  g UR                  S5      (       d$  [        UR                  S5      [        5      (       a  g [	        S5      er   r   r   s      r/   r    AsyncAnthropic._validate_headers  s     ([1I1IRYR]R]^mRnRn;;''7;;{+C+C;;{##z.2D2D[2QSW'X'X;;'':n6H6H6Y[_+`+` J
 	
r1   c                    U R                   $ r   r   r   s    r/   r   AsyncAnthropic.custom_auth  r   r1   c                   > UR                   S:X  aQ  U R                  bD  U R                  R                  5         UR                  R                  R                  S5      S:X  a  g[        TU ]  U5      $ r   r   r   s     r/   r   AsyncAnthropic._should_retry  r   r1   c                h   >#    [         TU ]  5       I S h  vN   [        U R                  5        g  N7fr   r   r   s    r/   r3   AsyncAnthropic.close&  s*     gmo 	4++, 	s   202r   c                  Ub  Ub  [        S5      eUb  Ub  [        S5      eU R                  nUb  0 UEUEnOUb  UnU R                  nUb  0 UEUEnOUb  UnU	=(       d    U R                  n	Ub*  [	        U[
        5      (       a  Ub  [        S5      eSU0UEnOUb'  [	        U[
        5      (       d  [        S5      eSU0UEnOa[	        U[
        5      (       a  U R                  OUnUb;  [        U 5      (       a+  SU0UEn[	        U[
        5      (       a  SU R                  0UEnU R                  " S	U=(       d    U R                  U=(       d    U R                  U=(       d    U R                  U=(       d    U R                  [	        U[
        5      (       a  U R                  OUU	[!        U
5      (       a  U
OU R"                  UUS.	UD6$ r   r   r   s                      r/   r   AsyncAnthropic.copy/  r   r1   c                  UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R
                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S	:X  a  [        R                  " XUS9$ UR                   S
:X  a  [        R                  " XUS9$ UR                   S:  a  [        R                  " XUS9$ [        XUS9$ r   r   r  s       r/   r
  !AsyncAnthropic._make_status_error|  r  r1   r  )r>   rZ   r?   rZ   r5   r\   rb   r  rc   rZ   r[   rZ   r:   r  rd   r  re   r  rf   r  rg   r  rh   httpx.AsyncClient | Noneri   r  r^   r  r  r  )r  rS   )r  rU   )r  rO   )r  rQ   )r  r?  )r  rB  r  r  r  r  r  r  r   ) r>   rZ   r?   rZ   r5   r!  rb   r  rc   rZ   r[   rZ   r:   r  rd   r  rh   rZ  re   r"  rf   r  r   r  rg   r  r   r  r   r#  r  r   r$  r&  r2  s   @r/   r-   r-     s   ++##(( **L$$I
 #!%26+/""&+/5>.4859 15 -25>7P/ P/ 	P/
 0P/ )P/ P/  P/ )P/ 3P/ P/ 2P/ 3P/" .#P/4 &*5P/6 37P/8 
9P/ P/d & &
 # #
 ! !
  
 3 3 8 8 4  4 ;  ; & & 
9 
9 
  
 
 
( !  ! / / - - #!%=F+/""&+/5>04&/488<599=+-#G
 G
 	G

 ;G
 )G
 G
  G
 )G
 3G
 .G
 $G
 2G
 6G
 3G
  7!G
" )#G
$ 
%G
V L$E$E 	$E
 !$E 
$E $Er1   r-   c                  z    \ rS rSr% S\S'   SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
S	rg
)r   i  r,   r   c                    Xl         g r   r   r   r.   s     r/   r   !AnthropicWithRawResponse.__init__      r1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )CompletionsWithRawResponse)r   rb  r   rM   )r   rb  s     r/   rM   $AnthropicWithRawResponse.completions  s    E)$,,*B*BCCr1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )MessagesWithRawResponse)r   re  r   rL   )r   re  s     r/   rL   !AnthropicWithRawResponse.messages  s    ?&t||'<'<==r1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )ModelsWithRawResponse)r   rh  r   rK   )r   rh  s     r/   rK   AnthropicWithRawResponse.models  s    ;$T\\%8%899r1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )BetaWithRawResponse)r   rk  r   rJ   )r   rk  s     r/   rJ   AnthropicWithRawResponse.beta  s    7"4<<#4#455r1   r]  Nr.   r,   r  r  )r  z&completions.CompletionsWithRawResponse)r  z messages.MessagesWithRawResponse)r  zmodels.ModelsWithRawResponse)r  zbeta.BetaWithRawResponser'  r(  r)  r*  r+  r   r   rM   rL   rK   rJ   r0  r   r1   r/   r   r     s_     D D
 > >
 : :
 6 6r1   r   c                  z    \ rS rSr% S\S'   SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
S	rg
)r?  i  r-   r   c                    Xl         g r   r]  r^  s     r/   r   &AsyncAnthropicWithRawResponse.__init__  r`  r1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncCompletionsWithRawResponse)r   rs  r   rM   )r   rs  s     r/   rM   )AsyncAnthropicWithRawResponse.completions  s    J.t||/G/GHHr1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncMessagesWithRawResponse)r   rv  r   rL   )r   rv  s     r/   rL   &AsyncAnthropicWithRawResponse.messages  s    D+DLL,A,ABBr1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncModelsWithRawResponse)r   ry  r   rK   )r   ry  s     r/   rK   $AsyncAnthropicWithRawResponse.models  s    @)$,,*=*=>>r1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncBetaWithRawResponse)r   r|  r   rJ   )r   r|  s     r/   rJ   "AsyncAnthropicWithRawResponse.beta  s    <'(9(9::r1   r]  Nr.   r-   r  r  )r  z+completions.AsyncCompletionsWithRawResponse)r  z%messages.AsyncMessagesWithRawResponse)r  z!models.AsyncModelsWithRawResponse)r  zbeta.AsyncBetaWithRawResponsern  r   r1   r/   r?  r?    sa     I I
 C C
 ? ?
 ; ;r1   r?  c                  z    \ rS rSr% S\S'   SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
S	rg
)r   i  r,   r   c                    Xl         g r   r]  r^  s     r/   r   &AnthropicWithStreamedResponse.__init__  r`  r1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   ) CompletionsWithStreamingResponse)r   r  r   rM   )r   r  s     r/   rM   )AnthropicWithStreamedResponse.completions  s    K/0H0HIIr1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )MessagesWithStreamingResponse)r   r  r   rL   )r   r  s     r/   rL   &AnthropicWithStreamedResponse.messages  s    E,T\\-B-BCCr1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )ModelsWithStreamingResponse)r   r  r   rK   )r   r  s     r/   rK   $AnthropicWithStreamedResponse.models  s    A*4<<+>+>??r1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )BetaWithStreamingResponse)r   r  r   rJ   )r   r  s     r/   rJ   "AnthropicWithStreamedResponse.beta  s    =():):;;r1   r]  Nrm  )r  z,completions.CompletionsWithStreamingResponse)r  z&messages.MessagesWithStreamingResponse)r  z"models.ModelsWithStreamingResponse)r  zbeta.BetaWithStreamingResponsern  r   r1   r/   r   r     sc     J J
 D D
 @ @
 < <r1   r   c                  z    \ rS rSr% S\S'   SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
S	rg
)rB  i  r-   r   c                    Xl         g r   r]  r^  s     r/   r   +AsyncAnthropicWithStreamedResponse.__init__  r`  r1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )%AsyncCompletionsWithStreamingResponse)r   r  r   rM   )r   r  s     r/   rM   .AsyncAnthropicWithStreamedResponse.completions  s    P4T\\5M5MNNr1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )"AsyncMessagesWithStreamingResponse)r   r  r   rL   )r   r  s     r/   rL   +AsyncAnthropicWithStreamedResponse.messages  s    J1$,,2G2GHHr1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   ) AsyncModelsWithStreamingResponse)r   r  r   rK   )r   r  s     r/   rK   )AsyncAnthropicWithStreamedResponse.models  s    F/0C0CDDr1   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncBetaWithStreamingResponse)r   r  r   rJ   )r   r  s     r/   rJ   'AsyncAnthropicWithStreamedResponse.beta  s    B-dll.?.?@@r1   r]  Nr~  )r  z1completions.AsyncCompletionsWithStreamingResponse)r  z+messages.AsyncMessagesWithStreamingResponse)r  z'models.AsyncModelsWithStreamingResponse)r  z#beta.AsyncBetaWithStreamingResponsern  r   r1   r/   rB  rB    se     O O
 I I
 E E
 A Ar1   rB  )r.   r%  r  r  )r5   r%  r  r  )r5   r\   r:   r   r  r  )r>   rZ   r?   rZ   r5   r%  r  r  )r>   rZ   r?   rZ   r  r  )T
__future__r   rE   typingr   r   r   typing_extensionsr   r   httpx r
   r   _qsr   _typesr   r   r   r   r   r   r   r   _utilsr   r   r   _compatr   _versionr   
_streamingr   r   r   _base_clientr   r   r    lib.credentialsr!   r"   r#   r$   r%   r&   lib.credentials._authr'   r(   lib.credentials._constantsr)   r0   r6   r<   rA   rI   	resourcesrJ   rK   rL   rM   r   rN   rO   resources.beta.betarP   rQ   r   rR   rS   resources.messages.messagesrT   rU   __all__r,   r-   r   r?  r   rB  rV   rW   r   r1   r/   <module>r     s    # 	 . . ,  % 	 	 	 
 % ! D '   K7	?G  >>54DD	OE OEdKE^ KE\6 6>; ;>< <>A A> 
r1   