Load an agent executor given tools and LLM. Simplified version of langchain.agents.initialize.initialize_agent
(
llm: BaseLanguageModel,
tools: Sequence[BaseTool],
prompt: BasePromptTemplate,
verbose: bool = False,
agent_kwargs: dict[str, Any] = {},
)
| 42 | |
| 43 | |
| 44 | def initialize_react_agent_executor( |
| 45 | llm: BaseLanguageModel, |
| 46 | tools: Sequence[BaseTool], |
| 47 | prompt: BasePromptTemplate, |
| 48 | verbose: bool = False, |
| 49 | agent_kwargs: dict[str, Any] = {}, |
| 50 | ): |
| 51 | """Load an agent executor given tools and LLM. |
| 52 | Simplified version of langchain.agents.initialize.initialize_agent |
| 53 | """ |
| 54 | agent = ReActDocstoreAgentForWiki.from_llm_and_tools( |
| 55 | llm=llm, |
| 56 | tools=tools, |
| 57 | prompt=prompt, |
| 58 | human_message_template=agent_kwargs.get("human_message_template", None), |
| 59 | input_variables=agent_kwargs.get("input_variables", None), |
| 60 | ) |
| 61 | agent_executor = AgentExecutor.from_agent_and_tools( |
| 62 | agent=agent, tools=tools, verbose=verbose |
| 63 | ) |
| 64 | return agent_executor |
no test coverage detected