
    Ngd                         d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ  G d de          Z G d	 d
e          ZdS )z%Tool for the SearchApi.io search API.    )Optional)AsyncCallbackManagerForToolRunCallbackManagerForToolRun)BaseTool)Field)SearchApiAPIWrapperc                       e Zd ZU dZdZeed<   dZeed<   eed<   	 dded	e	e
         d
efdZ	 dded	e	e         d
efdZdS )SearchAPIRunz.Tool that queries the SearchApi.io search API.	searchapinamezGoogle search API provided by SearchApi.io.This tool is handy when you need to answer questions about current events.Input should be a search query.descriptionapi_wrapperNqueryrun_managerreturnc                 6    | j                             |          S zUse the tool.)r   runselfr   r   s      d/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/tools/searchapi/tool.py_runzSearchAPIRun._run   s     ##E***    c                 F   K   | j                             |           d{V S zUse the tool asynchronously.N)r   arunr   s      r   _arunzSearchAPIRun._arun"   s1       %**5111111111r   N)__name__
__module____qualname____doc__r   str__annotations__r   r   r   r   r   r   r    r   r   r
   r
      s         88D#	*    
 %$$$
 <@+ ++ 78+ 
	+ + + + AE2 22 <=2 
	2 2 2 2 2 2r   r
   c                       e Zd ZU dZdZeed<   dZeed<    ee	          Z
e	ed<   	 dd	ed
ee         defdZ	 dd	ed
ee         defdZdS )SearchAPIResultsz?Tool that queries the SearchApi.io search API and returns JSON.searchapi_results_jsonr   zGoogle search API provided by SearchApi.io.This tool is handy when you need to answer questions about current events.The input should be a search query and the output is a JSON object with the query results.r   )default_factoryr   Nr   r   r   c                 P    t          | j                            |                    S r   )r#   r   resultsr   s      r   r   zSearchAPIResults._run7   s#     4#++E22333r   c                 j   K   | j                             |           d{V                                 S r   )r   aresults__str__r   s      r   r   zSearchAPIResults._arun?   s=       &//66666666??AAAr   r   )r   r    r!   r"   r   r#   r$   r   r   r   r   r   r   r   r   r   r%   r   r   r'   r'   +   s         II(D#(((	"     (-u=P'Q'Q'QK$QQQ
 <@4 44 784 
	4 4 4 4 AEB BB <=B 
	B B B B B Br   r'   N)r"   typingr   langchain_core.callbacksr   r   langchain_core.toolsr   pydanticr   'langchain_community.utilities.searchapir   r
   r'   r%   r   r   <module>r4      s    + +              * ) ) ) ) )       G G G G G G2 2 2 2 28 2 2 28B B B B Bx B B B B Br   