Skip to main content

ai-eval-platform (Python SDK + CLI)

Standard-library-only client for the AI Evaluation Platform API, plus an ai-eval command that runs an evaluation and fails your CI build when quality drops.

pip install ai-eval-platform
export AI_EVAL_API_KEY=...            # Settings > API keys in the app
export AI_EVAL_API_URL=https://api.ai-evaluation-platform.com

Quality gate in CI

# 1. Your pipeline runs your app over the dataset's prompts and writes outputs.json:
#    {"case-1": "the app's answer", "case-2": "..."}
# 2. Evaluate and gate:
ai-eval run --project <project_id> --dataset <dataset_id> --outputs outputs.json \
    --fail-under pass_rate=0.9 --metric factual_accuracy=0.8 --version-label "$GIT_SHA"
  • --fail-under NAME=VALUE (repeatable or comma-separated): pass_rate (share of cases where every metric meets its pass mark), good_rate (share labelled Good), or a run average: overall, safety, truth, quality.
  • --metric KEY=VALUE: the run average of metric KEY must be at least VALUE; VALUE is also that metric's pass mark for pass_rate. Other metrics use the project's thresholds, else 0.70.
  • Instead of a dataset: --file cases.jsonl (cases with prompt, llm_output, ...) or --file results.csv (uploaded with the same column mapping as the app), or --job <job_id> to gate a run that already exists.
  • Exit code 0 = passed, 1 = gate failed, 2 = error (bad arguments, API error, timeout). --report-json gate.json writes the numbers for later steps.

The run shows up in the app with its version label, so you can compare it with the previous build's run on the same dataset version.

GitHub Actions

The AI Evaluation Platform quality gate action wraps the CLI:

- run: python scripts/generate_outputs.py > outputs.json   # your app
- uses: assertthat/ai-eval-action@v1
  with:
    api-key: ${{ secrets.AI_EVAL_API_KEY }}
    project: ${{ vars.AI_EVAL_PROJECT }}
    dataset: ${{ vars.AI_EVAL_DATASET }}
    outputs: outputs.json
    fail-under: pass_rate=0.9
    metric-thresholds: factual_accuracy=0.8

Bitbucket Pipelines

With the pipe:

- step:
    name: LLM quality gate
    script:
      - python scripts/generate_outputs.py > outputs.json   # your app
      - pipe: docker://assertthat/ai-eval-pipe:1.0.1
        variables:
          AI_EVAL_API_KEY: $AI_EVAL_API_KEY
          PROJECT: $AI_EVAL_PROJECT
          DATASET: $AI_EVAL_DATASET
          OUTPUTS: outputs.json
          FAIL_UNDER: pass_rate=0.9

Or with the CLI directly:

- step:
    name: LLM quality gate
    image: python:3.12-slim
    script:
      - pip install ai-eval-platform
      - python scripts/generate_outputs.py > outputs.json
      - ai-eval run --project $AI_EVAL_PROJECT --dataset $AI_EVAL_DATASET --outputs outputs.json
          --fail-under pass_rate=0.9 --version-label $BITBUCKET_COMMIT --run-name "$BITBUCKET_BRANCH"

(Set AI_EVAL_API_KEY as a secured repository variable.)

Tracing agents

from ai_eval import Client
from ai_eval.tracing import Tracer

tracer = Tracer(Client(), project_id="...")
with tracer.trace("support-agent", session_id=conversation_id, input=question) as t:
    with tracer.span("lookup_order", kind="tool", input={"id": 42}) as s:
        s.output = lookup_order(42)
    t.output = answer

Or point any OpenTelemetry OTLP/HTTP exporter at <api>/v1/traces with the header X-API-Key - see the tracing docs.

Production monitoring

from ai_eval.monitor import Monitor

monitor = Monitor(Client(), project_id="...")          # sends in the background
monitor.log(prompt=question, llm_output=answer, id=request_id, latency_ms=812)

Turn monitoring on and set the sample rate per project in the app (Monitoring > Setup); only sampled records are evaluated.

Library use

from ai_eval import Client, evaluate_gate

c = Client()
job = c.evaluate_batch(dataset_id="...", outputs={"case-1": "..."}, project_id="...",
                       version={"label": "v2", "model": "claude-sonnet", "prompt": open("system.txt").read()})
results = c.wait_for_results(job["job_id"])
gate = evaluate_gate(results, {"pass_rate": 0.9}, {"factual_accuracy": 0.8})
print(gate.passed, gate.stats["pass_rate"])

Metadata

Release files for ai-eval-platform 1.0.1

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

Source distribution (sdist)

Source distribution for ai-eval-platform 1.0.1
File Size Uploaded Provenance Actions
ai_eval_platform-1.0.1.tar.gz 21.6 kB Without provenance Details for ai_eval_platform-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-eval-platform 1.0.1
File Interpreter ABI Platform Actions
ai_eval_platform-1.0.1-py3-none-any.whl Python 3 none any Details for ai_eval_platform-1.0.1-py3-none-any.whl

Total release size: 41.6 kB

Release files / ai_eval_platform-1.0.1.tar.gz

Download URL ai_eval_platform-1.0.1.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3717247ad89e39b5c5f65c3f5b589b9d2ed3106c53b7b2444c1f9f8df8704b9f
BLAKE2b-256 checksum
How to use checksums
c28fb8d1ee6793dad38f2a1882d60c35b44ec79597f7e3cf2f9005a55a8bac2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / ai_eval_platform-1.0.1-py3-none-any.whl

Download URL ai_eval_platform-1.0.1-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b9968fe0acfa57a041c6dca702c3804db3741b9231eff0580998ab1a4788d99
BLAKE2b-256 checksum
How to use checksums
cfdb94bf15a5b12a1d2e3d939b7c20d7e091f4e621e84bdd2d6febcdd04d1503
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for ai-eval-platform 1.0.1

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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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