Launch Week 02 wrapped — explore all five launches

Create Metrics

POSThttps://api.confident-ai.com/v1/metrics

Creates a new metric on your Confident AI project.

POST/v1/metrics
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
}'
200
{
  "success": true,
  "data": {
    "id": "METRIC-ID"
  },
  "deprecated": false
}

Headers

  • CONFIDENT_API_KEYstringRequired

    The API key of your Confident AI project.

Request body

  • namestringRequired

    The name of the metric you're creating in your project.

  • criteriastring

    The criteria for this particular metric, that will be used to evaluate test cases later.

  • evaluationStepsstring

    An alternative to criteria, it is a list of steps to take to evaluate your test cases.

  • evaluationParamslist of enums | list of enums

    It is an array of the params that will be used to evaluate your test cases.

    Show 2 variantsHide 2 variants
    • llmTestCaseParamslist of enums

      Show 7 enum valuesHide 7 enum values
      • input
      • actualOutput
      • expectedOutput
      • context
      • toolsCalled
      • expectedTools
      • retrievalContext
    • OR
    • conversationalTestCaseParamslist of enums

      Show 6 enum valuesHide 6 enum values
      • role
      • content
      • scenario
      • toolsCalled
      • expectedOutcome
      • retrievalContext
  • multiTurnbooleanRequired

    This is true if your metric is used for evaluating multi-turn test cases.

  • rubriclist of objects

    A 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 numbersRequired

      An array consisting of the ranges of scores to generate.

    • expectedOutcomestringRequired

      The expected outcome for your evaluation.

Response

  • successboolean

    This is true if the metric was created successfully.

  • dataobject

    This maps to the id of the metric created.

    Show 1 propertyHide 1 property
    • idstring

      The id of the metric created

  • deprecatedboolean

    This is true if this metrics endpoint is deprecated.

Built byConfident AI