Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ragas-evaluation

БесплатноБез исполняемых скриптовНе проверен

Use for any question or task about RAG or agent evaluation metrics, including which metrics to use, scoring an answer against its contexts, and telling…

testlandот testland★ 18 звёзд на GitHub

Об этом скилле

ragas-evaluation

The model: assemble a dataset (user_input + response + retrieved_contexts + reference), import the metrics relevant to the evaluation goal, run evaluate(), and inspect per-metric per-row scores (per rg-gh).

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:

pip install ragas

Or from source:

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

Step 2 - Custom metric quickstart

Per rg-gh (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/.

Step 4 - Dataset shape

Each row is a SingleTurnSample; build the set with EvaluationDataset.from_list([...]) (rg-sample, rg-start). The fields match the metrics being run:

Field Required by
user_input (the question) All RAG metrics
response (the generated answer) Response Relevancy, Faithfulness, NL Comparison
retrieved_contexts (list of strings) Context Precision/Recall, Faithfulness
reference (the ground-truth answer) Context Recall, Factual Correctness, Answer Accuracy
reference_contexts Context-comparison metrics

Older tutorials use question, answer, contexts and ground_truth; the current sample fields are the names above.

from ragas import EvaluationDataset

dataset = EvaluationDataset.from_list([
    {
        "user_input": "When was the refund window extended?",
        "retrieved_contexts": ["Refunds are accepted within 60 days since March 2026."],
        "response": "In March 2026, to 60 days.",
        "reference": "March 2026",
    },
])

See the per-metric pages on docs.ragas.io for exact required-column lists.

Step 5 - Integration with retrieval frameworks

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

Step 5a - References must come from somewhere else

Reference-based metrics (Context Recall, Factual Correctness, reference-based Context Precision) compare against reference. If the reference is the bot's own answer copied in, the pipeline is graded against itself and those scores sit near 1.0 whatever it retrieves. Either write references by hand (or from a trusted source) for a labelled set, or use the reference-free metrics until you have one: LLMContextPrecisionWithoutReference (needs user_input, response, retrieved_contexts) and ContextUtilization (rg-ctx-precision).

Step 5b - Agents:

Полный SKILL.md на GitHub

Установить ragas-evaluation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.tessl-plugin/plugin.jsonevals/every-metric-on-every-pull-request-by-friday/criteria.jsonevals/every-metric-on-every-pull-request-by-friday/task.mdevals/forty-one-correct-queries-failing-the-sql-gate/criteria.jsonevals/forty-one-correct-queries-failing-the-sql-gate/task.mdevals/green-grounding-score-through-an-invented-refund-policy/criteria.jsonevals/green-grounding-score-through-an-invented-refund-policy/task.mdevals/ragas-agent-tools/criteria.jsonevals/ragas-agent-tools/task.mdevals/ragas-chunk-diagnosis/criteria.jsonevals/ragas-chunk-diagnosis/task.mdevals/ragas-current-api/criteria.jsonevals/ragas-current-api/task.mdevals/same-commit-scored-lower-in-september-than-in-june/criteria.jsonevals/same-commit-scored-lower-in-september-than-in-june/task.mdevals/wider-retrieval-scored-better-and-answered-worse/criteria.jsonevals/wider-retrieval-scored-better-and-answered-worse/task.mdreferences/metrics.md

FAQ

Что делает скилл ragas-evaluation?

Use for any question or task about RAG or agent evaluation metrics, including which metrics to use, scoring an answer against its contexts, and telling retrieval problems from generation problems after a change such as chunk size: Ragas faithfulness, response relevancy, context precision and recall, noise sensitivity, factual correctness, tool-call accuracy, agent goal accuracy and rubric scoring.

Как установить скилл ragas-evaluation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ragas-evaluation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить ragas-evaluation с