RAG Evaluation Kit

Find out whether your RAG bot fails at retrieval, chunking or answering, and prove a change made it better.

RAG Evaluation Kit product illustration

What it does

Your retrieval-augmented chatbot answers from your documents, until it doesn't: the right page isn't retrieved, the answer invents a number, or it confidently answers a question your docs never cover. This kit measures all three on a set of test questions, so you can change the chunk size, embedding model, prompt or LLM and see whether things got better or worse.

  • Retrieval metrics: hit@k, recall@k, precision@k, MRR and nDCG@k against the documents (or chunks) that should be found. Chunk ids like refunds.md#3 count as the document refunds.md.
  • Answer metrics: token F1, ROUGE-L and exact match against a reference answer, plus must_include facts ("5-7 business days").
  • Faithfulness without an LLM: every answer sentence must be covered by a retrieved chunk, and every number it states must appear in the chunks. Catches invented timelines, prices and limits.
  • Context recall: did the retrieved chunks contain the reference answer at all?
  • Abstention: mark questions your docs don't cover with "answerable": false; the bot should say it doesn't know.
  • Optional LLM judge (--judge openai:<model>, anthropic:<model>, OpenRouter or local Ollama): faithfulness, relevance and correctness scores with a reason.
  • BM25 baseline + chunk-size sweep over a folder of .md, .txt or .html docs: a number your vector search has to beat, and the chunk size that works for your docs.
  • Any pipeline: ragcheck run --pipeline "python3 my_rag.py" (JSON in, JSON out, any language), or score a JSONL file you already logged (LangChain, LlamaIndex, your own code).
  • Compare runs and CI gates (--min faithfulness=0.9 --min hit@5=0.8, exit 1 below). Text, Markdown and JSON reports.
  • Python 3.9+ standard library only. Claude Code skill included (skills/rag-eval).

What you get

The screenshot is real output from the kit’s own commands. Tested from a fresh download of this exact zip: ./run_tests.sh ran 8 tests OK on Python 3.13 and 3.10.

Real terminal output from RAG Evaluation Kit: demo and passing tests

Use

python3 -m ragcheck bm25 qa.jsonl --docs docs/ --sweep 100,200,400          # baseline + chunk sizes
python3 -m ragcheck run qa.jsonl --pipeline "python3 my_rag.py" --out run-a.json
python3 -m ragcheck eval qa.jsonl logged-results.jsonl --judge openai:<model> --out run-b.json
python3 -m ragcheck compare run-a.json run-b.json
python3 -m ragcheck eval qa.jsonl results.jsonl --min faithfulness=0.9 --min hit@5=0.8 --format md >> "$GITHUB_STEP_SUMMARY"

./demo.sh evaluates a fictional coffee shop's help-center bot (8 docs, 11 questions): the chunk-size sweep, then a recorded LLM run where ragcheck catches a retrieval miss ("torn open" vs "damaged"), an invented "10 business days" refund time and an answer about a café that doesn't exist. ./run_tests.sh runs 8 test groups.

Files

Dataset (qa.jsonl), one question per line:

{"id": "q05", "question": "How quickly do refunds reach my card?", "ground_truth": "Within 5-7 business days after approval.", "relevant": ["refunds.md"], "must_include": ["5-7 business days"]}
{"id": "q11", "question": "Do you have a café in Denver?", "answerable": false}

Results (results.jsonl, or what your --pipeline prints for each question):

{"id": "q05", "answer": "Refunds arrive within 5-7 business days.", "contexts": [{"id": "refunds.md#2", "text": "Refunds go back to..."}]}

contexts can also be plain strings; text, content and page_content keys are all read. The pipeline gets {"id": ..., "question": ...} on stdin and prints one JSON line. examples/simple_rag.py is a short example (BM25 + extractive answers).

How to read the scores

  • Low hit@k / recall@k: fix retrieval first (chunking, hybrid search, query rewriting); the LLM can't use what it never sees.
  • Good retrieval, low context recall: chunks are found but cut off the answer; try larger chunks or more overlap.
  • Low faithfulness: the model adds facts not in the context; tighten the prompt ("answer only from the context, say you don't know otherwise").
  • Low answer F1 with high faithfulness: answers are correct but worded differently; check must_include and the judge before worrying.

Honest limits

  • The built-in faithfulness check is word overlap, not understanding: it catches invented numbers and off-context sentences, but a claim built from words that all appear in the context (e.g. "free express shipping" when only standard shipping is free) can pass. Use --judge for those, and spot-read the flagged questions.
  • Scores are only as good as your test questions: 30-100 real user questions with references beat thousands of generated ones.
  • No embedding model is included; BM25 is the baseline. Your own retriever runs through --pipeline or logged results.

Format and license

Zip, 30 KB, v1.0, 26 files. You may use and modify this kit for your own work and for clients you serve, including paid client work. Not affiliated with or endorsed by any model or vector database vendor.

FAQ

Do I need an OpenAI key?
No. All metrics except the optional --judge run locally without any model.
Does it work with LangChain or LlamaIndex?
Yes: log each question's answer and retrieved chunks to JSONL, or wrap your chain in a small script for --pipeline.
How is it different from Ragas or DeepEval?
Those are larger libraries that mostly use an LLM for every metric; this is a dependency-free CLI with classic retrieval metrics, offline faithfulness checks and an optional judge.
How do I get the files?
Pay by card right here on youraitools.co: your download links appear on this page the moment the payment goes through (claim window: 72 hours, up to 5 downloads per 7 days). Need the files re-sent later? Email hello@youraitools.co.
Refunds?
Email hello@youraitools.co within 14 days if it doesn’t work and we can’t fix it.
Can I pay with crypto?
Yes. Pay the same price in USDC or USDT on Base, Ethereum, Arbitrum, Optimism, Polygon or Solana from the "Pay with crypto" button, with no account or KYC. We check the payment on-chain and show your download links as soon as it confirms.

Get RAG Evaluation Kit

RAG evaluation kit: hit@k, recall, MRR, nDCG, faithfulness, context recall and answer F1 on your own questions. BM25 baseline, chunk sweep, CI gates. $29.

Save with a bundle

Pairs well with

Download$29

Vibe Coding Security Audit

Security audit for AI-built apps: exposed API keys, NEXT_PUBLIC secrets, Supabase service_role, open API routes, Stripe webhooks, CORS. Grade + fixes. $29.

View Vibe Coding Security Audit
Download$19

Supabase RLS Checker

Supabase RLS checker for migrations: tables without RLS, using (true) policies, user_metadata, slow auth.uid(), definer views. Fix SQL included. $19.

View Supabase RLS Checker
Download$19

Dockerfile Linter & Best Practices Checker

Dockerfile linter with fixes: non-root user, pinned slim images, secrets in ENV/ARG, apt cache, COPY order, .dockerignore. SARIF + Claude Code skill. $19.

View Dockerfile Linter & Best Practices Checker

Related

1 email a week: new x402 + MCP tools and free kits.

Short weekly digest of new x402 + MCP tools and free kits, including the MCP OAuth Checker. No spam, unsubscribe any time.