ragjudge
Typed, async evals for RAG pipelines — the Python package. TypeScript port at packages/js.
Install
pip install ragjudge # core (pydantic + httpx + rich)
pip install "ragjudge[openai]" # + OpenAI judge
pip install "ragjudge[anthropic]" # + Anthropic judge
Requires Python 3.10+. Strict-typed end to end.
60-second quickstart
import asyncio
from ragjudge import (
Sample, Suite, ContextRelevance, Faithfulness, AnswerRelevance,
)
from ragjudge.judges.openai import OpenAIJudge
samples = [
Sample(
question="What is the capital of France?",
contexts=["Paris is the capital of France."],
answer="Paris.",
),
]
suite = Suite(
name="my-rag",
metrics=[ContextRelevance(), Faithfulness(), AnswerRelevance()],
judge=OpenAIJudge(model="gpt-4o-mini"),
)
report = asyncio.run(suite.run(samples))
print(f"{report.passed_count}/{report.total} passed")
CLI
ragjudge run samples.jsonl \
--judge openai \
--model gpt-4o-mini \
--metrics context_relevance,faithfulness,answer_relevance \
--report-out report.json \
--fail-under 0.8
Each line of samples.jsonl is a Sample — see examples/samples.jsonl.
Metrics
| Metric | What it catches | Threshold default |
|---|---|---|
context_relevance |
Retriever pulling unrelated chunks | 0.7 |
faithfulness |
Hallucination — claims not grounded in context | 0.8 |
answer_relevance |
Answer that misses the question | 0.7 |
answer_correctness |
Semantic drift from a reference answer | 0.7 |
Custom judge
Anything matching this shape is a judge — Judge is a runtime_checkable Protocol, no inheritance needed:
class MyJudge:
async def judge(self, prompt: str, schema: dict) -> "JudgeResponse":
...
Custom metric
from ragjudge import Judge, Metric, Sample, Score
class MyMetric:
name = "my_metric"
threshold = 0.5
async def score(self, sample: Sample, judge: Judge) -> Score:
...
Pass instances of it to Suite(metrics=[...]). That's it.
License
MIT.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ragjudge-0.1.0.tar.gz.
File metadata
- Download URL: ragjudge-0.1.0.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41f4cf13c8ddcb01fde06a923aa3deb8ef590588e16dd907d420c1f4a4f050f5
|
|
| MD5 |
71b308fcec4d1ba28624a110f3ac1518
|
|
| BLAKE2b-256 |
6d8de96f88042125aeda0eebecbe18c131038ece3eea08c5eb60ef7e0b7ef43d
|
File details
Details for the file ragjudge-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ragjudge-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4be1c23cc836a6ca94aa72a11323fb129ca65d48b2ff6a584a6c9fa3414f009
|
|
| MD5 |
3e9afdfbc1948fa7eaa84ec9a6dffbad
|
|
| BLAKE2b-256 |
0b35564381b6c748c7fe3fd8f3a17bb5852ce0ac0a60ca2e128c14849f0bacc6
|