o
    i                     @  sv   d Z ddlmZ ddlmZmZ ddlmZm	Z	m
Z
 ddlmZ e
dZG dd	 d	ee	e ZdddZdddZdS )zmProviders for the API clients.

The providers are in charge of providing an authenticated client to the API.
    )annotations)ABCabstractmethod)AnyGenericTypeVar   )ModelProfileInterfaceClientc                   @  sd   e Zd ZU dZded< eedddZeeddd	Zeedd
dZ	dddZ
dddZdS )ProvideraU  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. A interface can be supported by multiple providers.

    For example, the `OpenAIChatModel` interface can be supported by the `OpenAIProvider` and the `DeepSeekProvider`.
    r
   _clientreturnstrc                 C     t  )zThe provider name.NotImplementedErrorself r   d/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/pydantic_ai/providers/__init__.pyname      zProvider.namec                 C  r   )z"The base URL for the provider API.r   r   r   r   r   base_url"   r   zProvider.base_urlc                 C  r   )zThe client for the provider.r   r   r   r   r   client(   r   zProvider.client
model_nameModelProfile | Nonec                 C  s   dS )z4The model profile for the named model, if available.Nr   )r   r   r   r   r   model_profile.   s   zProvider.model_profilec                 C  s   | j j d| j d| j dS )Nz(name=z, base_url=))	__class____name__r   r   r   r   r   r   __repr__2   s   zProvider.__repr__N)r   r   )r   r
   )r   r   r   r   )r   
__module____qualname____doc____annotations__propertyr   r   r   r   r   r    r   r   r   r   r      s   
 	
r   providerr   r   type[Provider[Any]]c                 C  sT  | dv rddl m} |S | dkrddlm} |S | dkr$ddlm} |S | dkr0dd	lm} |S | d
kr<ddlm	} |S | dv rHddl
m} |S | dkrTddlm} |S | dkr`ddlm} |S | dkrlddlm}	 |	S | dkrxddlm}
 |
S | dkrddlm} |S | dkrddlm} |S | dkrddlm} |S | dkrddlm} |S | dkrddlm} |S | d krdd!lm} |S | d"krdd#l m!} |S | d$krdd%l"m#} |S | d&krdd'l$m%} |S | d(krdd)l&m'} |S | d*krdd+l(m)} |S | d,kr	dd-l*m+} |S | d.krdd/l,m-} |S | d0kr#dd1l.m/} |S t0d2|  )3z1Infers the provider class from the provider name.)openaizopenai-chatzopenai-responses   )OpenAIProviderdeepseek)DeepSeekProvider
openrouter)OpenRouterProvidervercel)VercelProviderazure)AzureProvidergoogle-vertexz
google-glaGoogleProviderbedrock)BedrockProvidergroq)GroqProvider	anthropic)AnthropicProvidermistral)MistralProvidercerebras)CerebrasProvidercohere)CohereProvidergrok)GrokProvider
moonshotai)MoonshotAIProvider	fireworks)FireworksProvidertogether)TogetherProviderheroku)HerokuProviderhuggingface)HuggingFaceProviderollama)OllamaProvidergithub)GitHubProviderlitellm)LiteLLMProvidernebius)NebiusProviderovhcloud)OVHcloudProvideroutlines)OutlinesProviderzUnknown provider: )1r(   r*   r+   r,   r-   r.   r/   r0   r1   r2   googler6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   
ValueError)r&   r*   r,   r.   r0   r2   r6   r8   r:   r<   r>   r@   rB   rD   rF   rH   rJ   rL   rN   rP   rR   rT   rV   rX   rZ   r   r   r   infer_provider_class6   s   


r]   Provider[Any]c                 C  sX   |  drddlm} | d}||S | dv r%ddlm} || dkdS t| }| S )z*Infer the provider from the provider name.zgateway/r)   )gateway_providerr3   r5   r4   )vertexai)
startswithgatewayr_   removeprefixr[   r6   r]   )r&   r_   upstream_providerr6   provider_classr   r   r   infer_provider   s   

rf   N)r&   r   r   r'   )r&   r   r   r^   )r#   
__future__r   _annotationsabcr   r   typingr   r   r   profilesr	   r
   r   r]   rf   r   r   r   r   <module>   s    
&f