
    h/                     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 Serper.dev Google Search API.    )Optional)AsyncCallbackManagerForToolRunCallbackManagerForToolRun)BaseTool)Field)GoogleSerperAPIWrapperc                   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)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                 J    t        | j                  j                  |            S zUse the tool.)strr   runselfr   r   s      j/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/langchain_community/tools/google_serper/tool.py_runzGoogleSerperRun._run   s      4##''.//    c                 p   K   | j                   j                  |       d{   j                         S 7 wzUse the tool asynchronously.N)r   arun__str__r   s      r   _arunzGoogleSerperRun._arun"   s.      &&++E22;;==2   646N)__name__
__module____qualname____doc__r   r   __annotations__r   r   r   r   r   r   r    r   r   r
   r
      s    =D#	*  
 ('
 <@00 78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y)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                 J    t        | j                  j                  |            S r   )r   r   resultsr   s      r   r   zGoogleSerperResults._run7   s      4##++E233r   c                 p   K   | j                   j                  |       d{   j                         S 7 wr   )r   aresultsr   r   s      r   r   zGoogleSerperResults._arun?   s.      &&//66??AA6r    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*WK'W
 <@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.google_serperr   r
   r)   r'   r   r   <module>r5      s5    0  *  N>h >8B( Br   