Get Function Metrics

Hand off to an LLM

Retrieve performance metrics for functions based on labeled transformation data.

Calculates accuracy, precision, recall, F1, and the underlying confusion-matrix counts for each matching function by comparing model outputs against user corrections. Metrics are aggregated across every transformation the function has produced, regardless of function type — extract, transform, analyze, and join all populate the same metrics column on the transformation row, so v3 surfaces all of them uniformly.

Filtering

Combine functionIDs / functionNames / types to narrow the result set. types accepts extract alongside the legacy transform / analyze types (which remain readable). Pagination is cursor-based.

Requirements

A function only shows non-zero metrics once at least one of its transformations has been labeled — submit corrections via POST /v3/events/{eventID}/feedback.

GET
/v3/functions/metrics
x-api-key<token>

Authenticate using API Key in request header

In: header

Query Parameters

limit?integer
Default50
Range1 <= value <= 100
functionIDs?array<>
Items1 <= items
functionNames?array<>
Items1 <= items
types?array<>
Items1 <= items
sortOrder?string

Sort direction over the result set (default asc). Pagination works symmetrically in both directions via startingAfter / endingBefore.

Default"asc"
Value in"asc" | "desc"
startingAfter?string

Cursor — a functionID defining your place in the list.

endingBefore?string

Cursor — a functionID defining your place in the list.

Response Body

application/json

curl -X GET "https://api.bem.ai/v3/functions/metrics"
{
  "functions": [
    {
      "functionName": "invoice-extractor",
      "totalLabeledResults": 54,
      "totalResults": 120,
      "metrics": {
        "accuracy": 0.7407,
        "precision": 0.9524,
        "recall": 0.7692,
        "f1Score": 0.8511,
        "tp": 40,
        "fp": 2,
        "tn": 0,
        "fn": 12
      }
    }
  ],
  "totalCount": 1
}

See also