Functions

Apply Baseline Corrections to Regression Transformations

Applies corrected JSON from baseline transformations to regression transformations

This endpoint copies user-corrected data from baseline function version transformations to their corresponding regression test transformations. This is useful for:

  • Propagating ground truth corrections to regression test data
  • Ensuring consistent evaluation data across function versions
  • Preparing corrected datasets for evaluation after regression testing

How It Works

  1. Finds Regression Transformations: Locates transformations created during regression testing
  2. Matches Baseline Corrections: Finds corresponding baseline transformations with corrected JSON
  3. Applies Corrections: Copies the corrected JSON to regression transformations
  4. Returns Summary: Reports applied, skipped, and error counts with transformation IDs
POST
/v2/functions/regression/corrections
x-api-key<token>

Authenticate using API Key in request header

In: header

functionNamestring

Name of the function to apply corrections for

Must be an existing function with both baseline and regression transformation data.

Match^[a-zA-Z0-9_-]+$
baselineVersionNuminteger

Baseline version number (source of corrected data)

The function version number that contains transformations with corrected JSON that should be copied to regression transformations.

Formatuint
Range1 <= value
comparisonVersionNuminteger

Comparison version number (target for applying corrections)

The function version number of regression transformations that should receive the corrected JSON from the baseline version.

Formatuint
Range1 <= value

Response Body

curl -X POST "https://api.bem.ai/v2/functions/regression/corrections" \  -H "Content-Type: application/json" \  -d '{    "functionName": "invoice-transformer",    "baselineVersionNum": 3,    "comparisonVersionNum": 4  }'

Multiple corrections were applied to regression transformations

{
  "applied": 25,
  "appliedIds": [
    "tr-abc-123",
    "tr-def-456",
    "tr-ghi-789"
  ],
  "skipped": 0,
  "errors": {}
}

{
  "error": "functionName is required",
  "code": "validation_error"
}

{
  "error": "Function 'invoice-transformer' not found",
  "code": "not_found"
}

{
  "message": "invalid request body: missing required field 'transformationIDs'",
  "code": 400,
  "details": {
    "field": "transformationIDs",
    "reason": "required field missing"
  }
}