Skip to main content

Neutral, local-first AI regression-testing tool (明镜 / Evalith)

Project description

明镜 / Evalith

English | 中文

Catch AI regressions before your users do.

A neutral, local-first AI regression-testing tool. Define a test set, run it against any model (DeepSeek / Qwen / OpenAI / Claude / …), score every case, and diff two runs to see exactly what got better or worse — then gate CI so a prompt or model change can't silently break your product.

Why Evalith

  • Neutral & open. Your evaluation harness decides which model wins, so it shouldn't be owned by a model vendor. Evalith is vendor-independent and open source (Apache-2.0).
  • Local-first. The core workflow runs entirely on your machine — no account, no upload, no network. Your prompts and test data stay with you.
  • China models first-class. DeepSeek, Qwen and global models are first-class aliases (evalith models); a Chinese llm_judge ships in the box.
  • Regressions, not vibes. diff and --fail-on-regression tell you which cases improved, regressed, or broke when you change a prompt, model, or version.

Install

Requires Python ≥ 3.10.

pip install -e .            # core: pydantic, pyyaml, typer (no network needed)
pip install -e ".[litellm]" # optional: real models (DeepSeek/Qwen/OpenAI/Claude/...)

Quickstart (offline, no API key)

# 1. Run the example eval — uses the offline `echo` model, passes 2/2
evalith run examples/eval.yaml

# 2. Tweak your prompt/model in examples/eval.yaml, then run again
evalith run examples/eval.yaml

# 3. List runs, then diff the two newest to spot regressions
evalith list
evalith diff <OLDER_RUN_ID> <NEWER_RUN_ID>

Gate CI on regressions

Fail a build when quality drops — two ways:

# Absolute gate: fail if fewer than 90% of checks pass (no baseline needed)
evalith run examples/eval.yaml --fail-under 0.9

# Relative gate: fail if any case regressed vs a baseline run
evalith diff <BASELINE_RUN_ID> <NEW_RUN_ID> --fail-on-regression

Both exit non-zero on failure, so CI stops the PR. This repo ships a composite GitHub Action — drop this into .github/workflows/eval.yml:

name: AI eval gate
on: [pull_request]
jobs:
  eval:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dominciyue/Evalith_MingJing@main
        with:
          config: examples/eval.yaml
          fail-under: "0.9"

(See .github/workflows/eval-example.yml for a working copy using the offline demo.)

Shareable reports

Turn a run or a diff into Markdown (for PR comments) or a self-contained HTML page:

evalith report <RUN_ID> --format md                       # Markdown to stdout
evalith report <RUN_ID> --format html --output report.html # standalone HTML file
evalith diff <A> <B> --format md --output diff.md          # diff as Markdown

Reports include the pass rate, mean score, and — for real models — cost, token count, and latency.

Using real models (国产 first-class)

evalith models          # list first-class aliases + the env var each needs
export DEEPSEEK_API_KEY=sk-...
evalith run examples/eval.deepseek.yaml --concurrency 3
# -> Run <id> saved to .evalith/runs/<id>.json — 6/6 checks passed

Set model: to an alias (deepseek-chat, deepseek-reasoner, qwen-max, qwen-plus) or any LiteLLM id directly (gpt-4o-mini, claude-3-5-sonnet, …), then set that provider's API key. The llm_judge scorer can grade in Chinese with params: {language: zh}.

Scale

  • --concurrency N runs cases in parallel (provider calls are I/O-bound), or set concurrency: in the config. Order of results is always preserved.
  • Datasets load from YAML, JSON, CSV, or JSONL (examples/qa.jsonl).

Scorers

type passes when
exact_match output equals the case's expected
contains output contains params.text (or the case's expected)
regex output matches params.pattern
llm_judge an LLM grades the output against params.criteria (params.language: en|zh)

How it works

run evaluates a config against a model and saves a Run — a JSON snapshot of every case's output, scores, tokens, cost, and latency — to .evalith/runs/. diff compares two saved runs case-by-case and labels each improved / regressed / unchanged / new / removed.

Status

v0.2 — single-turn prompt evaluation, file-based run store, run-to-run diff, CI gating (--fail-under, --fail-on-regression, GitHub Action), Markdown/HTML reports, concurrency, cost/token/latency tracking, and 国产 model aliases with a Chinese judge. Team/cloud features are on the roadmap. Issues and PRs welcome.

License

Apache-2.0. Copyright © 2026 Evalith (明镜) Authors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evalith-0.2.0.tar.gz (51.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evalith-0.2.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file evalith-0.2.0.tar.gz.

File metadata

  • Download URL: evalith-0.2.0.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for evalith-0.2.0.tar.gz
Algorithm Hash digest
SHA256 08c15ce2d25bc76fc7bb9372d096d484e7b38b4c2e56008bbdff1207a9064580
MD5 17fb3d884cd241fa6d94571b13593c4c
BLAKE2b-256 d46af5e2f1ebc51588f0cdda606efcb7be47a9b980652f533ab7aa840da02e52

See more details on using hashes here.

File details

Details for the file evalith-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: evalith-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for evalith-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7bd227ea1b985cd1d9c6606948d3dfad86cb1f99e1913697d10438253fc34b4c
MD5 ea0425f2ab3b0e486a3fd3093a66c9ae
BLAKE2b-256 d3dd024256f377fa8fbc4327b48bf8309657d11de1628e3751710b4727a4926e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page