Skip to main content

PyPI Version

Phoenix Evals provides:

  • Built-in evaluators for common tasks (faithfulness, correctness, relevance, conciseness, and more)
  • A unified LLM wrapper supporting OpenAI, Anthropic, Google, LiteLLM, and other providers
  • Batch evaluation over pandas DataFrames with async_evaluate_dataframe (or sync evaluate_dataframe)
  • Custom evaluator creation via create_evaluator decorator or ClassificationEvaluator
  • Benchmark datasets for testing evaluator accuracy

Installation#

Install the LLM vendor SDK for your chosen provider:

Quick example#

Core API#

SymbolDescription
LLM(provider=..., model=...)Unified LLM wrapper for all supported providers
evaluate_dataframe(dataframe, evaluators)Run evaluators over a DataFrame (sync)
async_evaluate_dataframe(dataframe, evaluators)Async variant with concurrency control
create_evaluator(name, kind=...)Decorator to turn a function into an Evaluator
ClassificationEvaluator(name, prompt_template, llm, choices)Custom classification evaluator for LLM-as-a-judge tasks
bind_evaluator(evaluator, input_mapping)Bind field mappings to an evaluator

Built-in evaluators#

All built-in evaluators live in phoenix.evals.metrics and accept llm: LLM as their first argument:

EvaluatorInput fieldsLabels
FaithfulnessEvaluatorinput, output, contextfaithful / unfaithful
CorrectnessEvaluatorinput, outputcorrect / incorrect
RetrievalRelevanceEvaluatorinput, contextrelevant / irrelevant
ConcisenessEvaluatorinput, outputconcise / verbose / too_concise
RefusalEvaluatorinput, outputrefusal / no_refusal
ToolSelectionEvaluatorinput, output, tool_name, expected_toolcorrect / incorrect
ToolInvocationEvaluatorinput, tool_name, tool_call_argscorrect / incorrect
ToolResponseHandlingEvaluatorinput, tool_response, outputgood / bad
exact_matchoutput, expected(code-based, no LLM)
MatchesRegex(pattern=...)output(code-based, no LLM)

To learn more about LLM Evals, see the evals quickstart.


Reference Documentation#

Full API Reference

Complete API documentation for evaluators, metrics, and LLM classification