Skip to main content

⚡ CLI tool to evaluate and compare RAG systems.

Project description

⚡ RAG Harness

Evaluate any RAG system in seconds — no strict format.

PyPI version Python License CLI


🚀 Why RAG Harness?

Evaluating RAG systems is messy.

  • Different formats everywhere ❌
  • No simple CLI tools ❌
  • Hard to compare outputs ❌
  • Most tools require APIs ❌

👉 RAG Harness fixes that.

Just give your model output → get evaluation instantly.


📦 Install

pip install rag-harness

🎥 Demo

Demo


✨ Features

  • ⚡ One-command evaluation
  • 🧠 RAGAS-style scoring (no API required)
  • 🔍 Works with ANY JSON / JSONL / CSV
  • 🔄 Auto-detects ground truth
  • 📊 Exact Match + F1 + Fuzzy + Context metrics
  • ⚔️ Compare multiple RAG systems
  • 🧩 Handles messy real-world outputs (LangChain, LlamaIndex, custom)

⚡ Quick Start

rag-harness evaluate output.json

▶️ Run Evaluation

1. Evaluate predictions only

rag-harness evaluate predictions.json

2. Full evaluation (recommended)

rag-harness evaluate predictions.json --dataset dataset.json

3. Compare systems

rag-harness compare dataset.json pred_a.json pred_b.json

📊 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

  • LLM-based evaluation (user-provided API key)
  • Per-question analysis
  • HTML reports
  • Leaderboard mode

🤝 Contributing

PRs, ideas, and improvements are welcome!


👨‍💻 Author

Built by Abhishek — focused on practical AI tooling for real-world systems.


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

Project details


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.1.2.tar.gz (8.8 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.1.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rag_harness-0.1.2.tar.gz
  • Upload date:
  • Size: 8.8 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.1.2.tar.gz
Algorithm Hash digest
SHA256 f230afe0caa7e797cc88c6cb7de900d6b15c7ed2ad0dbd1be9e560890d60a8d4
MD5 8a3aa91f59d2b42b7055924ed961a7eb
BLAKE2b-256 2a4edacb4eb737e3c61289abeaa20e2cf8668980cd78c76da3d1e85a583939ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rag_harness-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 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.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ff9a41281ed32a3a8928236802cc1195833e04850a078b557477d528d7263b56
MD5 012e76d582410a96b2aa75e375a92fd8
BLAKE2b-256 eb15a10e8b9931be84c8896ca8ca89cd6e91a73189703e75320bc4321fd2bd4c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page