a
    bgl                     @   s|   d dl mZmZ d dlmZ d dlmZ d dlmZm	Z	 d dl
mZ d dlmZmZmZ G dd deZG d	d
 d
eZdS )    )OptionalType)CallbackManagerForToolRun)BaseExampleSelector)FewShotPromptTemplatePromptTemplate)BaseTool)	BaseModel
ConfigDictFieldc                   @   s"   e Zd ZU edddZeed< dS )_FewShotToolInput.z3The question for which we want example SQL queries.)descriptionquestionN)__name__
__module____qualname__r   r   str__annotations__ r   r   u/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/langchain_community/tools/few_shot/tool.pyr   
   s   
r   c                   @   s   e Zd ZU dZdZeed< dZeed< eZ	e
e ed< eddZeed< d	Zeed
< dZeed< eddZdeee edddZdS )FewShotSQLToolz=Tool to get example SQL queries related to an input question.Zfew_shot_sqlnamer   args_schemaT)excludeexample_selectorinputexample_input_keyqueryexample_query_key)Zarbitrary_types_allowedN)r   run_managerreturnc                 C   sF   t d| j d| j }t|| jd| jgd}|jf i | j|iS )z:Execute the query, return the results or an error message.zUser input: z
SQL query:  )example_promptr   suffixZinput_variables)r   Zfrom_templater   r   r   r   format)selfr   r   r"   promptr   r   r   _run   s    zFewShotSQLTool._run)N)r   r   r   __doc__r   r   r   r   r   r   r   r	   r   r   r   r   r   r
   Zmodel_configr   r   r'   r   r   r   r   r      s    
 r   N)typingr   r   Zlangchain_core.callbacksr   Z langchain_core.example_selectorsr   Zlangchain_core.promptsr   r   Zlangchain_core.toolsr   Zpydanticr	   r
   r   r   r   r   r   r   r   <module>   s   