Ë
    S^(hÙ
  ã                   óX   — d dl Z d dlZd dlmZ ddlmZ  G d„ de«      Z G d„ de«      Zy)	é    N)ÚRequestExceptioné   )ÚToolc                   ó6   — e Zd ZdZdZddddœiZdZdedefd	„Zy
)ÚDuckDuckGoSearchToolÚ
web_searchzµPerform a web search based on your query (think a Google search) then returns the top search results as a list of dict elements.
    Each result has keys 'title', 'href' and 'body'.ÚqueryÚstringzThe search query to perform.©ÚtypeÚdescriptionÚanyÚreturnc                 ót   — 	 ddl m}  |«       j                  |d¬«      }|S # t        $ r t        d«      ‚w xY w)Nr   )ÚDDGSzpYou must install package `duckduckgo_search` to run this tool: for instance run `pip install duckduckgo-search`.é   )Úmax_results)Úduckduckgo_searchr   ÚImportErrorÚtext)Úselfr	   r   Úresultss       úX/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/agents/search.pyÚforwardzDuckDuckGoSearchTool.forward    sI   € ð	Ý.ñ
 “&—+‘+˜e°�+Ó3ˆØˆøô ò 	Üð Cóð ð	ús   ‚" ¢7N©	Ú__name__Ú
__module__Ú__qualname__Únamer   ÚinputsÚoutput_typeÚstrr   © ó    r   r   r      s6   „ Ø€Dð8€Kà Ð9WÑXÐY€FØ€Kð˜Sð  Sô r$   r   c                   ó6   — e Zd ZdZdZddddœiZdZdedefd„Zy	)
ÚVisitWebpageToolÚvisit_webpagezOVisits a webpage at the given url and returns its content as a markdown string.Úurlr
   z The url of the webpage to visit.r   r   c                 ó„  — 	 ddl m } 	 t        j                  |«      }|j	                  «         ||j
                  «      j                  «       }t        j                  dd|«      }|S # t        $ r t        d«      ‚w xY w# t        $ r}dt        |«      › �cY d }~S d }~wt        $ r}dt        |«      › �cY d }~S d }~ww xY w)Nr   )ÚmarkdownifyzdYou must install package `markdownify` to run this tool: for instance run `pip install markdownify`.z\n{3,}z

zError fetching the webpage: zAn unexpected error occurred: )r*   r   ÚrequestsÚgetÚraise_for_statusr   ÚstripÚreÚsubr   r"   Ú	Exception)r   r(   r*   ÚresponseÚmarkdown_contentÚes         r   r   zVisitWebpageTool.forward6   s¼   € ð	Ý/ð
	=ä—|‘| CÓ(ˆHØ×%Ñ%Ô'ñ  +¨8¯=©=Ó9×?Ñ?ÓAÐô  "Ÿv™v i°Ð9IÓJÐà#Ð#øô ò 	ÜØvóð ð	ûô"  ò 	;Ø1´#°a³&°Ð:Õ:ûÜò 	=Ø3´C¸³F°8Ð<Õ<ûð	=ús;   ‚A' ‰AA? Á'A<Á?	B?ÂBÂB?ÂB?Â'B:Â4B?Â:B?Nr   r#   r$   r   r&   r&   +   s;   „ Ø€DØc€KàØØ=ñ
ð€Fð €Kð=˜3ð = 3ô =r$   r&   )r/   r+   Úrequests.exceptionsr   Útoolsr   r   r&   r#   r$   r   ú<module>r7      s+   ðó" 
ã Ý 0å ô˜4ô ô$"=�tõ "=r$   