
    hhR                         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e          Z G d	 d
e          ZdS )    )OptionalType)CallbackManagerForToolRun)BaseExampleSelector)FewShotPromptTemplatePromptTemplate)BaseTool)	BaseModel
ConfigDictFieldc                   4    e Zd ZU  e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__     d/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/langchain_community/tools/few_shot/tool.pyr   r   
   sC         EN  Hc     r   r   c                       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          Zeed<   d	Zeed
<   dZeed<    ed          Z	 ddedee         defdZdS )FewShotSQLToolz=Tool to get example SQL queries related to an input question.few_shot_sqlnamer   args_schemaT)excludeexample_selectorinputexample_input_keyqueryexample_query_key)arbitrary_types_allowedNr   run_managerreturnc                     t          j        d| j         d| j                   }t	          || j        d| j        g          } |j        di | j        |iS )z:Execute the query, return the results or an error message.zUser input: z
SQL query:  )example_promptr   suffixinput_variablesr   )r   from_templater!   r#   r   r   format)selfr   r%   r)   prompts        r   _runzFewShotSQLTool._run   s|     (5X41XX@VXX
 
 ')!2!34	
 
 
 v}BB 6ABBBr   )N)r   r   r   __doc__r   r   r   r   r   r   r   r
   r   r   r   r!   r#   r   model_configr   r   r0   r   r   r   r   r      s         GGD#VKVVV#4Ki444,1E$,?,?,?)???$s$$$$s$$$: $  L <@C CC 78C 
	C C C C C Cr   r   N)typingr   r   langchain_core.callbacksr    langchain_core.example_selectorsr   langchain_core.promptsr   r   langchain_core.toolsr	   pydanticr
   r   r   r   r   r   r   r   <module>r9      s    ! ! ! ! ! ! ! ! > > > > > > @ @ @ @ @ @ H H H H H H H H ) ) ) ) ) ) 1 1 1 1 1 1 1 1 1 1    	   C C C C CX C C C C Cr   