o
    #i                     @  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   )ChatCompletionFunctionToolParam)FunctionDefinition)FunctionToolParamc                      s6   e Zd ZU dZded< d fdd	Zdd
dZ  ZS )PydanticFunctionToolzDictionary 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__ Q/var/www/html/flask_server/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    