
    KKis                        S r SSK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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S9    SSS.S\\   S\S\S-  S\	S-  S\S-  S\S-  S\\   S-  S\S\4S jjj5       rg)zLoad agent.    N)Sequence)Any)
deprecated)BaseCallbackManager)BaseLanguageModel)BaseTool)AGENT_DEPRECATION_WARNING)AgentExecutor)	AgentType)
load_agent)AGENT_TO_CLASSz0.1.0z1.0)messageremoval)tagstoolsllmagentcallback_manager
agent_pathagent_kwargsr   kwargsreturnc                   U(       a  [        U5      O/ nUc  Uc  [        R                  nUb  Ub  Sn	[        U	5      eUb  U[        ;  a'  SU S[        R
                  " 5        S3n	[        U	5      eUR                  [        U[        5      (       a  UR                  OU5        [        U   n
U=(       d    0 nU
R                  " UU 4SU0UD6nO[UbK  [        UUU US9n[        R                  " [        5         UR                  UR                  5        SSS5        OSn	[        U	5      e[        R                   " S
UU UUS	.UD6$ ! , (       d  f       N)= f)a  Load an agent executor given tools and LLM.

Args:
    tools: List of tools this agent has access to.
    llm: Language model to use as the agent.
    agent: Agent type to use. If `None` and agent_path is also None, will default
        to AgentType.ZERO_SHOT_REACT_DESCRIPTION.
    callback_manager: CallbackManager to use. Global callback manager is used if
        not provided.
    agent_path: Path to serialized agent to use. If `None` and agent is also None,
        will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION.
    agent_kwargs: Additional keyword arguments to pass to the underlying agent.

    tags: Tags to apply to the traced runs.
    kwargs: Additional keyword arguments passed to the agent executor.

Returns:
    An agent executor.

Raises:
    ValueError: If both `agent` and `agent_path` are specified.
    ValueError: If `agent` is not a valid agent type.
    ValueError: If both `agent` and `agent_path` are None.
NzLBoth `agent` and `agent_path` are specified, but at most only one should be.zGot unknown agent type: z. Valid types are: .r   )r   r   r   zISomehow both `agent` and `agent_path` are None, this should never happen.)r   r   r   r    )listr   ZERO_SHOT_REACT_DESCRIPTION
ValueErrorr   keysappend
isinstancevaluefrom_llm_and_toolsr   
contextlibsuppressNotImplementedError_agent_typer
   from_agent_and_tools)r   r   r   r   r   r   r   r   tags_msg	agent_cls	agent_objs               e/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langchain_classic/agents/initialize.pyinitialize_agentr.      s|   P DJBE}+55Z3. 	 o&*5' 2$$2$7$7$9#:!=  S/!Jui$@$@U[[eL"5)	#)r00
 .
 	
	 
	-	
	   !45LL../ 65
 X 	 o-- )	
   65s   8E
E)NNNN)__doc__r$   collections.abcr   typingr   langchain_core._apir   langchain_core.callbacksr   langchain_core.language_modelsr   langchain_core.toolsr   "langchain_classic._api.deprecationr	   langchain_classic.agents.agentr
   $langchain_classic.agents.agent_typesr    langchain_classic.agents.loadingr   langchain_classic.agents.typesr   strdictr.   r       r-   <module>r>      s      $  * 8 < ) H 8 : 7 9 % #37! $Q "&QHQ	Q tQ *D0	Q
 d
Q +Q 3-$
Q Q Q
Qr=   