Skip to main content
The arize-phoenix-evals library uses an LLM-as-judge to grade model output — hallucinations, factuality, helpfulness, toxicity, custom rubrics. Plug Anthropic Claude in as the judge by passing provider="anthropic" to the LLM(...) wrapper, then build a create_classifier(...) evaluator and run it over a DataFrame with evaluate_dataframe(...).

Prerequisites

Install

Configure credentials

Setup the eval LLM

Use claude-haiku-4-5 for a cheaper judge if you’re evaluating large batches; the judge’s job is classification, not generation, so a smaller model is often sufficient.

Run an evaluation

This example builds a hallucination classifier and grades two sample question/answer pairs against a reference. The pattern generalizes: replace the prompt template, choices, and DataFrame columns with whatever metric you want to evaluate.

Expected output

The full returned DataFrame also includes hallucination_execution_details (status + exceptions + timing) and the original hallucination_score column with each evaluator result’s full dict (name, score, label, explanation, metadata, kind, direction) — useful for surfacing the LLM’s reasoning, persisting eval rows back to Arize AX, or filtering retries.

Troubleshooting

  • 401 from Anthropic. Verify ANTHROPIC_API_KEY is set and has access to the model in the example. Generate a new key at console.anthropic.com.
  • model_not_found. Anthropic occasionally retires older model aliases. Swap claude-sonnet-4-6 for a current model from the Anthropic models list.
  • All rows return the same label. Your prompt template isn’t differentiating cases. Make sure each row’s {input}/{output}/{reference} columns expose enough context for the judge to discriminate, and that choices lists every label your prompt asks the LLM to emit.
  • Some rows fail with timeout / rate-limit. Pass max_retries= to evaluate_dataframe(...) (defaults to 3). For large batches, also pass initial_per_second_request_rate=... to LLM(...) to throttle.
  • Logging results back to Arize AX. This guide stops at producing the eval DataFrame. To attach those evals to existing spans in an Arize AX project, use log_evaluations_sync on arize.Client.
  • Using Anthropic on AWS Bedrock instead. Switch to LLM(provider="bedrock", model="us.anthropic.claude-sonnet-4-6") and set AWS credentials — see the Amazon Bedrock evals doc for the full pattern.

Resources

Phoenix Evals Documentation

arize-phoenix-evals on PyPI

Phoenix Evals Source

Anthropic Tracing (instrument app calls)