
    @h                    N   S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	J
r
  SSKJrJrJr  SSKJr  SSKJrJrJrJrJr  SSKrSSKJr  SS	KJrJrJr  SS
KJrJ r J!r!J"r"J#r#J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0  SSK1J2r2  SSK3J4r4J5r5J6r6  SSK7J8r8  SSK9J:r:  SSK;J<r<  SSK=J>r>J?r?J@r@  SSKAJBrBJCrC  SSKDJErE  SSKFJGrG  SSKHJIrI  SSKJJKrK  SSKLJMrM  SSKNJOrO  SSKPJQrQ  \R                  " \S5      rT " S S \>5      rU " S! S"\>5      rV " S# S$\,\\\4      5      rW " S% S&\,\\X\   \4      5      rY " S' S(\U5      rZ " S) S*\V5      r[\" S+\ES,S-9 " S. S/\U5      5       r\\" S+\ES,S-9 " S0 S1\U5      5       r] " S2 S3\:5      r^\X\\\\4      r_\\Z\[4   r` " S4 S5\M5      rag)6zEChain that takes in an input and produces an action and action input.    )annotationsN)abstractmethod)AsyncIteratorIteratorSequence)Path)AnyCallableOptionalUnioncast)
deprecated)AgentActionAgentFinish	AgentStep)AsyncCallbackManagerForChainRunAsyncCallbackManagerForToolRunBaseCallbackManagerCallbackManagerForChainRunCallbackManagerForToolRun	Callbacks)OutputParserException)BaseLanguageModel)BaseMessage)BaseOutputParser)BasePromptTemplate)FewShotPromptTemplate)PromptTemplate)RunnableRunnableConfigensure_config)AddableDict)BaseTool)get_color_mapping)	BaseModel
ConfigDictmodel_validator)Selfoverride)AGENT_DEPRECATION_WARNING)AgentExecutorIterator)	AgentType)InvalidTool)Chain)LLMChain)asyncio_timeoutc                  *  ^  \ rS rSrSr\SS j5       rSS jr\ S       SS jj5       r	\ S       SS jj5       r
\\SS j5       5       r        SS jr\ S         SS	 jj5       r\SS
 j5       rSU 4S jjrSS jrSS jrSrU =r$ )BaseSingleActionAgent:   zBase Single Action Agent class.c                    S/$ Return values of the agent.output selfs    N/var/www/html/shao/venv/lib/python3.13/site-packages/langchain/agents/agent.pyreturn_values#BaseSingleActionAgent.return_values=        z    c                    g Nr8   r9   s    r;   get_allowed_tools'BaseSingleActionAgent.get_allowed_toolsB   s    r?   c                    g)Given input, decided what to do.

Args:
    intermediate_steps: Steps the LLM has taken to date,
        along with observations.
    callbacks: Callbacks to run.
    **kwargs: User inputs.

Returns:
    Action specifying what tool to use.
Nr8   r:   intermediate_steps	callbackskwargss       r;   planBaseSingleActionAgent.planE       r?   c                   #    g7f)Async given input, decided what to do.

Args:
    intermediate_steps: Steps the LLM has taken to date,
        along with observations.
    callbacks: Callbacks to run.
    **kwargs: User inputs.

Returns:
    Action specifying what tool to use.
Nr8   rF   s       r;   aplanBaseSingleActionAgent.aplanX           c                    g'Return the input keys.

:meta private:
Nr8   r9   s    r;   
input_keys BaseSingleActionAgent.input_keysk   rL   r?   c                L    US:X  a  [        SS0S5      $ SU S3n[        U5      e)r  Return response when agent has been stopped due to max iterations.

Args:
    early_stopping_method: Method to use for early stopping.
    intermediate_steps: Steps the LLM has taken to date,
        along with observations.
    **kwargs: User inputs.

Returns:
    AgentFinish: Agent finish object.

Raises:
    ValueError: If `early_stopping_method` is not supported.
forcer7   3Agent stopped due to iteration limit or time limit. 'Got unsupported early_stopping_method ``r   
ValueErrorr:   early_stopping_methodrG   rI   msgs        r;   return_stopped_response-BaseSingleActionAgent.return_stopped_responses   sA    ( !G+PQ  88M7NaPor?   c                    [         e)zConstruct an agent from an LLM and tools.

Args:
    llm: Language model to use.
    tools: Tools to use.
    callback_manager: Callback manager to use.
    kwargs: Additional arguments.

Returns:
    BaseSingleActionAgent: Agent object.
NotImplementedError)clsllmtoolscallback_managerrI   s        r;   from_llm_and_tools(BaseSingleActionAgent.from_llm_and_tools   s
    & "!r?   c                    [         ez#Return Identifier of an agent type.rg   r9   s    r;   _agent_type!BaseSingleActionAgent._agent_type   
     "!r?   c                   > [         TU ]  5       n U R                  n[	        U[
        5      (       a  [        UR                  5      US'   U$ Ub  X2S'   U$ ! [         a    Sn NFf = f)zcReturn dictionary representation of agent.

Returns:
    Dict: Dictionary representation of agent.
N_type)super
model_dumprq   rh   
isinstancer,   strvalue)r:   rI   _dictru   	__class__s       r;   dictBaseSingleActionAgent.dict   st     "$	$$E eY'' -E'N  "'N # 	E	s   A A$#A$c                P   [        U[        5      (       a  [        U5      OUnUR                  nUR	                  SSS9  U R                  5       nSU;  a  SU  S3n[        U5      eUR                  S:X  a0  UR                  S5       n[        R                  " XFSS	9  S
S
S
5        g
UR                  R                  S5      (       a0  UR                  S5       n[        R                  " XFSS9  S
S
S
5        g
U S3n[        U5      e! , (       d  f       g
= f! , (       d  f       g
= f)zSave the agent.

Args:
    file_path: Path to file to save the agent to.

Example:
.. code-block:: python

    # If working with agent executor
    agent.agent.save(file_path="path/agent.yaml")
Tparentsexist_okru   Agent z does not support saving.jsonw   indentNz.yamlz.ymlFdefault_flow_style must be json or yaml)rx   ry   r   parentmkdirr}   rh   suffixopenjsondumpendswithyamlr`   )r:   	file_path	save_pathdirectory_path
agent_dictrc   fs          r;   saveBaseSingleActionAgent.save   s    (2)S'A'ADOy	"))TD9 YY[
*$4& 89C%c**w&$		*2 %$&&'899$		*EB %$ K45CS/! %$ %$   DD
D
D%c                    0 $ #Return logging kwargs for tool run.r8   r9   s    r;   tool_run_logging_kwargs-BaseSingleActionAgent.tool_run_logging_kwargs   s    	r?   r8   return	list[str]r   Optional[list[str]]rA   rG   list[tuple[AgentAction, str]]rH   r   rI   r	   r   Union[AgentAction, AgentFinish]rb   ry   rG   r   rI   r	   r   r   )
rj   r   rk   Sequence[BaseTool]rl   Optional[BaseCallbackManager]rI   r	   r   r2   r   ry   rI   r	   r   builtins.dictr   zUnion[Path, str]r   Noner   r   )__name__
__module____qualname____firstlineno____doc__propertyr<   rB   r   rJ   rO   rV   rd   classmethodrm   rq   r}   r   r   __static_attributes____classcell__r|   s   @r;   r2   r2   :   sT   )    $9  	
 
) $   $9  	
 
) $   " : 	
 
: 
 ;?	"" "" 8	"
 " 
" "( " "" "D r?   r2   c                     ^  \ rS rSrSr\SS j5       rSS jr\ S       SS jj5       r	\ S       SS jj5       r
\\SS j5       5       r        SS jr\SS	 j5       rSU 4S
 jjrSS jrSS jrSrU =r$ )BaseMultiActionAgent   zBase Multi Action Agent class.c                    S/$ r5   r8   r9   s    r;   r<   "BaseMultiActionAgent.return_values   r>   r?   c                    g)zEGet allowed tools.

Returns:
    Optional[List[str]]: Allowed tools.
Nr8   r9   s    r;   rB   &BaseMultiActionAgent.get_allowed_tools   s     r?   c                    g)zGiven input, decided what to do.

Args:
    intermediate_steps: Steps the LLM has taken to date,
        along with the observations.
    callbacks: Callbacks to run.
    **kwargs: User inputs.

Returns:
    Actions specifying what tool to use.
Nr8   rF   s       r;   rJ   BaseMultiActionAgent.plan   rL   r?   c                   #    g7f)zAsync given input, decided what to do.

Args:
    intermediate_steps: Steps the LLM has taken to date,
        along with the observations.
    callbacks: Callbacks to run.
    **kwargs: User inputs.

Returns:
    Actions specifying what tool to use.
Nr8   rF   s       r;   rO   BaseMultiActionAgent.aplan  rQ   rR   c                    grT   r8   r9   s    r;   rV   BaseMultiActionAgent.input_keys  rL   r?   c                L    US:X  a  [        SS0S5      $ SU S3n[        U5      e)rY   rZ   r7   z$Agent stopped due to max iterations.r\   r]   r^   r_   ra   s        r;   rd   ,BaseMultiActionAgent.return_stopped_response   s:    ( !G+*PQSUVV78M7NaPor?   c                    [         erp   rg   r9   s    r;   rq    BaseMultiActionAgent._agent_type:  rs   r?   c                   > [         TU ]  5       n[        R                  " [        5         [        U R                  5      US'   SSS5        U$ ! , (       d  f       U$ = f)*Return dictionary representation of agent.ru   N)rv   rw   
contextlibsuppressrh   ry   rq   r:   rI   r{   r|   s      r;   r}   BaseMultiActionAgent.dict?  sK    "$  !45 !1!12E'N 6 65s   A
Ac                P   [        U[        5      (       a  [        U5      OUnU R                  5       nSU;  a  SU  S3n[	        U5      eUR
                  nUR                  SSS9  UR                  S:X  a0  UR                  S5       n[        R                  " X6SS	9  S
S
S
5        g
UR                  R                  S5      (       a0  UR                  S5       n[        R                  " X6SS9  S
S
S
5        g
U S3n[        U5      e! , (       d  f       g
= f! , (       d  f       g
= f)a8  Save the agent.

Args:
    file_path: Path to file to save the agent to.

Raises:
    NotImplementedError: If agent does not support saving.
    ValueError: If file_path is not json or yaml.

Example:
.. code-block:: python

    # If working with agent executor
    agent.agent.save(file_path="path/agent.yaml")
ru   r   z does not support saving.Tr   r   r   r   r   Nr   Fr   r   )rx   ry   r   r}   rh   r   r   r   r   r   r   r   r   r`   )r:   r   r   r   rc   r   r   s          r;   r   BaseMultiActionAgent.saveF  s   " (2)S'A'ADOy	 YY[
*$4& 9:C%c**"))TD9w&$		*2 %$&&'899$		*EB %$ K45CS/! %$ %$r   c                    0 $ r   r8   r9   s    r;   r   ,BaseMultiActionAgent.tool_run_logging_kwargsl  s	     	r?   r8   r   r   rA   rG   r   rH   r   rI   r	   r   %Union[list[AgentAction], AgentFinish]r   r   r   r   r   )r   r   r   r   r   r   r<   rB   r   rJ   rO   rV   rd   rq   r}   r   r   r   r   r   s   @r;   r   r      s   (    $9  	
 
/ $   $9  	
 
/ $   " : 	
 
4 " "$"L r?   r   c                  ,    \ rS rSrSr\SS j5       rSrg)AgentOutputParserir  z=Base class for parsing agent output into agent action/finish.c                    g)z$Parse text into agent action/finish.Nr8   r:   texts     r;   parseAgentOutputParser.parseu  rL   r?   r8   N)r   ry   r   r   r   r   r   r   r   r   r   r   r8   r?   r;   r   r   r  s    G3 3r?   r   c                  ,    \ rS rSrSr\SS j5       rSrg)MultiActionAgentOutputParseriz  zzBase class for parsing agent output into agent actions/finish.

This is used for agents that can return multiple actions.
c                    g)zParse text into agent actions/finish.

Args:
    text: Text to parse.

Returns:
    Union[List[AgentAction], AgentFinish]:
        List of agent actions or agent finish.
Nr8   r   s     r;   r   "MultiActionAgentOutputParser.parse  rL   r?   r8   N)r   ry   r   r   r   r8   r?   r;   r   r   z  s    
 	 	r?   r   c                      \ rS rSr% SrS\S'    / rS\S'   / rS\S'   SrS	\S
'    \	" SS9r
\SS j5       r\SS j5       r S       SS jjr S       SS jjrSrg)RunnableAgenti  Agent powered by Runnables.z/Runnable[dict, Union[AgentAction, AgentFinish]]runnabler   input_keys_argreturn_keys_argTboolstream_runnablearbitrary_types_allowedc                    U R                   $ r6   r   r9   s    r;   r<   RunnableAgent.return_values       ###r?   c                    U R                   $ )zReturn the input keys.r   r9   s    r;   rV   RunnableAgent.input_keys  s     """r?   Nc                    0 UESU0EnSnU R                   (       a0  U R                  R                  USU0S9 H  nUc  UnM
  XV-  nM     U$ U R                  R                  USU0S9nU$ a  Based on past history and current inputs, decide what to do.

Args:
    intermediate_steps: Steps the LLM has taken to date,
        along with the observations.
    callbacks: Callbacks to run.
    **kwargs: User inputs.

Returns:
    Action specifying what tool to use.
rG   NrH   configr   r   streaminvoker:   rG   rH   rI   inputsfinal_outputchunks          r;   rJ   RunnableAgent.plan  s    " FFE02DE  --fk9=U-V'#(L )L	 W   ==//Y?W/XLr?   c                   #    0 UESU0EnSnU R                   (       a2  U R                  R                  USU0S9  Sh  vN nUc  UnM  XV-  nM  U R                  R                  USU0S9I Sh  vN nU$  N7
 U$  N7fa  Async based on past history and current inputs, decide what to do.

Args:
    intermediate_steps: Steps the LLM has taken to date,
        along with observations.
    callbacks: Callbacks to run.
    **kwargs: User inputs.

Returns:
    Action specifying what tool to use.
rG   NrH   r   r   r   astreamainvoker   s          r;   rO   RunnableAgent.aplan  s     ( FFE02DE   $}}44#Y/  5   *e  '#(L )L!%!6!6#Y/ "7 " L *   	2   8A=A8A6A8-A=/A;0A=6A88A=r8   r   rA   r   r   r   r   r   r   __annotations__r   r   r   r&   model_configr   r<   rV   rJ   rO   r   r8   r?   r;   r   r     s    %==/ "NI"!#OY# OT   $L $ $ # #  $"9" " 	"
 
)"N  $*9* * 	*

* *r?   r   c                      \ rS rSr% SrS\S'    / rS\S'   / rS\S'   SrS	\S
'    \	" SS9r
\SS j5       r\SS j5       r S       SS jjr S       SS jjrSrg)RunnableMultiActionAgenti  r   z5Runnable[dict, Union[list[AgentAction], AgentFinish]]r   r   r   r   Tr   r   r   c                    U R                   $ r   r   r9   s    r;   r<   &RunnableMultiActionAgent.return_values  r   r?   c                    U R                   $ )9Return the input keys.

Returns:
    List of input keys.
r   r9   s    r;   rV   #RunnableMultiActionAgent.input_keys  s     """r?   Nc                    0 UESU0EnSnU R                   (       a0  U R                  R                  USU0S9 H  nUc  UnM
  XV-  nM     U$ U R                  R                  USU0S9nU$ r   r   r   s          r;   rJ   RunnableMultiActionAgent.plan   s    ( FFE02DE  --fk9=U-V'#(L )L	 W   ==//Y?W/XLr?   c                   #    0 UESU0EnSnU R                   (       a2  U R                  R                  USU0S9  Sh  vN nUc  UnM  XV-  nM  U R                  R                  USU0S9I Sh  vN nU$  N7
 U$  N7fr  r  r   s          r;   rO   RunnableMultiActionAgent.aplanG  s     ( FFE02DE   $}}44#Y/  5   *e  '#(L )L!%!6!6#Y/ "7 " L
 *   r
  r8   r   rA   r   r  r8   r?   r;   r  r    s    %CC0 "NI"!#OY# OT   $L $ $ # #  $%9% % 	%

%T  $+9+ + 	+

+ +r?   r  z0.1.0z1.0)messageremovalc                     ^  \ rS rSr% SrS\S'    S\S'    S\S'    \SS	 j5       rSU 4S
 jjr S       SS jjr	 S       SS jjr
SS jrSrU =r$ )LLMSingleActionAgentiu  z$Base class for single action agents.r/   	llm_chainr   output_parserr   stopc                Z    [        [        U R                  R                  5      S1-
  5      $ )r  rG   listsetr  rV   r9   s    r;   rV   LLMSingleActionAgent.input_keys  s'     C1126J5KKLLr?   c                *   > [         TU ]  5       nUS	 U$ r   r  rv   r}   r   s      r;   r}   LLMSingleActionAgent.dict      /"r?   c                    U R                   R                  " SUU R                  US.UD6nU R                  R	                  U5      $ )zGiven input, decided what to do.

Args:
    intermediate_steps: Steps the LLM has taken to date,
        along with the observations.
    callbacks: Callbacks to run.
    **kwargs: User inputs.

Returns:
    Action specifying what tool to use.
rG   r  rH   r8   )r  runr  r  r   r:   rG   rH   rI   r7   s        r;   rJ   LLMSingleActionAgent.plan  sM    " ## 
1
 	
 !!''//r?   c                   #    U R                   R                  " SUU R                  US.UD6I Sh  vN nU R                  R	                  U5      $  N7f)rN   r+  Nr8   )r  arunr  r  r   r-  s        r;   rO   LLMSingleActionAgent.aplan  sZ     " ~~** 
1
 	
 
 !!''//
s   .AA Ac                `    S[        U R                  5      S:X  a  SS.$ U R                  S   S.$ )r   r\   r   
llm_prefixobservation_prefix)lenr  r9   s    r;   r   ,LLMSingleActionAgent.tool_run_logging_kwargs  s8     (+DII!(;"
 	
AE1
 	
r?   r8   r   r   rA   r   r   )r   r   r   r   r   r  r   rV   r}   rJ   rO   r   r   r   r   s   @r;   r  r  u  s     /$$$)
O%M M  $090 0 	0
 
)08  $090 0 	0
 
)02
 
r?   r  c                    ^  \ rS rSr% SrS\S'    S\S'    SrS\S	'    S U 4S
 jjrS!S jr\	S"S j5       r
S#S jr\	S"S j5       r    S$S jr S%       S&S jjr S%       S&S jjr      S'S jr\	S"S j5       r\" SS9S(S j5       r\	\S)S j5       5       r\	\S)S j5       5       r\\S*S j5       5       r\S+S j5       r\\S,S j5       5       r\  S-           S.S jj5       r        S/S jrS0S jrSrU =r$ )1Agenti  zAgent that calls the language model and deciding the action.

This is driven by a LLMChain. The prompt in the LLMChain MUST include
a variable called "agent_scratchpad" where the agent can put its
intermediary work.
r/   r  r   r  Nr   allowed_toolsc                *   > [         TU ]  5       nUS	 U$ r&  r'  r   s      r;   r}   
Agent.dict  r)  r?   c                    U R                   $ )zGet allowed tools.)r:  r9   s    r;   rB   Agent.get_allowed_tools  s    !!!r?   c                    S/$ r5   r8   r9   s    r;   r<   Agent.return_values  r>   r?   c                    Sn[        U5      e)zKFix the text.

Args:
    text: Text to fix.

Returns:
    str: Fixed text.
z(fix_text not implemented for this agent.r`   )r:   r   rc   s      r;   	_fix_textAgent._fix_text  s     9or?   c                v    SU R                   R                  5        3SU R                   R                  5        3/$ )N
z
	)r5  rstripr9   s    r;   _stopAgent._stop  sB     ((//1234**11345
 	
r?   c                ~    SnU H4  u  p4X#R                   -  nUSU R                   U SU R                   3-  nM6     U$ )zJConstruct the scratchpad that lets the agent continue its thought process.r\   rF  )logr5  r4  )r:   rG   thoughtsactionobservations        r;   _construct_scratchpadAgent._construct_scratchpad  sP    
 #5F

"H"T445k]"T__DUVVH $6 r?   c                    U R                   " U40 UD6nU R                  R                  " SSU0UD6nU R                  R	                  U5      $ )rE   rH   r8   )get_full_inputsr  predictr  r   r:   rG   rH   rI   full_inputsfull_outputs         r;   rJ   
Agent.plan  sM    " **+=HHnn,,PyPKP!!''44r?   c                   #    U R                   " U40 UD6nU R                  R                  " SSU0UD6I Sh  vN nU R                  R	                  U5      I Sh  vN $  N' N7f)rN   rH   Nr8   )rR  r  apredictr  aparserT  s         r;   rO   Agent.aplan#  s_     " **+=HH NN33WiW;WW''..{;;; X;s!   5A#A"A#A!A#!A#c                L    U R                  U5      nX0R                  S.n0 UEUE$ )zCreate the full inputs for the LLMChain from intermediate steps.

Args:
    intermediate_steps: Steps the LLM has taken to date,
        along with observations.
    **kwargs: User inputs.

Returns:
    Dict[str, Any]: Full inputs for the LLMChain.
agent_scratchpadr  )rO  rH  )r:   rG   rI   rL  
new_inputss        r;   rR  Agent.get_full_inputs8  s1     --.@A*2JJG
'&'J''r?   c                Z    [        [        U R                  R                  5      S1-
  5      $ )rU   r^  r!  r9   s    r;   rV   Agent.input_keysK  s'     C1126H5IIJJr?   aftermodec                   U R                   R                  nSUR                  ;  a  [        R	                  S5        UR                  R                  S5        [        U[        5      (       a  U=R                  S-  sl        U $ [        U[        5      (       a  U=R                  S-  sl
        U $ S[        U5       3n[        U5      eU $ )a  Validate that prompt matches format.

Args:
    values: Values to validate.

Returns:
    Dict: Validated values.

Raises:
    ValueError: If `agent_scratchpad` is not in prompt.input_variables
     and prompt is not a FewShotPromptTemplate or a PromptTemplate.
r^  zl`agent_scratchpad` should be a variable in prompt.input_variables. Did not find it, so adding it at the end.z
{agent_scratchpad}zGot unexpected prompt type )r  promptinput_variablesloggerwarningappendrx   r   templater   r   typer`   )r:   rg  rc   s      r;   validate_promptAgent.validate_promptS  s     &&V%;%;;NN= ""))*<=&.11#99  F$9::!77  4DL>B o%r?   c                    g)z&Prefix to append the observation with.Nr8   r9   s    r;   r5  Agent.observation_prefixq  rL   r?   c                    g)z#Prefix to append the LLM call with.Nr8   r9   s    r;   r4  Agent.llm_prefixv  rL   r?   c                    g)zsCreate a prompt for this class.

Args:
    tools: Tools to use.

Returns:
    BasePromptTemplate: Prompt template.
Nr8   ri   rk   s     r;   create_promptAgent.create_prompt{  rL   r?   c                    g)zOValidate that appropriate tools are passed in.

Args:
    tools: Tools to use.
Nr8   ru  s     r;   _validate_toolsAgent._validate_tools  rL   r?   c                    g)z)Get default output parser for this class.Nr8   )ri   rI   s     r;   _get_default_output_parser Agent._get_default_output_parser  rL   r?   c                    U R                  U5        [        UU R                  U5      US9nU Vs/ sH  owR                  PM     nnU=(       d    U R	                  5       n	U " SUUU	S.UD6$ s  snf )a  Construct an agent from an LLM and tools.

Args:
    llm: Language model to use.
    tools: Tools to use.
    callback_manager: Callback manager to use.
    output_parser: Output parser to use.
    kwargs: Additional arguments.

Returns:
    Agent: Agent object.
)rj   rg  rl   )r  r:  r  r8   )ry  r/   rv  namer|  )
ri   rj   rk   rl   r  rI   r  tool
tool_names_output_parsers
             r;   rm   Agent.from_llm_and_tools  s    * 	E"$$U+-
	
 -22EDiiE
2&J#*H*H*J 
$(
 	
 	
 3s   A+c                   US:X  a  [        SS0S5      $ US:X  a  SnU H4  u  pVXER                  -  nUSU R                   U SU R                   3-  nM6     US-  nX@R                  S.n0 UEUEnU R
                  R                  " S
0 UD6n	U R                  R                  U	5      n
[        U
[         5      (       a  U
$ [        SU	0U	5      $ S	U 3n[        U5      e)a  Return response when agent has been stopped due to max iterations.

Args:
    early_stopping_method: Method to use for early stopping.
    intermediate_steps: Steps the LLM has taken to date,
        along with observations.
    **kwargs: User inputs.

Returns:
    AgentFinish: Agent finish object.

Raises:
    ValueError: If `early_stopping_method` is not in ['force', 'generate'].
rZ   r7   r[   r\   generaterF  zB

I now need to return a final answer based on the previous steps:r]  zBearly_stopping_method should be one of `force` or `generate`, got r8   )r   rK  r5  r4  rH  r  rS  r  r   rx   r`   )r:   rb   rG   rI   rL  rM  rN  r_  rU  rV  parsed_outputrc   s               r;   rd   Agent.return_stopped_response  s   ( !G+PQ  !J.H'9#JJ&001+b@QR (: VH /7

KJ2V2z2K..00?;?K ..44[AM-55$$ +6DD()+ 	 or?   c                4    U R                   U R                  S.$ )r   r3  r3  r9   s    r;   r   Agent.tool_run_logging_kwargs  s     //"&"9"9
 	
r?   r8   r   r   r   )r   ry   r   ry   )rG   r   r   zUnion[str, list[BaseMessage]]rA   r   )rG   r   rI   r	   r   zbuiltins.dict[str, Any]r   r(   r   )rk   r   r   r   )rk   r   r   r   )rI   r	   r   r   )NN)rj   r   rk   r   rl   r   r  zOptional[AgentOutputParser]rI   r	   r   r9  r   r   ) r   r   r   r   r   r  r:  r}   rB   r   r<   rC  rH  rO  rJ   rO   rR  rV   r'   rn  r   r5  r4  r   rv  ry  r|  rm   rd   r   r   r   r   s   @r;   r9  r9    s9    $$$))-M&-F"  
 
 
	9	 
'	  $595 5 	5
 
)50  $<9< < 	<
 
)<*(9( ( 
!	(& K K '" #: 5  5 2  2      8  8 
 ;?59!
!
 "!
 8	!

 3!
 !
 
!
 !
F5"5 :5 	5
 
5n
 
r?   r9  c                  n    \ rS rSr% SrSrS\S'    SrS\S'     S     SS	 jjr S     SS
 jjr	Sr
g)ExceptionTooli  z!Tool that just returns the query.
_Exceptionry   r  zException tooldescriptionNc                    U$ rA   r8   r:   queryrun_managers      r;   _runExceptionTool._run  s	    
 r?   c                   #    U$ 7frA   r8   r  s      r;   _arunExceptionTool._arun  s     
 s   r8   rA   )r  ry   r  z#Optional[CallbackManagerForToolRun]r   ry   )r  ry   r  z(Optional[AsyncCallbackManagerForToolRun]r   ry   )r   r   r   r   r   r  r  r  r  r  r   r8   r?   r;   r  r    ss    +D#'K'"
 <@ 9 
	 AE > 
	 r?   r  c                  b   \ rS rSr% SrS\S'    S\S'    SrS\S	'    S
rS\S'    SrS\S'    Sr	S\S'    Sr
S\S'    SrS\S'    \ S7         S8S jj5       r\" SS9S9S j5       r\" SS9\S:S j5       5       r\S;S j5       rS<S jrS<S  jr S7SSS!.         S=S" jjjr\S>S# j5       r\S>S$ j5       rS?S% jrS@S& jr S7       SAS' jjr S7       SBS( jjr    SCS) jr S7           SDS* jjr S7           SES+ jjr S7         SFS, jjr S7           SGS- jjr  S7           SHS. jjr! S7         SIS/ jjr" S7     SJS0 jjr# S7     SKS1 jjr$    SLS2 jr%    SMS3 jr&\' S7       SNS4 jj5       r(\' S7       SOS5 jj5       r)S6r*g)PAgentExecutori  zAgent that is using tools.<Union[BaseSingleActionAgent, BaseMultiActionAgent, Runnable]agentr   rk   Fr   return_intermediate_steps   zOptional[int]max_iterationsNzOptional[float]max_execution_timerZ   ry   rb   z8Union[bool, str, Callable[[OutputParserException], str]]handle_parsing_errorszTUnion[int, Callable[[list[tuple[AgentAction, str]]], list[tuple[AgentAction, str]]]]trim_intermediate_stepsc                    U " SUUUS.UD6$ )zCreate from agent and tools.

Args:
    agent: Agent to use.
    tools: Tools to use.
    callbacks: Callbacks to use.
    kwargs: Additional arguments.

Returns:
    AgentExecutor: Agent executor object.
)r  rk   rH   r8   r8   )ri   r  rk   rH   rI   s        r;   from_agent_and_tools"AgentExecutor.from_agent_and_toolsC  s)    &  

 	
 	
r?   rc  rd  c                   U R                   nU R                  nUR                  5       nUbU  [        U5      U Vs1 sH  oDR                  iM     sn:w  a-  SU SU Vs/ sH  oDR                  PM     sn S3n[        U5      eU $ s  snf s  snf )zValidate that tools are compatible with agent.

Args:
    values: Values to validate.

Returns:
    Dict: Validated values.

Raises:
    ValueError: If allowed tools are different than provided tools.
zAllowed tools (z!) different than provided tools ())r  rk   rB   r#  r  r`   )r:   r  rk   r:  r  rc   s         r;   validate_toolsAgentExecutor.validate_tools]  s     



//1$]);"'@
"'$II%@
 *
 "- 1#:?#@%$II%#@"AD  S/!@

 $As   BB
beforec                P   UR                  S5      nU(       at  [        U[        5      (       a_   UR                  nU[        [
        [           [        4   :H  nUR                  SS5      nU(       a  [        UUS9US'   U$ [        UUS9US'   U$ ! [         a  nSn SnANHSnAff = f)zuConvert runnable to agent if passed in.

Args:
    values: Values to validate.

Returns:
    Dict: Validated values.
r  FNr   T)r   r   )getrx   r   
OutputTyper   r"  r   r   	Exceptionpopr  r   )ri   valuesr  output_typemulti_action_r   s          r;   validate_runnable_agent%AgentExecutor.validate_runnable_agentw  s     

7#Zx00T#..  +eD4E{4R.SS$jj):DAO":"$3#w 	 #0"$3#w !  %$%s   B 
B%B  B%c                    [        U R                  [        5      (       a  [        [        U R                  5      $ U R                  $ )a  Type cast self.agent.

If the `agent` attribute is a Runnable, it will be converted one of
RunnableAgentType in the validate_runnable_agent root_validator.

To support instantiating with a Runnable, here we explicitly cast the type
to reflect the changes made in the root_validator.
)rx   r  r   r   RunnableAgentTyper9   s    r;   _action_agentAgentExecutor._action_agent  s1     djj(++)4::66zzr?   c                    Sn[        U5      e)zRaise error - saving not supported for Agent Executors.

Args:
    file_path: Path to save to.

Raises:
    ValueError: Saving not supported for agent executors.
zpSaving not supported for agent executors. If you are trying to save the agent, please use the `.save_agent(...)`rB  )r:   r   rc   s      r;   r   AgentExecutor.save  s    ! 	
 or?   c                8    U R                   R                  U5      $ )zBSave the underlying agent.

Args:
    file_path: Path to save to.
)r  r   )r:   r   s     r;   
save_agentAgentExecutor.save_agent  s     !!&&y11r?   )include_run_infoasync_c               0    [        U UUU R                  US9$ )a'  Enables iteration over steps taken to reach final output.

Args:
    inputs: Inputs to the agent.
    callbacks: Callbacks to run.
    include_run_info: Whether to include run info.
    async_: Whether to run async. (Ignored)

Returns:
    AgentExecutorIterator: Agent executor iterator object.
)tagsr  )r+   r  )r:   r   rH   r  r  s        r;   iterAgentExecutor.iter  s$    & %-
 	
r?   c                .    U R                   R                  $ )rU   )r  rV   r9   s    r;   rV   AgentExecutor.input_keys  s     !!,,,r?   c                    U R                   (       a  / U R                  R                  QSP$ U R                  R                  $ )z0Return the singular output key.

:meta private:
rG   )r  r  r<   r9   s    r;   output_keysAgentExecutor.output_keys  s<     ))LT''55L7KLL!!///r?   c                ^    U R                    Vs0 sH  o"R                  U_M     snU   $ s  snf )zYLookup tool by name.

Args:
    name: Name of tool.

Returns:
    BaseTool: Tool object.
)rk   r  )r:   r  r  s      r;   lookup_toolAgentExecutor.lookup_tool  s+     -1JJ7JD		4J7==7s   *c                    U R                   b  XR                   :  a  gU R                  S L =(       d    X R                  :  $ )NF)r  r  )r:   
iterationstime_elapseds      r;   _should_continueAgentExecutor._should_continue  s;    *z=P=P/P&&$.X,AXAX2XXr?   c                    U(       a  UR                  USU R                  S9  UR                  nU R                  (       a  X$S'   U$ Ngreen)colorverboserG   on_agent_finishr  r<   r  r:   r7   rG   r  r  s        r;   _returnAgentExecutor._return  sC     ''gt||'T++))1C-.r?   c                   #    U(       a#  UR                  USU R                  S9I S h  vN   UR                  nU R                  (       a  X$S'   U$  N'7fr  r  r  s        r;   _areturnAgentExecutor._areturn  s^      -- .   
 ++))1C-.s   &AA(Ac                    [        US   [        5      (       a!  [        U5      S:w  a  Sn[        U5      eUS   $ U Vs/ sH2  n[        U[        5      (       d  M  UR
                  UR                  4PM4     sn$ s  snf )Nr     z>Expected a single AgentFinish output, but got multiple values.)rx   r   r6  r`   r   rM  rN  )r:   r  rc   as       r;   _consume_next_step AgentExecutor._consume_next_step  sk     fRj+..6{aV o%":39V6aZ9=U)1==)6VVVs   A9A9c                \    U R                  [        U R                  UUUUU5      5      5      $ rA   )r  r"  _iter_next_step)r:   name_to_tool_mapcolor_mappingr   rG   r  s         r;   _take_next_stepAgentExecutor._take_next_step$  s<     &&$$$!&

 
	
r?   c              #    #     U R                  U5      nU R                  R                  " U4SU(       a  UR                  5       OS0UD6n[        U[,        5      (       a  Uv   g[        U[        5      (       a  U/OUnU H  nUv   M	     U H  nU R/                  UUUU5      v   M     g! [         Ga  n[        U R                  [        5      (       a  U R                  (       + nOSnU(       a  SU< 3n	[        U	5      Ue[        U5      n
[        U R                  [        5      (       a?  UR                  (       a+  [        UR                  5      n[        UR                  5      n
OiSnOf[        U R                  [        5      (       a  U R                  nO:[        U R                  5      (       a  U R                  U5      nOSn	[        U	5      Ue[        SX5      nU(       a  UR                  USS	9  U R                  R!                  5       n[#        5       R$                  " UR&                  4U R(                  SU(       a  UR                  5       OSS
.UD6n[+        XkS9v    SnAgSnAff = f7f)Take a single step in the thought-action-observation loop.

Override this to take control of how the agent makes and acts on choices.
rH   NFAn output parsing error occurred. In order to pass this error back to the agent and have it try again, pass `handle_parsing_errors=True` to the AgentExecutor. This is the error: Invalid or incomplete response.Got unexpected type of `handle_parsing_errors`r  r  r  r  r  rH   rM  rN  )_prepare_intermediate_stepsr  rJ   	get_childr   rx   r  r   r`   ry   send_to_llmrN  
llm_outputcallabler   on_agent_actionr   r  r,  
tool_inputr  r   r   _perform_agent_action)r:   r  r  r   rG   r  r7   eraise_errorrc   r   rN  tool_run_kwargsactionsagent_actions                  r;   r  AgentExecutor._iter_next_step8  s<    0	!%!A!ABT!U '',,"5@+//1d F^ fk**L )==6(6#L $#L,, 	  $e % '	$44d;;"&"<"<<#* +,0  !o1,q6D$44d;;=="%amm"4Kq||,D"BKD66<<"88$4455"88;F o1, {AF++F'+B"00HHJO'/--!!5@+//1d	
 "K 6CCO'	s1   I1AB, A!I1,I.7F-I)$I1)I..I1c                   U(       a  UR                  USS9  UR                  U;   a  XR                     nUR                  nX#R                     nU R                  R	                  5       nU(       a  SUS'   UR
                  " UR                  4U R                  UU(       a  UR                  5       OS S.UD6n	O~U R                  R	                  5       n[        5       R
                  " UR                  [        UR                  5       5      S.4U R                  S U(       a  UR                  5       OS S.UD6n	[        X9S9$ )Nr  r  r\   r4  r  requested_tool_nameavailable_tool_namesr  )r  r  return_directr  r   r,  r  r  r  r-   r"  keysr   
r:   r  r  r  r  r  r  r  r  rN  s
             r;   r  #AgentExecutor._perform_agent_action  s1    ''G'D 00#$5$56D ..M!"3"34E"00HHJO02-((''5@+//1d	
 "K #00HHJO%-+++7+<+<,01A1F1F1H,I	
 5@+//1d	 "	K FFr?   c           	        #    U R                  U R                  UUUUU5       Vs/ s S h  vN nUPM   N
 sn5      $ s  snf 7frA   )r  _aiter_next_step)r:   r  r  r   rG   r  r  s          r;   _atake_next_stepAgentExecutor._atake_next_step  sV      &&  $44$!& 	 	 	
 	
	s&   #A>6
46
>6
>Ac               L  #     U R                  U5      nU R                  R                  " U4SU(       a  UR                  5       OS0UD6I Sh  vN n[        U[*        5      (       a  U7v   g[        U[        5      (       a  U/OUnU H  nU7v   M
     [,        R.                  " U Vs/ sH  nU R1                  UUUU5      PM     sn6 I Sh  vN nU H  nU7v   M
     g N! [         Ga  n[        U R                  [        5      (       a  U R                  (       + nOSnU(       a  SU< 3n	[        U	5      Ue[        U5      n
[        U R                  [        5      (       a?  UR                  (       a+  [        UR                  5      n[        UR                  5      n
OiSnOf[        U R                  [        5      (       a  U R                  nO:[        U R                  5      (       a  U R                  U5      nOSn	[        U	5      Ue[        SX5      nU R                  R                  5       n[!        5       R"                  " UR$                  4U R&                  SU(       a  UR                  5       OSS.UD6I Sh  vN  n[)        XkS	97v    SnAgSnAff = fs  snf  GN7f)
r  rH   NFr  r  r  r  r  r  )r  r  rO   r  r   rx   r  r   r`   ry   r  rN  r  r  r   r   r  r0  r  r  r   r   asynciogather_aperform_agent_action)r:   r  r  r   rG   r  r7   r  r  rc   r   rN  r  r  r  resultr  s                    r;   r	  AgentExecutor._aiter_next_step  sz    .	!%!A!ABT!U  --33"5@+//1d  FZ fk**L )==6(6#L $ ~~ %, %,L ++$! 	 %,

 

 EK I
 % %	$44d;;"&"<"<<#* +,0  !o1,q6D$44d;;=="%amm"4Kq||,D"BKD66<<"88$4455"88;F o1, {AF"00HHJO - 4 4!!!5@+//1d	!
 "!  K 6CCK%	f

sg   J$A
C$ C"C$ AJ$*JJ$J!J$"C$ $J/FJ=J >JJ$J	J$c                  #    U(       a#  UR                  UU R                  SS9I S h  vN   UR                  U;   a  XR                     nUR                  nX#R                     nU R                  R                  5       nU(       a  SUS'   UR                  " UR                  4U R                  UU(       a  UR                  5       OS S.UD6I S h  vN n	OU R                  R                  5       n[        5       R                  " UR                  [        UR                  5       5      S.4U R                  S U(       a  UR                  5       OS S.UD6I S h  vN n	[        X9S9$  GN= N N7f)Nr  )r  r  r\   r4  r  r  r  )r  r  r  r  r  r   r0  r  r  r-   r"  r  r   r  s
             r;   r  $AgentExecutor._aperform_agent_action  sg     -- .     00#$5$56D ..M!"3"34E"00HHJO02- $		''!5@+//1d	!
 "! K #00HHJO + 2 2+7+<+<,01A1F1F1H,I	!
 5@+//1d	! "	! 	K FFC	s5   &E,E%B'E,E(BE,E*E,(E,*E,c                    U R                    Vs0 sH  o3R                  U_M     nn[        U R                    Vs/ sH  o3R                  PM     snSS/S9n/ nSnSn[        R                  " 5       n	U R	                  Xx5      (       a  U R                  UUUUUS9n
[        U
[        5      (       a  U R                  U
UUS9$ UR                  U
5        [        U
5      S:X  a*  U
S   nU R                  U5      nUb  U R                  UUUS9$ US-  n[        R                  " 5       U	-
  nU R	                  Xx5      (       a  M  U R                  R                  " U R                  U40 UD6nU R                  XUS9$ s  snf s  snf )z(Run text through and get agent response.r  redexcluded_colorsr           r  r  )rk   r  r$   timer  r  rx   r   r  extendr6  _get_tool_returnr  rd   rb   r:   r   r  r  r  r  rG   r  r  
start_timenext_step_outputnext_step_actiontool_returnr7   s                 r;   _callAgentExecutor._callE  s    9=

C
IItO
C)#'::.:4YY:.$e,
 =?
YY[
##J==#33 "'  4   *K88||$& + $   %%&67#$)#3A#6 "334DE*<<#*$/ (  
 !OJ99;3L7 ##J==8 ##;;&&
 

 ||FK|PP[ D /s
   E6E;c           	       #    U R                    Vs0 sH  o3R                  U_M     nn[        U R                    Vs/ sH  o3R                  PM     snS/S9n/ nSnSn[        R                  " 5       n	 [	        U R
                  5       ISh  vN   U R                  Xx5      (       a  U R                  UUUUUS9I Sh  vN n
[        U
[        5      (       a*  U R                  U
UUS9I Sh  vN sSSS5      ISh  vN   $ UR                  U
5        [        U
5      S:X  aC  U
S   nU R                  U5      nUb*  U R                  UUUS9I Sh  vN sSSS5      ISh  vN   $ US-  n[        R                  " 5       U	-
  nU R                  Xx5      (       a  M  U R                  R                  " U R                   U40 UD6nU R                  UUUS9I Sh  vN sSSS5      ISh  vN   $ s  snf s  snf  GNi GN; GN GN N N N/ N!! , ISh  vN  (       d  f       g= f! ["        [$        R"                  4 aE    U R                  R                  " U R                   U40 UD6nU R                  UUUS9I Sh  vN  s $ f = f7f)z.Async run text through and get agent response.r  r  r   r  Nr  r  )rk   r  r$   r  r0   r  r  r
  rx   r   r  r  r6  r  r  rd   rb   TimeoutErrorr  r  s                 r;   _acallAgentExecutor._acall{  s     9=

C
IItO
C)#'::.:4YY:.$I
 =?
YY[
4	&t'>'>??++JEE-1-B-B(%*$/ .C . ($ ""2K@@%)]],.(3 &3 &   @??  '--.>?+,1+;A+>(&*&;&;<L&M&2)- + 2,7 *7 * $- @??8 !OJ#'99;#;L9 ++JEE: ++CC..& 
 "]]& + +  G @?? D / @(  @,$- @FG @???P g223 	''??**" F
 "' '    	s6  JG*JG/"J2H" G4H" -H<G7=-H*G:+H.H" :G=;H" ?J AHH HH" HH" "J#3H<HHHH" $H%H" )J4H" 7H:H=H"  HH" HH" HHHH" JH" "AJ8I;9J>J JJc                P   Uu  p#U R                    Vs0 sH  oDR                  U_M     nnSn[        U R                  R                  5      S:  a  U R                  R                  S   nUR
                  U;   a*  XRR
                     R                  (       a  [        Xc0S5      $ gs  snf )z&Check if the tool is a returning tool.r7   r   r\   N)rk   r  r6  r  r<   r  r  r   )r:   r  r  rN  r  r  return_value_keys          r;   r  AgentExecutor._get_tool_return  s    
 %5!8<

C
IItO
C#t!!//014#11??B !11 !2!23AA!/   Ds   B#c                    [        U R                  [        5      (       a  U R                  S:  a  XR                  * S  $ [        U R                  5      (       a  U R                  U5      $ U$ )Nr   )rx   r  intr  )r:   rG   s     r;   r  )AgentExecutor._prepare_intermediate_steps  sc    
 t33S99,,q0%'C'C&C&EFFD0011//0BCC!!r?   c           	   +     #    [        U5      n[        U UUR                  S5      4UR                  S5      UR                  S5      UR                  S5      UR                  S5      SS.UD6nU Sh  vN   g N7f)	zEnables streaming over steps taken to reach final output.

Args:
    input: Input to the agent.
    config: Config to use.
    kwargs: Additional arguments.

Yields:
    AddableDict: Addable dictionary.
rH   r  metadatarun_namerun_idTr  r/  r0  r1  yield_actionsNr!   r+   r  )r:   inputr   rI   iterators        r;   r   AgentExecutor.stream  s|     " v&(JJ{#

 F#ZZ
+ZZ
+::h'

 

 s   A0A:2A83A:c           	    
  #    [        U5      n[        U UUR                  S5      4UR                  S5      UR                  S5      UR                  S5      UR                  S5      SS.UD6nU  Sh  vN nU7v   M   N
 g7f)	zAsync enables streaming over steps taken to reach final output.

Args:
    input: Input to the agent.
    config: Config to use.
    kwargs: Additional arguments.

Yields:
    AddableDict: Addable dictionary.
rH   r  r/  r0  r1  Tr2  Nr4  )r:   r5  r   rI   r6  steps         r;   r  AgentExecutor.astream  s     $ v&(JJ{#

 F#ZZ
+ZZ
+::h'

 

 # 	$J	(s*   A-B/B3A?4B7B?BBr8   rA   )
r  r  rk   r   rH   r   rI   r	   r   r  r  )r  r}   r   r	   )r   z2Union[BaseSingleActionAgent, BaseMultiActionAgent]r   )
r   r	   rH   r   r  r   r  r   r   r+   r   )r  ry   r   r#   )r  r,  r  floatr   r   )r7   r   rG   r"  r  $Optional[CallbackManagerForChainRun]r   dict[str, Any])r7   r   rG   r"  r  )Optional[AsyncCallbackManagerForChainRun]r   r=  )r  NextStepOutputr   1Union[AgentFinish, list[tuple[AgentAction, str]]])r  dict[str, BaseTool]r  dict[str, str]r   rB  rG   r   r  r<  r   r@  )r  rA  r  rB  r   rB  rG   r   r  r<  r   z4Iterator[Union[AgentFinish, AgentAction, AgentStep]])
r  rA  r  rB  r  r   r  r<  r   r   )r  rA  r  rB  r   rB  rG   r   r  r>  r   r@  )r  rA  r  rB  r   rB  rG   r   r  r>  r   z9AsyncIterator[Union[AgentFinish, AgentAction, AgentStep]])
r  rA  r  rB  r  r   r  r>  r   r   )r   rB  r  r<  r   r=  )r   rB  r  r>  r   rB  )r  ztuple[AgentAction, str]r   zOptional[AgentFinish])rG   r   r   r   )r5  Union[dict[str, Any], Any]r   Optional[RunnableConfig]rI   r	   r   zIterator[AddableDict])r5  rC  r   rD  rI   r	   r   zAsyncIterator[AddableDict])+r   r   r   r   r   r  r  r  r  rb   r  r  r   r  r'   r  r  r   r  r   r  r  rV   r  r  r  r  r  r  r  r  r  r
  r	  r  r"  r&  r  r  r)   r   r  r   r8   r?   r;   r  r    s   $GG3-&+t+3$&NM&9 +/. ")3( 	 S  	    
  $	
K
 "
 	

 
 

 
2 '" #2 (#  $>   2  $

 "'

 

 
 
 

6 - - 0 0	>Y =A	 ! :	
 
" BF	 ! ?	
 
"	W	W 
;	W" =A
-
 &
 	

 :
 :
 
;
4 =AM-M &M 	M
 :M :M 
>Mh =A%G-%G &%G "	%G
 :%G 
%GZ BF
-
 &
 	

 :
 ?
 
;
6 BFU-U &U 	U
 :U ?U 
CUx BF)G-)G &)G "	)G
 ?)G 
)G\ =A4Q4Q :4Q 
	4Qr BFGG ?G 
	GR1 
*"9" 
'"  ,0) ) 	
 
 <  ,0) ) 	
 
$ r?   r  )br   
__future__r   r  builtinsr   r   loggingr  abcr   collections.abcr   r   r   pathlibr   typingr	   r
   r   r   r   r   langchain_core._apir   langchain_core.agentsr   r   r   langchain_core.callbacksr   r   r   r   r   r   langchain_core.exceptionsr   langchain_core.language_modelsr   langchain_core.messagesr   langchain_core.output_parsersr   langchain_core.promptsr   langchain_core.prompts.few_shotr   langchain_core.prompts.promptr   langchain_core.runnablesr   r    r!   langchain_core.runnables.utilsr"   langchain_core.toolsr#   langchain_core.utils.inputr$   pydanticr%   r&   r'   typing_extensionsr(   r)   langchain._api.deprecationr*   langchain.agents.agent_iteratorr+   langchain.agents.agent_typesr,   langchain.agents.toolsr-   langchain.chains.baser.   langchain.chains.llmr/   langchain.utilities.asyncior0   	getLoggerr   ri  r2   r   r   r"  r   r   r  r  r9  r  r?  r  r  r8   r?   r;   <module>rd     s   K "        = =    * E E  < < / : 5 A 8 L L 6 ) 8 ; ; , @ A 2 . ' ) 7			8	$eI ePM9 M`3({K/G)HI 3U4,k9:;*l) l^t3 tn %
P
0 P

P
f %
b
! b

b
J	H . eKi?@A-)AAB RE Rr?   