Create a metric definition
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.
Authorizations
Body
- LLM judge metric
- Formula metric
- Pattern metric
- HTTP request metric
Input for creating a new metric definition. calculationType selects the variant and defaults to LLM_JUDGE when omitted (legacy prompt-metric payloads remain valid). To create a threshold, use the threshold sub-resource.
What the judge grades (default: ["CALL"], the whole conversation). ["CALL", "SEGMENT"] also grades each utterance of participantRole; ["CALL", "TURN"] also grades each agent reply to the caller (requires participantRole: AGENT). Per-utterance and per-reply grading needs scope: PER_PARTICIPANT and a BOOLEAN, SCALE, NUMERIC or COUNT output; the CALL value stays the graded result and the per-unit values are its evidence.
1CALL, SEGMENT, TURN LLM prompt/criteria for evaluating this metric. Required for BOOLEAN, NUMERIC, TEXT, and SCALE types. A custom metric prompt must include a transcript variable such as {{transcript}} and {{world_context}}, which gives the judge the current date and time when it grades.
20000"Evaluate whether the customer expressed satisfaction with the service provided.\n\n{{transcript}}\n\nContext: {{world_context}}"