langchain_core.tools.create_retriever_toolΒΆ

langchain_core.tools.create_retriever_tool(retriever: BaseRetriever, name: str, description: str, *, document_prompt: Optional[BasePromptTemplate] = None, document_separator: str = '\n\n') Tool[source]ΒΆ

Create a tool to do retrieval of documents.

Args:

retriever: The retriever to use for the retrieval name: The name for the tool. This will be passed to the language model,

so should be unique and somewhat descriptive.

description: The description for the tool. This will be passed to the language

model, so should be descriptive.

document_prompt: The prompt to use for the document. Defaults to None. document_separator: The separator to use between documents. Defaults to β€œ

β€œ.

Returns:

Tool class to pass to an agent.

Parameters
  • retriever (BaseRetriever) –

  • name (str) –

  • description (str) –

  • document_prompt (Optional[BasePromptTemplate]) –

  • document_separator (str) –

Return type

Tool

Examples using create_retriever_toolΒΆ