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.0
        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.0

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.0
File Size Uploaded Provenance Actions
ai_eval_platform-1.0.0.tar.gz 21.6 kB Without provenance Details for ai_eval_platform-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 41.6 kB

Release files / ai_eval_platform-1.0.0.tar.gz

Download URL ai_eval_platform-1.0.0.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e25c3fbd996b22bff9d20503d4988ea22fd4ec501a47b2207d75e97dbf118d64
BLAKE2b-256 checksum
How to use checksums
73aa66d67ecec0746c5e9bf98d0b74edc7c9301495b2a7b856c02b1026417bc3
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.0-py3-none-any.whl

Download URL ai_eval_platform-1.0.0-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23d79d42e126622e1bcb3cad02d5ac237e5ca804557218cc20513f57d1197e20
BLAKE2b-256 checksum
How to use checksums
f6200eae7605bfcc54c6ba3501899b9b1dbe12b424c44e7e8034e216d475e347
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.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.

Release history Release notifications | RSS feed

This release

1.0.0 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