
    Ngc                         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 Serper.dev Google Search API.    )Optional)AsyncCallbackManagerForToolRunCallbackManagerForToolRun)BaseTool)Field)GoogleSerperAPIWrapperc                       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 )GoogleSerperRunz3Tool that queries the Serper.dev Google search API.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                 P    t          | j                            |                    S zUse the tool.)strr   runselfr   r   s      h/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/tools/google_serper/tool.py_runzGoogleSerperRun._run   s#     4#''..///    c                 j   K   | j                             |           d{V                                 S zUse the tool asynchronously.N)r   arun__str__r   s      r   _arunzGoogleSerperRun._arun"   s=       &++E22222222;;===r   N)__name__
__module____qualname____doc__r   r   __annotations__r   r   r   r   r   r   r    r   r   r
   r
      s         ==D#	*    
 ('''
 <@0 00 780 
	0 0 0 0 AE> >> <=> 
	> > > > > >r   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 )GoogleSerperResultszITool that queries the Serper.dev Google Search API
    and get back json.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                 P    t          | j                            |                    S r   )r   r   resultsr   s      r   r   zGoogleSerperResults._run7   s#     4#++E22333r   c                 j   K   | j                             |           d{V                                 S r   )r   aresultsr   r   s      r   r   zGoogleSerperResults._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           -D#,,,	W    
 +0%@V*W*W*WK'WWW
 <@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.google_serperr   r
   r(   r&   r   r   <module>r4      s    0 0              * ) ) ) ) )       N N N N N N> > > > >h > > >8B B B B B( B B B B Br   