o
    i !                     @  sF  U d dl mZ d dlmZ d dlmZ d dlmZm	Z	m
Z
mZ d dlZd dlmZ d dlmZ dZi Zd	ed
< eddG dd deZeddG dd deZG dd deddZeddG dd deZeddG dd deZeddG dd deZeddG dd deZeddG dd deZd%d#d$ZdS )&    )annotations)ABC)	dataclass)	AnnotatedAnyLiteralUnionN)core_schema)	TypedDict)AbstractBuiltinToolWebSearchToolWebSearchUserLocationCodeExecutionToolUrlContextToolImageGenerationTool
MemoryToolMCPServerToolz$dict[str, type[AbstractBuiltinTool]]_BUILTIN_TOOL_TYPEST)kw_onlyc                      sN   e Zd ZU dZdZded< 	 edddZd fddZe	dddZ
  ZS )r   zA builtin tool that can be used by an agent.

    This class is abstract and cannot be instantiated directly.

    The builtin tools are passed to the model as part of the `ModelRequestParameters`.
    unknown_builtin_toolstrkindreturnc                 C  s   | j S )zA unique identifier for the builtin tool.

        If multiple instances of the same builtin tool can be passed to the model, subclasses should override this property to allow them to be distinguished.
        )r   self r   _/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/pydantic_ai/builtin_tools.py	unique_id%   s   zAbstractBuiltinTool.unique_idkwargsr   Nonec                   s    t  jdi | | t| j< d S )Nr   )super__init_subclass__r   r   )clsr   	__class__r   r   r!   -   s   z%AbstractBuiltinTool.__init_subclass___source_typehandlerpydantic.GetCoreSchemaHandlercore_schema.CoreSchemac                 C  sh   | t ur|| S t }t|dkrtt|}||S dd |D }ttt| t	
tf }||S )N   c                 S  s    g | ]}t |t|jf qS r   )r   pydanticTagr   ).0toolr   r   r   
<listcomp><   s     zDAbstractBuiltinTool.__get_pydantic_core_schema__.<locals>.<listcomp>)r   r   valueslennextiterr   r   tupler*   Discriminator_tool_discriminator)r"   r%   r&   tools
tools_typetools_annotatedr   r   r   __get_pydantic_core_schema__1   s   z0AbstractBuiltinTool.__get_pydantic_core_schema__r   r   )r   r   r   r   )r%   r   r&   r'   r   r(   )__name__
__module____qualname____doc__r   __annotations__propertyr   r!   classmethodr9   __classcell__r   r   r#   r   r      s   
 r   c                   @  sd   e Zd ZU dZdZded< 	 dZded< 	 dZded	< 	 dZded
< 	 dZ	ded< 	 dZ
ded< dS )r   a  A builtin tool that allows your agent to search the web for information.

    The parameters that PydanticAI passes depend on the model, as some parameters may not be supported by certain models.

    Supported by:

    * Anthropic
    * OpenAI Responses
    * Groq
    * Google
    mediumz Literal['low', 'medium', 'high']search_context_sizeNzWebSearchUserLocation | Noneuser_locationlist[str] | Noneblocked_domainsallowed_domainsz
int | Nonemax_uses
web_searchr   r   )r;   r<   r=   r>   rD   r?   rE   rG   rH   rI   r   r   r   r   r   r   B   s   
 

r   c                   @  s8   e Zd ZU dZded< 	 ded< 	 ded< 	 ded< dS )r   zAllows you to localize search results based on a user's location.

    Supported by:

    * Anthropic
    * OpenAI Responses
    r   citycountryregiontimezoneN)r;   r<   r=   r>   r?   r   r   r   r   r      s   
 r   F)totalc                   @     e Zd ZU dZdZded< dS )r   zA builtin tool that allows your agent to execute code.

    Supported by:

    * Anthropic
    * OpenAI Responses
    * Google
    code_executionr   r   Nr;   r<   r=   r>   r   r?   r   r   r   r   r      s   
 	r   c                   @  rP   )r   zUAllows your agent to access contents from URLs.

    Supported by:

    * Google
    url_contextr   r   NrR   r   r   r   r   r         
 r   c                   @  s   e Zd ZU dZdZded< 	 dZded< 	 dZded	< 	 d
Zded< 	 dZ	ded< 	 dZ
ded< 	 dZded< 	 dZded< 	 dZded< dS )r   zvA builtin tool that allows your agent to generate images.

    Supported by:

    * OpenAI Responses
    * Google
    autoz(Literal['transparent', 'opaque', 'auto']
backgroundNzLiteral['high', 'low'] | Noneinput_fidelityzLiteral['auto', 'low']
moderationd   intoutput_compressionz%Literal['png', 'webp', 'jpeg'] | Noneoutput_formatr   partial_imagesz(Literal['low', 'medium', 'high', 'auto']qualityz6Literal['1024x1024', '1024x1536', '1536x1024', 'auto']sizeimage_generationr   r   )r;   r<   r=   r>   rV   r?   rW   rX   r[   r\   r]   r^   r_   r   r   r   r   r   r      s(   
 	r   c                   @  rP   )r   z]A builtin tool that allows your agent to use memory.

    Supported by:

    * Anthropic
    memoryr   r   NrR   r   r   r   r   r     rT   r   c                   @  sx   e Zd ZU dZded< 	 ded< 	 dZded< 	 dZded< 	 dZd	ed
< 	 dZded< 	 dZ	ded< e
dddZdS )r   zyA builtin tool that allows your agent to use MCP servers.

    Supported by:

    * OpenAI Responses
    * Anthropic
    r   idurlNz
str | Noneauthorization_tokendescriptionrF   allowed_toolszdict[str, str] | Noneheaders
mcp_serverr   r   c                 C  s   d | j| jgS )N:)joinr   rb   r   r   r   r   r   L  s   zMCPServerTool.unique_idr:   )r;   r<   r=   r>   r?   rd   re   rf   rg   r   r@   r   r   r   r   r   r     s"   
 	r   	tool_data$dict[str, Any] | AbstractBuiltinToolr   r   c                 C  s   t | tr| dtjS | jS )Nr   )
isinstancedictgetr   r   )rk   r   r   r   r5   Q  s   
r5   )rk   rl   r   r   )
__future__r   _annotationsabcr   dataclassesr   typingr   r   r   r   r*   pydantic_corer	   typing_extensionsr
   __all__r   r?   r   r   r   r   r   r   r   r   r5   r   r   r   r   <module>   s2    (@P=