o
    µªRh¡  ã                   @  sž   d dl mZ d dlmZ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 G d
d„ deeef ƒZG dd„ deeef ƒZdddœddd„ZdS )é    )Úannotations)ÚAnyÚDictÚcastNé   )Úto_strict_json_schemaé   )ÚChatCompletionToolParam)ÚFunctionDefinition)ÚFunctionToolParamc                      s6   e Zd ZU dZded< d‡ fdd	„Zdd
d„Z‡  ZS )ÚPydanticFunctionToolzŠDictionary wrapper so we can pass the given base model
    throughout the entire request stack without having to special
    case it.
    útype[pydantic.BaseModel]ÚmodelÚdefnr
   ÚreturnÚNonec                   ó   t ƒ  |¡ || _d S ©N©ÚsuperÚ__init__r   )Úselfr   r   ©Ú	__class__© úS/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/openai/lib/_tools.pyr      ó   
zPydanticFunctionTool.__init__c                 C  ó
   t t| ƒS r   )r   r
   ©r   r   r   r   r      ó   
zPydanticFunctionTool.cast)r   r
   r   r   r   r   )r   r
   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   Ú__classcell__r   r   r   r   r      s
   
 r   c                      s2   e Zd ZU ded< d‡ fdd„Zdd	d
„Z‡  ZS )ÚResponsesPydanticFunctionToolr   r   ÚtoolÚResponsesFunctionToolParamr   r   c                   r   r   r   )r   r'   r   r   r   r   r       r   z&ResponsesPydanticFunctionTool.__init__c                 C  r   r   )r   r(   r   r   r   r   r   $   r   z"ResponsesPydanticFunctionTool.cast)r'   r(   r   r   r   r   )r   r(   )r    r!   r"   r$   r   r   r%   r   r   r   r   r&      s   
 r&   )ÚnameÚdescriptionr   r   r)   ú
str | Noner*   r   r	   c                C  sH   |d u r| j }t|p| jdt| ƒdœ| ƒ ¡ }|d ur||d< d|dœS )NT)r)   ÚstrictÚ
parametersr*   Úfunction)Útyper.   )r#   r   r    r   r   )r   r)   r*   r.   r   r   r   Úpydantic_function_tool(   s    ýúù	þr0   )r   r   r)   r+   r*   r+   r   r	   )Ú
__future__r   Útypingr   r   r   ÚpydanticÚ	_pydanticr   Ú
types.chatr	   Útypes.shared_paramsr
   Ú#types.responses.function_tool_paramr   r(   Ústrr   r&   r0   r   r   r   r   Ú<module>   s    ü