RAGAS is an open-source evaluation framework for RAG systems that scores faithfulness, answer relevancy, context precision, and context recall automatically.
RAGAS (Retrieval-Augmented Generation Assessment) is an open-source evaluation framework for measuring the quality of RAG systems. It gives you a set of metrics — faithfulness, answer relevancy, context precision, and context recall — that score different aspects of how well your RAG pipeline is working, so you can track quality over time rather than guessing.
The practical problem RAGAS solves is this: once you have built a RAG application, how do you know whether it is working? A response might sound plausible but be hallucinated, or it might be technically grounded but not actually answer the question. Manually reviewing outputs works for a handful of test queries, but does not scale. RAGAS automates this evaluation using LLM-as-a-judge techniques, which means it can score thousands of query-response pairs without requiring you to label each one by hand.
RAGAS takes the inputs and outputs of a RAG pipeline — typically a query, the retrieved context chunks, and the generated answer — and scores them across four dimensions. Each score is a number between 0 and 1, where 1 is best. The mean of all four forms the overall RAGAS score.
Beyond scoring individual responses, RAGAS is used to compare pipeline configurations: does chunking strategy A produce better context recall than strategy B? Does increasing top-k retrieval improve faithfulness or hurt answer relevancy? RAGAS gives you the numbers to answer those questions systematically.
It also integrates with popular LLM observability platforms — including LangSmith, LangFuse, and Braintrust — so you can feed evaluation scores into dashboards alongside traces and latency metrics.
RAGAS is used by AI engineers and data scientists building RAG applications who want to go beyond subjective manual review. Teams shipping RAG to production need a repeatable, automated way to catch quality regressions before they reach users — RAGAS plugs into CI/CD pipelines so a degraded score blocks a deploy in the same way a failing unit test would.
ML practitioners benchmarking retrieval strategies use it to compare chunking approaches, embedding models, rerankers, and top-k settings with hard numbers rather than intuition. Researchers and data scientists use it when they need an evaluation dataset and scoring protocol they can share with others — RAGAS scores are reproducible and interpretable, which makes them useful for communicating results. Anyone building with LangChain or LlamaIndex can also drop RAGAS directly into their existing framework via native integrations.
For each query-response pair, RAGAS runs a series of LLM-assisted judgments.
Faithfulness is measured by decomposing the answer into individual claims, then asking an LLM to verify whether each claim is supported by the retrieved context. The faithfulness score is the proportion of claims that are supported. An answer that invents facts not present in the context scores low, even if those facts happen to be true.
Answer relevancy works in the opposite direction: RAGAS generates several hypothetical questions that the answer could plausibly be answering, then measures how similar those questions are to the original query. An answer that genuinely addresses the question will generate hypothetical questions that closely resemble it; a vague or off-topic answer will not.
Context precision checks whether the retrieved chunks are ranked in a useful order. It measures how much of the relevant information appears in the top-ranked chunks rather than being buried further down the retrieved list.
Context recall compares the retrieved context to a reference answer and measures how much of the reference answer’s content is covered by the retrieved chunks. If the retrieval step missed important information that the answer needed, context recall surfaces this.
All scoring happens locally by default — RAGAS calls whatever LLM you configure, and the intermediate judgments are not sent anywhere else.
RAG pipeline benchmarking. Before choosing an embedding model, chunking strategy, or vector database for production, you run each candidate configuration through a RAGAS evaluation on a representative test set. The scores tell you which configuration retrieves more relevant context (context precision and recall) and which produces more faithful, on-topic answers (faithfulness and answer relevancy).
CI/CD quality gates. A RAGAS eval suite runs on every pull request that changes the retrieval configuration, system prompt, or answer generation logic. If any metric drops below a threshold, the build fails and the change is blocked. This prevents silent regressions — the kind where a prompt change improves one response type but degrades another.
Production monitoring. A sample of live query-response pairs runs through RAGAS on a schedule. Scores are logged to a dashboard alongside latency and cost. When faithfulness starts dropping, it signals that the retrieval layer is returning less relevant context — possibly because the document corpus has grown in ways the indexing strategy was not designed for.
Comparing LLM providers. A team evaluating whether to switch from GPT-4o to Claude for their RAG answer generation runs both models against the same retrieval results and compares RAGAS scores. The framework makes it straightforward to isolate the impact of the generation model from the retrieval layer.
RAGAS is fully open-source under the Apache 2.0 licence and free to use without restriction. You install it with pip install ragas and it runs locally. The only cost is the LLM calls it makes to score responses, which are billed by your chosen model provider at their standard rates.
There is no managed RAGAS service or paid tier. The project is maintained by Explodinggradients and receives regular updates. For teams that want a managed evaluation platform with a UI and team collaboration features, third-party tools like Braintrust, LangSmith, and LangFuse offer RAGAS integration alongside their broader observability features.
Install the package:
pip install ragas
A minimal eval run requires a dataset with your queries, retrieved contexts, and generated answers:
from ragas import evaluate
from ragas.metrics import faithfulness, answer_relevancy, context_precision, context_recall
from datasets import Dataset
data = {
"question": ["What is the capital of France?"],
"answer": ["Paris is the capital of France."],
"contexts": [["France is a country in Western Europe. Its capital is Paris."]],
"ground_truth": ["Paris"]
}
dataset = Dataset.from_dict(data)
result = evaluate(dataset, metrics=[faithfulness, answer_relevancy, context_precision, context_recall])
print(result)
The documentation at docs.ragas.io covers synthetic test set generation, LangChain and LlamaIndex integrations, and how to configure alternative LLM providers for the evaluation step. A good first project is running an eval on 20–30 representative queries from your own RAG application and using the per-metric scores to identify which part of the pipeline — retrieval or generation — is causing the most quality issues.
RAGAS stands for Retrieval-Augmented Generation Assessment. The name reflects its specific focus on evaluating RAG systems — measuring the quality of retrieval, the faithfulness of generated answers, and the relevance of responses across four distinct metrics.
Partially. Faithfulness and answer relevancy are reference-free — they score responses against retrieved context without needing labelled ground truth. Context precision and context recall do require a reference answer per query. For most teams, the reference-free metrics are sufficient to identify the most significant quality issues, and ground-truth labels add precision but are not required to get started.
RAGAS is an evaluation library — a set of metrics and scoring logic you run in your own Python code. Braintrust and LangSmith are managed platforms with UI, tracing, and team collaboration features that can incorporate RAGAS metrics as part of their evaluation suites. Use RAGAS for a code-first, self-hosted evaluation workflow; use RAGAS metrics inside Braintrust or LangSmith if you want a managed platform with dashboards and sharing.
Prometheus is an open-source monitoring system that scrapes metrics from your services on an interval, stores them as time-series data, and lets you query and alert on them with PromQL.
ObservabilityOpen-source distributed tracing.
ObservabilityPromptfoo is an open-source CLI and library for testing, evaluating, and red-teaming LLM applications and agents before they reach production.
ObservabilityHelicone is an open-source AI gateway that logs, traces, and optimizes every LLM API call with one line of code.
ObservabilityUpdates from the AI world — what shipped, what we’re using in production, and what’s worth your attention. Two emails a month, no spam.