ó
    ±"³j)  ã                  óü   • S r SSKJr  SSK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  SSKrSSKJrJr  S	S
KJr  S	SKJr  S	SKJr  \(       a  S	SKJr  \" S\S9rSrSS jr " S S\\\   5      rSS jr SS jr!g)zmProviders for the API clients.

The providers are in charge of providing an authenticated client to the API.
é    )ÚannotationsN)ÚABCÚabstractmethod)ÚCallable)ÚTracebackType)ÚTYPE_CHECKINGÚAnyÚGeneric)ÚSelfÚTypeVaré   )ÚAsyncHTTPClient)Ú	UserError)ÚModelProfile)ÚRealtimeModelProfileÚInterfaceClient)Údefaultz…To try Pydantic AI without an API key, use the built-in test model: `Agent('test')`. See https://pydantic.dev/docs/ai/guides/testing/c                ó*   • [        U  S[         35      $ )ak  Build a [`UserError`][pydantic_ai.exceptions.UserError] for missing provider credentials.

The provider-specific `message` (which environment variable to set or how to pass the key) is followed by a
hint pointing newcomers to the keyless [test model](https://pydantic.dev/docs/ai/guides/testing/), so a missing key never
dead-ends the getting-started experience.
Ú )r   Ú_KEYLESS_HINT)Úmessages    Ú[/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pydantic_ai/providers/__init__.pyÚmissing_api_key_errorr       s   € ô ˜�y ¤- Ð1Ó2Ð2ó    c                  óR  • \ rS rSr% SrS\S'   SrS\S'   SrS\S	'   S
rS\S'   Sr	S\S'   \
R                  SS j5       r\\SS j5       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 S jrS!S jr        S"S jrSS jrSrg)#ÚProvideré*   a  Abstract class for a provider.

The provider is in charge of providing an authenticated client to the API.

Each provider only supports a specific interface. An interface can be supported by multiple providers.

For example, the `OpenAIChatModel` interface can be supported by the `OpenAIProvider` and the `DeepSeekProvider`.

When used as an async context manager, providers that create their own HTTP client will close it on exit.
This is handled automatically when using [`Agent`][pydantic_ai.agent.Agent] as a context manager.
r   Ú_clientNzAsyncHTTPClient | NoneÚ_own_http_clientz$Callable[[], AsyncHTTPClient] | NoneÚ_http_client_factoryr   ÚintÚ_entered_countz
str | NoneÚ_model_id_namespacec                ó,   • [         R                  " 5       $ )N)ÚanyioÚLock©Úselfs    r   Ú_enter_lockÚProvider._enter_lock=   s   € ô
 �zŠz‹|Ðr   c                ó   • [        5       e)aZ  The provider name.

The returned value flows into [`ModelMessage.provider_name`][pydantic_ai.messages.ModelMessage]
on every part. Thinking-tag detection and native-tool detection check this value when
the model class loads history, so silently renaming a concrete `name` value breaks
replay of any message history captured against the old name.
©ÚNotImplementedErrorr'   s    r   ÚnameÚProvider.nameD   s   € ô "Ó#Ð#r   c                ó@   • U R                   =(       d    U R                  $ )zKThe namespace used to fully qualify model IDs routed through this provider.)r#   r.   r'   s    r   Úmodel_id_namespaceÚProvider.model_id_namespaceP   s   € ð ×'Ñ'×4¨4¯9©9Ð4r   c                ó   • [        5       e)z"The base URL for the provider API.r,   r'   s    r   Úbase_urlÚProvider.base_urlU   ó   € ô "Ó#Ð#r   c                ó   • [        5       e)zThe client for the provider.r,   r'   s    r   ÚclientÚProvider.client[   r6   r   c                ó   • g)z4The model profile for the named model, if available.N© ©Ú
model_names    r   Úmodel_profileÚProvider.model_profilea   ó   € ð r   c                ó   • g)z=The realtime model profile for the named model, if available.Nr;   r<   s    r   Úrealtime_model_profileÚProvider.realtime_model_profilef   r@   r   c                ó   • g)z½Update the SDK client's internal HTTP client reference.

Subclasses that manage their own HTTP client should override this to inject
the new client into their SDK client after re-creation.
Nr;   )r(   Úhttp_clients     r   Ú_set_http_clientÚProvider._set_http_clientk   s   � r   c              ƒ  ó˜  #   • U R                    IS h  v•N   U R                  S:X  a\  U R                  bO  U R                  R                  (       a4  U R                  b'  U R	                  5       nXl        U R                  U5        U =R                  S-  sl        S S S 5      IS h  v•N   U $  N— N! , IS h  v•N  (       d  f       U $ = f7f©Nr   é   )r)   r"   r   Ú	is_closedr    rF   )r(   Ú
new_clients     r   Ú
__aenter__ÚProvider.__aenter__r   s›   é € Ø×#×#Ó#Ø×"Ñ" aÓ'¨D×,AÑ,AÑ,MØ×(Ñ(×2×2°t×7PÑ7PÑ7\Ø!%×!:Ñ!:Ó!<�JØ,6Ô)Ø×)Ñ)¨*Ô5Ø×Ò 1Ñ$Õ÷ $×#ð ˆ÷ $×#×#Ñ#ð ˆüsE   ‚C
“B+”C
—BB/ÂC
Â$B-Â%C
Â-C
Â/CÂ5B8Â6CÃC
c              ƒ  ó`  #   • U R                   S:X  a  g U R                   IS h  v•N   U =R                   S-  sl         U R                   S:X  a/  U R                  b"  U R                  R                  5       I S h  v•N   S S S 5      IS h  v•N   g  Ni N N	! , IS h  v•N  (       d  f       g = f7frI   )r"   r)   r   Úaclose)r(   Úexc_typeÚexc_valÚexc_tbs       r   Ú	__aexit__ÚProvider.__aexit__|   s„   é € ð ×Ñ !Ó#àØ×#×#Ó#Ø×Ò 1Ñ$ÕØ×"Ñ" aÓ'¨D×,AÑ,AÑ,MØ×+Ñ+×2Ñ2Ó4×4Ð4÷ $×#Ò#ñ 5÷ $×#×#Ð#üsW   ‚"B.¤B¥B.¨ABÁ8BÁ9BÁ=B.ÂBÂ	B.ÂBÂB.ÂB+ÂBÂB+Â'B.c                óh   • U R                   R                   SU R                   SU R                   S3$ )Nz(name=z, base_url=Ú))Ú	__class__Ú__name__r.   r4   r'   s    r   Ú__repr__ÚProvider.__repr__Š   s/   € Ø—.‘.×)Ñ)Ð*¨&°·±°¸;ÀtÇ}Á}ÀoÐUVÐWÐWr   )r   )Úreturnz
anyio.Lock)r\   Ústr)r\   r   )r=   r]   r\   zModelProfile | None)r=   r]   r\   zRealtimeModelProfile | None)rE   r   r\   ÚNone)r\   r   )rQ   ztype[BaseException] | NonerR   zBaseException | NonerS   zTracebackType | Noner\   zbool | None)rY   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r   r    r"   r#   Ú	functoolsÚcached_propertyr)   Úpropertyr   r.   r1   r4   r8   Ústaticmethodr>   rB   rF   rM   rT   rZ   Ú__static_attributes__r;   r   r   r   r   *   s  ‡ ñ
ð ÓØ/3ÐÐ,Ó3ØAEÐÐ>ÓEØ€N�CÓØ&*Ð˜Ó*à×Ñóó ðð Øó$ó ó ð$ð ó5ó ð5ð Øó$ó ó ð$ð Øó$ó ó ð$ð óó ðð óó ðôôð5à,ð5ð &ð5ð %ð	5ð
 
ô5÷Xr   r   c                óV  • U R                  S5      (       a  SSKJn  U" U 5      n U S;   a  SSKJn  U$ U S:X  a  SSKJn  U$ U S:X  a  SS	KJn  U$ U S
:X  a  SSK	J
n  U$ U S:X  a  SSKJn  U$ U S;   a  SSKJn  U$ U S:X  a  SSKJn  U$ U S:X  a  SSKJn	  U	$ U S:X  a  SSKJn
  U
$ U S:X  a  SSKJn  U$ U S:X  a  SSKJn  U$ U S:X  a  SSKJn  U$ U S:X  a  SSKJn  U$ U S:X  a  SSKJn  U$ U S :X  a  SS!KJ n  U$ U S":X  a  SS#K!J"n  U$ U S$:X  a  SS%K#J$n  U$ U S&:X  a  SS'K%J&n  U$ U S(:X  a  SS)K'J(n  U$ U S*:X  a  SS+K)J*n  U$ U S,:X  a  SS-K+J,n  U$ U S.:X  a  SS/K-J.n  U$ U S0:X  a  SS1K/J0n  U$ U S2:X  a  SS3K1J2n  U$ U S4:X  a  SS5K3J4n  U$ U S6:X  a  SS7K5J6n  U$ U S8:X  a  SS9K7J8n  U$ U S::X  a  SS;K9J:n  U$ U S<:X  a  SS=K;J<n  U$ U S>:X  a  SS?K=J>n  U$ U S@:X  a  SSAK?J@n   U $ U SB:X  a  SSCKAJBn!  U!$ U SD:X  a  SSEKCJDn"  U"$ U SF:X  a  SSGKEJFn#  U#$ U SH:X  a  SSIKGJHn$  U$$ U SJ:X  a  SSKKIJJn%  U%$ [—        SLU  35      e)Mz1Infers the provider class from the provider name.úgateway/rJ   )Únormalize_gateway_provider)Úopenaizopenai-chatzopenai-responses)ÚOpenAIProviderzopenai-codex)ÚOpenAICodexProviderÚdeepseek)ÚDeepSeekProviderÚ
openrouter)ÚOpenRouterProviderÚvercel)ÚVercelProvider)Úazurezazure-responses)ÚAzureProviderÚgoogle)ÚGoogleProviderzgoogle-cloud)ÚGoogleCloudProviderÚbedrock)ÚBedrockProviderzbedrock-mantle)ÚBedrockMantleProviderÚgroq)ÚGroqProviderÚ	anthropic)ÚAnthropicProviderÚmistral)ÚMistralProviderÚcerebras)ÚCerebrasProviderÚcohere)ÚCohereProviderÚcrusoe)ÚCrusoeProviderÚxai)ÚXaiProviderÚ
moonshotai)ÚMoonshotAIProviderÚ	fireworks)ÚFireworksProviderÚtogether)ÚTogetherProviderÚheroku)ÚHerokuProviderÚhuggingface)ÚHuggingFaceProviderÚollama)ÚOllamaProviderÚgithub)ÚGitHubProviderzgithub-copilot)ÚGitHubCopilotProviderÚlitellm)ÚLiteLLMProviderÚvllm)ÚVLLMProviderÚnebius)ÚNebiusProviderÚovhcloud)ÚOVHcloudProviderÚalibaba)ÚAlibabaProviderÚ	sambanova)ÚSambaNovaProviderzsentence-transformers)ÚSentenceTransformersProviderÚ	snowflake)ÚSnowflakeProviderÚtypesafe)ÚTypeSafeProviderÚvoyageai)ÚVoyageAIProviderÚzai)ÚZaiProviderzUnknown provider: )LÚ
startswithÚgatewayrk   rl   rm   Úopenai_codexrn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   Úgoogle_cloudry   rz   r{   Úbedrock_mantler|   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•   r–   r—   r˜   Úgithub_copilotr™   rš   r›   rœ   r�   rž   rŸ   r    r¡   r¢   r£   r¤   r¥   Úsentence_transformersr¦   r§   r¨   r©   rª   r«   r¬   r­   r®   Ú
ValueError)&Úproviderrk   rm   rn   rp   rr   rt   rv   rx   ry   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¨   rª   r¬   r®   s&                                         r   Úinfer_provider_classr¸   Ž   sž  € ð
 ×Ñ˜:×&Ñ&Ý7á-¨hÓ7ˆàÐ@Ó@Ý*àÐØ	�^Ó	#Ý5à"Ð"Ø	�ZÓ	Ý.àÐØ	�\Ó	!Ý2à!Ð!Ø	�XÓ	Ý*àÐØ	Ð1Ó	1Ý(àÐØ	�XÓ	Ý*àÐØ	�^Ó	#Ý5à"Ð"Ø	�YÓ	Ý,àÐØ	Ð%Ó	%Ý9à$Ð$Ø	�VÓ	Ý&àÐØ	�[Ó	 Ý0à Ð Ø	�YÓ	Ý,àÐØ	�ZÓ	Ý.àÐØ	�XÓ	Ý*àÐØ	�XÓ	Ý*àÐØ	�UÓ	Ý$àÐØ	�\Ó	!Ý2à!Ð!Ø	�[Ó	 Ý0à Ð Ø	�ZÓ	Ý.àÐØ	�XÓ	Ý*àÐØ	�]Ó	"Ý4à"Ð"Ø	�XÓ	Ý*àÐØ	�XÓ	Ý*àÐØ	Ð%Ó	%Ý9à$Ð$Ø	�YÓ	Ý,àÐØ	�VÓ	Ý&àÐØ	�XÓ	Ý*àÐØ	�ZÓ	Ý.àÐØ	�YÓ	Ý,àÐØ	�[Ó	 Ý0à Ð Ø	Ð,Ó	,ÝGà+Ð+Ø	�[Ó	 Ý0à Ð Ø	�ZÓ	Ý.àÐØ	�ZÓ	Ý.àÐØ	�UÓ	Ý$àÐäÐ-¨h¨ZÐ8Ó9Ð9r   c                ó�   • U R                  S5      (       a  SSKJn  U R                  S5      nU" U5      $ [	        U 5      nU" 5       $ )z*Infer the provider from the provider name.rj   rJ   )Úgateway_provider)r¯   r°   rº   Úremoveprefixr¸   )r·   rº   Úupstream_providerÚprovider_classs       r   Úinfer_providerr¾   ,  sF   € à×Ñ˜:×&Ñ&Ý-à$×1Ñ1°*Ó=ÐÙÐ 1Ó2Ð2ä)¨(Ó3€NÙÓÐr   )r   r]   r\   r   )r·   r]   r\   ztype[Provider[Any]])r·   r]   r\   zProvider[Any])"rb   Ú
__future__r   Ú_annotationsrd   Úabcr   r   Úcollections.abcr   Útypesr   Útypingr   r	   r
   r%   Útyping_extensionsr   r   Ú_httpr   Ú
exceptionsr   Úprofilesr   Úrealtimer   r   r   r   r   r¸   r¾   r;   r   r   Ú<module>rÊ      sv   ðñõ
 3ã ß #Ý $Ý ß .Ñ .ã ß +å #Ý "Ý #æÝ/áÐ+°SÑ9€ð7ð ô3ôaXˆs�G˜OÑ,ô aXôH[:õ|	r   