
    l
i                       d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	m
Z
 ddlmZmZmZmZ ddlmZ ddlmZmZ ddlZddlmZ dd	lmZmZmZ dd
l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, ddl-m.Z. ddl/m0Z0 ddl1m2Z2m3Z3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z<m=Z=m>Z> ddl?m@Z@mAZA ddlBmCZC ddlDmEZE ddlFmGZG ddlHmIZI ddlJmKZK ddlLmMZM ddlNmOZO  ejP        eQ          ZR G d d e<          ZS G d! d"e<          ZT G d# d$e*eez                     ZU G d% d&e*eVe         ez                     ZW G d' d(eS          ZX G d) d*eT          ZY ed+eCd,-           G d. d/eS                      ZZ ed+eCd,-           G d0 d1eS                      Z[ G d2 d3e8          Z\eVeez  ez           Z]eXeYz  Z^ G d4 d5eK          Z_dS )6zEChain that takes in an input and produces an action and action input.    )annotationsN)abstractmethod)AsyncIteratorCallableIteratorSequence)Path)Any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                       e Zd ZdZed&d            Zd'dZe	 d(d)d            Ze	 d(d)d            Z	eed&d                        Z
d*dZe	 d(d+d            Zed,d            Zed- fd             Zd.d$Zd/d%Z xZS )0BaseSingleActionAgentzBase Single Action Agent class.return	list[str]c                    dgS Return values of the agent.output selfs    C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\langchain_classic/agents/agent.pyreturn_valuesz#BaseSingleActionAgent.return_values:        z    list[str] | Nonec                    dS )Get allowed tools.Nr7   r8   s    r:   get_allowed_toolsz'BaseSingleActionAgent.get_allowed_tools?   s    tr=   Nintermediate_stepslist[tuple[AgentAction, str]]	callbacksr   kwargsr
   AgentAction | AgentFinishc                    dS )0  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.
        Nr7   r9   rB   rD   rE   s       r:   planzBaseSingleActionAgent.planC         r=   c                
   K   dS )6  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.
        Nr7   rI   s       r:   aplanzBaseSingleActionAgent.aplanV   
        r=   c                    dS Return the input keys.Nr7   r8   s    r:   
input_keysz BaseSingleActionAgent.input_keysi   rK   r=   early_stopping_methodstr_r   c                \    |dk    rt          ddid          S d| d}t          |          )  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.

        Returns:
            Agent finish object.

        Raises:
            ValueError: If `early_stopping_method` is not supported.
        forcer6   3Agent stopped due to iteration limit or time limit. 'Got unsupported early_stopping_method ``r   
ValueErrorr9   rT   rB   rV   msgs        r:   return_stopped_responsez-BaseSingleActionAgent.return_stopped_responsen   sM    & !G++PQ   Q8MPPPoor=   llmr   toolsSequence[BaseTool]callback_managerBaseCallbackManager | Nonec                    t           )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.
            kwargs: Additional arguments.

        Returns:
            Agent object.
        NotImplementedError)clsrc   rd   rf   rE   s        r:   from_llm_and_toolsz(BaseSingleActionAgent.from_llm_and_tools   s
    & "!r=   c                    t           z#Return Identifier of an agent type.ri   r8   s    r:   _agent_typez!BaseSingleActionAgent._agent_type   
     "!r=   builtins.dictc                    t                                                      }	 | j        }n# t          $ r d}Y nw xY wt	          |t
                    rt          |j                  |d<   n|||d<   |S )zuReturn dictionary representation of agent.

        Returns:
            Dictionary representation of agent.
        N_type)super
model_dumpro   rj   
isinstancer*   rU   value)r9   rE   _dictrs   	__class__s       r:   dictzBaseSingleActionAgent.dict   s     ""$$	$EE" 	 	 	EEE	eY'' 	# --E'NN"E'Ns   + ::	file_path
Path | strNonec                r   t          |t                    rt          |          n|}|j        }|                    dd           |                                 }d|vrd|  d}t          |          |j        dk    rG|                    d          5 }t          j
        ||d	           d
d
d
           d
S # 1 swxY w Y   d
S |j                            d          rG|                    d          5 }t          j
        ||d           d
d
d
           d
S # 1 swxY w Y   d
S | d}t          |          )zSave the agent.

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

        Example:
        ```python
        # If working with agent executor
        agent.agent.save(file_path="path/agent.yaml")
        ```
        Tparentsexist_okrs   Agent z does not support saving.jsonw   indentNz.yamlz.ymlFdefault_flow_style must be json or yaml)rv   rU   r	   parentmkdirrz   rj   suffixopenjsondumpendswithyamlr_   )r9   r{   	save_pathdirectory_path
agent_dictra   fs          r:   savezBaseSingleActionAgent.save   s    (2)S'A'APDOOOy	")TD999 YY[[
*$$94999C%c***w&&$$ 3	*a22223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3&&'899 	"$$ C	*aEBBBBC C C C C C C C C C C C C C C C C C 555CS//!$   B77B;>B;3DDDc                    i S #Return logging kwargs for tool run.r7   r8   s    r:   tool_run_logging_kwargsz-BaseSingleActionAgent.tool_run_logging_kwargs       	r=   r1   r2   r1   r>   NrB   rC   rD   r   rE   r
   r1   rF   rT   rU   rB   rC   rV   r
   r1   r   )
rc   r   rd   re   rf   rg   rE   r
   r1   r0   r1   rU   rE   r
   r1   rq   r{   r|   r1   r}   r1   rq   )__name__
__module____qualname____doc__propertyr;   rA   r   rJ   rN   rS   rb   classmethodrl   ro   r'   rz   r   r   __classcell__ry   s   @r:   r0   r0   7   s       ))   X      $    ^$   $    ^$ % % % ^ X%   8 
 8<	" " " " ["( " " " X"      X" "  "  "  "D       r=   r0   c                       e Zd ZdZedd            Zd dZe	 d!d"d            Ze	 d!d"d            Z	eedd                        Z
d#dZed$d            Zed% fd            Zd&dZd'dZ xZS )(BaseMultiActionAgentzBase Multi Action Agent class.r1   r2   c                    dgS r4   r7   r8   s    r:   r;   z"BaseMultiActionAgent.return_values   r<   r=   r>   c                    dS )zHGet allowed tools.

        Returns:
            Allowed tools.
        Nr7   r8   s    r:   rA   z&BaseMultiActionAgent.get_allowed_tools   s	     tr=   NrB   rC   rD   r   rE   r
   list[AgentAction] | AgentFinishc                    dS )a5  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.
        Nr7   rI   s       r:   rJ   zBaseMultiActionAgent.plan   rK   r=   c                
   K   dS )a;  Async 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.
        Nr7   rI   s       r:   rN   zBaseMultiActionAgent.aplan   rO   r=   c                    dS rQ   r7   r8   s    r:   rS   zBaseMultiActionAgent.input_keys  rK   r=   rT   rU   rV   r   c                \    |dk    rt          ddid          S d| d}t          |          )rX   rY   r6   z$Agent stopped due to max iterations.r[   r\   r]   r^   r`   s        r:   rb   z,BaseMultiActionAgent.return_stopped_response  sC    & !G++*PQSUVVVP8MPPPoor=   c                    t           rn   ri   r8   s    r:   ro   z BaseMultiActionAgent._agent_type1  rp   r=   rq   c                    t                                                      }t          j        t                    5  t          | j                  |d<   ddd           n# 1 swxY w Y   |S )*Return dictionary representation of agent.rs   N)rt   ru   
contextlibsuppressrj   rU   ro   r9   rE   rx   ry   s      r:   rz   zBaseMultiActionAgent.dict6  s     ""$$ !455 	3 	3 !122E'N	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3s   AA#&A#r{   r|   r}   c                r   t          |t                    rt          |          n|}|                                 }d|vrd|  d}t	          |          |j        }|                    dd           |j        dk    rG|                    d          5 }t          j
        ||d	           d
d
d
           d
S # 1 swxY w Y   d
S |j                            d          rG|                    d          5 }t          j
        ||d           d
d
d
           d
S # 1 swxY w Y   d
S | d}t          |          )a  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:
        ```python
        # If working with agent executor
        agent.agent.save(file_path="path/agent.yaml")
        ```
        rs   r   z does not support saving.Tr   r   r   r   r   Nr   Fr   r   )rv   rU   r	   rz   rj   r   r   r   r   r   r   r   r   r_   )r9   r{   r   r   ra   r   r   s          r:   r   zBaseMultiActionAgent.save>  s   " (2)S'A'APDOOOy	 YY[[
*$$:4:::C%c***")TD999w&&$$ 3	*a22223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3&&'899 	"$$ C	*aEBBBBC C C C C C C C C C C C C C C C C C 555CS//!r   c                    i S r   r7   r8   s    r:   r   z,BaseMultiActionAgent.tool_run_logging_kwargsd  r   r=   r   r   r   rB   rC   rD   r   rE   r
   r1   r   r   r   r   r   r   )r   r   r   r   r   r;   rA   r   rJ   rN   rS   rb   ro   r'   rz   r   r   r   r   s   @r:   r   r      s\       ((   X      $    ^$   $    ^$ % % % ^ X%   2 " " " X"      X$" $" $" $"L       r=   r   c                  *    e Zd ZdZedd            ZdS )	AgentOutputParserz=Base class for parsing agent output into agent action/finish.textrU   r1   rF   c                    dS )z$Parse text into agent action/finish.Nr7   r9   r   s     r:   parsezAgentOutputParser.parsel  rK   r=   N)r   rU   r1   rF   r   r   r   r   r   r   r7   r=   r:   r   r   i  s8        GG3 3 3 ^3 3 3r=   r   c                  *    e Zd ZdZedd            ZdS )	MultiActionAgentOutputParserzBase class for parsing agent output into agent actions/finish.

    This is used for agents that can return multiple actions.
    r   rU   r1   r   c                    dS )zParse text into agent actions/finish.

        Args:
            text: Text to parse.

        Returns:
            List of agent actions or agent finish.
        Nr7   r   s     r:   r   z"MultiActionAgentOutputParser.parsey  rK   r=   N)r   rU   r1   r   r   r7   r=   r:   r   r   q  s>         
    ^  r=   r   c                      e Zd ZU dZded<   	 g Zded<   g Zded<   dZded	<   	  ed
          Z	e
dd            Ze
dd            Z	 dddZ	 dddZdS )RunnableAgentAgent powered by Runnables.z)Runnable[dict, AgentAction | AgentFinish]runnabler2   input_keys_argreturn_keys_argTboolstream_runnablearbitrary_types_allowedr1   c                    | j         S r5   r   r8   s    r:   r;   zRunnableAgent.return_values       ##r=   c                    | j         S rR   r   r8   s    r:   rS   zRunnableAgent.input_keys  s     ""r=   NrB   rC   rD   r   rE   r
   rF   c                    i |d|i}d}| j         r,| j                            |d|i          D ]}||}||z  }n| j                            |d|i          }|S aP  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.
        rB   NrD   configr   r   streaminvoker9   rB   rD   rE   inputsfinal_outputchunks          r:   rJ   zRunnableAgent.plan      " FFE02DEE  	Y --fk9=U-VV * *'#(LL E)LL	*  =//Y?W/XXLr=   c                   K   i |d|i}d}| j         r2| j                            |d|i          2 3 d{V }||}||z  }6 n$| j                            |d|i           d{V }|S aR  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.
        rB   NrD   r   r   r   astreamainvoker   s          r:   rN   zRunnableAgent.aplan  s      " FFE02DEE  	  $}44#Y/  5     * * * * * * *e  '#(LL E)LL    "&!6!6#Y/ "7 " "      L    Ar   r   r   r   r   r   r   __annotations__r   r   r   r$   model_configr   r;   rS   rJ   rN   r7   r=   r:   r   r     s         %%7777/ "N""""!#O#### O     : $  L $ $ $ X$ # # # X#  $" " " " "N  $' ' ' ' ' ' 'r=   r   c                      e Zd ZU dZded<   	 g Zded<   g Zded<   dZded	<   	  ed
          Z	e
dd            Ze
dd            Z	 dddZ	 dddZdS )RunnableMultiActionAgentr   z/Runnable[dict, list[AgentAction] | AgentFinish]r   r2   r   r   Tr   r   r   r1   c                    | j         S r   r   r8   s    r:   r;   z&RunnableMultiActionAgent.return_values  r   r=   c                    | j         S )QReturn the input keys.

        Returns:
            List of input keys.
        r   r8   s    r:   rS   z#RunnableMultiActionAgent.input_keys
  s     ""r=   NrB   rC   rD   r   rE   r
   r   c                    i |d|i}d}| j         r,| j                            |d|i          D ]}||}||z  }n| j                            |d|i          }|S r   r   r   s          r:   rJ   zRunnableMultiActionAgent.plan  r   r=   c                   K   i |d|i}d}| j         r2| j                            |d|i          2 3 d{V }||}||z  }6 n$| j                            |d|i           d{V }|S r   r   r   s          r:   rN   zRunnableMultiActionAgent.aplan7  s      " FFE02DEE  	  $}44#Y/  5     * * * * * * *e  '#(LL E)LL    "&!6!6#Y/ "7 " "      L
 r   r   r   r   r   r7   r=   r:   r   r     s         %%====0 "N""""!#O#### O     : $  L $ $ $ X$ # # # X#  $" " " " "N  $( ( ( ( ( ( (r=   r   z0.1.0z1.0)messageremovalc                       e Zd ZU dZded<   	 ded<   	 ded<   	 edd	            Zed fd            Z	 dddZ		 dddZ
ddZ xZS )LLMSingleActionAgentz$Base class for single action agents.r-   	llm_chainr   output_parserr2   stopr1   c                V    t          t          | j        j                  dhz
            S )r   rB   listsetr   rS   r8   s    r:   rS   zLLMSingleActionAgent.input_keysq  s(     C1226J5KKLLLr=   rE   r
   rq   c                N    t                                                      }|d= |S r   r   rt   rz   r   s      r:   rz   zLLMSingleActionAgent.dictz  #     /"r=   NrB   rC   rD   r   rF   c                l     | j         j        d|| j        |d|}| j                            |          S )a4  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:
            Action specifying what tool to use.
        rB   r   rD   r7   )r   runr   r   r   r9   rB   rD   rE   r6   s        r:   rJ   zLLMSingleActionAgent.plan  sR    " $# 
1
 
 	
 
 !''///r=   c                |   K    | j         j        d|| j        |d| d{V }| j                            |          S )rM   r	  Nr7   )r   arunr   r   r   r  s        r:   rN   zLLMSingleActionAgent.aplan  st      " +t~* 
1
 
 	
 
 
 
 
 
 
 
 !''///r=   c                V    dt          | j                  dk    rdn| j        d         dS )r   r[   r   
llm_prefixobservation_prefix)lenr   r8   s    r:   r   z,LLMSingleActionAgent.tool_run_logging_kwargs  s5     (+DI!(;(;""1
 
 	
r=   r   r   r   r   r   )r   r   r   r   r   r   rS   r'   rz   rJ   rN   r   r   r   s   @r:   r   r   b  s          /.$$$$$)OOO%M M M XM      X  $0 0 0 0 08  $0 0 0 0 02
 
 
 
 
 
 
 
r=   r   c                      e Zd ZU dZded<   	 ded<   	 dZded<   	 ed6 fd            Zd7dZe	d8d            Z
e	d8d            Zd9dZ	 d:d;dZ	 d:d;dZd<dZe	d8d            Z ed          d=d!            Ze	ed>d#                        Ze	ed>d$                        Zeed?d(                        Zed@d*            ZeedAd+                        Ze	 	 dBdCd1            ZdDd4ZdEd5Z xZS )FAgentzAgent 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_toolsrE   r
   r1   rq   c                N    t                                                      }|d= |S r  r  r   s      r:   rz   z
Agent.dict  r  r=   c                    | j         S )r@   )r  r8   s    r:   rA   zAgent.get_allowed_tools  s    !!r=   r2   c                    dgS r4   r7   r8   s    r:   r;   zAgent.return_values  r<   r=   c                r    d| j                                          d| j                                          gS )N
z
	)r  rstripr8   s    r:   _stopzAgent._stop  sB     4(//113354*113355
 	
r=   rB   rC   str | list[BaseMessage]c                \    d}|D ]&\  }}||j         z  }|d| j         | d| j         z  }'|S )zJConstruct the scratchpad that lets the agent continue its thought process.r[   r  )logr  r  )r9   rB   thoughtsactionobservations        r:   _construct_scratchpadzAgent._construct_scratchpad  sW    
 #5 	W 	WFK
"HVT4VkVVT_VVVHHr=   rD   r   rF   c                z     | j         |fi |} | j        j        dd|i|}| j                            |          S )rH   rD   r7   )get_full_inputsr   predictr   r   r9   rB   rD   rE   full_inputsfull_outputs         r:   rJ   z
Agent.plan  sU    " +d*+=HHHH,dn,PPyPKPP!''444r=   c                   K    | j         |fi |} | j        j        dd|i| d{V }| j                            |           d{V S )rM   rD   Nr7   )r%  r   apredictr   aparser'  s         r:   rN   zAgent.aplan  s}      " +d*+=HHHH3DN3WWiW;WWWWWWWW'..{;;;;;;;;;r=   builtins.dict[str, Any]c                L    |                      |          }|| j        d}i ||S )a!  Create 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:
            Full inputs for the LLMChain.
        agent_scratchpadr   )r#  r  )r9   rB   rE   r   
new_inputss        r:   r%  zAgent.get_full_inputs  s7     --.@AA*2DJGG
'&'J''r=   c                V    t          t          | j        j                  dhz
            S )rR   r0  r  r8   s    r:   rS   zAgent.input_keys.  s(     C1226H5IIJJJr=   aftermoder&   c                r   | j         j        }d|j        vrt                              d           |j                            d           t          |t                    r|xj        dz  c_        nGt          |t                    r|xj
        dz  c_
        n!dt          |           }t          |          | S )aC  Validate that prompt matches format.

        Args:
            values: Values to validate.

        Returns:
            Validated values.

        Raises:
            ValueError: If `agent_scratchpad` is not in prompt.input_variables
                and prompt is not a FewShotPromptTemplate or a PromptTemplate.
        r0  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appendrv   r   templater   r   typer_   )r9   r7  ra   s      r:   validate_promptzAgent.validate_prompt3  s     &V%;;;NN=   "))*<===&.11 &#99F$9:: &!77BDLLBB oo%r=   rU   c                    dS )z&Prefix to append the observation with.Nr7   r8   s    r:   r  zAgent.observation_prefixQ  rK   r=   c                    dS )z#Prefix to append the LLM call with.Nr7   r8   s    r:   r  zAgent.llm_prefixV  rK   r=   rd   re   r   c                    dS )zCreate a prompt for this class.

        Args:
            tools: Tools to use.

        Returns:
            Prompt template.
        Nr7   rk   rd   s     r:   create_promptzAgent.create_prompt[  rK   r=   r}   c                    dS )zgValidate that appropriate tools are passed in.

        Args:
            tools: Tools to use.
        Nr7   rB  s     r:   _validate_toolszAgent._validate_toolsg  rK   r=   c                    dS )z)Get default output parser for this class.Nr7   )rk   rE   s     r:   _get_default_output_parserz Agent._get_default_output_parsero  rK   r=   rc   r   rf   rg   AgentOutputParser | Nonec                    |                      |           t          ||                     |          |          }d |D             }|p|                                 } | d|||d|S )aH  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 object.
        )rc   r7  rf   c                    g | ]	}|j         
S r7   name.0tools     r:   
<listcomp>z,Agent.from_llm_and_tools.<locals>.<listcomp>  s    222Ddi222r=   )r   r  r   r7   )rE  r-   rC  rG  )	rk   rc   rd   rf   r   rE   r   
tool_names_output_parsers	            r:   rl   zAgent.from_llm_and_toolst  s    * 	E"""$$U++-
 
 
	
 32E222
&J#*H*H*J*Js 
$(
 
 	
 
 	
r=   rT   r   c                   |dk    rt          ddid          S |dk    rd}|D ]&\  }}||j        z  }|d| j         | d| j         z  }'|dz  }|| j        d}i ||} | j        j        di |}	| j                            |	          }
t          |
t                     r|
S t          d|	i|	          S d	| }t          |          )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:
            Agent finish object.

        Raises:
            ValueError: If `early_stopping_method` is not in ['force', 'generate'].
        rY   r6   rZ   r[   generater  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 Nr7   )r   r  r  r  r  r   r&  r   r   rv   r_   )r9   rT   rB   rE   r   r!  r"  r1  r(  r)  parsed_outputra   s               r:   rb   zAgent.return_stopped_response  s;   ( !G++PQ   !J..H'9  #FJ&R0R+RRRR VH /7
KKJ2V2z2K0$.0??;??K .44[AAM-55 %$$ +6DDD+(+ + 	 oor=   c                     | j         | j        dS )r   r  r  r8   s    r:   r   zAgent.tool_run_logging_kwargs  s     /"&"9
 
 	
r=   r   r   r   )rB   rC   r1   r  r   r   )rB   rC   rE   r
   r1   r-  r1   r&   r   )rd   re   r1   r   )rd   re   r1   r}   )rE   r
   r1   r   )NN)rc   r   rd   re   rf   rg   r   rH  rE   r
   r1   r  )rT   rU   rB   rC   rE   r
   r1   r   r   )r   r   r   r   r   r  r'   rz   rA   r   r;   r  r#  rJ   rN   r%  rS   r%   r>  r   r  r  r   rC  rE  rG  rl   rb   r   r   r   s   @r:   r  r    s          $$$$$)&*M****H     X" " " "    X 
 
 
 X
	 	 	 	  $5 5 5 5 50  $< < < < <*( ( ( (& K K K XK _'"""   #": 5 5 5 ^ X5 2 2 2 ^ X2    ^ [    [ 8 8 8 ^ [8 
 8<26!
 !
 !
 !
 [!
F5 5 5 5n
 
 
 
 
 
 
 
r=   r  c                  l    e Zd ZU dZdZded<   	 dZded<   	 e	 ddd            Ze	 ddd            Z	dS )ExceptionToolz!Tool that just returns the query.
_ExceptionrU   rL  zException tooldescriptionNqueryrun_manager CallbackManagerForToolRun | Noner1   c                    |S r   r7   r9   r\  r]  s      r:   _runzExceptionTool._run  s	     r=   %AsyncCallbackManagerForToolRun | Nonec                
   K   |S r   r7   r`  s      r:   _arunzExceptionTool._arun  s       r=   r   )r\  rU   r]  r^  r1   rU   )r\  rU   r]  rb  r1   rU   )
r   r   r   r   rL  r   r[  r'   ra  rd  r7   r=   r:   rY  rY    s         ++D'K''''" 9=    X  >B    X  r=   rY  c                  d   e Zd ZU dZded<   	 ded<   	 dZded<   	 d	Zd
ed<   	 dZded<   	 dZded<   	 dZ	ded<   	 dZ
ded<   	 e	 didjd            Z ed          dkd             Z ed!          edld$                        Zedmd&            Zednd*            Zdnd+Z	 diddd,dod1Zedpd3            Zedpd4            Zdqd7Zdrd<Z	 didsdDZ	 didtdFZdudIZ	 didvdOZ	 didwdQZ	 didxdUZ	 didydVZ 	 didzdXZ!	 did{dYZ"	 did|dZZ#	 did}d[Z$d~d_Z%dd`Z&e	 diddf            Z'e	 diddh            Z(dS )AgentExecutorzAgent that is using tools.7BaseSingleActionAgent | BaseMultiActionAgent | Runnableagentre   rd   Fr   return_intermediate_steps   z
int | Nonemax_iterationsNzfloat | Nonemax_execution_timerY   rU   rT   z3bool | str | Callable[[OutputParserException], str]handle_parsing_errorszNint | Callable[[list[tuple[AgentAction, str]]], list[tuple[AgentAction, str]]]trim_intermediate_stepsrD   r   rE   r
   r1   c                     | d|||d|S )zCreate from agent and tools.

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

        Returns:
            Agent executor object.
        )rh  rd   rD   r7   r7   )rk   rh  rd   rD   rE   s        r:   from_agent_and_toolsz"AgentExecutor.from_agent_and_tools"  s5    & s 

 
 	
 
 	
r=   r3  r4  r&   c                    | j         }| j        }|                                }|?t          |          d |D             k    r"d| dd |D              d}t	          |          | S )zValidate that tools are compatible with agent.

        Args:
            values: Values to validate.

        Returns:
            Validated values.

        Raises:
            ValueError: If allowed tools are different than provided tools.
        Nc                    h | ]	}|j         
S r7   rK  rM  s     r:   	<setcomp>z/AgentExecutor.validate_tools.<locals>.<setcomp>L  s-     @
 @
 @
DI@
 @
 @
r=   zAllowed tools (z!) different than provided tools (c                    g | ]	}|j         
S r7   rK  rM  s     r:   rP  z0AgentExecutor.validate_tools.<locals>.<listcomp>Q  s    #@#@#@$DI#@#@#@r=   ))rh  rd   rA   r  r_   )r9   rh  rd   r  ra   s        r:   validate_toolszAgentExecutor.validate_tools<  s     

//11$]);); @
 @
"'@
 @
 @
 *
 *
D- D D#@#@%#@#@#@D D D  S//!r=   beforevaluesrz   c                   |                     d          }|rt          |t                    r	 |j        }|t          t
                   t          z  k    }n9# t          $ r d}Y n+t          $ r t          
                    d           d}Y nw xY w|                    dd          }|rt          ||          |d<   nt          ||          |d<   |S )zConvert runnable to agent if passed in.

        Args:
            values: Values to validate.

        Returns:
            Validated values.
        rh  Fz.Unexpected error getting OutputType from agentr   T)r   r   )getrv   r   
OutputTyper  r   r   	TypeError	Exceptionr9  	exceptionpopr   r   )rk   ry  rh  output_typemulti_actionr   s         r:   validate_runnable_agentz%AgentExecutor.validate_runnable_agentV  s    

7## 	Zx00 	N#.  +d;.?+.MM  % % %$ % % %  !QRRR$% %jj):DAAO 	":"$3# # #w
 #0"$3# # #w s   A B
"%B
	B
,BaseSingleActionAgent | BaseMultiActionAgentc                n    t          | j        t                    rt          d| j                  S | j        S )aC  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.
        RunnableAgentType)rv   rh  r   r   r8   s    r:   _action_agentzAgentExecutor._action_agentz  s3     dj(++ 	9+TZ888zr=   r{   r|   r}   c                $    d}t          |          )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(...)`)r_   )r9   r{   ra   s      r:   r   zAgentExecutor.save  s    ! 	
 oor=   c                6    | j                             |          S )zZSave the underlying agent.

        Args:
            file_path: Path to save to.
        )r  r   )r9   r{   s     r:   
save_agentzAgentExecutor.save_agent  s     !&&y111r=   )include_run_infoasync_r   r  r  r)   c               4    t          | ||| j        |          S )aP  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:
            Agent executor iterator object.
        )tagsr  )r)   r  )r9   r   rD   r  r  s        r:   iterzAgentExecutor.iter  s,    & %-
 
 
 	
r=   r2   c                    | j         j        S r   )r  rS   r8   s    r:   rS   zAgentExecutor.input_keys  s     !,,r=   c                H    | j         rg | j        j        dS | j        j        S )zReturn the singular output key.rB   )ri  r  r;   r8   s    r:   output_keyszAgentExecutor.output_keys  s3     ) 	MLT'5L7KLL!//r=   rL  r!   c                0    d | j         D             |         S )zwLookup tool by name.

        Args:
            name: Name of tool.

        Returns:
            Tool object.
        c                    i | ]
}|j         |S r7   rK  rM  s     r:   
<dictcomp>z-AgentExecutor.lookup_tool.<locals>.<dictcomp>  s    777D	4777r=   )rd   )r9   rL  s     r:   lookup_toolzAgentExecutor.lookup_tool  s     87DJ777==r=   
iterationsinttime_elapsedfloatc                R    | j         || j         k    rdS | j        d u p
|| j        k     S )NF)rk  rl  )r9   r  r  s      r:   _should_continuezAgentExecutor._should_continue  s8    *zT=P/P/P5&$.X,AX2XXr=   r6   r   rB   r  r]  !CallbackManagerForChainRun | Nonedict[str, Any]c                j    |r|                     |d| j                   |j        }| j        r||d<   |S Ngreen)colorverboserB   on_agent_finishr  r;   ri  r9   r6   rB   r]  r   s        r:   _returnzAgentExecutor._return  sO      	U''gt|'TTT+) 	D1CL-.r=   &AsyncCallbackManagerForChainRun | Nonec                z   K   |r#|                     |d| j                   d {V  |j        }| j        r||d<   |S r  r  r  s        r:   _areturnzAgentExecutor._areturn  s}        	-- .         
 +) 	D1CL-.r=   NextStepOutput+AgentFinish | list[tuple[AgentAction, str]]c                    t          |d         t                    r,t          |          dk    rd}t          |          |d         S d |D             S )Nrn     z>Expected a single AgentFinish output, but got multiple values.c                T    g | ]%}t          |t                    |j        |j        f&S r7   )rv   r   r!  r"  rN  as     r:   rP  z4AgentExecutor._consume_next_step.<locals>.<listcomp>  s0    VVVaZ9=U=UV1=)VVVr=   )rv   r   r  r_   )r9   ry  ra   s      r:   _consume_next_stepz AgentExecutor._consume_next_step  sZ     fRj+.. 	6{{aV oo%":VV6VVVVr=   name_to_tool_mapdict[str, BaseTool]color_mappingdict[str, str]rC   c                t    |                      t          |                     |||||                              S r   )r  r  _iter_next_stepr9   r  r  r   rB   r]  s         r:   _take_next_stepzAgentExecutor._take_next_step  sK     &&$$$!&  

 

 
	
r=   /Iterator[AgentFinish | AgentAction | AgentStep]c              #    K   	 |                      |          } | j        j        |fd|r|                                ndi|}n# t          $ r}t          | j        t                    r	| j         }nd}|rd|}	t          |	          |t          |          }
t          | j        t                    r3|j
        r)t          |j                  }t          |j                  }
nad}n^t          | j        t                    r| j        }n<t          | j                  r|                     |          }nd}	t          |	          |t          d||
          }|r|                    |d	           | j                                        } t#                      j        |j        f| j        d|r|                                ndd
|}t+          ||          V  Y d}~dS d}~ww xY wt          |t,                    r|V  dS t          |t                    r|gn|}|D ]}|V  |D ]}|                     ||||          V  dS )Take a single step in the thought-action-observation loop.

        Override this to take control of how the agent makes and acts on choices.
        rD   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`rZ  r  r  r  r  rD   r!  r"  )_prepare_intermediate_stepsr  rJ   	get_childr   rv   rm  r   r_   rU   send_to_llmr"  
llm_outputcallabler   on_agent_actionr   rY  r
  
tool_inputr  r   r   _perform_agent_action)r9   r  r  r   rB   r]  r6   eraise_errorra   r   r"  tool_run_kwargsactionsagent_actions                  r:   r  zAgentExecutor._iter_next_step  s     0	!%!A!ABT!U!U -T'," 5@J+//111d  FF
 % '	 '	 '	$4d;; $"&"<<# -0 +,0 0  !oo1,q66D$4d;; -= C"%am"4"4Kq|,,DD"BKKD6<< -"8$455 -"88;;F oo1, {DAAF C++F'+BBB"0HHJJO--//-!5@J+//111d	 
 " K 6{CCCCCCFFFFFO'	T fk** 	LLLF )==I6((6# 	 	L# 	 	L,, 	     	 	s   A A G&F
G!!G&r  r   r   c                B   |r|                     |d           |j        |v rt||j                 }|j        }||j                 }| j                                        }|rd|d<    |j        |j        f| j        ||r|                                nd d|}	ny| j                                        } t                      j        |j        t          |                                          df| j        d |r|                                nd d|}	t          ||	          S )Nr  r  r[   r  r  requested_tool_nameavailable_tool_namesr  )r  rO  return_directr  r   r
  r  r  r  r+   r  keysr   
r9   r  r  r  r]  rO  r  r  r  r"  s
             r:   r  z#AgentExecutor._perform_agent_actiond  so     	E''G'DDD 000#L$56D .M!,"34E"0HHJJO 302-"$('5@J+//111d	 
 " KK #0HHJJO++--++7+<,01A1F1F1H1H,I,I 	
 5@J+//111d	 	 "	 	K +FFFFr=   c           
     ~   K   |                      d |                     |||||          2              d {V           S )Nc                $   K   g | 3 d {V 	 }|6 S r   r7   r  s     r:   rP  z2AgentExecutor._atake_next_step.<locals>.<listcomp>  sO       	 	 	 	 	 	 	 	 	 	 	 	 	s   )r  _aiter_next_stepr  s         r:   _atake_next_stepzAgentExecutor._atake_next_step  sy       &&	 	#44$!&   	 	 	 	 	 	 	 	 	
 
 	
r=   4AsyncIterator[AgentFinish | AgentAction | AgentStep]c                  K   	                       |          }  j        j        |fdr                                ndi| d{V }n# t          $ r}t           j        t                    r	 j         }nd}|rd|}	t          |	          |t          |          }
t           j        t                    r3|j
        r)t          |j                  }t          |j                  }
nad}n^t           j        t                    r j        }n<t           j                  r                     |          }nd}	t          |	          |t          d||
          } j                                        } t!                      j        |j        f j        dr                                ndd| d{V }t)          ||	          W V  Y d}~dS d}~ww xY wt          |t*                    r|W V  dS t          |t                    r|gn|}|D ]}|W V  t-          j         fd
|D               d{V }|D ]}|W V  dS )r  rD   NFr  r  r  rZ  r  r  c                @    g | ]}                     |          S r7   )_aperform_agent_action)rN  r  r  r  r]  r9   s     r:   rP  z2AgentExecutor._aiter_next_step.<locals>.<listcomp>  sG        ! ++$! 	   r=   )r  r  rN   r  r   rv   rm  r   r_   rU   r  r"  r  r  r   r   rY  r  r  r  r   r   asynciogather)r9   r  r  r   rB   r]  r6   r  r  ra   r   r"  r  r  r  resultr   s   ```  `           r:   r  zAgentExecutor._aiter_next_step  sa     .	!%!A!ABT!U!U 44-3" 5@J+//111d        FF
 % %	 %	 %	$4d;; $"&"<<# -0 +,0 0  !oo1,q66D$4d;; -= C"%am"4"4Kq|,,DD"BKKD6<< -"8$455 -"88;;F oo1, {DAAF"0HHJJO 4 4!!5@J+//111d	! !
 "! !      K 6{CCCCCCCFFFFFK%	P fk** 	LLLLF )==I6((6# 	 	L ~       %,  

 

 

 

 

 

 

  	 	EKKKKK	 	s   AA GE8GGc                v  K   |r#|                     || j        d           d {V  |j        |v rz||j                 }|j        }||j                 }| j                                        }|rd|d<    |j        |j        f| j        ||r|                                nd d| d {V }	n| j                                        } t                      j        |j        t          |                                          df| j        d |r|                                nd d| d {V }	t          ||	          S )Nr  )r  r  r[   r  r  r  r  )r  r  rO  r  r  r   r  r  r  r+   r  r  r   r  s
             r:   r  z$AgentExecutor._aperform_agent_action  s       	-- .           000#L$56D .M!,"34E"0HHJJO 302- )	'!5@J+//111d	! !
 "! !      KK #0HHJJO 2 2+7+<,01A1F1F1H1H,I,I 	!
 5@J+//111d	! 	! "	! 	! 	 	 	 	 	 	K +FFFFr=   c                   d | j         D             }t          d | j         D             ddg          }g }d}d}t          j                    }|                     ||          r|                     |||||          }	t          |	t                    r|                     |	||          S |                    |	           t          |	          d	k    r7|	d         }
| 
                    |
          }||                     |||          S |d	z  }t          j                    |z
  }|                     ||           | j        j        | j        |fi |}|                     |||          S )
z(Run text through and get agent response.c                    i | ]
}|j         |S r7   rK  rM  s     r:   r  z'AgentExecutor._call.<locals>.<dictcomp>)      CCCDItCCCr=   c                    g | ]	}|j         
S r7   rK  rM  s     r:   rP  z'AgentExecutor._call.<locals>.<listcomp>,      ...4TY...r=   r  redexcluded_colorsr           r]  r  )rd   r"   timer  r  rv   r   r  extendr  _get_tool_returnr  rb   rT   r9   r   r]  r  r  rB   r  r  
start_timenext_step_outputnext_step_actiontool_returnr6   s                r:   _callzAgentExecutor._call"  s    DC
CCC)..4:...$e,
 
 
 =?
Y[[
##J== 	4#33 "'  4     *K88 ||$& + $    %%&6777#$$))#3A#6 "334DEE*<<#*$/ (   
 !OJ9;;3L7 ##J== 	48 <#;&
 
 
 

 ||F$6K|PPPr=   c                |  K   d | j         D             }t          d | j         D             dg          }g }d}d}t          j                    }	 t          | j                  4 d{V  |                     ||          r|                     |||||           d{V }	t          |	t                    r0| 	                    |	||           d{V cddd          d{V  S |
                    |	           t          |	          d	k    rO|	d         }
|                     |
          }|0| 	                    |||           d{V cddd          d{V  S |d	z  }t          j                    |z
  }|                     ||           | j        j        | j        |fi |}| 	                    |||           d{V cddd          d{V  S # 1 d{V swxY w Y   dS # t           t"          j        f$ r:  | j        j        | j        |fi |}| 	                    |||           d{V cY S w xY w)
z.Async run text through and get agent response.c                    i | ]
}|j         |S r7   rK  rM  s     r:   r  z(AgentExecutor._acall.<locals>.<dictcomp>_  r  r=   c                    g | ]	}|j         
S r7   rK  rM  s     r:   rP  z(AgentExecutor._acall.<locals>.<listcomp>b  r  r=   r  r  r   r  Nr  r  )rd   r"   r  r.   rl  r  r  rv   r   r  r  r  r  r  rb   rT   TimeoutErrorr  r  s                r:   _acallzAgentExecutor._acallX  sR      DC
CCC)..4:...$I
 
 
 =?
Y[[
4	&t'>?? ' ' ' ' ' ' ' '++JEE <-1-B-B(%*$/ .C . . ( ( ( ( ( ($ ""2K@@ %)]],.(3 &3 & &            ' ' ' ' ' ' ' ' ' ' ' ' ' '  '--.>???+,,11+;A+>(&*&;&;<L&M&M&2)- + 2,7 *7 * * $ $ $ $ $ $-' ' ' ' ' ' ' ' ' ' ' ' ' '8 !OJ#'9;;#;L9 ++JEE <: D+C.&   
 "]]& + +        G' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'P g23 	 	 	?T'?*"   F
 "' '           	sR   G+ )A*GG+ &A$G
G+ A(GG+ 
G""G+ %G"&G+ +AH;:H;r  tuple[AgentAction, str]AgentFinish | Nonec                    |\  }}d | j         D             }d}t          | j        j                  dk    r| j        j        d         }|j        |v r$||j                 j        rt          ||id          S dS )z&Check if the tool is a returning tool.c                    i | ]
}|j         |S r7   rK  rM  s     r:   r  z2AgentExecutor._get_tool_return.<locals>.<dictcomp>  r  r=   r6   r   r[   N)rd   r  r  r;   rO  r  r   )r9   r  r  r"  r  return_value_keys         r:   r  zAgentExecutor._get_tool_return  s    
 %5!kCC
CCC#t!/00144#1?B !111 !23A 2 !;/   tr=   c                    t          | j        t                    r| j        dk    r|| j         d          S t          | j                  r|                     |          S |S )Nr   )rv   ro  r  r  )r9   rB   s     r:   r  z)AgentExecutor._prepare_intermediate_steps  sn    
 t3S99	G,q00%t'C&C&E&EFFD011 	D//0BCCC!!r=   inputdict[str, Any] | Anyr   RunnableConfig | NoneIterator[AddableDict]c           	   +     K   t          |          }t          | ||                    d          f|                    d          |                    d          |                    d          |                    d          dd|}|E d{V  dS )	zEnables streaming over steps taken to reach final output.

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

        Yields:
            Addable dictionary.
        rD   r  metadatarun_namerun_idTr  r  r  r	  yield_actionsNr   r)   r{  )r9   r  r   rE   iterators        r:   r   zAgentExecutor.stream  s      " v&&(JJ{##

 F##ZZ
++ZZ
++::h''

 

 

 

 r=   AsyncIterator[AddableDict]c           	    0  K   t          |          }t          | ||                    d          f|                    d          |                    d          |                    d          |                    d          dd|}|2 3 d{V }|W V  6 dS )	zAsync enables streaming over steps taken to reach final output.

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

        Yields:
            Addable dictionary.
        rD   r  r  r  r	  Tr
  Nr  )r9   r  r   rE   r  steps         r:   r   zAgentExecutor.astream  s      " v&&(JJ{##

 F##ZZ
++ZZ
++::h''

 

 

 

 # 	 	 	 	 	 	 	$JJJJJ #((s   Br   )
rh  rg  rd   re   rD   r   rE   r
   r1   rf  rW  )ry  rz   r1   r
   )r1   r  r   )
r   r
   rD   r   r  r   r  r   r1   r)   r   )rL  rU   r1   r!   )r  r  r  r  r1   r   )r6   r   rB   r  r]  r  r1   r  )r6   r   rB   r  r]  r  r1   r  )ry  r  r1   r  )r  r  r  r  r   r  rB   rC   r]  r  r1   r  )r  r  r  r  r   r  rB   rC   r]  r  r1   r  )
r  r  r  r  r  r   r]  r  r1   r   )r  r  r  r  r   r  rB   rC   r]  r  r1   r  )r  r  r  r  r   r  rB   rC   r]  r  r1   r  )
r  r  r  r  r  r   r]  r  r1   r   )r   r  r]  r  r1   r  )r   r  r]  r  r1   r  )r  r  r1   r  )rB   rC   r1   rC   )r  r  r   r  rE   r
   r1   r  )r  r  r   r  rE   r
   r1   r  ))r   r   r   r   r   ri  rk  rl  rT   rm  ro  r   rq  r%   rw  r  r   r  r'   r   r  r  rS   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r7   r=   r:   rf  rf    sC        $$BBBB3-&+++++3!#N####9 (,++++ ")(((( RWVVVV 	      
  $	
 
 
 
 [
2 _'"""   #"2 _(###      [ $# D    X    X 2 2 2 2  $

 "'
 
 
 
 
 
6 - - - X- 0 0 0 X0	> 	> 	> 	>Y Y Y Y :>	    " ?C	    "	W 	W 	W 	W" :>
 
 
 
 
4 :>M M M M Mh :>%G %G %G %G %GZ ?C
 
 
 
 
6 ?CU U U U Ux ?C)G )G )G )G )G\ :>4Q 4Q 4Q 4Q 4Qr ?CG G G G GR   *" " " "  )-    X<  )-    X  r=   rf  )`r   
__future__r   r  builtinsr   r   loggingr  abcr   collections.abcr   r   r   r   pathlibr	   typingr
   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_classic._api.deprecationr(   'langchain_classic.agents.agent_iteratorr)   $langchain_classic.agents.agent_typesr*   langchain_classic.agents.toolsr+   langchain_classic.chains.baser,   langchain_classic.chains.llmr-   #langchain_classic.utilities.asyncior.   	getLoggerr   r9  r0   r   r   r  r   r   r   r   r  rY  r  r  rf  r7   r=   r:   <module>r0     sl   K K " " " " " "                G G G G G G G G G G G G             
  * * * * * * E E E E E E E E E E                < ; ; ; ; ; < < < < < < / / / / / / : : : : : : 5 5 5 5 5 5 A A A A A A 8 8 8 8 8 8 L L L L L L L L L L 6 6 6 6 6 6 ) ) ) ) ) ) 8 8 8 8 8 8 ; ; ; ; ; ; ; ; ; ; , , , , , , , , H H H H H H I I I I I I : : : : : : 6 6 6 6 6 6 / / / / / / 1 1 1 1 1 1 ? ? ? ? ? ?		8	$	$c c c c cI c c cLI I I I I9 I I IX3 3 3 3 3({)BC 3 3 3    T+&45  (i i i i i) i i iXn n n n n3 n n nb %  
Q
 Q
 Q
 Q
 Q
0 Q
 Q
 
Q
h %  
T
 T
 T
 T
 T
! T
 T
 
T
n    H   2 kK/);<!$<< L L L L LE L L L L Lr=   