Toggle Menu
Prev Up Next

# `langchain.agents.agent_toolkits.vectorstore.base`.create_vectorstore_router_agent

langchain.agents.agent_toolkits.vectorstore.base.create_vectorstore_router_agent(llm: BaseLanguageModel, toolkit: VectorStoreRouterToolkit, callback_manager: Optional[BaseCallbackManager] = None, prefix: str = 'You are an agent designed to answer questions.\nYou have access to tools for interacting with different sources, and the inputs to the tools are questions.\nYour main task is to decide which of the tools is relevant for answering question at hand.\nFor complex questions, you can break the question down into sub questions and use tools to answers the sub questions.\n', verbose: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Any) → AgentExecutor

  Construct a VectorStore router agent from an LLM and tools.

  Parameters

    - llm (BaseLanguageModel) – LLM that will be used by the agent

    - toolkit (VectorStoreRouterToolkit) – Set of tools for the agent which have routing capability with multiple vector stores

    - callback_manager (Optional[BaseCallbackManager], optional) – Object to handle the callback [ Defaults to None. ]

    - prefix (str, optional) – The prefix prompt for the router agent. If not provided uses default ROUTER_PREFIX.

    - verbose (bool, optional) – If you want to see the content of the scratchpad. [ Defaults to False ]

    - agent_executor_kwargs (Optional[Dict[str, Any]], optional) – If there is any other parameter you want to send to the agent. [ Defaults to None ]

    - **kwargs – Additional named parameters to pass to the ZeroShotAgent.

  Returns

    Returns a callable AgentExecutor object. Either you can call it or use run method with the query to get the response.

  Return type

    AgentExecutor