Search Tutorials
--Ads--RAG Evaluation Frameworks: RAGAS, DeepEval, TruLens and Phoenix
What the popular evaluation libraries offer and how they fit together.
You can build RAG evaluation yourself, as the previous lessons showed, or use a framework that packages metrics, datasets, reporting and tracing. This lesson surveys the most popular open-source options (RAGAS, DeepEval, TruLens and Arize Phoenix), shows what using them looks like, and suggests how to choose.
What frameworks provide
- Ready-made metrics (faithfulness, answer relevance, context precision and recall, and many more) with tested prompts.
- Dataset formats and test-set generation.
- Test runners that integrate with pytest and CI.
- Dashboards, experiment tracking and production tracing.
The main options
| Framework | Focus | Good for |
|---|---|---|
| RAGAS | RAG-specific metrics and synthetic test-set generation | Standard RAG metrics with minimal setup; research-backed definitions |
| DeepEval | Unit-testing style evaluation for LLM apps, pytest integration | Quality gates in CI; many metric types including custom LLM-judged criteria |
| TruLens | "Feedback functions" and the RAG triad, with app instrumentation | Tracking experiments across app versions with a local dashboard |
| Arize Phoenix | Open-source tracing (OpenTelemetry) plus evaluations | Debugging production traces and running evals on them |
Hosted platforms such as LangSmith, Langfuse, Braintrust and others combine tracing, datasets and evaluation with team features; Module 14 covers observability.
What using them looks like
All frameworks need the same raw material: for each test case, the question, the retrieved contexts, the generated answer and, for some metrics, a reference answer. If you log runs as in Why RAG Evaluation is Hard, you already have it.
RAGAS
# pip install ragas openai
import asyncio
from openai import AsyncOpenAI
from ragas.llms import llm_factory
from ragas.metrics.collections import Faithfulness
judge = llm_factory("gpt-6.2-sol", client=AsyncOpenAI()) # the judge model
faithfulness = Faithfulness(llm=judge)
result = asyncio.run(faithfulness.ascore(
user_input="How many leave days do new employees get?",
response="New employees get 18 days of paid leave.",
retrieved_contexts=["Employees in their first year receive 18 days of paid leave."],
))
print(result.value) # 1.0 when every claim is supported
This uses RAGAS's current metric API (ragas.metrics.collections); the older evaluate() workflow is deprecated. For a complete walkthrough with all four core metrics over a test set, see RAGAS Tutorial: Evaluating RAG Step by Step.
DeepEval
# pip install deepeval
from deepeval import assert_test
from deepeval.metrics import FaithfulnessMetric
from deepeval.test_case import LLMTestCase
def test_carry_over_answer():
case = LLMTestCase(
input="Can I carry unused leave into next year?",
actual_output=rag_answer("Can I carry unused leave into next year?"),
retrieval_context=retrieved_texts_for("Can I carry unused leave into next year?"),
)
assert_test(case, [FaithfulnessMetric(threshold=0.8, model=judge_model)]) # judge_model: see docs
Both frameworks let you choose the judge model. Their APIs change between versions, so check the current documentation for how to configure a judge LLM and for metric names.
Framework or your own code?
| Your own harness | A framework |
|---|---|
| Full control and transparency of every prompt | Tested metric implementations out of the box |
| Metrics tailored to your domain (policy correctness, citation format) | Standard metrics comparable with published work |
| No dependency churn | Dashboards, tracing and CI integrations |
| You maintain it | Version upgrades can change scores |
A practical path: start with a small harness of your own (retrieval metrics plus a correctness judge) so you understand what is measured. Add a framework when you need its extras, such as dashboards, many metrics or team workflows. Whichever you choose, validate LLM-judged metrics against human labels, and pin framework versions so scores stay comparable over time.
Key takeaways
- RAGAS, DeepEval, TruLens and Phoenix package metrics, test runners, dashboards and tracing.
- All of them need the same logged data: question, contexts, answer and optionally a reference.
- Configure the judge model explicitly and pin library versions so scores stay comparable.
- Start with a simple harness you understand; adopt a framework for its extras.