Skip to main content
These steps are optional. If you skip them, your retriever data will still be logged, but LangSmith will not render it with retriever-specific formatting.
Many LLM applications retrieve documents from vector databases, knowledge graphs, or other indexes as part of a retrieval-augmented generation (RAG) pipeline. LangSmith provides dedicated rendering for retriever steps, which makes it easier to inspect retrieved documents and diagnose retrieval issues. To enable retriever-specific rendering, complete the following two steps.

Set run_type to retriever

Pass run_type="retriever" to the traceable decorator (Python) or traceable wrapper (TypeScript). This tells LangSmith to treat the step as a retrieval run and apply retriever-specific rendering in the LangSmith UI.
If you are using the RunTree API instead of traceable, pass run_type="retriever" when creating the RunTree object.

Return documents in the expected format

Return a list of dictionaries (Python) or objects (TypeScript) from your retriever function. Each item in the list represents a retrieved document and must contain the following fields: The following examples show a complete retriever implementation with both requirements applied.
The UI displays each retrieved document with its contents and metadata.