Metrics
POST
/api/v1/metrics/from-discovered

Promote an LLM-discovered top-level metric into a real Metric row.

Parallel to :func:promote_discovered_child but creates a standalone metric (parent_metric_id=None) instead of a child. The new metric's name is normalized so slug(name) == key — this keeps any already-scored rows that referenced the candidate under the promoted slug resolvable without a backfill, and prevents duplicate promotions from sneaking in under slightly different casing.

metric_type selects how future evaluation runs will score the new metric: boolean / rating are scored standalone; category creates a multi_label parent with no children that the user can populate via the Metrics page.

Authorization

AuthorizationBearer <token>

JWT access token. Use: Authorization: Bearer .

In: header

Header Parameters

X-Workspace-Id?string|null
Authorization?string|null
X-API-Key?string|null
X-EFFICIENTAI-API-KEY?string|null

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body for POST /metrics/from-discovered.

Creates a standalone :class:Metric (parent_metric_id=None) from an LLM-discovered candidate. The new metric's name is normalized so slugify(name) == key to keep already-scored row payloads resolvable against the promoted metric. metric_type selects how the new metric will be scored on future runs; "category" creates a multi_label parent with no children (the user adds children via the existing Metrics page).

Response Body

application/json

application/json

curl -X POST "https://example.com/api/v1/metrics/from-discovered" \  -H "Content-Type: application/json" \  -d '{    "key": "string",    "name": "string"  }'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",  "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",  "scope": "workspace",  "name": "string",  "description": "string",  "example": "string",  "metric_type": "number",  "metric_category": "quality",  "trigger": "always",  "enabled": true,  "is_default": true,  "metric_origin": "string",  "supported_surfaces": [    "string"  ],  "enabled_surfaces": [    "string"  ],  "custom_data_type": "string",  "custom_config": {},  "tags": [    "string"  ],  "capture_rationale": false,  "parent_metric_id": "a4a6359f-6ade-48cb-af32-ccbc80976b98",  "selection_mode": "single_choice",  "allow_discovery": false,  "compare_transcripts": false,  "lifecycle": "active",  "promoted_from_draft_at": "2019-08-24T14:15:22Z",  "studio_notes": "string",  "children": [    {}  ],  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z",  "created_by": "string"}

Community & contact

  1. Found a bug or have a feature request? Open a GitHub issue.
  2. Join our Discord for faster replies!