raccca-eval
Enterprise-grade Python SDK for evaluating LLM responses using the RACCCA framework:
Relevance · Accuracy · Completeness · Clarity · Coherence · Appropriateness
Use a judge LLM to score any model output on six quality dimensions — with typed results, multi-provider support, and sync or async batch evaluation.
Install
pip install raccca-eval
Requires Python 3.11+. Set an API key for your judge provider (e.g. OPENAI_API_KEY).
Quickstart
from raccca_eval import EvaluationRequest, RacccaCriterion, RacccaEvaluator
evaluator = RacccaEvaluator(model="gpt-4o-mini")
result = evaluator.evaluate(
EvaluationRequest(
query="What causes Type 2 diabetes?",
response=(
"Type 2 diabetes is caused by insulin resistance and impaired beta-cell function, "
"often linked to obesity and sedentary lifestyle."
),
criteria_to_evaluate=[
RacccaCriterion.RELEVANCE,
RacccaCriterion.ACCURACY,
RacccaCriterion.COMPLETENESS,
],
reference_answer=(
"Insulin resistance and beta-cell dysfunction are primary causes of Type 2 diabetes."
),
audience="medical students",
)
)
print(f"Overall: {result.overall_score}/5")
print(f"Summary: {result.summary}")
for name, score in result.scores.items():
print(f" {name}: {score.score}/5 — {score.rationale}")
# Token usage from the judge call
print(f"Judge tokens: {result.usage.total_tokens}, latency: {result.usage.latency_ms:.0f}ms")
Example output:
Overall: 4.33/5
Summary: Accurate and relevant explanation with good coverage of core mechanisms.
relevance: 5/5 — Directly addresses the question about Type 2 diabetes causes.
accuracy: 4/5 — Core mechanisms are correct; minor details omitted.
completeness: 4/5 — Covers insulin resistance and lifestyle factors well.
Judge tokens: 842, latency: 1200ms
RACCCA criteria
| Criterion | RacccaCriterion |
What it measures |
|---|---|---|
| Relevance | RELEVANCE |
Does the response address the query? |
| Accuracy | ACCURACY |
Is the information factually correct? |
| Completeness | COMPLETENESS |
Are all essential points covered? |
| Clarity | CLARITY |
Is it understandable for the audience? |
| Coherence | COHERENCE |
Is it logically structured? |
| Appropriateness | APPROPRIATENESS |
Is tone and content suitable? |
Each criterion is scored 1–5 with a written rationale. Pass audience when evaluating clarity or appropriateness; provide reference_answer or context for stronger accuracy and completeness checks.
Evaluation request
EvaluationRequest(
query="...", # Original user prompt
response="...", # LLM output to evaluate
criteria_to_evaluate=[...], # Defaults to all six RACCCA criteria
reference_answer="...", # Optional gold-standard answer
context="...", # Optional grounding document
audience="...", # Required for clarity / appropriateness
external_prompt="...", # Extra instructions for the judge
)
Features
- Typed Pydantic API —
EvaluationRequest,EvaluationResult,CriterionScore - Multi-provider judges — OpenAI, Anthropic, Gemini, Azure, Ollama, vLLM via LiteLLM
- Flexible config — environment variables,
.env, orraccca.yaml - Sync & async —
evaluate(),aevaluate(),aevaluate_batch(),evaluate_batch() - Two strategies —
single(one judge call) orper_criterion(one call per dimension) - Production-ready — retries, optional fallback judge, JSON recovery, usage metadata
Configuration
Environment variables (all prefixed with RACCCA_):
export OPENAI_API_KEY=sk-...
export RACCCA_JUDGE_MODEL=gpt-4o-mini
export RACCCA_STRATEGY=single
export RACCCA_FALLBACK_MODEL=anthropic/claude-3-5-haiku-20241022
export RACCCA_MAX_RETRIES=3
Or use a YAML config file (raccca.yaml):
judge_model: gpt-4o-mini
strategy: single
temperature: 0.0
weights:
relevance: 0.3
accuracy: 0.4
completeness: 0.3
evaluator = RacccaEvaluator.from_settings()
See docs/configuration.md for all options.
Evaluation strategies
| Strategy | Behavior | Best for |
|---|---|---|
single (default) |
One LLM call scores all selected criteria | Cost-efficient production use |
per_criterion |
Separate LLM call per criterion | Audits and maximum granularity |
from raccca_eval.config import RacccaSettings
evaluator = RacccaEvaluator(settings=RacccaSettings(strategy="per_criterion"))
Providers
| Provider | Model string example | Env vars |
|---|---|---|
| OpenAI | gpt-4o-mini |
OPENAI_API_KEY |
| Anthropic | anthropic/claude-3-5-haiku-20241022 |
ANTHROPIC_API_KEY |
gemini/gemini-2.0-flash |
GEMINI_API_KEY |
|
| Azure | azure/gpt-4o |
AZURE_API_KEY, AZURE_API_BASE |
| Ollama | ollama/llama3.2 |
OLLAMA_API_BASE |
See docs/providers.md for setup details.
Async batch evaluation
Evaluate many responses concurrently with bounded parallelism:
import asyncio
from raccca_eval import EvaluationRequest, RacccaCriterion, RacccaEvaluator
async def main() -> None:
evaluator = RacccaEvaluator.from_settings()
requests = [
EvaluationRequest(
query="What is RACCCA?",
response="RACCCA is a framework for evaluating AI responses.",
criteria_to_evaluate=[RacccaCriterion.RELEVANCE, RacccaCriterion.CLARITY],
audience="developers",
),
EvaluationRequest(
query="What is 2+2?",
response="2+2 equals 4.",
criteria_to_evaluate=[RacccaCriterion.ACCURACY, RacccaCriterion.RELEVANCE],
reference_answer="4",
),
]
results = await evaluator.aevaluate_batch(requests, concurrency=5)
for i, result in enumerate(results, start=1):
print(f"Request {i}: {result.overall_score}/5 — {result.summary}")
asyncio.run(main())
Sync equivalent: evaluator.evaluate_batch(requests, concurrency=5).
Examples
Runnable scripts in examples/:
| Script | Description |
|---|---|
basic_eval.py |
Single evaluation with score breakdown |
batch_eval.py |
Async batch evaluation |
azure_and_ollama.py |
Azure OpenAI and Ollama judges |
export OPENAI_API_KEY=sk-...
python examples/basic_eval.py
Development
git clone https://github.com/Abhishek-2502/raccca-eval.git
cd raccca-eval
pip install -e ".[dev]"
pytest
ruff check .
mypy raccca_eval
Integration tests (require live API keys) are skipped by default:
pytest -m integration
Changelog
See CHANGELOG.md for version history.
License
MIT — see LICENSE.
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 raccca_eval-0.1.2.tar.gz.
File metadata
- Download URL: raccca_eval-0.1.2.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cef5ad80afcf5fd898564e30929536e62905bf916a23209bcfaf43f93c179b1e
|
|
| MD5 |
0603195f9b07da785a9e5931e4bd7d57
|
|
| BLAKE2b-256 |
62e71a445c0fde1f224013f53e84311364848ddc9e32cc97e01825864298f041
|
Provenance
The following attestation bundles were made for raccca_eval-0.1.2.tar.gz:
Publisher:
ci.yml on Abhishek-2502/raccca-eval
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
raccca_eval-0.1.2.tar.gz -
Subject digest:
cef5ad80afcf5fd898564e30929536e62905bf916a23209bcfaf43f93c179b1e - Sigstore transparency entry: 2391962709
- Sigstore integration time:
-
Permalink:
Abhishek-2502/raccca-eval@ccf0d2484d4f32be589f92af7db14cdca17b5d41 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Abhishek-2502
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@ccf0d2484d4f32be589f92af7db14cdca17b5d41 -
Trigger Event:
release
-
Statement type:
File details
Details for the file raccca_eval-0.1.2-py3-none-any.whl.
File metadata
- Download URL: raccca_eval-0.1.2-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
374bb4145369e415a31a12f86c2403fbdd2f5e31bf3c4902ce2cdfa0004ff73a
|
|
| MD5 |
aa030ac84dac051a60c7ae17bb024399
|
|
| BLAKE2b-256 |
81424caa3d8d90c7fa8df0d4a586a539eff25bc49dec3a5e8a2ccc40f0909f50
|
Provenance
The following attestation bundles were made for raccca_eval-0.1.2-py3-none-any.whl:
Publisher:
ci.yml on Abhishek-2502/raccca-eval
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
raccca_eval-0.1.2-py3-none-any.whl -
Subject digest:
374bb4145369e415a31a12f86c2403fbdd2f5e31bf3c4902ce2cdfa0004ff73a - Sigstore transparency entry: 2391962763
- Sigstore integration time:
-
Permalink:
Abhishek-2502/raccca-eval@ccf0d2484d4f32be589f92af7db14cdca17b5d41 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Abhishek-2502
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@ccf0d2484d4f32be589f92af7db14cdca17b5d41 -
Trigger Event:
release
-
Statement type: