Overview
The Retrieval Relevance evaluator determines whether the external information retrieved during a step is relevant to the request it was meant to serve. It is source-agnostic: the retrieved information may come from a vector-database / semantic search, a tool or function call, an MCP server, a web search, or a database query. It scores the retrieved information as a whole — holistically, per retrieval step — against the request.When to Use
Use the Retrieval Relevance evaluator when you need to:- Diagnose RAG quality - Check whether retrieved documents actually bear on the user’s question
- Evaluate tool- and MCP-based retrieval - Judge whether a tool call, MCP query, or web search returned information relevant to the request, not just whether it succeeded
- Compare retrieval strategies - Measure the relevance of what a retriever, reranker, or agent surfaces across different pipelines
This evaluator judges the retrieved information against the request — it is independent of any final answer. To judge whether the answer is grounded in the context, use the Faithfulness Evaluator.
Supported Levels
The level of an evaluator determines the scope of the evaluation in OpenTelemetry terms. Some evaluations are applicable to individual spans, some to full traces or sessions, and some are applicable at multiple levels.
Relevant span kinds:
RETRIEVER and RERANKER spans, TOOL spans that return information (knowledge base, web search, MCP, SQL), and LLM spans that retrieved information themselves (e.g. server-side / native web search, where results are embedded in the message content). Action tools with side effects (e.g. send_email) and pure LLM turns are not retrieval steps and should not be scored.
Input Requirements
The Retrieval Relevance evaluator requires two inputs:Formatting Tips
For best results:- Use the user’s request as
input. For tool and SQL steps, prefer the user’s request (e.g. the trace root’sinput.value) over a reformulated tool argument or a generated SQL query. - Join multiple retrieved items into a single
contextstring with clear separators (see Input Mapping below): - Use human-readable strings rather than raw JSON where possible.
Output Interpretation
The evaluator returns aScore object with the following properties:
Interpretation:
- Relevant (1.0): The retrieved information contains content that materially helps address the request. If any meaningful part of the retrieved information helps, the step is relevant — even when the set is partial or mixed with unrelated material.
- Irrelevant (0.0): The retrieved information does not help address the request — it is off-topic, about a different entity or time period, only tangentially related, empty, or an error.
Usage Examples
- Python
- TypeScript
Using Input Mapping
When your data has different field names or requires transformation, use input mapping. This is especially useful for combining multiple retrieved items into a single context string.- Python
- TypeScript
Configuration
For LLM client configuration options, see Configuring the LLM.Viewing and Modifying the Prompt
You can view the latest versions of our prompt templates on GitHub. The evaluators are designed to work well in a variety of contexts, but we highly recommend modifying the prompt to be more specific to your use case. Feel free to adapt them.- Python
- TypeScript
Using with Phoenix
Evaluating Traces
Run evaluations on traces collected in Phoenix and log results as annotations:Running Experiments
Use the Retrieval Relevance evaluator in Phoenix experiments:API Reference
- Python: RetrievalRelevanceEvaluator
- TypeScript: createRetrievalRelevanceEvaluator
Related
- Faithfulness Evaluator - Evaluate whether a response is grounded in the retrieved context
- Correctness Evaluator - Evaluate whether an answer is correct

