Skip to main content

Evaldiff

evaldiff CI PyPI version npm version

CI for LLM prompts. Datasets, eval runs, and regression diffs as a pass/fail gate for your CI — the npm test of prompts.

Evaldiff scores your LLM output against a dataset of expected answers and rubric criteria, then gives you a green/red gate you can wire straight into GitHub Actions. When a model change or prompt edit regresses a case, the diff tells you exactly which one.

Why

You already know how to test normal software. LLM output is non-deterministic, so "it worked yesterday, why not today?" is a daily problem. Evaldiff sells the green checkmark — not "AI testing" as an abstract service.

  • Dataset — a JSON file of {input, expected, rubric?} cases.
  • Run — score a (dataset, model, prompt) combination; per-case score, pass/fail vs. a threshold, latency, tokens, cost.
  • Diff — run A vs B: regressions highlighted, side by side.
  • Gate — evaldiff run / evaldiff diff exit 0 = pass, 1 = regression/failure, 2 = operational error (auth, deadline, incomplete run). Incomplete runs never exit 0. Drops straight into GitHub Actions.

Install

Python CLI (recommended):

pip install evaldiff
evaldiff --version

npm (placeholder + future GitHub Action):

npm i -g @evaldiff/evaldiff

Quickstart

# 1) Get a key (self-serve account; shown once)
evaldiff signup --email you@example.com
export EVALDIFF_API_KEY=eval_...

# 2) Scaffold a dataset with two example cases
evaldiff init --name my-dataset

# 3) Gate it: upload, run, poll to completion, exit 0/1/2
#    NOTE: each `--dataset FILE` upload creates a NEW dataset — remember the
#    printed dataset id so the next run can target the same one.
evaldiff run --dataset my-dataset.json \
             --endpoint https://your-openai-compatible/v1 \
             --model your-model \
             --model-key $YOUR_MODEL_KEY \
             --threshold 0.85
# → "uploaded dataset my-dataset (2 cases) → id 42"

# 4) Gate a change against the SAME dataset (this keeps runs comparable)
evaldiff run --dataset-id 42 \
             --endpoint https://your-openai-compatible/v1 \
             --model your-model \
             --model-key $YOUR_MODEL_KEY \
             --threshold 0.85

# 5) Compare the two runs; exit 1 on any regression
#    (diff rejects runs on different datasets)
evaldiff diff --base <runA-id> --new <runB-id>

# Reports with per-case evidence (input / expected / actual / judge)
evaldiff run ... --report report --format both   # report.json + report.md

Env: EVALDIFF_API_KEY (your evaldiff key), EVALDIFF_BASE_URL (default https://api.evaldiff.io), EVALDIFF_MODEL_API_KEY (key for the model endpoint, equivalent to --model-key).

Gate exit codes (stable contract)

code meaning
0 PASS — run finished with all cases passing / no regressions
1 FAIL — run finished with failures / regressions present
2 ERROR — auth, network, deadline, run failed, incomplete run, invalid comparison

A deadline or a failed run is an operational error (2), never a pass (0).

Dataset format

[
  {
    "input": "Refund policy for a returned item",
    "expected": "You can return any item within 30 days for a full refund.",
    "rubric": ["mentions the 30-day window", "mentions full refund"],
    "tags": ["support"]
  }
]

rubric is optional — a list of criteria a judge model scores 0/1 against. Without it, evaldiff falls back to exact / contains matching against expected.

API (v0.0.2)

The core is a small FastAPI service (pip install evaldiff includes it):

evaldiff-server   # uvicorn on :8000, SQLite by default
Endpoint Purpose
POST /v1/auth/signup Self-serve account + API key (eval_…), 1k free cases/month
POST /v1/datasets Create a dataset from inline cases
GET /v1/datasets/{id} Dataset detail
POST /v1/runs Score a dataset against an OpenAI-compatible endpoint (async job)
GET /v1/runs/{id} Run status: queued → running → done/failed
GET /v1/runs/{id}/cases Per-case output, score, pass/fail, tokens, error
GET /v1/datasets/{id}/cases Dataset cases (input/expected/rubric) for reports
GET /v1/runs/{id}/cases/{seq}/output One case's evidence: actual output + judge verdict
GET /v1/runs/{id}/diff?compare={other_id} Regression diff (JSON)
GET /v1/runs/{id}/report.md?compare={other_id} The same as a markdown report
GET /v1/usage Quota / usage for the key

Auth is a bearer eval_… key on every /v1/* call. Quota is per-account, per calendar month; failed runs are free.

Supported endpoints (v0)

Any OpenAI-compatible /chat/completions endpoint (BYO key): OpenAI, Groq, Together, Ollama, vLLM, LM Studio. Everything else: bring your own adapter.

Status

  • 0.0.23 — fixes: --deadline is now a true wall-clock budget — a successful response is re-checked against the deadline before being accepted, so a slowly-trickling server can no longer land a "pass" after the deadline; OPERATIONS.md backup-activation section no longer quotes the old 4h/six-hour schedule
  • 0.0.22 — fixes: backups run twice daily (03:00 + 15:00 UTC) so the 24h RPO holds end-to-end including capture/verification slack; OPERATIONS.md retention now matches backup.py exactly (all points 7d, daily 30d, weekly 84d); CLI --deadline now constrains in-flight requests, not only the poll loop — a stalled status call can no longer run past the deadline
  • 0.0.21 — fixes: reports work with normal datasets (API assigns seq; CLI falls back to list position), file-based workflow stays comparable (quickstart + hints for --dataset-id), creation requests are no longer auto-retried on 5xx/transport errors (no duplicate runs/quota), OPERATIONS.md RPO aligned to the shipped daily backup schedule
  • 0.0.20 — CLI gate: evaldiff run + evaldiff diff with stable exit codes (0/1/2), per-case evidence endpoints, JSON/Markdown reports, LocalStorage for evidence without S3
  • 0.0.19 — bounded responses, secret-key enforcement, deadlines + fair queueing
  • Next: GitHub Action (@evaldiff/action), web diff view, usage-based billing

Production credentials

Local development defaults to plaintext model-credential storage unless EVALDIFF_SECRET_KEY is configured. Set EVALDIFF_PRODUCTION=true in production; startup then requires a valid Fernet key and encrypted, readable stored credentials. The bundled Compose deployment enforces this mode.

Follow the upgrade guide for key provisioning, the offline python -m api.migrate_secrets command, backup restoration, and rotation. The deployment image builds the checked-out source; use the full repository checkout when deploying.

Running tests from source

Install the test dependencies before running the suite:

pip install -e '.[test]'
pytest -q

For PostgreSQL coverage, also install psycopg[binary]>=3.1 and set EVALDIFF_TEST_POSTGRES_URL to a disposable PostgreSQL database. See the qualification runbook for the isolated PostgreSQL runner and staging scenarios.

Metadata

Release files for evaldiff 0.0.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evaldiff 0.0.24
File Size Uploaded Provenance Actions
evaldiff-0.0.24.tar.gz 194.9 kB Without provenance Details for evaldiff-0.0.24.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for evaldiff 0.0.24
File Interpreter ABI Platform Actions
evaldiff-0.0.24-py3-none-any.whl Python 3 none any Details for evaldiff-0.0.24-py3-none-any.whl

Total release size: 273.7 kB

Release files / evaldiff-0.0.24.tar.gz

Download URL evaldiff-0.0.24.tar.gz
Size 194.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ae37c91d1c04c6322838014d38b836f229345edd9641b6f92a0cfe9f84936609
BLAKE2b-256 checksum
How to use checksums
8708fcda923a04a1bc1e75d831403e98d168244249c70fd0453242150d8d7158
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / evaldiff-0.0.24-py3-none-any.whl

Download URL evaldiff-0.0.24-py3-none-any.whl
Size 78.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03edd60a399be1db76835a35bf6fc5785dc7df11dc09cecfa8fff580c01436d0
BLAKE2b-256 checksum
How to use checksums
14915cd9a78adbeb03c53732c88a7dac01193a1a10a384b03767ef35bea1db66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for evaldiff 0.0.24

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page