Website review
This review may include AI-generated content and is not individually verified. Domain, certificate and other facts come from the observed data on this page.
What is Ragas?
Ragas is an open-source evaluation framework for AI applications, documented at Ragas. It gives teams a structured way to measure how well a language-model application performs, rather than judging outputs by eye. The documentation frames it around building evaluation datasets, running experiments, and scoring results with metrics suited to the application type.
What it covers
The framework is organized around a few practical building blocks:
- Datasets and experimentation — assemble test cases and compare runs as you change prompts, models or retrieval settings.
- Metrics — a broad catalog grouped by task, including retrieval-augmented generation (context precision, context recall, faithfulness, response relevancy), agents and tool use (tool call accuracy, tool call F1, agent goal accuracy), natural-language comparison (factual correctness, semantic similarity), SQL execution checks, and general-purpose rubric scoring.
- Traditional non-LLM metrics — BLEU, ROUGE, CHRF, exact match and string similarity for cases where deterministic scoring is enough.
- Test data generation — synthetic testsets for RAG, knowledge-graph scenarios and agent/tool-use cases, including non-English and persona-based generation.
- How-to guides — customizing models, adapting metrics to other languages, cost analysis, evaluating multi-turn conversations, and benchmarking a new LLM or a text-to-SQL agent.
Who it suits
Ragas fits teams that already have a working prototype and need to know whether a change helped. A concrete case: a support assistant that retrieves help-center articles. You would check context recall to see whether the right articles are retrieved at all, then faithfulness to catch answers that drift beyond the retrieved text, then response relevancy to catch answers that miss the question. Each metric points to a different fix — retrieval, grounding, or prompting.
The trade-off is setup effort. LLM-based metrics require model access and cost money per evaluation run, and they are judgments rather than ground truth, so they need calibration against human review. If your outputs can be checked exactly (structured SQL results, fixed-format answers), the traditional metrics are cheaper and more stable.
Next step
Start with the quick-start tutorial that matches your application — prompt, simple RAG system, workflow, or agent — and pick two or three metrics tied to your known failure modes rather than the whole catalog. If you are comparing frameworks, LangSmith and deepset document related evaluation tooling.
How do I evaluate a RAG pipeline with Ragas metrics like faithfulness and context recall?
Ragas is built for exactly this: scoring a retrieval-augmented generation (RAG) pipeline by separating what the retriever supplied from what the generator produced. Faithfulness and context recall are two of its core RAG metrics, and they answer different questions, so run them together rather than treating either as a single verdict.
What each metric tells you
- Faithfulness checks whether the claims in the generated answer are supported by the retrieved context. It targets the generator: a low score means the model is adding unsupported statements or drifting from the sources, even when retrieval was fine.
- Context recall checks whether the retrieved context contains the information needed for the reference answer. It targets the retriever: a low score means relevant passages were missed, so no amount of prompt tuning on the generator will fully fix the output.
Because these two fail in opposite directions, a side-by-side view is the fastest way to locate a problem. The table below shows how to read the combinations.
| Faithfulness | Context recall | Likely cause | Practical next step |
|---|---|---|---|
| High | High | Pipeline working as intended | Keep as a baseline; test edge-case queries |
| High | Low | Retriever missing needed passages | Improve chunking, embeddings or top-k retrieval |
| Low | High | Generator ignoring or overreaching beyond context | Tighten prompts, lower temperature, add grounding instructions |
| Low | Low | Both stages need work | Fix retrieval first, then re-measure generation |
A workable evaluation loop
- Build a small evaluation dataset. Assemble questions with reference answers and, where possible, the source passages. Ragas also documents test-set generation for RAG if you need to bootstrap examples, but hand-checked questions are a sensible starting point.
- Capture pipeline outputs. For each question, log the retrieved contexts and the final answer, since both faithfulness and context recall depend on them.
- Score, then inspect. Run the metrics, then read the lowest-scoring samples directly. Aggregate scores hide whether the problem is one bad chunking choice or a systematic prompt issue.
- Change one thing at a time. Adjust retrieval or generation separately and re-run, so you can attribute any movement in scores to a specific change.
Choosing where to start
If your users complain about wrong or invented details, start with faithfulness and inspect the answers. If they complain that the system "misses the point" or ignores documents you know exist, start with context recall and inspect the retrieved chunks. For a broader picture, Ragas also lists context precision, response relevancy and noise sensitivity, which help distinguish ranking problems from missing-content problems. The Ragas documentation at Ragas covers metric definitions and the evaluation workflow in more detail.
Which Ragas metric should I use to check whether my agent's tool calls are accurate?
Use Tool Call Accuracy when you want to check whether your agent called the right tools with the right arguments, in the right order. It is the metric Ragas lists under its "Agents or Tool Use Cases" section specifically for judging tool-call correctness. For a related but different question, Tool Call F1 measures how well the agent's set of tool calls matches the expected set, which is useful when you care about precision and recall of tool selection rather than exact sequence.
Choosing between the agent metrics
| Metric | What it answers | Best for |
|---|---|---|
| Tool Call Accuracy | Did the agent make the correct tool calls, including arguments and order? | Strict checks on a known expected trajectory |
| Tool Call F1 | How much do the agent's tool calls overlap with the expected calls? | Broader scoring when partial matches matter |
| Agent Goal Accuracy | Did the agent achieve the user's goal? | End-to-end task success, regardless of path |
| Topic Adherence | Did the agent stay on permitted topics? | Guardrails and scope control |
Practical next step
Write one or two representative agent traces with the exact tool calls you expect, then score them with Tool Call Accuracy. If your agent can legitimately reach the goal through different tool sequences, pair it with Agent Goal Accuracy so you don't penalise valid alternative paths. For a concrete walkthrough, see the Ragas documentation at Ragas.
How can I generate a synthetic test dataset for my RAG or agent application with Ragas?
Ragas generates synthetic evaluation datasets by sampling from a document corpus (for RAG) or from a described scenario (for agents and tool use), then producing question–answer or task–trajectory pairs you can run through your application. It is a test-data generator built into an evaluation framework, not a data-labeling service, so the output quality depends heavily on what you feed it.
For a RAG application
Start from your own source documents. Ragas includes a testset generation workflow for RAG that builds queries across different types — single-hop questions answerable from one chunk, and multi-hop questions that require combining evidence from several chunks. The documentation also covers persona generation and custom single-hop and multi-hop query styles, so you can steer the mix rather than accept a uniform set of easy questions.
A practical sequence:
- Assemble a representative document sample — include the messy sections, not just the clean ones.
- Choose query distributions: mostly single-hop, some multi-hop, and personas that reflect real users.
- Generate the testset and inspect a sample by hand before trusting aggregate scores.
- Run your retrieval and generation pipeline, then score with retrieval metrics (context precision, context recall) and generation metrics (faithfulness, response relevancy).
For an agent or tool-using application
Agent testset generation is scenario-based: you describe the tools and the kinds of goals a user might have, and Ragas produces task instances. These pair with agent metrics such as tool call accuracy, tool call F1, agent goal accuracy, and topic adherence. If your agent is a text-to-SQL system, the SQL metrics (execution-based scoring, query equivalence) are the relevant evaluation layer.
Choosing between the two paths
| Your situation | Generation approach | Metrics to pair |
|---|---|---|
| Answers questions over a document corpus | RAG testset from documents, single- and multi-hop | Context precision/recall, faithfulness, response relevancy |
| Calls APIs or tools to complete tasks | Agent testset from tool descriptions and scenarios | Tool call accuracy/F1, agent goal accuracy |
| Produces SQL from natural language | Agent-style testset with SQL-oriented checks | SQL execution, query equivalence |
Trade-offs and a next step
Synthetic sets are cheap and broad but inherit your generator's blind spots: they tend to mirror the phrasing and assumptions in your source material, and they will not surface failures caused by inputs unlike anything you supplied. Treat them as a regression suite and a coverage check, and keep a small hand-written set of real user queries as a sanity anchor.
Concrete next step: pick ten real user questions, run them alongside a generated batch of fifty, and compare where the two sets disagree — that gap usually tells you which query types your generator is missing. For setup details and the exact generation parameters, work through the testset generation tutorials on Ragas.
How do I set up a custom judge LLM or adapt Ragas metrics for non-English evaluations?
Ragas covers both needs in its customization guides: you can point its metrics at your own judge model, and you can adapt metrics for non-English data. The two tasks are related but separate, so treat them as distinct steps in your evaluation setup.
Using a custom judge LLM
Ragas metrics that rely on an LLM judge (faithfulness, response relevancy, context precision and recall, and the agent metrics) call a model you configure. The practical route is to wrap your provider's client in the LangChain-style interface Ragas expects, then pass that object where the metric or evaluation call accepts a model. The "Customise models" and "LLM Adapters" pages under Customizations are the reference points.
Concretely, if you run an open-weight model on your own infrastructure for data-residency reasons, you bind it once and reuse it across every metric, so scores stay comparable between runs. Keep a fixed model, temperature and prompt set for the whole experiment; swapping the judge mid-series makes historical scores meaningless.
Adapting metrics for non-English data
Two things usually break when you evaluate non-English content:
- The judge's language ability. A model that scores well in English may be weak in your target language. Validate it against a small set of human-labelled examples before trusting the numbers.
- The metric prompts. Ragas lets you modify prompts, and its "Adapt Metrics to Languages" guide explains how to translate or rewrite them so the judge is asked in a language and phrasing it handles well.
The "Train and Align Metrics" material goes further, aligning metric behaviour with human judgments, which matters most when your language is under-represented in the judge's training data. For generating synthetic test sets in another language, the "Non-English Testset Generation" guide is the matching piece.
Choosing between the two paths
| Situation | Better first move |
|---|---|
| Judge is strong in your language, prompts are English-only | Modify prompts to match the language of the data |
| Judge is weak or untested in your language | Swap to a stronger multilingual model, then validate |
| You need scores to track human reviewers closely | Train/align the metric on labelled examples |
| You need evaluation data, not just scoring | Non-English testset generation, then score |
A useful next step
Pick one metric you already trust in English, such as faithfulness, and run it on ten hand-checked non-English examples with your candidate judge. If agreement is poor, adjust the prompt language first, then consider a different model. Only after that baseline is stable should you expand to the full metric suite.
For broader context on evaluation frameworks and how they compare, the Ragas documentation itself is the primary source; LangChain and Hugging Face are useful for model selection and hosting options when you need a multilingual judge.
How can I benchmark my RAG application against a new LLM or compare evaluation runs in Ragas?
Use Ragas's Benchmarking and Experiment workflows: run the same evaluation dataset and metrics against each LLM (or each pipeline version), then compare the resulting experiment runs metric by metric.
Benchmarking a new LLM
The practical pattern is to hold everything except the model constant. Build one evaluation dataset that represents your real queries, define the metrics you care about, and run the same pipeline twice—once with your current model, once with the candidate—logging both as separate experiments. Because Ragas separates datasets, metrics and experiments, the only variable that changes is the model, which is what makes the comparison meaningful.
For a RAG application, the metric set usually splits into two questions:
| Question | Ragas metrics to consider |
|---|---|
| Did retrieval surface the right context? | Context Precision, Context Recall, Context Entities Recall, Noise Sensitivity |
| Did the answer use that context and stay on point? | Faithfulness, Response Relevancy |
If your application is agentic or tool-using, the agent metrics (Tool Call Accuracy, Tool Call F1, Agent Goal Accuracy, Topic Adherence) are the relevant benchmark rather than the RAG metrics.
Comparing evaluation runs
Treat each run as an experiment with a clear label (model name, prompt version, date) and compare aggregate scores side by side. A few practical rules:
- Fix the dataset. Reuse the identical evaluation set across runs; otherwise score differences reflect the questions, not the model.
- Look at per-metric deltas, not a single number. A new LLM often trades faithfulness for recall, or fluency for precision. Decide in advance which metric you are unwilling to regress on.
- Check cost and latency separately. Ragas's cost analysis guidance is the place to reason about token spend per run; a model that wins on quality but triples cost is a different decision.
- Use a judge you trust. LLM-as-judge metrics drift with the judge model, so keep the judge fixed when comparing candidate generators, and align or calibrate the judge if you must change it.
A concrete scenario
Suppose you run a support-answer bot and want to test a cheaper model. Export 200 real tickets as a Ragas dataset, score both models on Faithfulness, Response Relevancy, Context Precision and Context Recall, and log two experiments. If the cheaper model drops Faithfulness by a few points but holds Precision, you can decide whether the saving justifies the risk—or add a retrieval improvement to close the gap.
Next step
Start with the "Evaluate a simple RAG system" tutorial at Ragas to get one experiment running end to end, then adapt the Benchmarking and "Evaluate a New LLM" guides to add your second model and compare the runs.
User reviews (0)