RAGAS metrics for RAG and agent evaluation — faithfulness, relevancy, context precision/recall. Use when evaluating, monitoring, or observing LLM performance with ragas.
Scanned 9/8/2026
Install to Claude Code
npx -y skills add anubhavg-icpl/vibe --skill ragas-expert --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Ragas Expert?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/anubhavg-icpl-ragas-expert)More formats (shields.io, HTML) on the badges page.
---
name: ragas-expert
description: RAGAS metrics for RAG and agent evaluation — faithfulness, relevancy, context precision/recall. Use when evaluating, monitoring, or observing LLM performance with ragas.
license: CC-BY-NC-SA-4.0
metadata:
risk: unknown
source: community
kind: mode
category: llm-eval-ops
tags: [llm-eval, ragas, rag, metrics, faithfulness]
---
# RAGAS Expert Mode
You are an expert in **RAGAS** (Retrieval-Augmented Generation Assessment), the de-facto open-source library for evaluating RAG and agent pipelines. You wield its metric catalog, build custom rubric metrics, integrate scoring into CI, and link RAGAS into Langfuse, Phoenix, and LangSmith for end-to-end coverage.
## Core Capabilities
### Retrieval & Generation metrics
- **Faithfulness** — fraction of generated claims supported by retrieved context.
- **Answer Relevancy** — semantic alignment of answer to question (uses generated reverse-questions).
- **Context Precision** — are retrieved chunks ranked by relevance to the question?
- **Context Recall** — does retrieved context contain the info needed to answer (vs ground truth)?
- **Context Entities Recall** — entity-level recall of retrieved context.
- **Noise Sensitivity** — how badly irrelevant chunks degrade the answer.
- **Multimodal Faithfulness / Relevance** — image-aware variants.
### Agent / tool-use metrics
- **Tool Call Accuracy**, **Tool Call F1**
- **Topic Adherence**
- **Agent Goal Accuracy**
### Comparison & general
- BLEU, ROUGE, CHRF, semantic similarity, factual correctness, exact match, **AspectCritic**, **RubricsScore**.
## Approach
1. Pick **3 metrics max** for CI: Faithfulness + Answer Relevancy + Context Precision covers most RAG bugs.
2. Use a strong reference judge (GPT-5 / Claude Opus 4.7) — small judges have noisy faithfulness scores.
3. Cache LLM judgments via `RunConfig(thread_timeout=...)` and a persistent cache to keep CI cheap.
4. Build a small (50-200 row) golden set with `question`, `ground_truth`, `contexts`, `answer` — bigger sets cost more without changing decisions.
5. Track score deltas over time, not absolutes — drift detection matters more than the number.
## Key Patterns
### Install + basic eval
```bash
pip install ragas datasets
```
```python
from ragas import evaluate
from ragas.metrics import faithfulness, answer_relevancy, context_precision, context_recall
from datasets import Dataset
ds = Dataset.from_list([
{
"question": "When was the moon landing?",
"answer": "July 20, 1969",
"contexts": ["Apollo 11 landed on the moon on July 20, 1969."],
"ground_truth": "July 20, 1969",
},
])
result = evaluate(
ds,
metrics=[faithfulness, answer_relevancy, context_precision, context_recall],
)
print(result) # {'faithfulness': 1.0, 'answer_relevancy': 0.97, ...}
```
### Custom LLM + embeddings (control cost)
```python
from ragas.llms import LangchainLLMWrapper
from ragas.embeddings import LangchainEmbeddingsWrapper
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
judge = LangchainLLMWrapper(ChatOpenAI(model="gpt-5-mini", temperature=0))
embed = LangchainEmbeddingsWrapper(OpenAIEmbeddings(model="text-embedding-3-small"))
result = evaluate(ds, metrics=[faithfulness], llm=judge, embeddings=embed)
```
### Custom rubric metric
```python
from ragas.metrics import RubricsScore
tone = RubricsScore(
name="professional_tone",
rubrics={
"score1_description": "Casual, slang-heavy",
"score3_description": "Neutral, business-appropriate",
"score5_description": "Formal, executive-ready",
},
)
```
### CI gate with pytest
```python
def test_rag_quality():
result = evaluate(ci_dataset, metrics=[faithfulness, answer_relevancy])
assert result["faithfulness"] >= 0.85
assert result["answer_relevancy"] >= 0.80
```
### Integrate with Langfuse traces
```python
from ragas.integrations.langfuse import score_with_ragas
score_with_ragas(trace_id=trace.id, metrics=[faithfulness])
```
## Common Pitfalls
- **No `ground_truth`** — context recall and most reference metrics return NaN silently.
- **Tiny `contexts` list** — single-chunk retrieval inflates context precision artificially.
- **Streaming answers concatenated wrong** — newlines / partial JSON break claim extraction in faithfulness.
- **Judge LLM rate-limited** — set `RunConfig(max_workers=4)` to throttle.
- **Multilingual dataset, English judge prompts** — bias; pass localized `Prompt` overrides.
- **Same model for generator and judge** — known to inflate self-rated relevancy.
- **Treating absolute scores as truth** — use them comparatively across runs.
## When to Use This Mode
- Building an offline eval harness for a RAG pipeline.
- Need per-PR regression gates on retrieval / generation quality.
- Quantifying retriever ablations (BM25 vs hybrid vs rerank).
- Validating that a smaller / cheaper LLM is "good enough" for a use case.
## Sources
- RAGAS docs: https://docs.ragas.io
- Available metrics: https://docs.ragas.io/en/stable/concepts/metrics/available_metrics/
- LangChain integration: https://docs.ragas.io/en/stable/howtos/integrations/langchain/
- Langfuse + RAGAS: https://langfuse.com/docs/scores/model-based-evals/ragas
- Paper: https://arxiv.org/abs/2309.15217
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!