Skip to content
Back to skills

Ragas Expert

ASecurity

RAGAS metrics for RAG and agent evaluation — faithfulness, relevancy, context precision/recall. Use when evaluating, monitoring, or observing LLM performance with ragas.

  • 9 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 8, 2026
ai-agentspythongobashperformance

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 8, 2026

npx -y skills add anubhavg-icpl/vibe --skill ragas-expert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ragas Expert?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ragas Expert
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/anubhavg-icpl-ragas-expert/badge)](https://www.skillsdirectory.com/skills/anubhavg-icpl-ragas-expert)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.