o
    Zh                  	   @   s   d dl mZmZmZmZ d dlmZ d dlmZ G dd deZ	G dd deZ
ddd	d
ee dee dee de	fddZddd	d
ee dee dee de
fddZdS )    )LiteralOptionalType	TypedDict)dereference_refs)	BaseModelc                   @   s.   e Zd ZU dZeed< 	 eed< 	 eed< dS )FunctionDescription7Representation of a callable function to the Ernie API.namedescription
parametersN)__name__
__module____qualname____doc__str__annotations__dict r   r   `/var/www/html/lang_env/lib/python3.10/site-packages/langchain_community/utils/ernie_functions.pyr      s   
 r   c                   @   s&   e Zd ZU dZed ed< eed< dS )ToolDescriptionr	   functiontypeN)r   r   r   r   r   r   r   r   r   r   r   r      s   
 r   Nr
   r   modelr
   r   returnc                C   s4   t |  }|dd |p|d |p|d |dS )EConvert a Pydantic model to a function description for the Ernie API.ZdefinitionsNtitler   )r
   r   r   )r   schemapop)r   r
   r   r   r   r   r   "convert_pydantic_to_ernie_function   s   

r    c                C   s   t | ||d}d|dS )r   r   r   )r   r   )r    )r   r
   r   r   r   r   r   convert_pydantic_to_ernie_tool)   s   
r!   )typingr   r   r   r   Z langchain_core.utils.json_schemar   Zpydanticr   r   r   r   r    r!   r   r   r   r   <module>   s6    

