
    ihd                     t    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y)z%Tool for the SearchApi.io search API.    )Optional)AsyncCallbackManagerForToolRunCallbackManagerForToolRun)BaseTool)Field)SearchApiAPIWrapperc                   t    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y)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                 8    | j                   j                  |      S zUse the tool.)r   runselfr   r   s      f/var/www/html/dev/engine/venv/lib/python3.12/site-packages/langchain_community/tools/searchapi/tool.py_runzSearchAPIRun._run   s     ##E**    c                 T   K   | j                   j                  |       d{   S 7 wzUse the tool asynchronously.N)r   arunr   s      r   _arunzSearchAPIRun._arun"   s%      %%**51111s   (&(N)__name__
__module____qualname____doc__r   str__annotations__r   r   r   r   r   r   r    r   r   r
   r
      s    8D#	*  
 %$
 <@++ 78+ 
	+ AE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y)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                 J    t        | j                  j                  |            S r   )r#   r   resultsr   s      r   r   zSearchAPIResults._run7   s      4##++E233r   c                 p   K   | j                   j                  |       d{   j                         S 7 wr   )r   aresults__str__r   s      r   r   zSearchAPIResults._arun?   s.      &&//66??AA6s   646r   )r   r    r!   r"   r   r#   r$   r   r   r   r   r   r   r   r   r   r%   r   r   r'   r'   +   s    I(D#(	"   (-=P'QK$Q
 <@44 784 
	4 AE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      s5    +  *  G28 28Bx Br   