⚡ RAG Harness
Evaluate RAG systems in seconds — fast, deterministic, and without requiring an API key.
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
✨ 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. Enforce a minimum score in CI
rag-harness evaluate examples/predictions_a.jsonl --dataset examples/dataset.jsonl --fail-under 0.70
The command exits with status 1 when the RAGAS score is below the threshold or no examples could be evaluated.
5. 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!
Metadata
Release files for rag-harness 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rag_harness-0.2.1.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rag_harness-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.4 kB
Release files / rag_harness-0.2.1.tar.gz
| Download URL | rag_harness-0.2.1.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81d4e948468a4735cb16bd642e8e5298193044073bec1816c376d6e86e88f77f
|
|
BLAKE2b-256 checksum How to use checksums |
a0fd97b80154344591dbcb35ceba726b8cb7561e5b4c4bfaeb181ae9b272991a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / rag_harness-0.2.1-py3-none-any.whl
| Download URL | rag_harness-0.2.1-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2d8c1f3d3a6431995dbaecfae8179d1343740de15d71a7bf16d1875440296dd
|
|
BLAKE2b-256 checksum How to use checksums |
530a552b56edc78272825819cef78374bdb91aac36be7129affefa0b60238f6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|