Foundation Models Text Classification API, REST: TextClassification.FewShotClassify
RPC method for binary and multi-class classification.
You can provide up to 20 classes for few-shot text classification
with optional examples.
HTTP request
POST https://llm.api.cloud.yandex.net/foundationModels/v1/fewShotTextClassification
Body parameters
{
"modelUri": "string",
"taskDescription": "string",
"labels": [
"string"
],
"text": "string",
"samples": [
{
"text": "string",
"label": "string"
}
]
}
Request for the service to classify text.
For examples of usage, see step-by-step guides.
Field |
Description |
modelUri |
string The URI of the classifier model. |
taskDescription |
string Text description of the classification task. |
labels[] |
string List of available labels for the classification result. |
text |
string Text for classification. |
samples[] |
Optional set of text samples with expected labels that may be used as an additional hint for the classifier. |
ClassificationSample
Description of a sample for the classification task.
Field |
Description |
text |
string Text sample. |
label |
string Expected label for a given text. |
Response
HTTP Code: 200 - OK
{
"predictions": [
{
"label": "string",
"confidence": "string"
}
],
"modelVersion": "string"
}
Response containing classifier predictions.
Field |
Description |
predictions[] |
The classification results with the `confidence`` values |
modelVersion |
string The model version changes with each new releases. |
ClassificationLabel
A pair of text labels and their corresponding confidence values.
Field |
Description |
label |
string A class name label. |
confidence |
string The probability of classifying text into a specific class. |