Run Function Regression Testing

Hand off to an LLM

Kick off a regression run between two versions of a function.

Replays a sample of corrected historical inputs against the comparison version, producing fresh transformations marked isRegression: true. Each new run returns the workflow callIDs you can monitor via GET /v3/calls/{callID}.

Supported for every function type that produces correctable transformations: extract, transform, analyze, join. For extract specifically, the regression sample is dispatched through the same OCR vs. vision path used at original call time (PDF, PNG, JPEG, HEIC, HEIF, WebP go through the vision worker; everything else goes through OCR → transform).

The comparison version must share a schema-compatible output shape with the baseline; structural differences are reported as a 400 with the offending field-level diffs.

Typical flow

  1. POST /v3/functions/regression — queues calls, returns { originalReferenceID, callID } per sample.
  2. Wait (poll GET /v3/calls/{callID} or subscribe to webhooks).
  3. POST /v3/functions/regression/corrections to copy baseline corrections onto the new regression transformations.
  4. POST /v3/functions/compare to compare baseline vs comparison metrics for the regression dataset.
POST
/v3/functions/regression
x-api-key<token>

Authenticate using API Key in request header

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://api.bem.ai/v3/functions/regression" \  -H "Content-Type: application/json" \  -d '{    "functionName": "invoice-extractor",    "baselineVersionNum": 3,    "comparisonVersionNum": 5,    "sampleSize": 100,    "onlyCorrectedData": true  }'

Calls are processing asynchronously — poll the calls API or wait on webhooks.

{
  "functionName": "invoice-extractor",
  "result": {
    "functionName": "invoice-extractor",
    "totalSamples": 50,
    "calls": [
      {
        "originalReferenceID": "invoice-123",
        "callID": "wc_2N6gH8ZKCmvb6BnFcGqhKJ98VzP"
      }
    ]
  }
}
{
  "message": "string",
  "code": 0,
  "details": {}
}
{
  "message": "string",
  "code": 0,
  "details": {}
}

See also