trustrag-eval
RAGAS-based evaluation pipeline with trust-specific metrics for TrustRAG.
Getting Started
# Install in development mode
pip install -e packages/trustrag-eval
# Run tests
cd packages/trustrag-eval && pytest tests/ -v
Metrics Explained
RAGAS Metrics (industry-standard)
| Metric | What it measures |
|---|---|
| Faithfulness | Does the answer stay within retrieved context? |
| Answer Relevancy | Does the answer address the question? |
| Context Precision | How relevant are the retrieved chunks? |
| Context Recall | Did we retrieve the chunks needed for ground truth? |
Trust-Specific Metrics (TrustRAG)
| Metric | What it measures |
|---|---|
| Trust Score Distribution (p25/p50/p75/mean) | Overall trust score health across queries |
| Flagged Rate | Percentage of queries with trust_score < 50 |
| Hit@5 | Was the ground-truth chunk in the top-5 retrieved? |
| Hit@5 by Category | Hit rate broken down by query type (semantic/keyword/hybrid) |
Usage
from trustrag_eval import load_synthetic_queries, compute_trust_metrics
# Load benchmark dataset
queries = load_synthetic_queries("eval/synthetic_queries.json")
# Compute trust distribution from results
results = [{"trust_score": 85}, {"trust_score": 72}, ...]
dist = compute_trust_metrics(results)
print(f"Median trust: {dist['p50']}, Flagged: {dist['flagged_pct']:.0%}")
Metadata
Release files for trustrag-eval 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trustrag_eval-0.1.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trustrag_eval-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / trustrag_eval-0.1.0.tar.gz
| Download URL | trustrag_eval-0.1.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0bfe9cb080e8f299048568dcc8cb949806919496f6f91c39c787a873f4a022df
|
|
BLAKE2b-256 checksum How to use checksums |
ba8cce6f9543070ffd926dbbe58f030229d178eab1f3147416a5b01458868fc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / trustrag_eval-0.1.0-py3-none-any.whl
| Download URL | trustrag_eval-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba0049877ba3a7f065eb5eb420c3fca457317ee23bd9ad17364e12734a261719
|
|
BLAKE2b-256 checksum How to use checksums |
abbc0d565967d383d5d4862216857e7b5d7c5ce99c57ff5f112d7bd3ffbd9d37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|