К основному содержанию
скилл CX Codex

rag-eval — скилл для Claude Code: что делает и установка

Оценивает качество RAG по файловому набору с corpus/ и train.json. Нужен для сравнения настроек поиска и генерации по метрикам RAGAS.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add NVIDIA/skills --skill rag-eval -a claude-code
Открыть на GitHub

Что делает rag-eval

Скилл готовит файловые наборы RAG с corpus/ и train.json, запускает scripts/eval/evaluate_rag.py и разбирает JSON-результаты RAGAS. Он помогает сравнить настройки поиска, реранжирования, переформулирования запросов и генерации через параметры --top_k, --vdb_top_k и --temperature.

Команды нужно запускать из корня checkout. Для работы нужны Python 3.11+, uv, доступные RAG-сервер и ingestor, а зависимости оценки ставятся через uv sync --project scripts/eval; для RAGAS требуется NVIDIA_API_KEY.

Скилл также разбирает ошибки сети, пустые контексты и несовпадение коллекций. Для замеров задержки или пропускной способности он не подходит: в таких сценариях указан rag-perf, поэтому это повод не смешивать оценку качества с нагрузочными тестами.

Какие задачи решает

  • подготовить набор с corpus/ и train.json
  • запустить RAGAS-оценку через evaluate_rag.py
  • сравнить настройки поиска и генерации
  • найти причину пустых generated_contexts
  • разобрать ошибки ingestor и ключа NVIDIA_API_KEY

Примеры запросов агенту

  • Запусти оценку RAGAS для набора /path/to/my_dataset через uv run --project scripts/eval python scripts/eval/evaluate_rag.py.
  • Проверь, почему в результатах пустые generated_contexts, и разберись с коллекцией и --vdb_top_k.
  • Сравни RAGAS-результаты после изменения --top_k и --temperature.

Как установить rag-eval

1Через Skills CLI (Vercel)

npx skills add NVIDIA/skills --skill rag-eval -a claude-code

2Вручную: положить файлы

~/.claude/skills/rag-eval/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/rag-eval/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о rag-eval

Как установить rag-eval в Claude Code?

Выполните npx skills add NVIDIA/skills --skill rag-eval -a claude-code, затем повторите npx skills add NVIDIA/skills --skill rag-eval -a claude-code. Файл скилла находится в ~/.claude/skills/rag-eval/SKILL.md.

Что делает rag-eval?

Скилл оценивает файловый RAG-набор через scripts/eval/evaluate_rag.py и метрики RAGAS. Он помогает подготовить данные, менять параметры поиска и разбирать результаты.

Что нужно для запуска оценки?

Нужны checkout репозитория, Python 3.11+, uv, доступ к RAG-серверу и ingestor. Для RAGAS нужен NVIDIA_API_KEY.

Исходный текст

SKILL.md · Apache-2.0
---
name: rag-eval
version: "2.6.0"
description: >-
  Filesystem RAG benchmarks: corpus/, train.json, evaluate_rag.py (RAGAS quality). Not for prod
  monitoring, latency/throughput benchmarking (use rag-perf), or evals outside this repo layout.
license: Apache-2.0
compatibility: Repository checkout with uv; Python 3.11+; run from repo root; uv sync --project scripts/eval (eval deps live in scripts/eval/pyproject.toml); network to RAG, ingestor, and vdb endpoints; NVIDIA_API_KEY for RAGAS; optional RAG_EVAL_JUDGE_MODEL (default mistralai/mixtral-8x22b-instruct-v0.1).
metadata:
  author: NVIDIA RAG <[email protected]>
  github-url: "https://github.com/NVIDIA-AI-Blueprints/rag"
  endpoint-openapi-schemas:
    - docs/api_reference/openapi_schema_rag_server.json
    - docs/api_reference/openapi_schema_ingestor_server.json
  argument-hint: RAGAS eval | evaluate_rag | train.json | corpus | results json | error triage | uv run --project scripts/eval | enable_reranker | query_rewriting | temperature | skip_ingestion
  tags:
    - nvidia
    - blueprint
    - rag
    - evaluation
    - ragas
    - benchmarking
    - nvidia-rag-blueprint
  languages:
    - python
    - shell
  frameworks:
    - ragas
    - fastapi
  domain: ai-ml
allowed-tools: Read Grep Glob Bash(ls *) Bash(python3 *) Bash(uv *) Write Edit
---

# On-disk RAG evaluation (`corpus/` + `train.json`)

## Purpose

Guide agents through NVIDIA RAG Blueprint **filesystem** benchmarks: preparing `corpus/` and `train.json`, running `scripts/eval/evaluate_rag.py`, tuning retrieval and generation flags for **quality** comparisons, interpreting RAGAS JSON outputs, and triaging failures (HTTP/stream errors, empty contexts, collection mismatch, judge API).

For **latency, throughput, and load testing**, use the **rag-perf** skill (`scripts/rag-perf`, `docs/performance-benchmarking.md`) — not this skill.

## When not to use

Do **not** use this skill for: deploying or repairing services (use rag-blueprint); evaluating APIs without the `corpus/` + `train.json` layout; general ML experimentation unrelated to this evaluator; production monitoring/alerting; or latency/throughput benchmarking (use **rag-perf**).

## Prerequisites

- Repo cloned; **run commands from repo root** (imports and paths assume this).
- Python **3.11+** and **uv**; eval deps: `uv sync --project scripts/eval`.
- Reachable **RAG server** and **ingestor** (defaults often `localhost:8081` / `8082`).
- **`NVIDIA_API_KEY`** for RAGAS (see [credential hygiene](references/benchmark-execution.md#credential-hygiene-nvidia_api_key)); optional **`RAG_EVAL_JUDGE_MODEL`**.
- Dataset roots passed to `--dataset-paths` each contain **`corpus/`** and **`train.json`**.

## Instructions

1. **Prepare data** — Ensure each dataset directory matches the layout and `train.json` rules in [`references/dataset-and-conversion.md`](references/dataset-and-conversion.md). When sources arrive as public links (sites or dataset pages), materialize documents under `corpus/`—prefer **PDF** for multimodal content so **images stay embedded**; convert CSV/JSONL/etc. using the patterns there.
2. **Run eval** — `uv run --project scripts/eval python scripts/eval/evaluate_rag.py` with `--dataset-paths`, `--host`, and `--port`. See [`references/benchmark-execution.md`](references/benchmark-execution.md) for command examples, outputs, and errors. Use [`references/evaluate-rag-cli.md`](references/evaluate-rag-cli.md) for flag-level detail.
3. **Tune quality** — Adjust `--top_k` / `--vdb_top_k`, reranker and query-rewriting toggles, and generation overrides (`--temperature`, `--top-p`, `--max-tokens`) as documented in [`references/benchmark-execution.md`](references/benchmark-execution.md) when comparing retrieval/generation configs for RAGAS scores.
4. **Analyze results** — Use [`references/result-analysis.md`](references/result-analysis.md) for scripts; scan `rag_*_evaluation_summary.json` for headline RAGAS metrics.
5. **Triage errors** — Use the [error signal table](references/benchmark-execution.md#common-error-cases-and-signals) and the **Troubleshooting** section below.

## Examples

**Set API key without putting secrets in shell history (preferred patterns):** load from a gitignored env file or secrets manager; avoid committing `.env`; rotate keys if exposed. Details: [`references/benchmark-execution.md#credential-hygiene-nvidia_api_key`](references/benchmark-execution.md#credential-hygiene-nvidia_api_key).

**Minimal eval (key already in environment):**

```bash
uv sync --project scripts/eval
uv run --project scripts/eval python scripts/eval/evaluate_rag.py \
  --dataset-paths /path/to/my_dataset \
  --host localhost \
  --port 8081
```

**Pretty-print summary JSON:**

```bash
python3 -m json.tool results/my_dataset/rag_my_dataset_evaluation_summary.json
```

More examples (skip ingestion, quality sweeps): [`references/benchmark-execution.md`](references/benchmark-execution.md).

## Limitations

- Evaluator behavior is fixed to the **filesystem contract** and `evaluate_rag.py`; it does not substitute for custom offline judges or non-RAG benchmarks.
- **Vector DB / embedding** choices follow deployed ingestor and RAG env — not overridden by this CLI alone.
- **Scores depend on** retrieval quality, judge model availability, and `NVIDIA_API_KEY`; empty contexts yield partial RAGAS metrics (see references).
- Large procedural detail lives under **`references/`** to keep routing concise; read those files when the user needs step-by-step conversion, full flags, or error tables.

## Troubleshooting

| Error / signal | Likely cause | What to do |
|----------------|--------------|------------|
| Immediate exit mentioning `NVIDIA_API_KEY` | Missing or invalid key | Set key via secure channel; see credential hygiene in [`references/benchmark-execution.md`](references/benchmark-execution.md). |
| `train.json must be a JSON array` | Wrong JSON shape | Top-level array of objects; validate per [`references/dataset-and-conversion.md`](references/dataset-and-conversion.md). |
| Fewer rows in `evaluation_data.json` than `train.json` | Per-query failures | Check stderr: network or stream JSON errors; see error table in benchmark-execution. |
| Empty `generated_contexts` everywhere | Retrieval gap | Verify collection, ingestion, `top_k` / `vdb_top_k`, and `ingestor_server_url` **without** `/v1` suffix. |
| Ingestor 404 on upload | Bad ingestor base URL | Pass `http://host:port` only — code appends `/v1/`. |

Full signal table: [`references/benchmark-execution.md#common-error-cases-and-signals`](references/benchmark-execution.md#common-error-cases-and-signals).

## Gotchas

- **Run from repo root**: paths and imports in `scripts/eval/evaluate_rag.py` assume this; a wrong directory silently breaks imports.
- **`--ingestor_server_url`**: pass `http://host:port` without `/v1`—the code appends `/v1/` automatically. Including `/v1` causes 404s on ingestor calls.
- **Vector DB / embedding settings**: not set by this CLI; configure via the deployed ingestor and RAG server env vars (e.g. `APP_VECTORSTORE_URL`, embedding model).
- **`--model` / `--llm_endpoint`**: forwarded verbatim only when explicitly set; omit to keep the server's configured LLM.
- **Stale collections**: a previous run's ingested data persists unless you use `--force_ingestion`. Use `--collection` with a unique name when comparing quality across isolated runs.
- **Empty context metrics**: if all `generated_contexts` are empty, RAGAS scores only `nv_accuracy` and leaves the other two metrics blank—this is not a silent success.

## Source of truth

| Piece | Location |
|-------|----------|
| Driver | `scripts/eval/evaluate_rag.py` (`CORPUS_DIRECTORY` = `corpus`, `EVAL_DATA` = `train.json`) |
| Human README (always in-repo) | `scripts/eval/README.md` |
| Full CLI (flags, defaults) | `scripts/eval/evaluate_rag.py --help`; [`references/evaluate-rag-cli.md`](references/evaluate-rag-cli.md) |
| Dataset / conversion | [`references/dataset-and-conversion.md`](references/dataset-and-conversion.md) |
| Runs, outputs, errors | [`references/benchmark-execution.md`](references/benchmark-execution.md) |
| Result analysis scripts | [`references/result-analysis.md`](references/result-analysis.md) |
| Latency / throughput | **rag-perf** skill, `docs/performance-benchmarking.md` |

## Agent playbook

1. **Run eval** — `uv sync --project scripts/eval` then `uv run --project scripts/eval python scripts/eval/evaluate_rag.py` with required `--dataset-paths`, `--host`, and `--port` (and env `NVIDIA_API_KEY`). Argument `--ingestor_server_url` is optional (defaults to `http://localhost:8082`); pass it only when overriding the ingestor endpoint.
2. **Quality tuning** — See [`references/benchmark-execution.md`](references/benchmark-execution.md): `--top_k`/`--vdb_top_k`, reranker and query-rewriting toggles, `--temperature`, `--top-p`, `--max-tokens`.
3. **Data conversion** — Follow [`references/dataset-and-conversion.md`](references/dataset-and-conversion.md).
4. **Analyze results** — [`references/result-analysis.md`](references/result-analysis.md); quick scan: `python3 -m json.tool results/<dataset>/rag_<dataset>_evaluation_summary.json`.
5. **Error triage** — [`references/benchmark-execution.md#common-error-cases-and-signals`](references/benchmark-execution.md#common-error-cases-and-signals).

© NVIDIA RAG · Apache-2.0 · NVIDIA/skills

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

Всё по теме «ИИ и ML» →
rag-observability-evals devops-skills Скилл для мониторинга и оценки RAG-систем: метрики качества поиска, проверка обоснованности ответов, детекция галлюцинаций и регрессионное тестирование. CX Codex +1 318установок langchain-rag langchain-ai Даёт ИИ-агенту готовые шаблоны и код для сборки RAG-пайплайнов на LangChain в Python и TypeScript: от загрузки документов до векторного поиска. CX Codex +1 17 500установок agent-platform-rag-engine-management официальный google Скилл работает с корпусами Agent Platform RAG Engine: находит корпуса и файлы, извлекает контекст и помогает готовить ответы на его основе. Подойдёт для задач с RAG в Google Cloud. CX Codex 8 626установок rag-infrastructure devops-skills Скилл для сборки RAG-конвейера: загрузка документов, эмбеддинги, векторное хранилище, гибридный поиск и ответы LLM по найденному контексту. CX Codex +1 325установок pinecone-rag официальный github Скилл помогает строить RAG-системы и память агента на Pinecone. Подойдёт для семантического поиска по документам и хранения контекста между сессиями. 24установок evaluate-rag ai-evals-course Помогает раздельно оценить поиск и генерацию в RAG, подобрать метрики и проверить разбиение документов на чанки. CX Codex +1 970установок

Из того же набора178

cuopt-install Помогает развернуть NVIDIA cuOpt для Python, C или REST-сервера через pip, conda и Docker, а также проверить готовность среды. Пригодится при настройке GPU-оптимизации маршрутов. CX Codex +1 2 500установок data-designer Создаёт синтетические наборы данных и Python-конвейеры генерации. Пригодится, когда нужно описать структуру данных и получить скрипт для Data Designer. CX Codex +1 2 500установок deepstream-dev Помогает агенту собирать видеоаналитику на NVIDIA DeepStream SDK: GStreamer-пайплайны, вывод через TensorRT, трекинг и отправка сообщений в брокер. CX Codex +1 2 400установок nemo-retriever Индексирует и ищет данные в документах через CLI NeMo Retriever 26.8.1. Пригодится для работы с локальной базой LanceDB или удалённым сервисом поиска без написания обвязочного кода. CX Codex +1 2 400установок cuopt-routing-api-python Скилл учит агента решать задачи маршрутизации транспорта через Python API cuOpt: TSP, VRP и pickup-delivery. Пригодится, когда маршруты считают в Python. CX Codex +1 2 300установок dynamo-recipe-runner Скилл подбирает, валидирует, точечно правит и разворачивает готовые Kubernetes-рецепты NVIDIA Dynamo для инференс-моделей под vLLM или SGLang. CX Codex +1 2 300установок deepstream-import-vision-model Скилл проводит модель детекции объектов из HuggingFace или NGC в пайплайн NVIDIA DeepStream: ONNX, TRT-движок, парсер bbox, бенчмарк и PDF-отчёт. CX Codex +1 2 300установок omniverse-usd-performance-tuning Скилл для диагностики и оптимизации сцен USD: медленная загрузка, низкий FPS, высокая память. Ведёт весь рабочий процесс по фазам. CX Codex +1 2 300установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой