grounded-ai

One Python interface for evaluating what LLM apps and agents say and do. Use a frontier model as the judge, a small local model, or a decision model, and swap between them without rewriting your evals.
Cut your LLM-judge bill with a cascade
CascadeEvaluator asks a fast decision model first: Jev, OpenAI's Decisions API, or any model served at /v1/systemone. The decision model reports how confident it is in each answer. Confident answers are kept; only the rest go to the LLM judge of your choice.
On 200 real agent turns (should the agent have called a tool here, or replied?), against Claude Sonnet 4.6 judging everything:
| Setup | Sent to the judge | Mean time | $ per 1M checks | Accuracy |
|---|
| Sonnet 4.6 alone | 100% | 2.59 s | $7,751 | 0.675 |
| Cascade, threshold 0.7 | 37% | 1.28 s | $2,997 | 0.695 |
| Cascade, threshold 0.9 | 56% | 1.84 s | $4,572 | 0.685 |
51% faster and 61% cheaper at 0.7, with no accuracy lost. Write-up · benchmark script
Try it: examples/cascade.ipynb runs a cascade with Jev, OpenAI Decisions and agent-decision-3b (served in the notebook), then picks a model and threshold with compare().
from grounded_ai import CascadeEvaluator
from grounded_ai.backends.jev import HALLUCINATION, JevInput
cascade = CascadeEvaluator(
decision_model="jev/jev-latest", # or "openai-decisions/gpt-6-luna", "systemone/agent-decision-9b" + base_url
judge="anthropic/claude-haiku-4-5",
min_confidence=0.7,
)
result = cascade.evaluate(JevInput(
state={"context": "Collins stayed in orbit while Armstrong and Aldrin walked on the Moon.",
"response": "Aldrin stayed in orbit."},
questions={"verdict": HALLUCINATION},
))
answer = result.answers["verdict"]
print(answer.answer if result.judged else answer.choice) # 'hallucination'
Install
pip install grounded-ai # LLM judges: OpenAI, Anthropic, Bedrock
pip install "grounded-ai[jev]" # + decision models (Jev, any /v1/systemone server, OpenAI Decisions) and CascadeEvaluator
pip install "grounded-ai[jev-local]" # + Strands Decider, Jev's open-weights counterpart, on your machine
pip install "grounded-ai[slm]" # + the grounded-ai fine-tuned judges (GPU)
Python 3.10+.
Pick a judge
| Model string | What runs | Key |
|---|
openai/<model> | OpenAI, structured outputs | OPENAI_API_KEY |
anthropic/<model> | Anthropic, structured outputs | ANTHROPIC_API_KEY |
bedrock/<model-id> | Any model on Amazon Bedrock (Converse API) | AWS credentials |
hf/<repo> | A Hugging Face model on your machine | none |
grounded-ai/<model> | Our fine-tuned Phi-4 judges, on your GPU | none |
jev/jev-latest | TypeSafe's Jev decision model | TYPESAFE_API_KEY |
jev + use_local_model=True | Strands Decider on your machine | none |
systemone/<model> + base_url= or host= | Any decision model behind /v1/systemone: llama.cpp, Ollama, vLLM, SGLang, a vendor's API, agent-decision | the server's, if any |
openai-decisions/<model> | OpenAI's Decisions API (gpt-6-luna) | OPENAI_API_KEY |
Examples
An LLM judge
from grounded_ai import Evaluator
judge = Evaluator("anthropic/claude-haiku-4-5")
result = judge.evaluate(response="London is the capital of France.",
context="Paris is the capital of France.")
print(result.label, result.reasoning) # 'hallucination', 'The response contains a factual error...'
Your own metric
Any Pydantic model works as the output. The system prompt is set when you create the evaluator.
from pydantic import BaseModel
class BrandCheck(BaseModel):
on_brand: bool
issues: list[str]
judge = Evaluator("anthropic/claude-haiku-4-5", system_prompt="You review marketing copy for a premium brand.")
result = judge.evaluate(response="Our product is kinda cheap.", output_schema=BrandCheck)
print(result.on_brand) # False
To change the prompt itself, pass base_template= (a Jinja2 template over response, query and context).
Jev: typed questions, measured confidence
Jev doesn't write text. You give it a state and typed questions; it returns each answer with the probability of every option.
from grounded_ai.backends.jev import ChoiceQuestion, JevInput, NoulQuestion