
    b\j                    X   S SK Jr  S SKrS SKJr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'  SSK(J)r)J*r*J+r+J,r,  SSK-J.r.J/r/J0r0J1r1J2r2J3r3  SSK4J5r5J6r6  SSK7J8r8  S*S jr9S+S jr:S,S jr;S-S jr<S.S jr=\(       a,  SSK>J?r?J@r@JArAJBrB  SSKCJDrDJErE  SSKFJGrGJHrH  SSKIJJrJJKrK  SSKLJMrMJNrN  / SQrO " S S\*5      rP " S  S!\+5      rQ " S" S#5      rR " S$ S%5      rS " S& S'5      rT " S( S)5      rU\PrV\QrWg)/    )annotationsN)TYPE_CHECKINGAnyMappingSequence)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)MiddlewareInput)DEFAULT_MAX_RETRIESSyncAPIClientAsyncAPIClientmerge_headers)
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    G/var/www/website/venv/lib/python3.13/site-packages/anthropic/_client.py_is_base_clientr3   8   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)credentialsr6   s     r2   _close_credentialsr9   B   s     K$/E r4   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)r7   callable)r8   base_urlbinds      r2   _bind_credentials_base_urlr?   I   s'     ;6D~~X r4   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+   rA   rB   r8   s      r2   _warn_explicit_shadowrD   W   s.     0;0> r4   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*   rA   rB   s     r2   _warn_env_shadowrL   c   s]     .//rzz~~.ABB./BC"**..1G"H"H./EF #Ir4   )betamodelsmessagescompletions)ModelsAsyncModels)Beta	AsyncBeta)CompletionsAsyncCompletions)MessagesAsyncMessages)r   r   r   r   r/   r0   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.                               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\S0U 4S jj5       r\S1U 4S jj5       rSS\SSSS\S\SSSS\0 S.                                 S2S  jjr\rS3S! jr\        S4S" j5       r S#r!U =r"$ )5r/      
str | NonerA   rB   webhook_keyAccessTokenProvider | Noner8   TokenCache | None_token_cacheAccessTokenAuth | None_custom_authNFrA   rB   r8   configprofiler^   r=   timeoutmax_retriesdefault_headersdefault_queryhttp_client
middleware_strict_response_validationra   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  [!        U 5      (       a	  [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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.
NrF   rG   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=`.rf   r=   rC   rK   	versionr=   rh   rg   rk   custom_headerscustom_queryrl   rm   )$rH   rI   rJ   rA   rB   r^   splitfindstripr   	TypeErrorr%   dictextra_headersresolved_base_urlr'   r3   r)   strproviderr=   r?   r8   rD   rL   
isinstancer   ra   r$   r&   rc   super__init__r   r   _default_stream_clsselfrA   rB   r8   re   rf   r^   r=   rg   rh   ri   rj   rk   rl   rm   ra   has_explicit_credentialbase_url_is_explicitcustom_headers_envparsedlinecoloncredential_headers	in_memory
creds_fileresult	__class__s                             r2   r   Anthropic.__init__   s8   x 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]^4   WD,11 ,;F;R
; 7X\DBFBSBSB_OD,=,=>eiO!3O8M2OO 	##*&!(C 	 
	
 $* r4   c                    SSK Jn  U" U 5      $ )Nr
   )rU   )resources.completionsrU   )r   rU   s     r2   rP   Anthropic.completions*  s    64  r4   c                    SSK Jn  U" U 5      $ )Nr
   )rW   )resources.messagesrW   )r   rW   s     r2   rO   Anthropic.messages0  s    0~r4   c                    SSK Jn  U" U 5      $ )Nr
   )rQ   )resources.modelsrQ   )r   rQ   s     r2   rN   Anthropic.models6  s    ,d|r4   c                    SSK Jn  U" U 5      $ )Nr
   )rS   )resources.betarS   )r   rS   s     r2   rM   Anthropic.beta<  s    (Dzr4   c                    [        U 5      $ N)AnthropicWithRawResponser   s    r2   with_raw_responseAnthropic.with_raw_responseB  s    '--r4   c                    [        U 5      $ r   )AnthropicWithStreamedResponser   s    r2   with_streaming_response!Anthropic.with_streaming_responseF      ,T22r4   c                    [        SS9$ Nbrackets)array_formatr   r   s    r2   qsAnthropic.qsJ       
33r4   c                6    0 U R                   EU R                  E$ r   _api_key_auth_bearer_authr   s    r2   auth_headersAnthropic.auth_headersO        ;$$$:(9(9::r4   c                ,    U R                   nUc  0 $ SU0$ N	X-Api-KeyrA   r   rA   s     r2   r   Anthropic._api_key_authT       ,,?IW%%r4   c                2    U R                   nUc  0 $ SSU 30$ NAuthorizationzBearer rB   r   rB   s     r2   r   Anthropic._bearer_auth[  *     __
I7:,!788r4   c                >   > 0 [         TU ]  ESSS.EU R                  E$ )Nfalse
2023-06-01zX-Stainless-Asynczanthropic-version)r   ri   _custom_headersr   r   s    r2   ri   Anthropic.default_headersh  s5    
g%
!(!-
 ""	
 	
r4   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"ra   rJ   r   r   r   r   headersrz   s      r2   _validate_headersAnthropic._validate_headersr  s     ([1I1IRYR]R]^mRnRn;;''7;;{+C+C;;{##z.2D2D[2QSW'X'X;;'':n6H6H6Y[_+`+` J
 	
r4   c                    U R                   $ r   rc   r   s    r2   custom_authAnthropic.custom_auth          r4   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_codera   
invalidaterequestr   rJ   r   _should_retryr   responser   s     r2   r   Anthropic._should_retry  c     3&4+<+<+H((*''++,EF#Mw$X..r4   c                L   > [         TU ]  5         [        U R                  5        g r   r   r6   r9   r8   r   s    r2   r6   Anthropic.close  s    4++,r4   rA   rB   r8   re   rf   r^   r=   rg   rk   rh   ri   set_default_headersrj   set_default_queryrl   _extra_kwargsc                  Ub  Ub  [        S5      eUb  Ub  [        S5      eU R                  nUb  [        UU5      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[        U[        5      (       a  U R&                  O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 exclusiveru   re   rf   r8   ra   )
rA   rB   r^   r=   rg   rk   rh   ri   rj   rl    
ValueErrorr   r#   _custom_query_clientr   r   r   r8   r3   ra   r   rA   rB   r^   r=   rg   r   rh   _middlewarer   rA   rB   r8   re   rf   r^   r=   rg   rk   rh   ri   r   rj   r   rl   r   r   paramsresolved_credentialss                       r2   copyAnthropic.copy     . &+>+Jopp$):)Fkll&&&#G_=G ,)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# +5j(+K+Kt''Q[
 
 	
r4   c                <    U R                  / U R                  QUQS9$ zA new client with the given middleware appended after this client's middleware.

Convenience for applying extra middleware to a single request:

```py
client.with_middleware(my_middleware).messages.create(...)
```
)rl   r   r   r   rl   s     r2   with_middlewareAnthropic.with_middleware  &     yy$Dd&6&6$D$DyEEr4   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       r2   _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Dr4   rc   r   ra   rA   rB   r8   r^   ) rA   r]   rB   r]   r8   r_   re   Mapping[str, Any] | Nonerf   r]   r^   r]   r=   str | httpx.URL | Nonerg   !float | Timeout | None | NotGivenrh   intri   Mapping[str, str] | Nonerj   Mapping[str, object] | Nonerk   httpx.Client | Nonerl    Sequence[MiddlewareInput] | Nonerm   boolra   TokenCache | None | NotGivenreturnNone)r$  rU   )r$  rW   )r$  rQ   )r$  rS   )r$  r   )r$  r   r$  r   r$  zdict[str, str]r$  zdict[str, str | Omit]r   r   rz   r   r$  r%  r$  zhttpx.Auth | Noner   httpx.Responser$  r"  r$  r%  )"rA   r]   rB   r]   r8   %AccessTokenProvider | None | NotGivenre   r  rf   r]   r^   r]   r=   r  rg   r  rk   r   rh   int | NotGivenri   r  r   r  rj   r  r   r  rl   +Sequence[MiddlewareInput] | None | NotGivenr   Mapping[str, Any]r$  r   rl   r   r$  r   r  r   r  objectr   r,  r$  r   #__name__
__module____qualname____firstlineno____annotations__r   HUMAN_PROMPT	AI_PROMPTr   r    r   r   rP   rO   rN   rM   r   r   propertyr	   r   r   r   r   ri   r   r   r   r6   r   with_optionsr  r  __static_attributes____classcell__r   s   @r2   r/   r/      s   ++##(( **L$$I
 #!%26+/""&+/5>.4859 ,07; -25>9U* U* 	U*
 0U* )U* U*  U* )U* 3U* U* 2U* 3U*" )#U*$ 5%U*6 &*7U*8 39U*: 
;U* U*n ! !
  
  
  
 . . 3 3 4  4 ;  ; & & 
9 
9 
  
 
 
4 !  ! / / - - #!%=F+/""&+/5>+/&/488<599=BK+-%I
 I
 	I

 ;I
 )I
 I
  I
 )I
 3I
 )I
 $I
 2I
 6I
 3I
  7!I
" @#I
$ )%I
& 
'I
Z L	F $E$E 	$E
 !$E 
$E $Er4   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.                               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\S0U 4S jj5       r\S1U 4S jj5       rSS\SSSS\S\SSSS\0 S.                                 S2S  jjr\rS3S! jr\        S4S" j5       r S#r!U =r"$ )5r0   i*  r]   rA   rB   r^   r_   r8   r`   ra   rb   rc   NFrd   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  [!        U 5      (       a	  [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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.
NrF   rG   ro   rp   rq   rr   rs   rt   r   r
   ru   rv   rw   rC   rK   rx   )$rH   rI   rJ   rA   rB   r^   r|   r}   r~   r   r   r%   r   r   r   r'   r3   r)   r   r   r=   r?   r8   rD   rL   r   r   ra   r$   r&   rc   r   r   r   r   r   r   s                             r2   r   AsyncAnthropic.__init__7  s8   x 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]^4   WD,11 ,;F;R
; 7X\DBFBSBSB_OD,=,=>eiO!3O8M2OO 	##*&!(C 	 
	
 $/ r4   c                    SSK Jn  U" U 5      $ )Nr
   )rV   )r   rV   )r   rV   s     r2   rP   AsyncAnthropic.completions  s    ;%%r4   c                    SSK Jn  U" U 5      $ )Nr
   )rX   )r   rX   )r   rX   s     r2   rO   AsyncAnthropic.messages  s    5T""r4   c                    SSK Jn  U" U 5      $ )Nr
   )rR   )r   rR   )r   rR   s     r2   rN   AsyncAnthropic.models  s    14  r4   c                    SSK Jn  U" U 5      $ )Nr
   )rT   )r   rT   )r   rT   s     r2   rM   AsyncAnthropic.beta  s    -r4   c                    [        U 5      $ r   )AsyncAnthropicWithRawResponser   s    r2   r    AsyncAnthropic.with_raw_response  r   r4   c                    [        U 5      $ r   )"AsyncAnthropicWithStreamedResponser   s    r2   r   &AsyncAnthropic.with_streaming_response  s    1$77r4   c                    [        SS9$ r   r   r   s    r2   r   AsyncAnthropic.qs  r   r4   c                6    0 U R                   EU R                  E$ r   r   r   s    r2   r   AsyncAnthropic.auth_headers  r   r4   c                ,    U R                   nUc  0 $ SU0$ r   r   r   s     r2   r   AsyncAnthropic._api_key_auth  r   r4   c                2    U R                   nUc  0 $ SSU 30$ r   r   r   s     r2   r   AsyncAnthropic._bearer_auth  r   r4   c                T   > 0 [         TU ]  ES[        5        3SS.EU R                  E$ )Nzasync:r   r   )r   ri   r   r   r   s    r2   ri   AsyncAnthropic.default_headers  sA    
g%
#)*;*=)>!?!-
 ""	
 	
r4   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      r2   r    AsyncAnthropic._validate_headers  s     ([1I1IRYR]R]^mRnRn;;''7;;{+C+C;;{##z.2D2D[2QSW'X'X;;'':n6H6H6Y[_+`+` J
 	
r4   c                    U R                   $ r   r   r   s    r2   r   AsyncAnthropic.custom_auth+  r   r4   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     r2   r   AsyncAnthropic._should_retry0  r   r4   c                h   >#    [         TU ]  5       I S h  vN   [        U R                  5        g  N7fr   r   r   s    r2   r6   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  [        UU5      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[        U[        5      (       a  U R&                  OUS.
UD6$ r   r   r   s                       r2   r   AsyncAnthropic.copyH  r   r4   c                <    U R                  / U R                  QUQS9$ r   r  r  s     r2   r  AsyncAnthropic.with_middleware  r  r4   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       r2   r  !AsyncAnthropic._make_status_error  r  r4   r  ) rA   r]   rB   r]   r8   r_   re   r  rf   r]   r^   r]   r=   r  rg   r  rh   r  ri   r  rj   r  rk   httpx.AsyncClient | Nonerl   r!  rm   r"  ra   r#  r$  r%  )r$  rV   )r$  rX   )r$  rR   )r$  rT   )r$  rN  )r$  rQ  r&  r'  r(  r)  r*  r+  r-  )"rA   r]   rB   r]   r8   r.  re   r  rf   r]   r^   r]   r=   r  rg   r  rk   rk  rh   r/  ri   r  r   r  rj   r  r   r  rl   r0  r   r1  r$  r   r2  r3  r5  rA  s   @r2   r0   r0   *  s   ++##(( **L$$I
 #!%26+/""&+/5>.4859 157; -25>9U/ U/ 	U/
 0U/ )U/ U/  U/ )U/ 3U/ U/ 2U/ 3U/" .#U/$ 5%U/6 &*7U/8 39U/: 
;U/ U/n & &
 # #
 ! !
  
 3 3 8 8 4  4 ;  ; & & 
9 
9 
  
 
 
( !  ! / / - - #!%=F+/""&+/5>04&/488<599=BK+-%I
 I
 	I

 ;I
 )I
 I
  I
 )I
 3I
 .I
 $I
 2I
 6I
 3I
  7!I
" @#I
$ )%I
& 
'I
Z L	F $E$E 	$E
 !$E 
$E $Er4   r0   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   r1   s     r2   r   !AnthropicWithRawResponse.__init__      r4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )CompletionsWithRawResponse)r   rs  r   rP   )r   rs  s     r2   rP   $AnthropicWithRawResponse.completions  s    E)$,,*B*BCCr4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )MessagesWithRawResponse)r   rv  r   rO   )r   rv  s     r2   rO   !AnthropicWithRawResponse.messages  s    ?&t||'<'<==r4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )ModelsWithRawResponse)r   ry  r   rN   )r   ry  s     r2   rN   AnthropicWithRawResponse.models  s    ;$T\\%8%899r4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )BetaWithRawResponse)r   r|  r   rM   )r   r|  s     r2   rM   AnthropicWithRawResponse.beta  s    7"4<<#4#455r4   rn  Nr1   r/   r$  r%  )r$  z&completions.CompletionsWithRawResponse)r$  z messages.MessagesWithRawResponse)r$  zmodels.ModelsWithRawResponse)r$  zbeta.BetaWithRawResponser6  r7  r8  r9  r:  r   r   rP   rO   rN   rM   r?  r   r4   r2   r   r     s_     D D
 > >
 : :
 6 6r4   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
)rN  i  r0   r   c                    Xl         g r   rn  ro  s     r2   r   &AsyncAnthropicWithRawResponse.__init__  rq  r4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )AsyncCompletionsWithRawResponse)r   r  r   rP   )r   r  s     r2   rP   )AsyncAnthropicWithRawResponse.completions  s    J.t||/G/GHHr4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )AsyncMessagesWithRawResponse)r   r  r   rO   )r   r  s     r2   rO   &AsyncAnthropicWithRawResponse.messages  s    D+DLL,A,ABBr4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )AsyncModelsWithRawResponse)r   r  r   rN   )r   r  s     r2   rN   $AsyncAnthropicWithRawResponse.models  s    @)$,,*=*=>>r4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )AsyncBetaWithRawResponse)r   r  r   rM   )r   r  s     r2   rM   "AsyncAnthropicWithRawResponse.beta  s    <'(9(9::r4   rn  Nr1   r0   r$  r%  )r$  z+completions.AsyncCompletionsWithRawResponse)r$  z%messages.AsyncMessagesWithRawResponse)r$  z!models.AsyncModelsWithRawResponse)r$  zbeta.AsyncBetaWithRawResponser  r   r4   r2   rN  rN    sa     I I
 C C
 ? ?
 ; ;r4   rN  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   rn  ro  s     r2   r   &AnthropicWithStreamedResponse.__init__  rq  r4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   ) CompletionsWithStreamingResponse)r   r  r   rP   )r   r  s     r2   rP   )AnthropicWithStreamedResponse.completions  s    K/0H0HIIr4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )MessagesWithStreamingResponse)r   r  r   rO   )r   r  s     r2   rO   &AnthropicWithStreamedResponse.messages  s    E,T\\-B-BCCr4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )ModelsWithStreamingResponse)r   r  r   rN   )r   r  s     r2   rN   $AnthropicWithStreamedResponse.models  s    A*4<<+>+>??r4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )BetaWithStreamingResponse)r   r  r   rM   )r   r  s     r2   rM   "AnthropicWithStreamedResponse.beta   s    =():):;;r4   rn  Nr~  )r$  z,completions.CompletionsWithStreamingResponse)r$  z&messages.MessagesWithStreamingResponse)r$  z"models.ModelsWithStreamingResponse)r$  zbeta.BetaWithStreamingResponser  r   r4   r2   r   r     sc     J J
 D D
 @ @
 < <r4   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
)rQ  i'  r0   r   c                    Xl         g r   rn  ro  s     r2   r   +AsyncAnthropicWithStreamedResponse.__init__*  rq  r4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )%AsyncCompletionsWithStreamingResponse)r   r  r   rP   )r   r  s     r2   rP   .AsyncAnthropicWithStreamedResponse.completions-  s    P4T\\5M5MNNr4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )"AsyncMessagesWithStreamingResponse)r   r  r   rO   )r   r  s     r2   rO   +AsyncAnthropicWithStreamedResponse.messages3  s    J1$,,2G2GHHr4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   ) AsyncModelsWithStreamingResponse)r   r  r   rN   )r   r  s     r2   rN   )AsyncAnthropicWithStreamedResponse.models9  s    F/0C0CDDr4   c                F    SSK Jn  U" U R                  R                  5      $ )Nr
   )AsyncBetaWithStreamingResponse)r   r  r   rM   )r   r  s     r2   rM   'AsyncAnthropicWithStreamedResponse.beta?  s    B-dll.?.?@@r4   rn  Nr  )r$  z1completions.AsyncCompletionsWithStreamingResponse)r$  z+messages.AsyncMessagesWithStreamingResponse)r$  z'models.AsyncModelsWithStreamingResponse)r$  z#beta.AsyncBetaWithStreamingResponser  r   r4   r2   rQ  rQ  '  se     O O
 I I
 E E
 A Ar4   rQ  )r1   r4  r$  r"  )r8   r4  r$  r%  )r8   r_   r=   r   r$  r%  )rA   r]   rB   r]   r8   r4  r$  r%  )rA   r]   rB   r]   r$  r%  )X
__future__r   rH   typingr   r   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   r   r   _base_clientr    r!   r"   r#   lib.credentialsr$   r%   r&   r'   r(   r)   lib.credentials._authr*   r+   lib.credentials._constantsr,   r3   r9   r?   rD   rL   	resourcesrM   rN   rO   rP   r   rQ   rR   resources.beta.betarS   rT   r   rU   rV   resources.messages.messagesrW   rX   __all__r/   r0   r   rN  r   rQ  rY   rZ   r   r4   r2   <module>r     s    # 	 8 8 ,  % 	 	 	 
 % ! D ' (   K7	?G  >>54DD	aE aEH]E^ ]E@6 6>; ;>< <>A A> 
r4   