Why Arbiter?
Most evaluation frameworks tell you if your outputs are good. Arbiter tells you that AND exactly what it cost. Every evaluation automatically tracks tokens, latency, and real dollar costs across any provider.
from arbiter_ai import evaluate
result = await evaluate(
output="Paris is the capital of France",
reference="The capital of France is Paris",
evaluators=["semantic"],
model="gpt-4o-mini"
)
print(f"Score: {result.overall_score:.2f}")
print(f"Cost: ${await result.total_llm_cost():.6f}")
print(f"Calls: {len(result.interactions)}")
What makes Arbiter different:
- Automatic cost tracking using LiteLLM's bundled pricing database
- PydanticAI native with type-safe structured outputs
- Pure library with no platform signup or server to run
- Complete observability with every LLM interaction tracked
Installation
pip install arbiter-ai
Optional features:
pip install arbiter-ai[cli] # Command-line interface
pip install arbiter-ai[scale] # Fast FAISS semantic backend
pip install arbiter-ai[storage] # PostgreSQL + Redis persistence
pip install arbiter-ai[verifiers] # Web search fact verification
Quick Start
Set your API key:
export OPENAI_API_KEY=sk-...
Run an evaluation:
from arbiter_ai import evaluate
result = await evaluate(
output="Paris is the capital of France",
reference="The capital of France is Paris",
evaluators=["semantic"],
model="gpt-4o-mini"
)
print(f"Score: {result.overall_score:.2f}")
print(f"Cost: ${await result.total_llm_cost():.6f}")
Evaluators
Semantic Similarity
result = await evaluate(
output="Paris is the capital of France",
reference="The capital of France is Paris",
evaluators=["semantic"],
model="gpt-4o-mini"
)
Custom Criteria (no reference needed)
result = await evaluate(
output="Medical advice about diabetes management",
criteria="Medical accuracy, HIPAA compliance, appropriate tone",
evaluators=["custom_criteria"],
model="gpt-4o-mini"
)
print(f"Criteria met: {result.scores[0].metadata['criteria_met']}")
Pairwise Comparison (A/B testing)
from arbiter_ai import compare
comparison = await compare(
output_a="GPT-4 response",
output_b="Claude response",
criteria="accuracy, clarity, completeness",
model="gpt-4o-mini"
)
print(f"Winner: {comparison.winner}") # output_a, output_b, or tie
print(f"Confidence: {comparison.confidence:.2f}")
Factuality, Groundedness, Relevance
# Hallucination detection
result = await evaluate(output=text, evaluators=["factuality"])
# RAG source attribution
result = await evaluate(output=rag_response, evaluators=["groundedness"])
# Query-output alignment
result = await evaluate(output=response, reference=query, evaluators=["relevance"])
Multiple Evaluators
result = await evaluate(
output="Your LLM output",
reference="Expected output",
criteria="Accuracy, clarity, completeness",
evaluators=["semantic", "custom_criteria", "factuality"],
model="gpt-4o-mini"
)
for score in result.scores:
print(f"{score.name}: {score.value:.2f}")
Batch Evaluation
from arbiter_ai import batch_evaluate
items = [
{"output": "Paris is capital of France", "reference": "Paris is France's capital"},
{"output": "Tokyo is capital of Japan", "reference": "Tokyo is Japan's capital"},
]
result = await batch_evaluate(
items=items,
evaluators=["semantic"],
model="gpt-4o-mini",
max_concurrency=5
)
print(f"Success: {result.successful_items}/{result.total_items}")
print(f"Total cost: ${await result.total_llm_cost():.4f}")
Command-Line Interface
pip install arbiter-ai[cli]
# Single evaluation
arbiter evaluate --output "Paris is the capital" --reference "Paris is France's capital"
# Batch evaluation from file
arbiter batch --file inputs.jsonl --evaluators semantic --output results.json
# Compare two outputs
arbiter compare --output-a "Response A" --output-b "Response B"
# List evaluators
arbiter list-evaluators
# Check costs
arbiter cost --model gpt-4o-mini --input-tokens 1000 --output-tokens 500
Provider Support
Arbiter works with any model via PydanticAI:
- OpenAI (GPT-4, GPT-4o, GPT-4o-mini)
- Anthropic (Claude)
- Google (Gemini)
- Groq
- Mistral
- Cohere
Set the appropriate API key as an environment variable.
Examples
# Run examples
python examples/basic_evaluation.py
python examples/custom_criteria_example.py
python examples/pairwise_comparison_example.py
python examples/batch_evaluation_example.py
python examples/observability_example.py
Development
git clone https://github.com/ashita-ai/arbiter.git
cd arbiter
uv sync --all-extras
make test
License
MIT License
Metadata
Release files for arbiter-ai 0.2.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 | Provenance | |
|---|---|---|---|---|
| arbiter_ai-0.2.0.tar.gz | 105.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arbiter_ai-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 232.9 kB
Release files / arbiter_ai-0.2.0.tar.gz
| Download URL | arbiter_ai-0.2.0.tar.gz |
|---|---|
| Size | 105.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63a79e299579cbbee856c91f568b0c305d4e841855dcdadadb31278c54e8a64a
|
|
BLAKE2b-256 checksum How to use checksums |
2598357f9cac8eb50df17bab9409a67ad827a401303e2b6be3f183c3776105f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / arbiter_ai-0.2.0-py3-none-any.whl
| Download URL | arbiter_ai-0.2.0-py3-none-any.whl |
|---|---|
| Size | 127.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
905294e58f33254dd636e5bfd7efaf57c93287c2d73aafee66cc71dfdaf531ef
|
|
BLAKE2b-256 checksum How to use checksums |
30279ba8b76554228b0c57866d59ef122ee55c74cf8e210deb4110483d28b1a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for arbiter-ai 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.