Create Metrics
POSThttps://api.confident-ai.com/v1/metrics
Creates a new metric on your Confident AI project.
curl -X POST "https://api.confident-ai.com/v1/metrics" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Correctness",
"criteria": "Determine if the `actual output` is correct based on the `expected output`.",
"evaluationParams": [
"actualOutput",
"expectedOutput"
],
"multiTurn": false
}'{
"success": true,
"data": {
"id": "METRIC-ID"
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Request body
namestringRequiredThe name of the metric you're creating in your project.
criteriastringThe criteria for this particular metric, that will be used to evaluate test cases later.
evaluationStepsstringAn alternative to criteria, it is a list of steps to take to evaluate your test cases.
evaluationParamslist of enums | list of enumsIt is an array of the params that will be used to evaluate your test cases.
Show 2 variantsHide 2 variants
llmTestCaseParamslist of enumsShow 7 enum valuesHide 7 enum values
inputactualOutputexpectedOutputcontexttoolsCalledexpectedToolsretrievalContext
- OR
conversationalTestCaseParamslist of enumsShow 6 enum valuesHide 6 enum values
rolecontentscenariotoolsCalledexpectedOutcomeretrievalContext
multiTurnbooleanRequiredThis is true if your metric is used for evaluating multi-turn test cases.
rubriclist of objectsA list of score ranges (0–10 inclusive). Must be in order and non-overlapping. Click here to learn more
Show 2 propertiesHide 2 properties
scoreRangelist of numbersRequiredAn array consisting of the ranges of scores to generate.
expectedOutcomestringRequiredThe expected outcome for your evaluation.
Response
successbooleanThis is true if the metric was created successfully.
dataobjectThis maps to the id of the metric created.
Show 1 propertyHide 1 property
idstringThe id of the metric created
deprecatedbooleanThis is true if this metrics endpoint is deprecated.