Metric

Create custom metric definition

Changed on

Create a new metric definition. The calculationType field selects the variant: LLM_JUDGE (LLM-evaluated), FORMULA (computed from a math expression over other metrics), or PATTERN (detects a trigger→outcome pattern within a window). To create a threshold on top of an existing metric, use POST /metric/definitions/{idOrSlug}/thresholds instead.

post/v1/metric/definitions

Request

  • Base URL
    https://api.roark.ai
  • URL
    https://api.roark.ai/v1/metric/definitions
  • Auth
    HTTP bearer

Request body

OR
OR
OR

Example request

{
  "name": "Customer Satisfaction",
  "slug": "customer_satisfaction",
  "metricId": "customer_satisfaction",
  "outputType": "BOOLEAN",
  "supportedContexts": [
    "CALL",
    "TURN"
  ],
  "llmPrompt": "Evaluate whether the customer expressed satisfaction with the service provided."
}

Response

The created metric definition

Changes

    • breaking

      added to the response property oneOf list for the response status

    • info

      added HTTP_REQUEST mapping keys to the request discriminator

    • info

      added to the request body oneOf list

    • info

      added HTTP_REQUEST discriminator mapping keys to the response property for the response status

    • info

      the / request property's maxLength was increased from 3000 to 20000