Testland
Browse all skills & agents

ragas-evaluation

Authors and runs Ragas - RAG-pipeline evaluation framework with metrics organized into RAG (Faithfulness, Response Relevancy, Context Precision/Recall, Context Entities Recall, Noise Sensitivity), Natural Language Comparison (Factual Correctness, Semantic Similarity, BLEU/ROUGE/CHRF/Exact Match), Agents/Tool-Use (Topic Adherence, Tool Call Accuracy/F1, Agent Goal Accuracy), General Purpose (Aspect Critic, Rubrics-based Scoring), Nvidia (Answer Accuracy, Context Relevance, Response Groundedness), and Summarization. Use when the user evaluates a RAG pipeline (retriever + generator) and needs the deepest metric variety in the OSS LLM-eval space.

Install with skills.sh (any agent)

npx skills add testland/qa --skill ragas-evaluation
View source

ragas-evaluation

The model: assemble a dataset (question + answer + retrieval contexts + ground truth), import the metrics relevant to the evaluation goal, run evaluate(), and inspect per-metric per-row scores (per rg-gh (opens in new window)).

When to use

  • The repo uses LangChain / LlamaIndex / Haystack / direct retriever→LLM RAG pipelines.
  • You need RAG-specific retrieval + generation quality scoring, or agents-style eval (tool-call and goal accuracy), and want the widest metric variety in OSS LLM-eval.

For non-RAG prompt evals, prefer promptfoo-evaluation. For pytest-native LLM evals with a managed dashboard, prefer deepeval-evaluation.

Step 1 - Install

Per rg-gh (opens in new window):

pip install ragas

Or from source:

pip install git+https://github.com/explodinggradients/ragas

Step 2 - Custom metric quickstart

Per rg-gh (opens in new window) (verbatim):

import asyncio
from openai import AsyncOpenAI
from ragas.metrics import DiscreteMetric
from ragas.llms import llm_factory

# Setup your LLM
client = AsyncOpenAI()
llm = llm_factory("gpt-4o", client=client)

# Create a custom aspect evaluator
metric = DiscreteMetric(
    name="summary_accuracy",
    allowed_values=["accurate", "inaccurate"],
    prompt="""Evaluate if the summary is accurate and captures
key information.
Response: {response}
Answer with only 'accurate' or 'inaccurate'."""
)

# Score your application's output
async def main():
    score = await metric.ascore(
        llm=llm,
        response="The summary of the text is..."
    )
    print(f"Score: {score.value}")
    print(f"Reason: {score.reason}")

if __name__ == "__main__":
    asyncio.run(main())

DiscreteMetric is the pattern for custom rubric-based scoring; the built-in metrics in Step 3 follow a similar shape but are preconfigured.

Step 3 - Pick metrics

Ragas ships 30+ metrics across RAG, Natural Language Comparison, Agents/Tool-Use, SQL, General Purpose, Nvidia, and Summarization families. The RAG core: Faithfulness (claims grounded in retrieved context), Response Relevancy, Context Precision, and Context Recall. Pick 3 - 5 per pipeline.

Full per-family catalog with each metric's use: references/metrics.md, sourced from docs.ragas.io/en/stable/concepts/metrics/available_metrics/ (opens in new window).

Step 4 - Dataset shape

Ragas accepts a Hugging Face Dataset or pandas.DataFrame with columns matching the metrics being run:

ColumnRequired by
questionAll RAG metrics
answerResponse Relevancy, Faithfulness, NL Comparison
contexts (list of strings)Context Precision/Recall, Faithfulness
ground_truthContext Recall, Factual Correctness, Answer Accuracy
reference_contextsContext-comparison metrics

See the per-metric pages on docs.ragas.io (opens in new window) for exact required-column lists.

Step 5 - Integration with retrieval frameworks

Ragas integrates with LangChain + LlamaIndex retrieval pipelines - the integration code captures contexts from the retriever and answer from the generator into the evaluation dataset automatically. Consult the per-framework integration docs on docs.ragas.io (opens in new window) when wiring; APIs evolve faster than this skill body and the canonical doc is the source of truth.

Step 6 - CI integration

Ragas does not ship a first-party CI action. Pattern: run evaluate() in a pytest fixture or a CLI script, compare per-metric scores against thresholds, fail CI on regression.

from ragas import evaluate
from ragas.metrics import faithfulness, answer_relevancy

result = evaluate(dataset, metrics=[faithfulness, answer_relevancy])
assert result["faithfulness"] >= 0.85
assert result["answer_relevancy"] >= 0.80

Anti-patterns

Anti-patternWhy it failsFix
Run all 30+ metrics on every PRCost + latency explodePick 3 - 5 metrics per pipeline (Step 3)
Faithfulness without contexts columnMetric returns NaN / errorsPass contexts per dataset spec (Step 4)
Pin nothingRagas + judge-model versions both driftPin both in requirements + CI env
Skip Aspect Critic for product-specific concernsBuilt-in metrics miss the requirementCustom Aspect Critic + rubric (Step 3)

Limitations

  • Many metrics require a judge LLM → cost scales with metric count × dataset size.
  • Multimodal metrics need the multimodal extras (pip install ragas[multimodal]); check the per-metric doc on docs.ragas.io (opens in new window).
  • API surface evolves - pin versions in requirements; the canonical doc is the source of truth (this skill body curates the mainstream patterns but does not re-litigate per-method signatures).

References

Ragas built-in metric catalog

View source (opens in new window)

Ragas built-in metric catalog

Source: docs.ragas.io/en/stable/concepts/metrics/available_metrics/ (opens in new window). Pick 3 - 5 metrics per pipeline; running all 30+ on every PR blows up cost and latency.

Retrieval Augmented Generation

MetricUse
Context PrecisionAre the relevant chunks ranked high in the retrieved context?
Context RecallDoes the retrieved context contain ground-truth info?
Context Entities RecallEntity-level recall vs ground truth
Noise SensitivityDoes irrelevant context degrade output quality?
Response RelevancyDoes the response address the question?
FaithfulnessAre the response's claims grounded in retrieved context?
Multimodal FaithfulnessFaithfulness for text+image RAG
Multimodal RelevanceRelevance for text+image RAG

Nvidia Metrics

MetricUse
Answer AccuracyNvidia-blessed accuracy scoring
Context RelevanceRelevance scoring with Nvidia methodology
Response GroundednessGroundedness in retrieved context

Agents/Tool Use

MetricUse
Topic AdherenceDoes the agent stay on topic?
Tool Call AccuracyDid it call the right tool?
Tool Call F1F1 score for tool selection
Agent Goal AccuracyDid the agent achieve the user's goal?

Natural Language Comparison

MetricUse
Factual CorrectnessCompares response facts vs ground truth
Semantic SimilarityEmbedding-based similarity to reference
Non LLM String SimilarityString-distance metrics (no LLM call)
BLEU Score / ROUGE Score / CHRF ScoreClassical NLP metrics
String PresenceToken presence check
Exact MatchStrict equality

SQL

MetricUse
Execution-based Datacompy ScoreRun query, compare result-sets
SQL Query EquivalenceSemantic equivalence (different SQL, same result)

General Purpose

MetricUse
Aspect CriticYes/no LLM-judge on a custom aspect
Simple Criteria ScoringNumeric scoring against a rubric
Rubrics-based ScoringMulti-criterion rubric scoring
Instance-specific Rubrics ScoringPer-row rubric variation

Other

MetricUse
SummarizationSummary quality scoring

Related skills

deepeval-evaluation

Authors and runs DeepEval - pytest-native LLM eval framework with `LLMTestCase` (input + actual_output + expected_output + retrieval_context) and ~11 built-in metrics (G-Eval, Answer-Relevancy, Faithfulness, Contextual-Recall / Precision / Relevancy, Hallucination, Bias, Toxicity, Summarization, JSON-Correctness); runs via `deepeval test run {file.py}` with `assert_test()` per test or `evaluate()` for batch; integrates Confident-AI dashboard. Use when the user prefers pytest workflow, works with RAG and needs faithfulness/contextual metrics out-of-the-box, or wants a managed dashboard.

giskard-llm

Authors and runs Giskard LLM scans - adversarial test-case generation for LLM applications via `giskard.scan(model)` covering 7 vulnerability categories (hallucination, harmful_content, prompt_injection, sensitive_information_disclosure, stereotypes, robustness, basic_sycophancy); wraps any callable model behind `giskard.Model(model_predict, model_type="text_generation", ...)`; emits HTML report. Use when the user needs adversarial / red-team coverage on top of functional eval suites.

langfuse-tracing

Wires Langfuse tracing into LLM apps for production observability, monitoring, telemetry, and offline eval - instruments via `@observe` (Python) / `startActiveObservation` (TS) decorators that auto-capture inputs / outputs / timings / errors per generation; exposes `langfuse.update_current_span()` for metadata + cost / latency annotation; supports trace-bound scoring for eval datasets and prompt-as-code management. Use when the user needs to monitor, log, trace, or debug LLM API calls in production beyond pre-deploy eval, wants to add LLM observability tooling to an existing app, or wants to ship traces from production to an eval dataset for offline regression testing.

llm-eval-anti-patterns

Audits an existing LLM evaluation suite for eight methodology errors that make its numbers untrustworthy: too few cases per capability, single-provider lock-in, exact-match assertions on open-ended output, no semantic-similarity check on paraphrase-tolerant output, no baseline comparison in CI, no cost or latency ceiling, unpinned model identifiers, and no adversarial coverage. Supplies harness-neutral detection cues, the reason each error invalidates the result, a concrete fix, a Critical/Warning/Info severity scheme, and a findings-table output shape. Covers validating an LLM judge against human labels before its verdicts count as evidence. Use when an eval suite already exists and its pass rate is about to gate a release, a model swap, or a prompt change, and nobody has audited how the suite itself was built.

llm-regression-suite-author

Builds a versioned golden-dataset LLM regression suite for tracking quality across model upgrades: structures a versioned JSONL/CSV golden dataset, configures deterministic eval runs (temperature 0, seed), wires assertion layers (exact, semantic similarity, LLM-as-judge, rubric), enforces a pass-rate threshold with diff reporting vs the baseline model, and gates CI on regression. Use when upgrading an LLM provider model and needing a repeatable before/after quality gate, or when a prompt regression suite must track output quality across model versions over time.

openai-evals

Authors and runs OpenAI Evals - Python framework + registry for evaluating LLMs and LLM-backed systems with `oaieval {model} {eval-name}` CLI; supports template-based evals (Match / Includes / FuzzyMatch / ModelBasedClassify) defined in `evals/registry/evals/*.yaml` against JSONL data files in `evals/registry/data/`, plus custom Python eval classes implementing the Eval interface. Use when the user works with the openai/evals repo, needs the OpenAI-curated eval registry, or contributes new evals via PR to the registry.

promptfoo-evaluation

Authors and runs Promptfoo evals for LLM prompts and RAG pipelines - wires `promptfooconfig.yaml` providers + prompts + tests + assertions (deterministic `equals` / `contains` / `is-json` / `regex`, semantic `similar`, model-graded `llm-rubric` / `factuality` / `g-eval`, performance `latency` / `cost`, custom `javascript` / `python`), runs `npx promptfoo eval`, views HTML report via `promptfoo view`, and integrates CI for regression gating. Use when the user runs Promptfoo, asks about prompt regression suites, or needs an eval-driven workflow for LLM-backed features.