Skip to main content

⚡ RAG Harness

Evaluate RAG systems in seconds — fast, deterministic, and without requiring an API key.

PyPI version Python License CLI PyPI Downloads

Evaluating RAG systems shouldn't require paid APIs, rigid schemas, or complicated evaluation pipelines.

RAG Harness is a lightweight CLI that evaluates your RAG outputs using deterministic metrics, automatically detects common dataset formats, and provides human-readable diagnostics to help you understand why your system succeeds or fails.

Why choose RAG Harness?

  • No API key required
  • Fully deterministic and reproducible
  • Works offline and fast
  • Works with common RAG formats automatically
  • Great for local development and CI

👉Just give your model output → get evaluation instantly.

✓ Offline
✓ Deterministic
✓ CI-friendly
✓ No API


📦 Install

pip install rag-harness

📊 Score Interpretation Guide

RAG Harness uses deterministic scoring, which is typically stricter than LLM-based evaluation.

⚠️ Note

  • Scores may appear lower than LLM-based evaluators
  • Deterministic scoring is stricter and reproducible
  • LLM-based evaluation may give higher scores due to semantic reasoning

👉 Example:

A score of ~0.5 in RAG Harness often corresponds to reasonably good semantic answers, even if not perfectly aligned token-wise.


🎥 Demo

Demo


✨ Features

  • ⚡ One-command evaluation
  • 🧠 RAGAS-style scoring (no API required)
  • 🔍 Works with most JSON / JSONL / CSV RAG outputs
  • 📋 Rich CLI summaries
  • 💡 Human-readable diagnostics
  • 🔥 Top Failed Examples
  • 🔄 Auto-detects ground truth
  • 📊 Exact Match + F1 + Fuzzy + Context metrics
  • ⚔️ Compare multiple RAG systems
  • 🧩 Handles messy real-world outputs (LangChain, LlamaIndex, custom)

▶️ Quick Start

1. Evaluate predictions only

rag-harness evaluate examples/predictions_a.jsonl

2. Full evaluation (recommended)

rag-harness evaluate examples/predictions_a.jsonl --dataset examples/dataset.jsonl

3. Detailed diagnostics (verbose mode)

rag-harness evaluate examples/predictions_a.jsonl --dataset examples/dataset.jsonl --verbose

Displays:

  • 📊 Rich evaluation summary
  • 💡 Human-readable diagnostics
  • 🔥 Top Failed Examples
  • 🟢 Overall verdict for each failed example

4. Compare two RAG systems

rag-harness compare examples/dataset.jsonl examples/predictions_a.jsonl examples/predictions_b.jsonl

📊 Example Output

📊 RAG Evaluation Summary

Total             3
F1 Score          0.34
Fuzzy Score       0.60
Context Recall    0.00

🧠 RAGAS Score    0.47

🧠 Insights

  • Answers are semantically correct but not precise
  • No context detected → retrieval not evaluated

📁 Supported Input Formats

RAG Harness automatically detects:

  • answer, generated_answer, response
  • ground_truth, expected_answer
  • contexts, documents, source_documents

Works with:

  • LangChain outputs
  • LlamaIndex outputs
  • Custom RAG pipelines
  • Benchmark JSON logs

👉 No strict schema required.


🧾 Example Formats

Predictions + Ground Truth

{
  "generated_answer": "...",
  "ground_truth": "...",
  "contexts": ["..."]
}

Predictions only

{
  "answer": "...",
  "contexts": ["..."]
}

⚠️ Note

  • Without ground truth → limited evaluation
  • With ground truth → full evaluation

🧠 Scoring

RAG Harness approximates RAGAS using:

  • Exact Match
  • F1 Score
  • Fuzzy Semantic Matching
  • Context Recall

⚠️ Important

  • Fully deterministic (no API required)
  • Faster and reproducible
  • Scores may differ from LLM-based RAGAS

⚔️ Compare Systems

rag-harness compare dataset.json pred_a.json pred_b.json
⚔️ RAG Systems Comparison

Metric        A      B
------------------------
F1 Score      0.83   0.45
RAGAS Score   0.72   0.51

🏆 System A wins

🚧 Roadmap

Completed

  • ✅ Rich CLI output
  • ✅ Human-readable diagnostics
  • ✅ Overall verdicts
  • ✅ Top Failed Examples
  • ✅ Compare multiple systems

Coming Soon

  • ⏳ Rich metrics dashboard
  • ⏳ HTML reports
  • ⏳ Dataset Doctor
  • ⏳ CSV / Markdown export
  • ⏳ Optional LLM evaluation

🤝 Contributing

PRs, ideas, and improvements are welcome!


👨‍💻 Author

Built by Abhishek Bevinkatti


If this helped you evaluate your RAG system, consider starring ⭐ the repo!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rag_harness-0.2.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rag_harness-0.2.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file rag_harness-0.2.0.tar.gz.

File metadata

  • Download URL: rag_harness-0.2.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rag_harness-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e24bd670f9257cdeef7963f9c0800cf015b2cb866c9df3806b135a71f67c411f
MD5 6cbf5602351053210184bf452a1cbe3d
BLAKE2b-256 7544ac6cf5969b5b0c4a32b131e522cc53f88a8497d0cd37b0883b8e74ec8ec5

See more details on using hashes here.

File details

Details for the file rag_harness-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rag_harness-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rag_harness-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44044914c29155c131ff5e1af4ab21464e4475485984193bf90fe7e30182b0ff
MD5 fdcc3d83d85f800039ebac1e69e37dc3
BLAKE2b-256 386c57c649262a28f18e0d970d00b032843ae638f4f3f27cd8142e2c18e57da1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page