Skip to content
masterclass Buddy

LangChain · Function

create_retriever_tool

Creates a StructuredTool that retrieves documents through a BaseRetriever. The tool exposes a model-facing name and description and can format the retrieved documents.

Last updated

Since
v1.7

Syntax

create_retriever_tool(retriever: BaseRetriever, name: str, description: str, *, document_prompt: BasePromptTemplate | str | None = None, document_separator: str = '\n\n', response_format: Literal['content', 'content_and_artifact'] = 'content')

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • BaseRetriever
  • StructuredTool
  • BasePromptTemplate
  • Document
  • format_document
  • aformat_document

Source: create_retriever_tool | langchain_core | LangChain Reference. Checked 2026-11-03.