Skip to main content

Lightweight evaluation metrics for RAG (Hit@k, Recall@k, Precision@k MRR, nDCG, and more)

Project description

rag-eval-lite

Lightweight retrieval evaluation metrics for RAG systems.


Install

pip install rag-eval-lite

Usage

from rag_eval import evaluate_dataset

results = evaluate_dataset(data, k=3)
print(results)

Input Format

Each item in data must be:

{
  "question": "string",
  "golden_chunk_ids": ["chunk_1"],
  "retrieved_chunk_ids": ["chunk_1", "chunk_3", "chunk_7"]
}
  • golden_chunk_ids: ground truth relevant chunks
  • retrieved_chunk_ids: retriever output (ordered by rank)

Output

{
  "hit@k": float,
  "precision@k": float,
  "recall@k": float,
  "mrr": float,
  "ndcg@k": float,
  "num_failures": int,
  "failures": [...]
}

Notes

  • Order of retrieved chunks matters
  • Supports single and multi-chunk evaluation
  • Failures include full debug info

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_eval_lite-0.1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

rag_eval_lite-0.1.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file rag_eval_lite-0.1.1.tar.gz.

File metadata

  • Download URL: rag_eval_lite-0.1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for rag_eval_lite-0.1.1.tar.gz
Algorithm Hash digest
SHA256 99fc9ed94324b7c28b5145187a060f515c52d7c590029f4a979bc1ed01e60c2b
MD5 ba1d942e22aa58655cad0efcb8f1449f
BLAKE2b-256 d1ffbc2c3de6a92f3f21e3244401ad0f9a784e6efe4fceeafb2f98942160a2ae

See more details on using hashes here.

File details

Details for the file rag_eval_lite-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: rag_eval_lite-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for rag_eval_lite-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f457ec410ef7fb8940df6fbed01fee86f9155be980d6ce902197e736c77ea44a
MD5 c46d2a200cbad0e6916cd5cb32e97914
BLAKE2b-256 fcd74a4660e41b30b54e3cfc52e1e2df2acc816cf91ad62c886e9b7da5a3f486

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