o
    i,                  
   @  s   U d dl mZ d dlZd dlmZmZ d dlZd dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ zd d	lmZmZmZ W n eyR Z zed
edZ[ww eeB eB Zded< G dd dee ZdS )    )annotationsN)	TypeAliasoverload)ModelProfile)	UserError)cached_async_http_clientanthropic_model_profile)Provider)AsyncAnthropicAsyncAnthropicBedrockAsyncAnthropicVertexu   Please install the `anthropic` package to use the Anthropic provider, you can use the `anthropic` optional group — `pip install "pydantic-ai-slim[anthropic]"`r   AsyncAnthropicClientc                   @  s   e Zd ZdZedddZedddZed d	d
Zd!ddZe	ddd"ddZ
e	ddddd#ddZ
dddddd$ddZ
dS )%AnthropicProviderzProvider for Anthropic API.returnstrc                 C  s   dS )N	anthropic selfr   r   e/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/pydantic_ai/providers/anthropic.pyname   s   zAnthropicProvider.namec                 C  s   t | jjS N)r   _clientbase_urlr   r   r   r   r   !   s   zAnthropicProvider.base_urlr   c                 C  s   | j S r   )r   r   r   r   r   client%   s   zAnthropicProvider.client
model_nameModelProfile | Nonec                 C  s   t |S r   r   )r   r   r   r   r   model_profile)   s   zAnthropicProvider.model_profileN)anthropic_clientr   AsyncAnthropicClient | NoneNonec                C     d S r   r   )r   r   r   r   r   __init__,   s   zAnthropicProvider.__init__api_keyr   http_clientr%   
str | Noner   r&   httpx.AsyncClient | Nonec                C  r"   r   r   )r   r%   r   r&   r   r   r   r#   /   s   )r%   r   r   r&   c                C  s   |dur|du sJ d|du sJ d|| _ dS |ptd}|s&td|dur4t|||d| _ dS tdd}t|||d| _ dS )	aP  Create a new Anthropic provider.

        Args:
            api_key: The API key to use for authentication, if not provided, the `ANTHROPIC_API_KEY` environment variable
                will be used if available.
            base_url: The base URL to use for the Anthropic API.
            anthropic_client: An existing [`AsyncAnthropic`](https://github.com/anthropics/anthropic-sdk-python)
                client to use. If provided, the `api_key` and `http_client` arguments will be ignored.
            http_client: An existing `httpx.AsyncClient` to use for making HTTP requests.
        Nz8Cannot provide both `anthropic_client` and `http_client`z4Cannot provide both `anthropic_client` and `api_key`ANTHROPIC_API_KEYz~Set the `ANTHROPIC_API_KEY` environment variable or pass it via `AnthropicProvider(api_key=...)`to use the Anthropic provider.r$   r   )provider)r   osgetenvr   r   r   )r   r%   r   r   r&   r   r   r   r#   4   s   

)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(   r   r!   )__name__
__module____qualname____doc__propertyr   r   r   r   r   r#   r   r   r   r   r      s&    
r   )
__future__r   _annotationsr+   typingr   r   httpxpydantic_air   pydantic_ai.exceptionsr   pydantic_ai.modelsr   pydantic_ai.profiles.anthropicr	   pydantic_ai.providersr
   r   r   r   r   ImportError_import_errorr   __annotations__r   r   r   r   r   <module>   s*    