o
    #`^hÝ  ã                   @  sz   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 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)ÚFunctionDefinitionc                      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                   s   t ƒ  |¡ || _d S ©N)ÚsuperÚ__init__r   )Úselfr   r   ©Ú	__class__© úO/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/openai/lib/_tools.pyr      s   
zPydanticFunctionTool.__init__c                 C  s
   t t| ƒS r   )r   r
   )r   r   r   r   r      s   
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   )Ú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    ýúù	þr&   )r   r   r   r!   r    r!   r   r	   )Ú
__future__r   Útypingr   r   r   ÚpydanticÚ	_pydanticr   Ú
types.chatr	   Útypes.shared_paramsr
   Ústrr   r&   r   r   r   r   Ú<module>   s    ü