Skip to main content

Using Anthropic with Phoenix Evals

Requires anthropic
pip install "arize-phoenix-evals>=3" anthropic
Create an LLM instance with the Anthropic provider:
from phoenix.evals import LLM

llm = LLM(provider="anthropic", model="claude-sonnet-4-20250514")
The LLM wrapper reads your API key from the ANTHROPIC_API_KEY environment variable, or you can pass it directly:
llm = LLM(provider="anthropic", model="claude-sonnet-4-20250514", api_key="sk-ant-...")

Using with evaluators

from phoenix.evals import LLM, evaluate_dataframe
from phoenix.evals.metrics import FaithfulnessEvaluator

llm = LLM(provider="anthropic", model="claude-sonnet-4-20250514")
evaluator = FaithfulnessEvaluator(llm=llm)

results_df = evaluate_dataframe(dataframe=df, evaluators=[evaluator])