Get Function Metrics
Retrieve performance metrics for functions based on labeled transformation data.
This endpoint calculates accuracy metrics by comparing function outputs against ground truth data (user corrections). Metrics help you understand function performance and identify areas for improvement.
Available Metrics
For each function, the response includes:
- Accuracy: Overall correctness rate
- Precision: True positives / (True positives + False positives)
- Recall: True positives / (True positives + False negatives)
- F1 Score: Harmonic mean of precision and recall
- Confusion Matrix: TP, FP, TN, FN counts
Requirements
Metrics are only available for functions with:
- Historical transformations that have been labeled/corrected
- Sufficient sample size for meaningful calculations
Filtering
Filter by specific functions using functionIDs or functionNames, or by function type
using the types parameter.
Authorization
API Key Authenticate using API Key in request header
In: header
Query Parameters
501 <= value <= 1001 <= items1 <= items1 <= itemsSpecifies sorting behavior. The two options are asc and desc to sort ascending and descending respectively, with default sort being ascending. Paging works in both directions.
"asc""asc" | "desc"A cursor to use in pagination. startingAfter is a function ID that defines your place in the list.
A cursor to use in pagination. endingBefore is a function ID that defines your place in the list.
Response Body
application/json
curl -X GET "https://api.bem.ai/v2/functions/metrics"{
"functions": [
{
"functionName": "invoice-transformer",
"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
}