
    3fis                        d Z ddl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mZ dd
lmZ ddlmZ ddlmZ ddlmZ  eded      	 	 	 	 ddddee   dededz  de	dz  dedz  dedz  dee   dz  dedefd       Zy)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                t   |rt        |      ng }||t        j                  }||d}	t        |	      ||t        vr&d| dt	        j
                          d}	t        |	      |j                  t        |t              r|j                  n|       t        |   }
|xs i } |
j                  || fd|i|}n\|Mt        ||| |      }t        j                  t              5  |j                  |j                         ddd       nd}	t        |	      t        j                   d
|| ||d	|S # 1 sw Y   #xY w)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               a/var/www/auto_recruiter/arenv/lib/python3.12/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0I00
 .
 	
	 
	-	
	   !45 	0LL../	0 	0
 X 	 o-- )	
  	0 	0s   "D..D7)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=   