o
    Zhc                     @   sh   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 deZG d	d
 d
eZdS )z*Tool for the Serper.dev Google Search API.    )Optional)AsyncCallbackManagerForToolRunCallbackManagerForToolRun)BaseTool)Field)GoogleSerperAPIWrapperc                   @   sn   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dZ	dded	e	e d
efddZdS )GoogleSerperRunz3Tool that queries the Serper.dev Google search API.Zgoogle_serpernamez~A low-cost Google Search API.Useful for when you need to answer questions about current events.Input should be a search query.descriptionapi_wrapperNqueryrun_managerreturnc                 C      t | j|S zUse the tool.)strr   runselfr   r    r   c/var/www/html/lang_env/lib/python3.10/site-packages/langchain_community/tools/google_serper/tool.py_run      zGoogleSerperRun._runc                       | j |I dH  S zUse the tool asynchronously.N)r   Zarun__str__r   r   r   r   _arun"   s   zGoogleSerperRun._arunN)__name__
__module____qualname____doc__r	   r   __annotations__r
   r   r   r   r   r   r   r   r   r   r   r      s,   
 

r   c                   @   sx   e Zd ZU dZdZeed< dZeed< ee	dZ
e	ed< 	dd	ed
ee defddZ	dd	ed
ee defddZdS )GoogleSerperResultszITool that queries the Serper.dev Google Search API
    and get back json.Zgoogle_serper_results_jsonr	   zA low-cost Google Search API.Useful for when you need to answer questions about current events.Input should be a search query. Output is a JSON object of the query resultsr
   )default_factoryr   Nr   r   r   c                 C   r   r   )r   r   resultsr   r   r   r   r   7   r   zGoogleSerperResults._runc                    r   r   )r   Zaresultsr   r   r   r   r   r   ?   s   zGoogleSerperResults._arunr   )r   r   r    r!   r	   r   r"   r
   r   r   r   r   r   r   r   r   r   r   r   r   r#   +   s,   
 

r#   N)r!   typingr   Zlangchain_core.callbacksr   r   Zlangchain_core.toolsr   Zpydanticr   Z+langchain_community.utilities.google_serperr   r   r#   r   r   r   r   <module>   s    