Skip to navigation

Create Classifier

Create a classifier from labeled examples. It returns at once with status building and builds in the background, usually within a minute; poll it until status is ready. It needs 3 examples on each side of 0.5. Use it by setting a routing policy’s complexity_classifier_id to its id.

Authentication

AuthorizationBearer

A management key (mgmt_...), sent as Authorization: Bearer <key>. Reading /v1/routing-policies also accepts the organization’s gateway API keys; writing there needs a management key.

Request

This endpoint expects an object.
exampleslist of objectsRequired

Labeled prompts: what your requests look like and how complex each one is, from 0 (simple) to 1 (complex). Scores further from 0.5 count more. The classifier is ready once at least 3 are below 0.5 and 3 are at or above it.

namestringRequired1-255 characters
Unique within the organization.
descriptionstring or nullOptional
What the classifier is for.

Response

The created classifier
build_errorstring or nullRead-only

Why the last build failed, when status is failed.

created_atdatetimeRead-only
descriptionstring or null
What the classifier is for.
exampleslist of objects

Labeled prompts: what your requests look like and how complex each one is, from 0 (simple) to 1 (complex). Scores further from 0.5 count more. The classifier is ready once at least 3 are below 0.5 and 3 are at or above it.

has_readoutbooleanRead-only
Whether routers that score with the difficulty readout use it too. Classifiers saved before readouts get one when their examples are next updated.
idstringRead-onlyformat: "uuid"

Send as a routing policy’s complexity_classifier_id to use it.

is_readybooleanRead-only

Whether it has a build that scores requests (also true while a rebuild runs). A policy using a classifier that isn’t ready scores with the built-in scorer.

namestring
Unique within the organization.
quality_reportobject or nullRead-only
null until the classifier is ready.
statusenum

building while the classifier builds in the background after a save (a few seconds to a minute), then ready, or not_enough_examples when either side of 0.5 has fewer than 3 examples, or failed. While a rebuild runs, policies keep using the previous build.

Allowed values:
updated_atdatetimeRead-only

Errors

401
Unauthorized Error
403
Forbidden Error
409
Conflict Error
422
Unprocessable Entity Error