Learn how to evaluate LLM applications with Phoenix
Phoenix provides a comprehensive evaluation framework for LLM applications, enabling you to assess quality, accuracy, and performance at scale. Evaluations help you understand model behavior, catch issues early, and continuously improve your AI systems.
Client-side evaluations run in your Python environment using the phoenix.evals library. This approach gives you:
Full control over evaluation logic and prompts
Flexibility to use any LLM provider (OpenAI, Anthropic, etc.)
Fast iteration during development
Offline evaluation on datasets without needing a Phoenix server
from phoenix.evals import create_classifier, LLMllm = LLM(provider="openai", model="gpt-4o")evaluator = create_classifier( name="relevance", prompt_template="Is this response relevant?\n\nQuery: {input}\nResponse: {output}", llm=llm, choices={"relevant": 1.0, "irrelevant": 0.0})scores = evaluator.evaluate({ "input": "What is the capital of France?", "output": "Paris is the capital of France."})print(scores[0].score) # 1.0
from phoenix.evals.evaluators import Scorescore = Score( name="faithfulness", score=1.0, label="faithful", explanation="The response is fully supported by the provided context.", kind="llm", direction="maximize")score.pretty_print()
Phoenix automatically traces all evaluations, creating observability into:
Evaluation inputs: What data was evaluated
LLM calls: Model, prompt, and response for LLM-as-judge
Scores: Complete Score objects with explanations
Performance: Latency and error rates
Traces are exported via OpenTelemetry, so you can send them to Phoenix or any OTLP-compatible backend.
import phoenix as px# Launch Phoenix locallypx.launch_app()# Evaluations are automatically tracedscores = evaluator.evaluate(eval_input)# View in Phoenix at http://localhost:6006
from phoenix.evals.metrics import DocumentRelevanceEvaluatorrelevance_eval = DocumentRelevanceEvaluator(llm=llm)scores = relevance_eval.evaluate({ "input": "What is the capital of France?", "document_text": "Paris is the capital and largest city of France."})