Ë
    S^(hÎ  ã            
       ó  — d dl Z d dlZd dlZd dlZd dlmZmZmZmZm	Z	m
Z
mZ d dlmZ ddlmZ ddlmZ ddlmZ dd	lmZmZ dd
lmZmZmZ ddlmZmZ ddlmZ ddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* ddl+m,Z,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2  e«       rd dl3m4Z4 d dl5m6Z6 d dl7m8Z8  G d„ dejr                  «      Z: ejv                  e<«      Z=de=_>         ej~                  «       Z@e@jƒ                   e:«       «       e=j…                  e@«       deCdeeCeCf   fd„ZDdeCdeCfd„ZEdeCde
eCeeCeCf   f   fd„ZFdeCde
eCeeCeeCeCf   f   f   fd„ZGdeeeeCeCf      eeCeCf   eCf   deCfd„ZHi aIdaJ G d „ d!«      ZK G d"„ d#eL«      ZM G d$„ d%eM«      ZN G d&„ d'eM«      ZO G d(„ d)eM«      ZP G d*„ d+eM«      ZQd,eKd-eCd.eCdeCfd/„ZRd0eSfd1„ZTdBdeCfd2„ZUd-eCd3eeC   deCfd4„ZV G d5„ d6«      ZW G d7„ d8eW«      ZX G d9„ d:eW«      ZY G d;„ d<eY«      ZZ G d=„ d>eY«      Z[d?Z\ G d@„ dA«      Z]y)Cé    N)ÚAnyÚCallableÚDictÚListÚOptionalÚTupleÚUnion)Ú_deprecate_methodé   )Úis_torch_available)Úlogging)Úis_pygments_availableé   )Ú
AgentAudioÚ
AgentImage)ÚBASE_PYTHON_TOOLSÚFinalAnswerToolÚsetup_default_tools)ÚHfApiEngineÚMessageRole)ÚMonitor)
ÚDEFAULT_CODE_SYSTEM_PROMPTÚ DEFAULT_REACT_CODE_SYSTEM_PROMPTÚ DEFAULT_REACT_JSON_SYSTEM_PROMPTÚ PLAN_UPDATE_FINAL_PLAN_REDACTIONÚPROMPTS_FOR_INITIAL_PLANÚPROMPTS_FOR_PLAN_UPDATEÚSUPPORTED_PLAN_TYPESÚSYSTEM_PROMPT_FACTSÚSYSTEM_PROMPT_FACTS_UPDATEÚUSER_PROMPT_FACTS_UPDATE)ÚLIST_SAFE_MODULESÚevaluate_python_code)Ú!DEFAULT_TOOL_DESCRIPTION_TEMPLATEÚToolÚget_tool_description_with_argsÚ	load_tool)Ú	highlight)ÚTerminal256Formatter)ÚPythonLexerc                   óJ  — e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZej                  eez   ez   ej                   eej"                  eez   ez   ej$                  eez   ez   ej&                  eez   ez   deez   ez   deez   ez   deez   ez   de	ez   ez   de
ez   ez   deez   ez   iZd„ Zy)ÚCustomFormatterz[38;20mz[33;1mz[31;20mz[32;20mz
[32;20;1mz[31;1mz[37;1mz[38;5;214mz[38;5;214;1mz[0mz%(message)sé   é    é!   é"   é#   é$   c                 ó˜   — | j                   j                  |j                  «      }t        j                  |«      }|j                  |«      S ©N)ÚFORMATSÚgetÚlevelnor   Ú	FormatterÚformat)ÚselfÚrecordÚlog_fmtÚ	formatters       úX/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/agents/agents.pyr9   zCustomFormatter.formatV   s;   € Ø—,‘,×"Ñ" 6§>¡>Ó2ˆÜ×%Ñ% gÓ.ˆ	Ø×Ñ Ó'Ð'ó    N)Ú__name__Ú
__module__Ú__qualname__ÚgreyÚbold_yellowÚredÚgreenÚ
bold_greenÚbold_redÚ
bold_whiteÚorangeÚbold_orangeÚresetr9   r   ÚDEBUGÚINFOÚWARNINGÚERRORÚCRITICALr5   © r?   r>   r,   r,   ;   só   „ Ø€DØ€KØ
€CØ€EØ €JØ€HØ€JØ€FØ$€KØ€EØ€Fð 	�‰�t˜f‘} uÑ,Ø�‰�fØ�‰˜ vÑ-°Ñ5Ø�‰�s˜V‘| eÑ+Ø×Ñ˜( VÑ+¨eÑ3Ø
ˆE�F‰N˜UÑ"Ø
ˆE�F‰N˜UÑ"Ø
ˆJ˜Ñ %Ñ'Ø
ˆJ˜Ñ %Ñ'Ø
ˆF�V‰O˜eÑ#Ø
ˆK˜&Ñ  5Ñ(ð€Gó(r?   r,   FÚ	json_blobÚreturnc                 óþ  — 	 | j                  d«      }t        t        j                  d| «      «      D �cg c]  }|j	                  «       ‘Œ c}d   }| ||dz    j                  dd«      } t        j                  | d¬«      }|S c c}w # t        j                  $ rH}|j                  }| |dz
  |d	z    d
k(  rt        d«      ‚t        d|› d| › d| |dz
  |dz    › d�«      ‚d }~wt        $ r}t        d|› �«      ‚d }~ww xY w)Nú{ú}éÿÿÿÿr   z\"ú'F)Ústrictr   z},
zmJSON is invalid: you probably tried to provide multiple tool calls in one action. PROVIDE ONLY ONE TOOL CALL.z>The JSON blob you used is invalid due to the following error: z.
JSON blob was: z6, decoding failed on that specific part of the blob:
'é   é   ú'.z Error in parsing the JSON blob: )ÚfindÚlistÚreÚfinditerÚstartÚreplaceÚjsonÚloadsÚJSONDecodeErrorÚposÚ
ValueErrorÚ	Exception)rS   Úfirst_accolade_indexÚaÚlast_accolade_indexÚ	json_dataÚeÚplaces          r>   Úparse_json_blobrp   c   s,  € ðAØ(Ÿ~™~¨cÓ2ÐÜ26´r·{±{À3È	Ó7RÓ2SÖT¨Q˜qŸw™w�yÒTÐUWÑXÐØÐ2Ð5HÈ1Ñ5LÐM×UÑUÐV[Ð]`Óaˆ	Ü—J‘J˜y°Ô7ˆ	ØÐùò Uøô ×Ñò 

Ø—‘ˆØ�U˜Q‘Y ¨¡Ð+¨vÒ5ÜØóð ô ØLÈQÈCð PØ'˜[ð )Ø˜% !™) e¨a¡iÐ0Ð1°ð5ó
ð 	
ûô
 ò AÜÐ;¸A¸3Ð?Ó@Ð@ûðAús5   ‚2B ´BÁ6B ÂB ÂC<ÂACÃC<Ã)C7Ã7C<Ú	code_blobc                 óÖ   — 	 d}t        j                  || t         j                  «      }|j                  d«      j	                  «       S # t
        $ r}t        d|› d› d�«      ‚d }~ww xY w)Nz```(?:py|python)?\n(.*?)\n```r   z@
The code blob you used is invalid: due to the following error: z#
This means that the regex pattern z¡ was not respected: make sure to include code with the correct pattern, for instance:
Thoughts: Your thoughts
Code:
```py
# Your python code here
```<end_action>)r`   ÚsearchÚDOTALLÚgroupÚstripri   rh   )rq   ÚpatternÚmatchrn   s       r>   Úparse_code_blobry   y   sv   € ð
Ø2ˆÜ—	‘	˜' 9¬b¯i©iÓ8ˆØ�{‰{˜1‹~×#Ñ#Ó%Ð%øÜò 

Üð@Ø@A¸sð C#Ø#* )ð ,ðó	
ð 		
ûð

ús   ‚AA Á	A(ÁA#Á#A(c                 óè   — | j                  dd«      j                  dd«      } t        | «      }d|v rd|v r
|d   |d   fS d|v r|d   d fS t        ddD �cg c]	  }||vsŒ|‘Œ c}› d|› �«      ‚c c}w )	Nz```jsonÚ z```ÚactionÚaction_inputzMissing keys: )r|   r}   z	 in blob )rc   rp   rh   )rS   Ú	tool_callÚkeys      r>   Úparse_json_tool_callr€   ‹   sŸ   € Ø×!Ñ! )¨RÓ0×8Ñ8¸ÀÓC€IÜ 	Ó*€IØ�9Ñ °9Ñ!<Ø˜Ñ" I¨nÑ$=Ð=Ð=Ø	�YÑ	Ø˜Ñ" DÐ(Ð(äØÐ-GÖ` cÈ3ÐV_ÒK_šcÒ`ÐaÐajÐktÐjuÐvó
ð 	
ùÚ`s   Á	A/
ÁA/
Útextc                 ó�  — 	 d| v r| j                  d«      d   } d| v r| j                  d«      d   } | j                  d«      \  }}d|v rt        |«      }n |j                  «       j                  dd«      }|j                  «       j                  dd«      j                  d	d«      |fS # t        $ r}t        d
|› d�«      ‚d}~ww xY w)z�
    Expects a text in the format: 'Action:', 'Action input:', 'Observation:'. 'Action input:' contains a json string with input arguments.
    úObservation:r   úAction:r   zAction input:rV   ú"r{   ú\z%Error in parsing the text tool call: zY. Be sure to provide the correct format. DO NOT repeat your previous incorrect tool call.N)Úsplitrp   rv   rc   ri   rh   )r�   Ú	tool_nameÚ
tool_inputrn   s       r>   Úparse_text_tool_callrŠ   ˜   sÙ   € ð
Ø˜TÑ!Ø—:‘:˜nÓ-¨aÑ0ˆDØ˜ÑØ—:‘:˜iÓ(¨Ñ+ˆDØ $§
¡
¨?Ó ;Ñˆ	�:Ø�*ÑÜ(¨Ó4‰Jà#×)Ñ)Ó+×3Ñ3°C¸Ó<ˆJØ�‰Ó ×(Ñ(¨¨bÓ1×9Ñ9¸$ÀÓCÀZÐOÐOøÜò 
ÜØ3°A°3ð  7Pð  Qó
ð 	
ûð
ús   ‚B%B( Â(	CÂ1C Ã CÚinputc                 óž   — t        | t        «      r"dj                  | D �cg c]  }|d   ‘Œ	 c}«      S t        | t        «      r| d   S | S c c}w )Nú
Úcontent)Ú
isinstancer_   ÚjoinÚdict)r‹   Úms     r>   Úto_textr“   ­   sI   € Ü�%œÔØ�y‰y°Ö6¨1˜!˜I›,Ò6Ó7Ð7Ü	�Eœ4Ô	 Ø�YÑÐàˆùò	 7s    A
c                   ó¤   — e Zd ZdZddee   defd„Zddefd„Ze	de
eef   fd„«       Zdd
ee   defd„Zdefd„Zdefd„Zdefd„Zd„ Zd„ Zd„ Zy	)ÚToolboxa”  
    The toolbox contains all tools that the agent can perform operations with, as well as a few methods to
    manage them.

    Args:
        tools (`List[Tool]`):
            The list of tools to instantiate the toolbox with
        add_base_tools (`bool`, defaults to `False`, *optional*, defaults to `False`):
            Whether to add the tools available within `transformers` to the toolbox.
    ÚtoolsÚadd_base_toolsc                 ó’   — |D �ci c]  }|j                   |“Œ c}| _        |r| j                  «        | j                  «        y c c}w r4   )ÚnameÚ_toolsr—   Ú_load_tools_if_needed)r:   r–   r—   Útools       r>   Ú__init__zToolbox.__init__Æ   s<   € Ø38Ö9¨4�t—y‘y $‘Ò9ˆŒÙØ×ÑÔ!Ø×"Ñ"Õ$ùò :s   …AÚadd_python_interpreterc                 óÊ   — t         st        t        «      ada t        j	                  «       D ]%  }|j
                  dk7  s|sŒ| j                  |«       Œ' | j                  «        y )NTÚpython_interpreter)Ú_tools_are_initializedr   ÚloggerÚHUGGINGFACE_DEFAULT_TOOLSÚvaluesr™   Úadd_toolr›   )r:   rž   rœ   s      r>   r—   zToolbox.add_base_toolsÌ   sZ   € õ &Ü(;¼FÓ(CÐ%Ø%)Ð"Ü-×4Ñ4Ó6ò 	$ˆDØ�y‰yÐ0Ò0Ò4JØ—‘˜dÕ#ð	$ð 	×"Ñ"Õ$r?   rT   c                 ó   — | j                   S )z&Get all tools currently in the toolbox©rš   ©r:   s    r>   r–   zToolbox.tools×   s   € ð �{‰{Ðr?   NÚtool_description_templatec           	      óŽ   — dj                  | j                  j                  «       D �cg c]  }t        ||«      ‘Œ c}«      S c c}w )zþ
        Returns the description of all tools in the toolbox

        Args:
            tool_description_template (`str`, *optional*):
                The template to use to describe the tools. If not provided, the default template will be used.
        r�   )r�   rš   r¤   r&   )r:   r©   rœ   s      r>   Úshow_tool_descriptionszToolbox.show_tool_descriptionsÜ   s?   € ð �y‰yØY]×YdÑYd×YkÑYkÓYmÖnÐQUÔ+¨DÐ2KÕLÒnó
ð 	
ùÚns   ¨Arœ   c                 ó˜   — |j                   | j                  v rt        d|j                   › d�«      ‚|| j                  |j                   <   y)z†
        Adds a tool to the toolbox

        Args:
            tool (`Tool`):
                The tool to add to the toolbox.
        zError: tool 'z ' already exists in the toolbox.N)r™   rš   ÚKeyError©r:   rœ   s     r>   r¥   zToolbox.add_toolè   s?   € ð �9‰9˜Ÿ™Ñ#Ü˜]¨4¯9©9¨+Ð5UÐVÓWÐWØ!%ˆ�‰�D—I‘IÒr?   rˆ   c           	      ó    — || j                   vr3t        d|› dt        | j                   j                  «       «      › d�«      ‚| j                   |= y)z”
        Removes a tool from the toolbox

        Args:
            tool_name (`str`):
                The tool to remove from the toolbox.
        úError: tool z< not found in toolbox for removal, should be instead one of ú.N)rš   r­   r_   Úkeys)r:   rˆ   s     r>   Úremove_toolzToolbox.remove_toolô   s]   € ð ˜DŸK™KÑ'ÜØ˜y˜kÐ)eÔfjÐko×kvÑkv×k{Ñk{Ók}Óf~Ðeð  @Að  Bóð ð �K‰K˜	Ñ"r?   c           	      óà   — |j                   | j                  vr=t        d|j                   › dt        | j                  j	                  «       «      › d�«      ‚|| j                  |j                   <   y)z£
        Updates a tool in the toolbox according to its name.

        Args:
            tool (`Tool`):
                The tool to update to the toolbox.
        r°   z; not found in toolbox for update, should be instead one of r±   N)r™   rš   r­   r_   r²   r®   s     r>   Úupdate_toolzToolbox.update_tool  sg   € ð �9‰9˜DŸK™KÑ'ÜØ˜tŸy™y˜kÐ)dÔeiÐjn×juÑju×jzÑjzÓj|Óe}Ðd~Ð~ð  Aóð ð "&ˆ�‰�D—I‘IÒr?   c                 ó   — i | _         y)zClears the toolboxNr§   r¨   s    r>   Úclear_toolboxzToolbox.clear_toolbox  s	   € àˆ�r?   c                 óâ   — | j                   j                  «       D ]R  \  }}t        |t        «      rŒ|j                  €|j
                  n|j                  }t        |«      | j                   |<   ŒT y r4   )rš   Úitemsr�   r%   Úrepo_idÚtaskr'   )r:   r™   rœ   Útask_or_repo_ids       r>   r›   zToolbox._load_tools_if_needed  sW   € ØŸ+™+×+Ñ+Ó-ò 	?‰JˆD�$Ü˜d¤DÕ)Ø/3¯|©|Ð/C $§)¢)ÈÏÉ�Ü$-¨oÓ$>�—‘˜DÒ!ñ	?r?   c                 óˆ   — d}| j                   j                  «       D ]"  }|d|j                  › d|j                  › d�z  }Œ$ |S )NzToolbox contents:
ú	ú: r�   )rš   r¤   r™   Údescription)r:   Útoolbox_descriptionrœ   s      r>   Ú__repr__zToolbox.__repr__  sQ   € Ø3ÐØ—K‘K×&Ñ&Ó(ò 	JˆDØ R¨¯	©	 {°"°T×5EÑ5EÐ4FÀbÐ#IÑIÑð	Jà"Ð"r?   ©Fr4   )r@   rA   rB   Ú__doc__r   r%   Úboolr�   r—   Úpropertyr   Ústrr–   r   r«   r¥   r³   rµ   r·   r›   rÂ   rR   r?   r>   r•   r•   º   s˜   „ ñ	ñ%˜d 4™jð %¸$ó %ñ	%°Tó 	%ð ð�t˜C ˜I‘ò ó ðñ

ÀÈÁð 

ÐY\ó 

ð
&˜Tó 
&ð# Só #ð& ó &òò?ó#r?   r•   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )Ú
AgentErrorz-Base class for other agent-related exceptionsc                 ó2   •— t         ‰| �  |«       || _        y r4   )Úsuperr�   Úmessage)r:   rÌ   Ú	__class__s     €r>   r�   zAgentError.__init__$  s   ø€ Ü‰Ñ˜Ô!Øˆ�r?   )r@   rA   rB   rÄ   r�   Ú__classcell__©rÍ   s   @r>   rÉ   rÉ   !  s   ø„ Ù7÷ð r?   rÉ   c                   ó   — e Zd ZdZy)ÚAgentParsingErrorz3Exception raised for errors in parsing in the agentN©r@   rA   rB   rÄ   rR   r?   r>   rÑ   rÑ   )  s   „ Ù=àr?   rÑ   c                   ó   — e Zd ZdZy)ÚAgentExecutionErrorú5Exception raised for errors in execution in the agentNrÒ   rR   r?   r>   rÔ   rÔ   /  ó   „ Ù?àr?   rÔ   c                   ó   — e Zd ZdZy)ÚAgentMaxIterationsErrorrÕ   NrÒ   rR   r?   r>   rØ   rØ   5  rÖ   r?   rØ   c                   ó   — e Zd ZdZy)ÚAgentGenerationErrorz6Exception raised for errors in generation in the agentNrÒ   rR   r?   r>   rÚ   rÚ   ;  s   „ Ù@àr?   rÚ   ÚtoolboxÚprompt_templater©   c                 óö   — | j                  |«      }|j                  d|«      }d|v rL| j                  j                  «       D �cg c]  }d|› d�‘Œ
 }}|j                  ddj	                  |«      «      }|S c c}w )Nz<<tool_descriptions>>z<<tool_names>>rY   z, )r«   rc   r–   r²   r�   )rÛ   rÜ   r©   Útool_descriptionsÚpromptrˆ   Ú
tool_namess          r>   Úformat_prompt_with_toolsrá   A  s~   € Ø×6Ñ6Ð7PÓQÐØ×$Ñ$Ð%<Ð>OÓP€Fà˜6Ñ!Ø8?¿¹×8JÑ8JÓ8LÖM¨9˜˜)˜ AÒ&ÐMˆ
ÐMØ—‘Ð 0°$·)±)¸JÓ2GÓHˆà€Mùò Ns   ÁA6Úmanaged_agentsc                 ór   — d}| j                  «       D ]!  }|d|j                  › d|j                  › �z  }Œ# |S )Na_  
You can also give requests to team members.
Calling a team member works the same as for calling a tool: simply, the only argument you can give in the call is 'request', a long string explaining your request.
Given that this team member is a real human, you should be very verbose in your request.
Here is a list of the team members that you can call:z
- r¿   )r¤   r™   rÀ   )râ   Úmanaged_agents_descriptionsÚagents      r>   Úshow_agents_descriptionsræ   L  sO   € ð#9Ðð
  ×&Ñ&Ó(ò PˆØ#¨¨e¯j©j¨\¸¸E×<MÑ<MÐ;NÐ'OÑOÑ#ðPà&Ð&r?   c                 ó`   — |�| j                  dt        |«      «      S | j                  dd«      S )Nz<<managed_agents_descriptions>>r{   )rc   ræ   )rÜ   râ   s     r>   Ú.format_prompt_with_managed_agents_descriptionsrè   W  s7   € ØÐ!Ø×&Ñ&Ð'HÔJbÐcqÓJrÓsÐsà×&Ñ&Ð'HÈ"ÓMÐMr?   Úauthorized_importsc                 óV   — d| vrt        d«      ‚| j                  dt        |«      «      S )Nú<<authorized_imports>>z>Tag '<<authorized_imports>>' should be provided in the prompt.)rÉ   rc   rÇ   )rÜ   ré   s     r>   Úformat_prompt_with_importsrì   ^  s0   € Ø Ñ6ÜÐYÓZÐZØ×"Ñ"Ð#;¼SÐASÓ=TÓUÐUr?   c                   ó<  — e Zd Zdddi ddddddddfdeee   ef   dedee	   d	ee	   d
e
dedee   dededee
e	e	f      dee   deee      defd„Zedefd„«       Zd„ Zd$dee   dee
e	e	f      fd„Zd„ Zde	de	de	fd„Zde	de
e	e	f   defd„Zd e	d!e	ddfd"„Zd#„ Zy)%ÚAgentNé   Fr   Tr–   Ú
llm_engineÚsystem_promptr©   Úadditional_argsÚmax_iterationsÚtool_parserr—   ÚverboseÚgrammarrâ   Ústep_callbacksÚmonitor_metricsc                 óä  — |€t         }|€t        }| j                  j                  | _        || _        || _        |r|nt        | _        || _	        || _
        t        | _        || _        |
| _        d | _        |� |D �ci c]  }|j                  |“Œ c}| _        t!        |t"        «      rL|| _        |rUt'        «       st)        d«      ‚| j$                  j+                  | j                  t,        k(  ¬«       nt#        ||¬«      | _        | j$                  j/                  t1        «       «       t3        | j$                  | j                  | j                  «      | _        t7        | j4                  | j                  «      | _        d | _        g | _        d | _        |	dk(  r$t        j?                  t@        jB                  «       nQ|	dk(  r$t        j?                  t@        jD                  «       n(|	dk(  r#t        j?                  t@        jF                  «       |�|ng | _$        d | _%        |rJtM        | j
                  «      | _%        | jH                  jO                  | jJ                  jP                  «       y y c c}w )Nz4Using the base tools requires torch to be installed.)rž   )r—   r   r   r   ))r   r€   rÍ   r@   Ú
agent_namerð   Úsystem_prompt_templater$   r©   rò   ró   r¢   rô   rö   râ   r™   r�   r•   Ú_toolboxr   ÚImportErrorr—   ÚReactJsonAgentr¥   r   rá   rñ   rè   rß   Úlogsr»   ÚsetLevelr   rO   rN   rM   r÷   Úmonitorr   ÚappendÚupdate_metrics)r:   r–   rð   rñ   r©   rò   ró   rô   r—   rõ   rö   râ   r÷   rø   rå   s                  r>   r�   zAgent.__init__e  sú  € ð  Ð Ü<ˆMØÐÜ.ˆKØŸ.™.×1Ñ1ˆŒØ$ˆŒØ&3ˆÔ#á)BÑ%ÔHið 	Ô&ð  /ˆÔØ,ˆÔÜˆŒØ&ˆÔØˆŒà"ˆÔØÐ%ØBPÖ"Q¸ 5§:¡:¨uÑ#4Ò"QˆDÔä�eœWÔ%Ø!ˆDŒMÙÜ)Ô+Ü%Ð&\Ó]Ð]à—‘×,Ñ,ÀTÇ^Á^ÔWeÑEeÐ,Õgä# E¸.ÔIˆDŒMØ�‰×ÑœÓ0Ô1ä5Ø�M‰M˜4×6Ñ6¸×8VÑ8Vó
ˆÔô LÈD×L^ÑL^Ð`d×`sÑ`sÓtˆÔØˆŒØˆŒ	ØˆŒ	à�aŠ<Ü�O‰OœGŸO™OÕ,Ø˜Š\Ü�O‰OœGŸL™LÕ)Ø˜Š\Ü�O‰OœGŸM™MÔ*ð 1?Ð0J™nÐPRˆÔð ˆŒÙÜ" 4§?¡?Ó3ˆDŒLØ×Ñ×&Ñ& t§|¡|×'BÑ'BÕCð ùòC #Rs   Á=I-rT   c                 ó   — | j                   S )z0Get the toolbox currently available to the agent)rü   r¨   s    r>   rÛ   zAgent.toolbox¬  s   € ð �}‰}Ðr?   c           	      ó¤  — d| _         t        | j                  | j                  | j                  «      | _        t        | j
                  | j                  «      | _        t        | d«      rGt        | j
                  t        t        t        «      t        | j                  «      z  «      «      | _        | j
                  | j                  dœg| _        | j                   j#                  dd«       | j                   j#                  d| j                  «       | j                   j%                  d«       | j                   j%                  | j
                  «       y )Nr   ré   )rñ   r»   r/   z======== New task ========r0   zSystem prompt is as follows:)Útoken_countrá   rü   rû   r©   rñ   rè   râ   Úhasattrrì   r_   Úsetr"   ré   r»   rÿ   r¢   ÚlogÚdebugr¨   s    r>   Úinitialize_for_runzAgent.initialize_for_run±  sü   € ØˆÔÜ5Ø�M‰MØ×'Ñ'Ø×*Ñ*ó
ˆÔô
 LÈD×L^ÑL^Ð`d×`sÑ`sÓtˆÔÜ�4Ð-Ô.Ü!;Ø×"Ñ"¤D¬Ô->Ó)?Ä#Àd×F]ÑF]ÓB^Ñ)^Ó$_ó"ˆDÔð (,×'9Ñ'9À4Ç9Á9ÑMÐNˆŒ	Ø�‰�‰˜Ð8Ô9Ø�‰�‰˜˜DŸI™IÔ&Ø�‰×ÑÐ8Ô9Ø�‰×Ñ˜$×,Ñ,Õ-r?   Úsummary_modec                 ó   — t         j                  | j                  d   d   dœ}t         j                  d| j                  d   d   z   dœ}|r|g}n||g}t	        | j                  dd «      D �]Ž  \  }}d|v r7|s5t         j
                  |d   j                  «       dœ}|j                  |«       d	|v r8t         j
                  d
|d	   j                  «       z   dœ}|j                  |«       d|v r:|s8t         j
                  d|d   j                  «       z   dœ}|j                  |«       d|v rG|rEt         j
                  d|› d�t        |d   «      j                  «       z   dœ}|j                  |«       d|v r*t         j                  d|d   z   dœ}|j                  |«       d|v sd|v s�Œ?d|v rd|› d�t        |d   «      z   dz   }	nd|v rd|› d|d   › �}	t         j                  	dœ}
|j                  |
«       �Œ‘ |S )z£
        Reads past llm_outputs, actions, and observations or errors from the logs into a series of messages
        that can be used as input to the LLM.
        r   rñ   ©ÚrolerŽ   úTask: r»   r   NÚ
llm_outputÚfactsz[FACTS LIST]:
Úplanz[PLAN]:
r~   z[STEP z TOOL CALL]: z
New task:
ÚerrorÚobservationz[OUTPUT OF STEP z] -> Error:
zƒ
Now let's retry: take care not to repeat previous errors! If you have retried several times, try a completely different approach.
z] -> Observation:
)
r   ÚSYSTEMrÿ   ÚUSERÚ	enumerateÚ	ASSISTANTrv   r  rÇ   ÚTOOL_RESPONSE)r:   r  Úprompt_messageÚtask_messageÚmemoryÚiÚstep_logÚthought_messageÚtool_call_messageÚmessage_contentÚtool_response_messages              r>   Úwrite_inner_memory_from_logsz"Agent.write_inner_memory_from_logsÃ  s?  € ô
 #.×"4Ñ"4ÀÇÁÈ1ÁÈoÑA^Ñ_ˆä×$Ñ$Ø $§)¡)¨A¡,¨vÑ"6Ñ6ñ
ˆñ Ø"�^‰Fà$ lÐ3ˆFÜ$ T§Y¡Y¨q¨r ]Ó3ó '	5‰KˆAˆxØ˜xÑ'±Ü+6×+@Ñ+@ÈXÐVbÑMc×MiÑMiÓMkÑ"l�Ø—‘˜oÔ.Ø˜(Ñ"ä'×1Ñ1Ø0°8¸GÑ3D×3JÑ3JÓ3LÑLñ#�ð —‘˜oÔ.à˜Ñ!©,Ü+6×+@Ñ+@È[Ð[cÐdjÑ[k×[qÑ[qÓ[sÑMsÑ"t�Ø—‘˜oÔ.à˜hÑ&©<ä'×1Ñ1Ø!'¨ s¨-Ð8¼3¸xÈÑ?TÓ;U×;[Ñ;[Ó;]Ñ]ñ%Ð!ð —‘Ð/Ô0à˜Ñ!ä'×,Ñ,Ø,¨x¸Ñ/?Ñ?ñ%Ð!ð —‘Ð/Ô0à˜(Ñ" m°xÓ&?Ø˜hÑ&à*¨1¨#¨]Ð;Ü˜h wÑ/Ó0ñ1ð bñbñ $ð
 # hÑ.Ø(8¸¸Ð;NÈxÐXeÑOfÐNgÐ&h�OÜ1<×1JÑ1JÐWfÑ(gÐ%Ø—‘Ð3Ö4ðO'	5ðR ˆr?   c                 ó¨   — | j                   D ���cg c],  }|j                  «       D ��ci c]  \  }}|dk7  sŒ||“Œ c}}‘Œ. c}}}S c c}}w c c}}}w )NÚagent_memory)rÿ   r¹   )r:   r	  r   Úvalues       r>   Úget_succinct_logszAgent.get_succinct_logsü  sC   € Ø_c×_hÑ_h×iÐiÐX[¨c¯i©i«k×S¡
  U¸SÀNÓ=R��e‘ÕSÔiÐiùÓSùÔis   ‘A©A·A¼AÁAr  Úsplit_tokenc           
      ó   — 	 |j                  |«      }|d   |d   }}|j                  «       |j                  «       fS # t        $ r7}| j                  j                  |d¬«       t	        d|› d|› d|› d�«      ‚d	}~ww xY w)
zÝ
        Parse action from the LLM output

        Args:
            llm_output (`str`): Output of the LLM
            split_token (`str`): Separator for the action. Should match the example in the system prompt.
        éþÿÿÿrX   r   ©Úexc_infozError: No 'z.' token provided in your output.
Your output:
z0
. Be sure to include an action, prefaced with 'z'!N)r‡   ri   r¢   r  rÑ   rv   )r:   r  r)  r‡   Ú	rationaler|   rn   s          r>   Úextract_actionzAgent.extract_actionÿ  s®   € ð
	Ø×$Ñ$ [Ó1ˆEà�b‘	Ø�b‘	ð ˆIð �‰Ó  &§,¡,£.Ð0Ð0øô ò 	Ø�K‰K×Ñ˜a¨!ÐÔ,Ü#Ø˜k˜]Ð*ZÐ[eÐZfð  gXð  Ydð  Xeð  egð  hóð ûð	ús   ‚= ½	A=Á2A8Á8A=rˆ   Ú	argumentsc           
      ó  — | j                   j                  }| j                  �i |¥| j                  ¥}||vrHd|› dt        |j	                  «       «      › d�}| j
                  j                  |d¬«       t        |«      ‚	 t        |t        «      r ||   |«      }|S t        |t        «      rW|j                  «       D ]7  \  }}t        |t        «      sŒ|| j                  v sŒ&| j                  |   ||<   Œ9  ||   di |¤Ž}|S t        dt        |«      › d�«      ‚# t        $ ra}|| j                   j                  v rt        d|› d	t        ||   «      › �«      ‚|| j                  v rt        d
|› d||   › �«      ‚Y d}~yd}~ww xY w)ap  
        Execute tool with the provided input and returns the result.
        This method replaces arguments with the actual values from the state if they refer to state variables.

        Args:
            tool_name (`str`): Name of the Tool to execute (should be one from self.toolbox).
            arguments (Dict[str, str]): Arguments passed to the Tool.
        NzError: unknown tool z, should be instead one of r±   r   r,  z;Arguments passed to tool should be a dict or string: got a zError in tool call execution: zn
You should only use this tool with a correct input.
As a reminder, this tool's description is the following:
zError in calling team member: z~
You should only ask this team member with a correct request.
As a reminder, this team member's description is the following:
rR   )rÛ   r–   râ   r_   r²   r¢   r  rÔ   r�   rÇ   r‘   r¹   ÚstateÚtyperi   r&   )	r:   rˆ   r0  Úavailable_toolsÚ	error_msgr  r   r'  rn   s	            r>   Úexecute_tool_callzAgent.execute_tool_call  sã  € ð Ÿ,™,×,Ñ,ˆØ×ÑÐ*ØH ÐH°D×4GÑ4GÐHˆOØ˜OÑ+Ø.¨y¨kÐ9TÔUYÐZi×ZnÑZnÓZpÓUqÐTrÐrsÐtˆIØ�K‰K×Ñ˜i°!ÐÔ4Ü% iÓ0Ð0ð	Ü˜)¤SÔ)Ø8˜o¨iÑ8¸ÓC�ð Ðô ˜I¤tÔ,Ø"+§/¡/Ó"3ò ;‘J�C˜ä! %¬Õ-°%¸4¿:¹:Ò2EØ)-¯©°EÑ):˜	 #šð;ð 9˜o¨iÑ8ÑE¸9ÑE�ð
 Ðô *ØQÔRVÐW`ÓRaÐQbÐbcÐdóð øô ò 
	Ø˜DŸL™L×.Ñ.Ñ.Ü)Ø4°Q°Cð 8QÜQoÐpð  AJñ  qKó  RLð  QMðNóð ð ˜d×1Ñ1Ñ1Ü)Ø4°Q°Cð 8XØXgÐhqÑXrÐWsðuóð ô 2ûð
	ús1   Â D Â6D ÃD Ã# D ÄD Ä	FÄ%AFÆFr.  Úcode_actionc           
      ó¢  — | j                   j                  d«       | j                   j                  d|«       | j                   j                  d«       t        «       r<| j                   j                  dt	        |t        d¬«      t        d¬«      «      «       n| j                   j                  d|«       | j                   j                  d«       y )	Nú=== Agent thoughts:r-   z&>>> Agent is executing the code below:F)ÚensurenlÚnord)Ústylez====)r¢   Úwarningr	  r   r(   r*   r)   )r:   r.  r7  s      r>   Úlog_rationale_code_actionzAgent.log_rationale_code_action?  s�   € Ø�‰×ÑÐ1Ô2Ø�‰�‰˜˜IÔ&Ø�‰×ÑÐDÔEÜ Ô"Ø�K‰K�O‰OØ”I˜k¬;ÀÔ+FÔH\ÐciÔHjÓkõð �K‰K�O‰O˜B Ô,Ø�‰×Ñ˜FÕ#r?   c                 ó   — t         ‚)z$To be implemented in the child class)ÚNotImplementedError)r:   Úkwargss     r>   Úrunz	Agent.runK  s   € ä!Ð!r?   rÃ   )r@   rA   rB   r	   r   r%   r•   r   r   rÇ   r   ÚintrÅ   r�   rÆ   rÛ   r  r$  r(  r/  r   r6  r>  rB  rR   r?   r>   rî   rî   d  s¬  „ ð  $Ø'+Ø37Ø "ØØ*.Ø$ØØ,0Ø)-Ø37Ø $ñEDà�T˜$‘Z Ð(Ñ)ðEDð ðEDð   ‘}ð	EDð
 $,¨C¡=ðEDð ðEDð ðEDð ˜hÑ'ðEDð ðEDð ðEDð ˜$˜s C˜x™.Ñ)ðEDð ! ™ðEDð !  h¡Ñ0ðEDð óEDðN ð˜ò ó ðò.ñ$7¸À$¹ð 7ÐTXÐY]Ð^aÐcfÐ^fÑYgÑThó 7òrjð1¨ð 1¸3ð 1À3ó 1ð*)¨3ð )¸4ÀÀSÀ¹>ð )Ècó )ðV
$°3ð 
$ÀSð 
$ÈTó 
$ó"r?   rî   c                   óž   ‡ — e Zd ZdZ	 	 	 	 	 ddee   dee   dee   dee   dee	eef      deee      fˆ fd„Z
d	ed
efd„Zddedefd„Zˆ xZS )Ú	CodeAgentz�
    A class for an agent that solves the given task using a single block of code. It plans all its actions, then executes all in one shot.
    r–   rð   rñ   r©   rö   Úadditional_authorized_importsc           	      óª  •— |€
t        «       }|€t        }|€t        }t        ‰| �  d|||||dœ|¤Ž t        «       st        j                  t        d«       t        | _
        |r|ng | _        t        t        t        «      t        | j                  «      z  «      | _        | j                   j#                  dt%        | j                  «      «      | _        y )N©r–   rð   rñ   r©   rö   zepygments isn't installed. Installing pygments will enable color syntax highlighting in the CodeAgent.rë   rR   )r   r   r$   rË   r�   r   Útransformers_loggingÚwarning_oncer¢   r#   Úpython_evaluatorrF  r_   r  r"   ré   rñ   rc   rÇ   )	r:   r–   rð   rñ   r©   rö   rF  rA  rÍ   s	           €r>   r�   zCodeAgent.__init__U  sÖ   ø€ ð ÐÜ$›ˆJØÐ Ü6ˆMØ$Ð,Ü(IÐ%Ü‰Ñð 	
ØØ!Ø'Ø&?Øñ	
ð ò	
ô %Ô&Ü ×-Ñ-Üðôô !5ˆÔÙNkÑ-JÐqsˆÔ*Ü"&¤sÔ+<Ó'=ÄÀD×DfÑDfÓ@gÑ'gÓ"hˆÔØ!×/Ñ/×7Ñ7Ð8PÔRUÐVZ×VmÑVmÓRnÓoˆÕr?   ÚresultrT   c                 ó   — t        |«      S )zu
        Override this method if you want to change the way the code is
        cleaned in the `run` method.
        )ry   )r:   rL  s     r>   ry   zCodeAgent.parse_code_blobz  s   € ô
 ˜vÓ&Ð&r?   r»   Úreturn_generated_codec                 ó  — || _         t        |«      dkD  r"| xj                   dt        |«      › d�z  c_         |j                  «       | _        | j                  «        t        j                  | j                  dœ}t        j                  d| j                   z   dœ}||g| _
        | j                  j                  d«       | j                  j                  | j                  «       | j                  �d| j                  ini } | j                  | j                  fd	d
gi|¤Ž}|r|S 	 | j                  |d¬«      \  }}		 | j%                  |	«      }	| j)                  ||	«       	 i t+        j                  «       ¥| j,                  j.                  ¥}| j1                  |	|i | j                  | j2                  ¬«      }| j                  j                  | j                  d   «       |S # t         $ r,}
| j                  j#                  d|
› �«       d|}	}Y d}
~
ŒÕd}
~
ww xY w# t         $ r/}
d|
› d�}| j                  j'                  |d¬«       |cY d}
~
S d}
~
ww xY w# t         $ r/}
d|
› d�}| j                  j'                  |d¬«       |cY d}
~
S d}
~
ww xY w)aK  
        Runs the agent for the given task.

        Args:
            task (`str`): The task to perform
            return_generated_code (`bool`, *optional*, defaults to `False`): Whether to return the generated code instead of running it
            kwargs (additional keyword arguments, *optional*):
                Any keyword argument to send to the agent when evaluating the code.

        Example:

        ```py
        from transformers.agents import CodeAgent

        agent = CodeAgent(tools=[])
        agent.run("What is the result of 2 power 3.7384?")
        ```
        r   ú6
You have been provided with these initial arguments: r±   r  r  z"====Executing with this prompt====Nrö   Ústop_sequencesú<end_action>úCode:©r  r)  zSError in extracting action, trying to parse the whole output as code. Error trace: r{   úError in code parsing: z!. Be sure to provide correct coder   r,  ©Ústatic_toolsÚcustom_toolsr2  ré   Úprint_outputszError in execution: z". Be sure to provide correct code.)r»   ÚlenrÇ   Úcopyr2  r  r   r  rñ   r  rß   r¢   Úinforö   rð   r/  ri   r
  ry   r  r>  r   rÛ   r–   rK  ré   )r:   r»   rN  rA  r  r  rò   r  r.  r7  rn   r5  r4  Úoutputs                 r>   rB  zCodeAgent.run�  st  € ð& ˆŒ	Üˆv‹;˜Š?Ø�IŠIÐRÔSVÐW]ÓS^ÐR_Ð_`ÐaÑa�IØ—[‘[“]ˆŒ
Ø×ÑÔ!ô #.×"4Ñ"4À×ASÑASÑTˆä×$Ñ$Ø $§)¡)Ñ+ñ
ˆð
 & |Ð4ˆŒØ�‰×ÑÐ=Ô>Ø�‰×Ñ˜Ÿ™Ô%à7;·|±|Ð7O˜9 d§l¡lÑ3ÐUWˆØ$�T—_‘_ T§[¡[ÑeÀ.ÐAQÐeÐUdÑeˆ
á ØÐð	4Ø%)×%8Ñ%8ÀJÐ\cÐ%8Ó%dÑ"ˆI�{ð	Ø×.Ñ.¨{Ó;ˆKð 	×&Ñ& y°+Ô>ð	ØPÔ!2×!7Ñ!7Ó!9ÐP¸T¿\¹\×=OÑ=OÐPˆOØ×*Ñ*ØØ,ØØ—j‘jØ#'×#:Ñ#:ð +ó ˆFð �K‰K×Ñ˜TŸZ™Z¨Ñ8Ô9ØˆMøô3 ò 	4Ø�K‰K×ÑØeÐfgÐehÐiôð &(¨�{�Iûð		4ûô ò 	Ø1°!°Ð4UÐVˆIØ�K‰K×Ñ˜i°!ÐÔ4ØÕûð	ûô$ ò 	Ø.¨q¨cÐ1SÐTˆIØ�K‰K×Ñ˜i°!ÐÔ4ØÕûð	úsU   Ä$G Ä;H ÅA?I Ç	HÇ("HÈHÈ	IÈ $I
ÉIÉ
IÉ	J
É$JÉ?J
ÊJ
©NNNNNrÃ   )r@   rA   rB   rÄ   r   r%   r   r   rÇ   r   r�   ry   rÅ   rB  rÎ   rÏ   s   @r>   rE  rE  P  s°   ø„ ñð *.Ø'+Ø37Ø,0Ø=Añ#pà�D‰zð#pð ˜XÑ&ð#pð   ‘}ð	#pð
 $,¨C¡=ð#pð ˜$˜s C˜x™.Ñ)ð#pð (0°°S±	Ñ':õ#pðJ' cð '¨có 'ñJ˜ð J°D÷ Jr?   rE  c                   ó  ‡ — e Zd ZdZ edd¬«      	 	 	 	 	 	 ddee   dee   dee	   dee	   d	ee
e	e	f      d
ee	   dee   fˆ fd„«       Zde	fd„Z edd¬«      dde	dedefd„«       Zde	fd„Zde	fd„Zddedee   fd„Zˆ xZS )Ú
ReactAgentaC  
    This agent that solves the given task step by step, using the ReAct framework:
    While the objective is not reached, the agent will perform a cycle of thinking and acting.
    The action will be parsed from the LLM output: it consists in calls to tools from the toolbox, with arguments chosen by the LLM engine.
    ú4.51.0úzSwitch to smolagents instead, with the same functionalities and similar API (https://huggingface.co/docs/smolagents/index)©ÚversionrÌ   r–   rð   rñ   r©   rö   Ú	plan_typeÚplanning_intervalc           	      óÂ   •— |€
t        «       }|€t        }|€t        }|€
t        d   }n|t        v sJ d|› d�«       ‚t	        ‰	| �  d|||||dœ|¤Ž || _        || _        y )Nr   z
plan type z is not supportedrH  rR   )r   r   r$   r   rË   r�   rf  re  )
r:   r–   rð   rñ   r©   rö   re  rf  rA  rÍ   s
            €r>   r�   zReactAgent.__init__Õ  s“   ø€ ð ÐÜ$›ˆJØÐ Ü<ˆMØ$Ð,Ü(IÐ%ØÐÜ,¨QÑ/‰IàÔ 4Ñ4Ð_¸
À9À+ÐM^Ð6_Ó_Ð4Ü‰Ñð 	
ØØ!Ø'Ø&?Øñ	
ð ò	
ð "3ˆÔØ"ˆ�r?   rT   c                 óD  — t         j                  ddœg| _        | xj                  | j                  «       dd z  c_        | xj                  t         j                  d|› �dœgz  c_        	 | j                  | j                  «      S # t        $ r}d|› d�cY d}~S d}~ww xY w)zq
        This method provides a final answer to the task, based on the logs of the agent's interactions.
        z™An agent tried to answer an user query but it got stuck and failed to do so. You are tasked with providing an answer instead. Here is the agent's memory:r  r   NzLBased on the above, please provide an answer to the following user request:
z&Error in generating final llm output: r±   )r   r  rß   r$  r  rð   ri   )r:   r»   rn   s      r>   Úprovide_final_answerzReactAgent.provide_final_answerù  s¨   € ô $×*Ñ*ð wñð
ˆŒð 	�Š�t×8Ñ8Ó:¸1¸2Ð>Ñ>�Ø�Šä#×(Ñ(ØjÐkoÐjpÐqñð
ñ 	
�ð	AØ—?‘? 4§;¡;Ó/Ð/øÜò 	AØ;¸A¸3¸aÐ@Õ@ûð	Aús   Á+B Â	BÂBÂBÂBr»   ÚstreamrL   c                 óB  — || _         t        |«      dkD  r"| xj                   dt        |«      › d�z  c_         |j                  «       | _        |r| j                  «        n| j                  j                  d|i«       |r| j                  |«      S | j                  |«      S )a8  
        Runs the agent for the given task.

        Args:
            task (`str`): The task to perform

        Example:
        ```py
        from transformers.agents import ReactCodeAgent
        agent = ReactCodeAgent(tools=[])
        agent.run("What is the result of 2 power 3.7384?")
        ```
        r   rP  r±   r»   )
r»   rZ  rÇ   r[  r2  r  rÿ   r  Ú
stream_runÚ
direct_run)r:   r»   rj  rL   rA  s        r>   rB  zReactAgent.run  sŠ   € ð$ ˆŒ	Üˆv‹;˜Š?Ø�IŠIÐRÔSVÐW]ÓS^ÐR_Ð_`ÐaÑa�IØ—[‘[“]ˆŒ
ÙØ×#Ñ#Õ%à�I‰I×Ñ˜f d˜^Ô,ÙØ—?‘? 4Ó(Ð(à—?‘? 4Ó(Ð(r?   c              #   óÞ  K  — d}d}|€³|| j                   k  r¤t        j                  «       }||dœ}	 | j                  |«       d|v r|d   }t        j                  «       }||d<   ||z
  |d	<   | j                  j                  |«       | j                  D ]
  } ||«       Œ |dz  }|–— |€|| j                   k  rŒ¤|€Ž|| j                   k(  rd
}	dt        |	«      i}
| j                  j                  |
«       | j                  j                  |	d¬«       | j                  |«      }||
d<   d|
d	<   | j                  D ]
  } ||
«       Œ |
–— |–— y# t        $ r-}| j                  j                  |d¬«       ||d<   Y d}~�Œ6d}~ww xY w# t        j                  «       }||d<   ||z
  |d	<   | j                  j                  |«       | j                  D ]
  } ||«       Œ |dz  }|–— w xY w­w)z…
        Runs the agent in streaming mode, yielding steps as they are executed: should be launched only in the `run` method.
        Nr   ©Ú	iterationÚ
start_timeÚfinal_answerr   r,  r  Ústep_end_timeÚstep_durationúReached max iterations.)ró   ÚtimeÚsteprÉ   r¢   r  rÿ   r  r÷   rØ   ri  ©r:   r»   rr  rp  Ústep_start_timeÚstep_log_entryrn   rs  ÚcallbackÚerror_messageÚfinal_step_logs              r>   rl  zReactAgent.stream_run.  s  è ø€ ð ˆØˆ	ØÐ" y°4×3FÑ3FÒ'FÜ"Ÿi™i›kˆOØ+4ÀOÑTˆNð%Ø—	‘	˜.Ô)Ø! ^Ñ3Ø#1°.Ñ#A�Lô
 !%§	¡	£�Ø2?�˜Ñ/Ø2?À/Ñ2Q�˜Ñ/Ø—	‘	× Ñ  Ô0Ø $× 3Ñ 3ò -�HÙ˜^Õ,ð-à˜Q‘�	Ø$Ò$ð% Ð" y°4×3FÑ3FÓ'Fð( Ð I°×1DÑ1DÒ$DØ5ˆMØ%Ô'>¸}Ó'MÐNˆNØ�I‰I×Ñ˜^Ô,Ø�K‰K×Ñ˜m°aÐÔ8Ø×4Ñ4°TÓ:ˆLØ-9ˆN˜>Ñ*Ø./ˆN˜?Ñ+Ø ×/Ñ/ò )�Ù˜Õ(ð)à Ò àÓøô3 ò ,Ø—‘×!Ñ! !¨aÐ!Ô0Ø*+�˜w×'ûð,ûô !%§	¡	£�Ø2?�˜Ñ/Ø2?À/Ñ2Q�˜Ñ/Ø—	‘	× Ñ  Ô0Ø $× 3Ñ 3ò -�HÙ˜^Õ,ð-à˜Q‘�	Ø$Ó$üsC   ‚/G-²E ÁA/G-Â<BG-Å	FÅ"FÅ<F
 ÆFÆF
 Æ
A G*Ç*G-c                 ó"  — d}d}|€ä|| j                   k  rÕt        j                  «       }||dœ}	 | j                  �)|| j                  z  dk(  r| j                  ||dk(  |¬«       | j	                  |«       d|v r|d   }t        j                  «       }||d	<   ||z
  |d
<   | j                  j                  |«       | j                  D ]
  } ||«       Œ |dz  }|€|| j                   k  rŒÕ|€Š|| j                   k(  r{d}	dt        |	«      i}
| j                  j                  |
«       | j                  j                  |	d¬«       | j                  |«      }||
d<   d|
d
<   | j                  D ]
  } ||
«       Œ |S # t
        $ r-}| j                  j                  |d¬«       ||d<   Y d}~�Œ+d}~ww xY w# t        j                  «       }||d	<   ||z
  |d
<   | j                  j                  |«       | j                  D ]
  } ||«       Œ |dz  }w xY w)z€
        Runs the agent in direct mode, returning outputs only at the end: should be launched only in the `run` method.
        Nr   ro  )Úis_first_steprp  rr  r   r,  r  rs  rt  ru  )ró   rv  rf  Úplanning_steprw  rÉ   r¢   r  rÿ   r  r÷   rØ   ri  rx  s              r>   rm  zReactAgent.direct_runV  s3  € ð ˆØˆ	ØÐ" y°4×3FÑ3FÒ'FÜ"Ÿi™i›kˆOØ+4ÀOÑTˆNðØ×)Ñ)Ð5¸)Àd×F\ÑF\Ñ:\Ð`aÒ:aØ×&Ñ& t¸IÈ¹NÐW`Ð&ÔaØ—	‘	˜.Ô)Ø! ^Ñ3Ø#1°.Ñ#A�Lô
 !%§	¡	£�Ø2?�˜Ñ/Ø2?À/Ñ2Q�˜Ñ/Ø—	‘	× Ñ  Ô0Ø $× 3Ñ 3ò -�HÙ˜^Õ,ð-à˜Q‘�	ð' Ð" y°4×3FÑ3FÓ'Fð* Ð I°×1DÑ1DÒ$DØ5ˆMØ%Ô'>¸}Ó'MÐNˆNØ�I‰I×Ñ˜^Ô,Ø�K‰K×Ñ˜m°aÐÔ8Ø×4Ñ4°TÓ:ˆLØ-9ˆN˜>Ñ*Ø./ˆN˜?Ñ+Ø ×/Ñ/ò )�Ù˜Õ(ð)ð Ðøô/ ò ,Ø—‘×!Ñ! !¨aÐ!Ô0Ø*+�˜w×'ûð,ûô !%§	¡	£�Ø2?�˜Ñ/Ø2?À/Ñ2Q�˜Ñ/Ø—	‘	× Ñ  Ô0Ø $× 3Ñ 3ò -�HÙ˜^Õ,ð-à˜Q‘‘	ús+   °AE9 Å9	F/Æ"F*Æ$F2 Æ*F/Æ/F2 Æ2AHr  rp  c           	      ó:  — |�rmt         j                  t        dœ}t         j                  d|› d�dœ}| j	                  ||g«      }t         j                  t
        | j                     d   dœ}t         j                  t
        | j                     d   j                  || j                  j                  | j                  «      | j                  �t        | j                  «      nd|¬«      dœ}| j	                  ||gd	g¬
«      }	d|	› d�}
d|› d�j                  «       }| j                  j                  |
|dœ«       | j                   j#                  dd«       | j                   j#                  d|
«       y| j%                  d¬«      }t         j                  t&        dœ}t         j                  t(        dœ}| j	                  |g|z   |gz   «      }t         j                  t*        | j                     d   j                  |¬«      dœ}t         j                  t*        | j                     d   j                  || j                  j                  | j                  «      | j                  �t        | j                  «      nd|| j,                  |z
  ¬«      dœ}| j	                  |g|z   |gz   d	g¬
«      }t/        j                  ||¬«      }
d|› d�}| j                  j                  |
|dœ«       | j                   j#                  dd«       | j                   j#                  d|
«       y)ax  
        Used periodically by the agent to plan the next steps to reach the objective.

        Args:
            task (`str`): The task to perform
            is_first_step (`bool`): If this step is not the first one, the plan should be an update over a previous plan.
            iteration (`int`): The number of the current step, used as an indication for the LLM.
        r  zHere is the task:
```
z
```
Now begin!ÚsystemÚuserNr{   )r»   rÞ   rä   Úanswer_factsz
<end_plan>)rQ  zEHere is the plan of action that I will follow to solve the task:
```
z
```z+Here are the facts that I know so far:
```
)r  r  r2   z===== Initial plan =====r1   F©r  )r»   )r»   rÞ   rä   Úfacts_updateÚremaining_steps)r»   Úplan_updatez7Here is the updated list of the facts that I know:
```
z===== Updated plan =====)r   r  r   r  rð   r   re  r9   rü   r«   r©   râ   ræ   rv   rÿ   r  r¢   r	  r$  r    r!   r   ró   r   )r:   r»   r  rp  Úmessage_prompt_factsÚmessage_prompt_taskr„  Úmessage_system_prompt_planÚmessage_user_prompt_planÚanswer_planÚfinal_plan_redactionÚfinal_facts_redactionr&  Úfacts_update_system_promptÚfacts_update_messager†  Úplan_update_messageÚplan_update_message_userrˆ  s                      r>   r€  zReactAgent.planning_step~  s=  € ò Ü,7×,>Ñ,>ÔK^Ñ#_Ð ä#×(Ñ(ð à€ð ðñ#Ðð  Ÿ?™?Ð,@ÐBUÐ+VÓWˆLô $×*Ñ*Ü3°D·N±NÑCÀHÑMñ*Ð&ô
 $×(Ñ(Ü3°D·N±NÑCÀFÑK×RÑRØØ&*§m¡m×&JÑ&JÈ4×KiÑKiÓ&jàIM×I\ÑI\ÐIhÔ0°×1DÑ1DÔEÐnpà!-ð Só ñ
(Ð$ð Ÿ/™/Ø+Ð-EÐFÐXdÐWeð *ó ˆKð(à€ð ð$Ð ð)à€ð ð%÷ �uƒwð "ð �I‰I×ÑÐ&:ÐEZÑ[Ô\Ø�K‰K�O‰O˜BÐ :Ô;Ø�K‰K�O‰O˜BÐ 4Õ5à×<Ñ<Ø"ð =ó ˆLô $×*Ñ*Ü5ñ*Ð&ô
 $×(Ñ(Ü3ñ$Ð ð  Ÿ?™?Ð,FÐ+GÈ,Ñ+VÐZnÐYoÑ+oÓpˆLô $×*Ñ*Ü2°4·>±>ÑBÀ8ÑL×SÑSÐY]ÐSÓ^ñ#Ðô
 $×(Ñ(Ü2°4·>±>ÑBÀ6ÑJ×QÑQØØ&*§m¡m×&JÑ&JÈ4×KiÑKiÓ&jàIM×I\ÑI\ÐIhÔ0°×1DÑ1DÔEÐnpà!-Ø%)×%8Ñ%8¸9Ñ%Dð Ró ñ(Ð$ð Ÿ/™/Ø$Ð%¨Ñ4Ð8PÐ7QÑQÐcoÐbpð *ó ˆKô
 $D×#JÑ#JÐPTÐbmÔ#nÐ ð)à€ð ð%Ð!ð �I‰I×ÑÐ&:ÐEZÑ[Ô\Ø�K‰K�O‰O˜BÐ :Ô;Ø�K‰K�O‰O˜BÐ 4Õ5r?   ©NNNNNN)FT)FN)r@   rA   rB   rÄ   r
   r   r%   r   r   rÇ   r   rC  r�   ri  rÅ   rB  rl  rm  r€  rÎ   rÏ   s   @r>   r`  r`  Î  s#  ø„ ññ Øð Môð *.Ø'+Ø37Ø,0Ø#'Ø+/ñ#à�D‰zð#ð ˜XÑ&ð#ð   ‘}ð	#ð
 $,¨C¡=ð#ð ˜$˜s C˜x™.Ñ)ð#ð ˜C‘=ð#ð $ C™=ô#ó	ð#ð@A¨Có Añ, Øð Môñ)˜ð ) Tð )¸$ò )ó	ð)ð6&˜só &ðP&˜só &ñPa6°ð a6È(ÐSVÉ-÷ a6r?   r`  c                   óŒ   ‡ — e Zd ZdZ	 	 	 	 	 ddee   dee   dee   dee   dee	eef      dee
   fˆ fd„Zd	e	eef   fd
„Zˆ xZS )rþ   a  
    This agent that solves the given task step by step, using the ReAct framework:
    While the objective is not reached, the agent will perform a cycle of thinking and acting.
    The tool calls will be formulated by the LLM in JSON format, then parsed and executed.
    r–   rð   rñ   r©   rö   rf  c           
      ój   •— |€
t        «       }|€t        }|€t        }t        ‰| �  d||||||dœ|¤Ž y )N©r–   rð   rñ   r©   rö   rf  rR   )r   r   r$   rË   r�   )	r:   r–   rð   rñ   r©   rö   rf  rA  rÍ   s	           €r>   r�   zReactJsonAgent.__init__é  sW   ø€ ð ÐÜ$›ˆJØÐ Ü<ˆMØ$Ð,Ü(IÐ%Ü‰Ñð 	
ØØ!Ø'Ø&?ØØ/ñ	
ð ó	
r?   Ú	log_entryc                 óÔ  — | j                  «       }|| _        | j                  j                  d«       |j	                  «       |d<   | j                  j                  d«       | j                  j                  | j                  d   «       	 | j                  �d| j                  ini } | j                  | j                  fddd	gi|¤Ž}| j                  j                  d«       | j                  j                  |«       ||d<   | j                  j                  d«       | j                  |d¬«      \  }}	 | j                  |«      \  }}	||d<   ||	dœ|d<   | j                  j                  d«       | j                  j                  d|«       | j                  j                  d|› d|	› �«       |dk(  rat        |	t         «      rHd|	v rA|	d   }
t        |
t"        «      r1|
| j$                  j'                  «       v r| j$                  |
   }
n|	}
n|	}
|
|d<   |
S |	€i }	| j)                  ||	«      }t+        |«      }|t,        t.        fv r-|t,        k(  rd}n|t.        k(  rd}|| j$                  <   d|› d�}nt#        |«      j1                  «       }| j                  j                  |«       ||d<   |S # t        $ r}t        d
|› d�«      ‚d}~ww xY w# t        $ r}t        d|› d�«      ‚d}~ww xY w) ú¿
        Perform one step in the ReAct framework: the agent thinks, acts, and observes the result.
        The errors are raised here, they are caught and logged in the run() method.
        ú===== New step =====r&  z/===== Calling LLM with this last message: =====rX   Nrö   rQ  rR  rƒ   ú Error in generating llm output: r±   z&===== Output message of the LLM: =====r  z===== Extracting action =====r„   rT  z"Could not parse the given action: r.  ©rˆ   Útool_argumentsr~   r9  r-   z>>> Calling tool: 'z' with arguments: rr  Úanswerz	image.pngz	audio.mp3zStored 'z' in memory.r  )r$  rß   r¢   r
  r[  r\  rö   rð   ri   rÚ   r/  rô   rÑ   r=  r	  r�   r‘   rÇ   r2  r²   r6  r3  r   r   rv   )r:   r˜  r&  rò   r  rn   r.  r|   rˆ   r0  rŸ  r  Úobservation_typeÚobservation_nameÚupdated_informations                  r>   rw  zReactJsonAgent.step  sü  € ð
 ×8Ñ8Ó:ˆà"ˆŒØ�‰×ÑÐ0Ô1ð %1×$5Ñ$5Ó$7ˆ	�.Ñ!à�‰×ÑÐJÔKØ�‰×Ñ˜Ÿ™ R™Ô)ð	PØ;?¿<¹<Ð;S˜y¨$¯,©,Ñ7ÐY[ˆOØ(˜Ÿ™Ø—‘ñØ-;¸^Ð,LðØP_ñˆJð
 	�‰×ÑÐBÔCØ�‰×Ñ˜*Ô%Ø",ˆ	�,Ñð 	�‰×ÑÐ9Ô:Ø ×/Ñ/¸:ÐS\Ð/Ó]Ñˆ	�6ð	OØ#'×#3Ñ#3°FÓ#;Ñ ˆI�yð "+ˆ	�+ÑØ/8ÈIÑ!Vˆ	�+Ñð 	�‰×ÑÐ1Ô2Ø�‰�‰˜˜IÔ&Ø�‰×ÑÐ1°)°Ð<NÈyÈkÐZÔ[Ø˜Ò&Ü˜)¤TÔ*Ø˜yÑ(Ø& xÑ0�Fä" 6¬3Ô/°F¸d¿j¹j¿o¹oÓ>OÑ4Oà!%§¡¨FÑ!3™à&‘Fà"�Ø(.ˆI�nÑ%ØˆMàÐ Ø�	Ø×0Ñ0°¸IÓFˆKÜ# KÓ0ÐØ¤J´
Ð#;Ñ;Ø#¤zÒ1Ø'2Ñ$Ø%¬Ò3Ø'2Ð$ð 0;�—
‘
Ð+Ñ,Ø(0Ð1AÐ0BÀ,Ð&OÑ#ä&)¨+Ó&6×&<Ñ&<Ó&>Ð#Ø�K‰K×ÑÐ0Ô1Ø':ˆI�mÑ$ØÐøôm ò 	PÜ&Ð)IÈ!ÈÈAÐ'NÓOÐOûð	Pûô ò 	OÜ#Ð&HÈÈÈ1Ð$MÓNÐNûð	Oús0   Â
=J* Ä4K
 Ê*	KÊ3KËKË
	K'ËK"Ë"K'r^  ©r@   rA   rB   rÄ   r   r%   r   r   rÇ   r   rC  r�   r   rw  rÎ   rÏ   s   @r>   rþ   rþ   â  s�   ø„ ñð *.Ø'+Ø37Ø,0Ø+/ñ
à�D‰zð
ð ˜XÑ&ð
ð   ‘}ð	
ð
 $,¨C¡=ð
ð ˜$˜s C˜x™.Ñ)ð
ð $ C™=õ
ð4K˜d 3¨ 8™n÷ Kr?   rþ   c                   óž   ‡ — e Zd ZdZ	 	 	 	 	 	 ddee   dee   dee   dee   dee	eef      deee      dee
   fˆ fd	„Zd
e	eef   fd„Zˆ xZS )ÚReactCodeAgenta  
    This agent that solves the given task step by step, using the ReAct framework:
    While the objective is not reached, the agent will perform a cycle of thinking and acting.
    The tool calls will be formulated by the LLM in code format, then parsed and executed.
    r–   rð   rñ   r©   rö   rF  rf  c           
      óº  •— |€
t        «       }|€t        }|€t        }t        ‰	| �  d||||||dœ|¤Ž t        «       st        j                  t        d«       t        | _
        |r|ng | _        t        t        t        «      t        | j                  «      z  «      | _        | j                   j#                  dt%        | j                  «      «      | _        i | _        y )Nr—  zjpygments isn't installed. Installing pygments will enable color syntax highlighting in the ReactCodeAgent.rë   rR   )r   r   r$   rË   r�   r   rI  rJ  r¢   r#   rK  rF  r_   r  r"   ré   rñ   rc   rÇ   rX  )
r:   r–   rð   rñ   r©   rö   rF  rf  rA  rÍ   s
            €r>   r�   zReactCodeAgent.__init__X  sá   ø€ ð ÐÜ$›ˆJØÐ Ü<ˆMØ$Ð,Ü(IÐ%Ü‰Ñð 	
ØØ!Ø'Ø&?ØØ/ñ	
ð ò	
ô %Ô&Ü ×-Ñ-Üð"ôô !5ˆÔÙNkÑ-JÐqsˆÔ*Ü"&¤sÔ+<Ó'=ÄÀD×DfÑDfÓ@gÑ'gÓ"hˆÔØ!×/Ñ/×7Ñ7Ð8PÔRUÐVZ×VmÑVmÓRnÓoˆÔØˆÕr?   r˜  c                 ór  — | j                  «       }|j                  «       | _        | j                  j	                  d«       |j                  «       |d<   | j                  j                  d«       | j                  j                  | j                  dd «       	 | j                  �d| j                  ini } | j                  | j                  fddd	gi|¤Ž}| j                  j	                  d«       | j                  j	                  |«       ||d<   | j                  j	                  d«       	 | j                  |d¬«      \  }}	 t        |«      }||d<   d|dœ|d<   | j                  ||«       	 i t        j                  «       ¥| j                  j                   ¥}
| j"                  �i |
¥| j"                  ¥}
| j%                  ||
| j&                  | j(                  | j*                  ¬«      }| j                  j-                  d«       | j                  j/                  d| j(                  d   «       d| j(                  d   z   }|�T| j                  j-                  d«       | j                  j/                  dt1        |«      «       |dt1        |«      dd z   z  }||d <   |j5                  d$«      D ]Q  }|dt7        d%«       d%k(  sŒ| j                  j/                  d&d'«       | j                  j/                  d|«       ||d%<   ŒS |S # t        $ r}t        d
|› d�«      ‚d}~ww xY w# t        $ r-}| j                  j	                  d|› �«       ||}}Y d}~�Œd}~ww xY w# t        $ r}d|› d�}	t        |	«      ‚d}~ww xY w# t        $ r0}d!t1        |«      › �}	d"t1        |«      v r|	d#z  }	t3        |	«      ‚d}~ww xY w)(rš  r›  r&  z1===== Calling LLM with these last messages: =====r+  Nrö   rQ  rR  rƒ   rœ  r±   z=== Output message of the LLM:r  z=== Extracting action ===rS  rT  zKError in extracting action, trying to parse the whole output. Error trace: rU  z#. Make sure to provide correct coder.  zcode interpreterr�  r~   rV  zPrint outputs:r.   rY  zPrint outputs:
zLast output from code snippet:zLast output from code snippet:
i † r  z2Code execution failed due to the following error:
z%'dict' object has no attribute 'read'zd
You get this error because you passed a dict as input for one of the arguments instead of a string.r�   rr  r/   zFinal answer:)r$  r[  rß   r¢   r
  r\  rö   rð   ri   rÚ   r/  ry   rÑ   r>  r   rÛ   r–   râ   rK  rX  r2  ré   r=  r	  rÇ   rÔ   r‡   rZ  )r:   r˜  r&  rò   r  rn   r.  Úraw_code_actionr7  r5  rW  rL  r  Úlines                 r>   rw  zReactCodeAgent.step€  sÆ  € ð
 ×8Ñ8Ó:ˆà"×'Ñ'Ó)ˆŒØ�‰×ÑÐ0Ô1ð %1×$5Ñ$5Ó$7ˆ	�.Ñ!à�‰×ÑÐLÔMØ�‰×Ñ˜Ÿ™ R SÐ)Ô*ð	PØ;?¿<¹<Ð;S˜y¨$¯,©,Ñ7ÐY[ˆOØ(˜Ÿ™Ø—‘ñØ-;¸^Ð,LðØP_ñˆJð 	�‰×ÑÐ:Ô;Ø�‰×Ñ˜*Ô%Ø",ˆ	�,Ñð 	�‰×ÑÐ5Ô6ð	@Ø)-×)<Ñ)<È
Ð`gÐ)<Ó)hÑ&ˆI�ð
	/Ü)¨/Ó:ˆKð
 "+ˆ	�+ÑØ/AÐU`Ñ!aˆ	�+Ñð 	×&Ñ& y°+Ô>ð	1ðÜ#×(Ñ(Ó*ðà—,‘,×$Ñ$ðˆLð ×"Ñ"Ð.ØF ,ÐF°$×2EÑ2EÐF�Ø×*Ñ*ØØ)Ø!×.Ñ.Ø—j‘jØ#'×#:Ñ#:ð +ó ˆFð �K‰K×ÑÐ 0Ô1Ø�K‰K�O‰O˜B §
¡
¨?Ñ ;Ô<Ø,¨t¯z©z¸/Ñ/JÑJˆKØÐ!Ø—‘×#Ñ#Ð$DÔEØ—‘—‘ ¤C¨£KÔ0ØÐAÄCÈÃKÐPWÐQWÐDXÑXÑX�Ø'2ˆI�mÑ$ð  ×%Ñ% dÓ+ò 	3ˆDØÐ)”c˜.Ó)Ð*¨nÓ<Ø—‘—‘  OÔ4Ø—‘—‘  FÔ+Ø,2�	˜.Ò)ð		3ð
 ˆøôu ò 	PÜ&Ð)IÈ!ÈÈAÐ'NÓOÐOûð	Pûô ò 	@Ø�K‰K×ÑÐ kÐlmÐknÐoÔpØ)3°Z�ŽIûð	@ûô ò 	/Ø1°!°Ð4WÐXˆIÜ# IÓ.Ð.ûð	/ûô> ò 	1ØMÌcÐRSËfÈXÐVˆIØ6¼#¸a»&Ñ@Øð  Eñ  E�	Ü% iÓ0Ð0ûð		1úsa   Â=L Ä,L" ÅM Å.D-M= Ì	LÌLÌLÌ"	MÌ+"MÍMÍ	M:Í$M5Í5M:Í=	N6Î+N1Î1N6r”  r£  rÏ   s   @r>   r¥  r¥  Q  s§   ø„ ñð *.Ø'+Ø37Ø,0Ø=AØ+/ñ&à�D‰zð&ð ˜XÑ&ð&ð   ‘}ð	&ð
 $,¨C¡=ð&ð ˜$˜s C˜x™.Ñ)ð&ð (0°°S±	Ñ':ð&ð $ C™=õ&ðPO˜d 3¨ 8™n÷ Or?   r¥  iè  c                   ó:   — e Zd Z edd¬«      dd„«       Zd„ Zd„ Zy)	ÚManagedAgentra  rb  rc  Nc                 óJ   — || _         || _        || _        || _        || _        y r4   )rå   r™   rÀ   Úadditional_promptingÚprovide_run_summary)r:   rå   r™   rÀ   r­  r®  s         r>   r�   zManagedAgent.__init__Ö  s*   € ð
 ˆŒ
ØˆŒ	Ø&ˆÔØ$8ˆÔ!Ø#6ˆÕ r?   c                 óÜ   — d| j                   › d|› d�}| j                  r,|j                  d| j                  «      j                  «       }|S |j                  dd«      j                  «       }|S )NzYou're a helpful agent named 'z@'.
You have been submitted this task by your manager.
---
Task:
a˜  
---
You're helping your manager solve a wider task: so make sure to not provide a one-line answer, but give as much information as possible so that they have a clear understanding of the answer.

Your final_answer WILL HAVE to contain these parts:
### 1. Task outcome (short version):
### 2. Task outcome (extremely detailed version):
### 3. Additional context (if relevant):

Put all these in your final_answer tool, everything that you do not pass as an argument to final_answer will be lost.
And even if your task resolution is not successful, please return as much context as possible, so that your manager can act upon this feedback.
<<additional_prompting>>z
<<additional_prompting>>r{   )r™   r­  rc   rv   )r:   r»   Ú	full_tasks      r>   Úwrite_full_taskzManagedAgent.write_full_taská  s   € Ø6°t·y±y°kð Bð €ð ð	ˆ	ð  ×$Ò$Ø!×)Ñ)Ð*FÈ×HaÑHaÓb×hÑhÓjˆIð Ðð "×)Ñ)Ð*FÈÓK×QÑQÓSˆIØÐr?   c                 ó  — | j                  |«      } | j                  j                  |fi |¤Ž}| j                  rÄd| j                  › d�}|t        |«      z  }|d| j                  › d�z  }| j                  j                  d¬«      D ]_  }|d   }t        t        |«      «      t        k  sdt        |«      v r|dt        |«      z   d	z   z  }ŒE|dt        |«      d t         z   d
z   z  }Œa |d| j                  › d�z  }|S |S )Nz2Here is the final answer from your managed agent 'z':
zZ

For more detail, find below a summary of this agent's work:
SUMMARY OF WORK FROM AGENT 'Tr…  rŽ   z[FACTS LIST]r�   z
---z0
(...Step was truncated because too long)...
---z$
END OF SUMMARY OF WORK FROM AGENT 'r]   )	r±  rå   rB  r®  r™   rÇ   r$  rZ  ÚLENGTH_TRUNCATE_REPORTS)r:   ÚrequestrA  r°  r]  rŸ  rÌ   rŽ   s           r>   Ú__call__zManagedAgent.__call__ø  s4  € Ø×(Ñ(¨Ó1ˆ	Ø�—‘—‘ 	Ñ4¨VÑ4ˆØ×#Ò#ØIÈ$Ï)É)ÈÐTXÐYˆFØ”c˜&“kÑ!ˆFØÐuÐvz×vÑvð  vAð  AEð  Fñ  FˆFØŸ:™:×BÑBÐPTÐBÓUò 	�Ø! )Ñ,�Ü”s˜7“|Ó$Ô'>Ò>À.ÔTWÐX_ÓT`ÑB`Ø˜d¤S¨£\Ñ1°GÑ;Ñ;‘FàØÜ˜g›,Ð'?Ô(?Ð@ñAàNñOñ‘Fð	ð Ð=¸d¿i¹i¸[ÈÐKÑKˆFØˆMàˆMr?   )NF)r@   rA   rB   r
   r�   r±  rµ  rR   r?   r>   r«  r«  Õ  s,   „ ÙØð Môò7ó	ð7òó.r?   r«  r4   )^rd   r   r`   rv  Útypingr   r   r   r   r   r   r	   Ú"huggingface_hub.utils._deprecationr
   r{   r   ÚutilsrI  Úutils.import_utilsr   Úagent_typesr   r   Údefault_toolsr   r   r   rð   r   r   Ú
monitoringr   Úpromptsr   r   r   r   r   r   r   r   r    r!   r    r"   r#   r–   r$   r%   r&   r'   Úpygmentsr(   Úpygments.formattersr)   Úpygments.lexersr*   r8   r,   Ú
get_loggerr@   r¢   Ú	propagateÚStreamHandlerÚchÚsetFormatterÚ
addHandlerrÇ   rp   ry   r€   rŠ   r“   r£   r¡   r•   ri   rÉ   rÑ   rÔ   rØ   rÚ   rá   r_   ræ   rè   rì   rî   rE  r`  rþ   r¥  r³  r«  rR   r?   r>   ú<module>rÇ     s�  ðó" Û Û 	Û ß D× DÑ Då @å !Ý 3Ý 6ß /ß RÑ Rß 0Ý ÷÷ ÷ ÷ H÷ó ñ ÔÝ"Ý8Ý+ô(�g×'Ñ'ô (ðB 
)Ð	×	(Ñ	(¨Ó	2€Ø€Ô Ø€W×ÑÓ€Ø ‡�‘Ó!Ô "Ø × Ñ �"Ô ðA˜sð A t¨C°¨H¡~ó Að,
˜sð 
 só 
ð$

 Cð 

¨E°#°t¸CÀ¸H±~Ð2EÑ,Fó 

ð
˜sð 
 u¨S°%¸¸TÀ#ÀsÀ(¹^Ð8KÑ2LÐ-LÑ'Mó 
ð*�5˜˜d 3¨ 8™nÑ-¨t°C¸°H©~¸sÐBÑCð Èó ð Ð ØÐ ÷d#ñ d#ôN�ô ô	˜
ô 	ô	˜*ô 	ô	˜jô 	ô	˜:ô 	ð gð Àð Ð`cð Ðhkó ð'¨Tó 'ñNÐ\_ó NðV°ð VÈÈcÉð VÐWZó V÷i"ñ i"ôX{�ô {ô|Q6�ô Q6ôhl�Zô lô^~�Zô ~ðB Ð ÷7ò 7r?   