HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/langchain/agents/__pycache__/initialize.cpython-310.pyc
o

���g�
�@s�dZddlmZmZmZddlmZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZdd
lmZmZededd
�				ddd�deede
deedeedeedeedeeededefdd��ZdS)zLoad agent.�)�Any�Optional�Sequence)�
deprecated)�BaseCallbackManager)�BaseLanguageModel)�BaseTool)�AGENT_DEPRECATION_WARNING)�
AgentExecutor)�	AgentType)�AGENT_TO_CLASS�
load_agentz0.1.0z1.0)�message�removalN)�tags�tools�llm�agent�callback_manager�
agent_path�agent_kwargsr�kwargs�returncKs
|rt|�ng}|dur|durtj}|dur|durtd��|durV|tvr4td|�dt���d���|�t|t�r>|jn|�t|}	|pHi}|	j	||fd|i|��}
n"|durtt
||||d�}
z|�|
j�Wn
tysYnwtd��t
jd
|
|||d	�|��S)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. Defaults to None.
        callback_manager: CallbackManager to use. Global callback manager is used if
            not provided. Defaults to None.
        agent_path: Path to serialized agent to use. If None and agent is also None,
            will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION. Defaults to None.
        agent_kwargs: Additional keyword arguments to pass to the underlying agent.
            Defaults to None.
        tags: Tags to apply to the traced runs. Defaults to None.
        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.zGot unknown agent type: z. Valid types are: �.r)rrrzISomehow both `agent` and `agent_path` are None, this should never happen.)rrrr�)�listr�ZERO_SHOT_REACT_DESCRIPTION�
ValueErrorr�keys�append�
isinstance�value�from_llm_and_toolsr
�_agent_type�NotImplementedErrorr
�from_agent_and_tools)rrrrrrrr�tags_�	agent_cls�	agent_objrr�F/usr/local/lib/python3.10/dist-packages/langchain/agents/initialize.py�initialize_agentsX(�����������r*)NNNN)�__doc__�typingrrr�langchain_core._apir�langchain_core.callbacksr�langchain_core.language_modelsr�langchain_core.toolsr�langchain._api.deprecationr	�langchain.agents.agentr
�langchain.agents.agent_typesr�langchain.agents.loadingrr
�str�dictr*rrrr)�<module>sP���������
�	�
�