AnswerAccuracy (does the response match a reference), ContextRelevance (does the retrieved context cover the question), and ResponseGroundedness (is the response supported by the context). They follow NVIDIA’s published RAG quality benchmarks and reuse Ragas’s prompting and execution machinery.
This guide shows two ways to use them with Phoenix:
- Flow 1 grades existing Phoenix traces with
ResponseGroundednessand logs the scores back as span annotations. - Flow 2 uploads a small dataset, runs a Phoenix experiment with the same metric as an evaluator, and records a score for each run.
Prerequisites
- Python 3.11+
- An
OPENAI_API_KEYfrom the OpenAI Platform. It’s used for both the model under trace and the judge model for NVIDIA’s metrics. - A running Phoenix instance. See Phoenix setup.
Install
Configure credentials
Define the metric
The shared setup creates NVIDIA’sResponseGroundedness metric (from ragas.metrics.collections) backed by gpt-4.1 through Ragas’s llm_factory, the two-row dataset that both flows score, and a Phoenix client. The judge is pinned to gpt-4.1 because Ragas doesn’t remap max_tokens to max_completion_tokens for GPT-5 reasoning models with dotted version names, so they reject the request. gpt-4.1 is non-reasoning, accepts max_tokens, and is deterministic at temperature=0.
Flow 1: Evaluate existing traces
Trace some LLM calls
Register Phoenix tracing with OpenAI auto-instrumentation, make two calls that each echo a known answer so the trace contains predictable text, then pull the resulting spans back from Phoenix.Run the metric
The metric exposesascore(response=..., retrieved_contexts=[...]) directly. It’s async, so wrap each call in asyncio.run(...) from synchronous code. The OpenAI instrumentor records the full response as JSON in attributes.output.value, so the code reads the message text out of it.
Log evaluations to Phoenix
log_span_annotations_dataframe reads a dataframe indexed by span ID with score and label columns, and attaches each row to its span as an annotation.
nv-ragas-tracing-example-<timestamp> project in Phoenix (the name printed above). Each traced ChatCompletion span now has an nv_response_groundedness annotation with the score and the grounded or ungrounded label.
Ragas calls the judge model through the OpenAI SDK, so the auto-instrumentation also traces the judge calls into the same project as additional
ChatCompletion spans. Only the two spans fetched before evaluation are annotated.Flow 2: Run an experiment
Create a dataset
Define the task
The task returns the stored answer for each example so the experiment grades the same two responses as Flow 1. In a real experiment, the task would call your RAG application.Wrap the metric as an evaluator
Phoenix binds experiment evaluator arguments by name:output is the task’s result and metadata is the example’s metadata. run_experiment calls evaluators synchronously, so the wrapper uses asyncio.run(...) around the metric’s ascore. Return a dictionary with score and label.
Run the experiment
nv-ragas-experiment-example-ds-<timestamp>. The experiment nv-ragas-experiment-example-<timestamp> lists one run per example, each with its nv_response_groundedness score and label.
Troubleshooting
Skipping a sample by assigning it nan score. The judge call failed (rate limit, model error, and so on) and Ragas swallowed the exception. Check the warnings above this message for the actual error.NotImplementedError: Async evaluator must use async_evaluate.run_experimentruns evaluators synchronously. Keep the evaluator a plaindefthat callsasyncio.run(...), or useasync_run_experimentwith anasync defevaluator.- Spans never appear. Confirm
PHOENIX_COLLECTOR_ENDPOINTpoints at your Phoenix instance and, if authentication is enabled, thatPHOENIX_API_KEYis set. - Using
AnswerAccuracyorContextRelevanceinstead. SwapResponseGroundednessforAnswerAccuracy(requires a reference answer) orContextRelevance(requires the user input and retrieved contexts). The wiring is otherwise identical. See the Ragas NVIDIA metrics docs for each metric’s required fields.

