This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided examples
of text + label pairs as a reference.
Note: Fine-tuned models trained on classification examples don’t require the examples
parameter to be passed in explicitly.
The name of the project that is making the request.
A list of up to 96 texts to be classified. Each one must be a non-empty string.
There is, however, no consistent, universal limit to the length a particular input can be. We perform classification on the first x
tokens of each input, and x
varies depending on which underlying model is powering classification. The maximum token length for each model is listed in the “max tokens” column here.
Note: by default the truncate
parameter is set to END
, so tokens exceeding the limit will be automatically dropped. This behavior can be disabled by setting truncate
to NONE
, which will result in validation errors for longer texts.
An array of examples to provide context to the model. Each example is a text string and its associated label/class. Each unique label requires at least 2 examples associated with it; the maximum number of examples is 2500, and each example has a maximum length of 512 tokens. The values should be structured as {text: "...",label: "..."}
.
Note: Fine-tuned Models trained on classification examples don’t require the examples
parameter to be passed in explicitly.
The identifier of the model. Currently available models are embed-multilingual-v2.0
, embed-english-light-v2.0
, and embed-english-v2.0
(default). Smaller “light” models are faster, while larger models will perform better. Fine-tuned models can also be supplied with their full ID.
The ID of a custom playground preset. You can create presets in the playground. If you use a preset, all other parameters become optional, and any included parameters will override the preset’s parameters.
END
One of NONE|START|END
to specify how the API will handle inputs longer than the maximum token length.
Passing START
will discard the start of the input. END
will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model.
If NONE
is selected, when the input exceeds the maximum input token length an error will be returned.
OK