HUB
Sign inSign up

assertthat/ai-eval-pipe

By assertthat

•Updated 2 days ago

Image
0

91

assertthat/ai-eval-pipe repository overview

⁠Bitbucket Pipelines Pipe: AI Evaluation Platform quality gate

Evaluate your LLM app's outputs on the AI Evaluation Platform⁠ and fail the build when quality drops below your thresholds. The run appears in the app with the commit as its version label, so you can compare builds.

⁠YAML Definition

Add the following snippet to the script section of your bitbucket-pipelines.yml file:

- pipe: docker://assertthat/ai-eval-pipe:1.0.0
  variables:
    AI_EVAL_API_KEY: $AI_EVAL_API_KEY
    # PROJECT: '<string>'            # Optional
    # DATASET: '<string>'            # One of DATASET, FILE or JOB
    # OUTPUTS: '<string>'            # Optional
    # FILE: '<string>'               # One of DATASET, FILE or JOB
    # FAIL_UNDER: '<string>'         # Optional
    # METRIC_THRESHOLDS: '<string>'  # Optional
    # DEBUG: '<boolean>'             # Optional

⁠Variables

VariableUsage
AI_EVAL_API_KEY (*)API key from Settings > API keys in the app. Use a secured repository variable.
AI_EVAL_API_URLAPI base URL. Default: https://api.ai-evaluation-platform.com
PROJECTProject id. Its metrics and thresholds apply.
DATASETDataset id to evaluate (use with OUTPUTS).
DATASET_VERSIONDataset version. Default: latest.
OUTPUTSYour app's outputs for the dataset rows: JSON {case_id: output}, JSONL or CSV.
FILECases (.json, .jsonl, .csv, .xlsx) instead of a dataset.
JOBGate an existing run by its job id instead of submitting one.
METRICSComma-separated metric keys. Default: the project's metrics.
FAIL_UNDERGates, comma-separated: pass_rate, good_rate, overall, safety, truth, quality. Default: pass_rate=0.9
METRIC_THRESHOLDSPer-metric minimum averages, e.g. factual_accuracy=0.8,hallucination=0.85.
RUN_NAMERun name shown in the app. Default: <workspace>/<repo>@<branch>
VERSION_LABELVersion label on the run. Default: the short commit hash.
VERSION_MODELModel behind this version.
VERSION_PROMPT_FILEFile with the system prompt (hashed into the version).
TIMEOUTSeconds to wait for the run. Default: 1800
REPORT_JSONWhere to write the JSON gate report. Default: ai-eval-report.json
DEBUGtrue prints the CLI arguments. Default: false

(*) = required variable.

⁠Details

The pipe runs the ai-eval CLI from the ai-eval-platform⁠ Python package. It exits with 0 when the gate passes, 1 when it fails and 2 on an error (bad variables, API error, timeout), so a failing gate fails the step.

⁠Prerequisites

  • An AI Evaluation Platform subscription (AWS Marketplace⁠).
  • An API key stored as the secured repository variable AI_EVAL_API_KEY.

⁠Examples

Gate a dataset run, with outputs your app wrote earlier in the step:

script:
  - python scripts/generate_outputs.py > outputs.json
  - 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,overall=0.75
      METRIC_THRESHOLDS: factual_accuracy=0.8

Evaluate a file of cases and keep the report:

- step:
    name: LLM quality gate
    script:
      - pipe: docker://assertthat/ai-eval-pipe:1.0.0
        variables:
          AI_EVAL_API_KEY: $AI_EVAL_API_KEY
          FILE: tests/llm_cases.jsonl
    artifacts:
      - ai-eval-report.json

⁠Support

Email [email protected]⁠, or see the docs⁠.

Tag summary
Recent tags
Content type
Image
Digest
sha256:caf9c58f4…
Size
45.6 MB
Last updated
2 days ago
docker pull assertthat/ai-eval-pipe:1