Function accuracy

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

Request Body

application/json

functionName*string

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_-]+$
baselineVersionNum*integer

Baseline version number (source of corrected data)

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

Range1 <= value
comparisonVersionNum*integer

Comparison version number (target for applying corrections)

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

Range1 <= value

Response Body

application/json

application/json

application/json

application/json

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

Some corrections applied, others had errors

{
  "applied": 18,
  "appliedIds": [
    "tr-abc-123",
    "tr-def-456"
  ],
  "skipped": 2,
  "errors": {
    "tr-xyz-789": "baseline transformation not found for reference ID: invoice-789"
  }
}

{
  "message": "baselineVersionNum and comparisonVersionNum must be different"
}

{
  "message": "No regression transformations found for comparison version 4"
}

{
  "message": "string",
  "code": 0,
  "details": {}
}