Foundation Models Text Classification API, REST: TextClassification.fewShotClassify
Статья создана
Обновлена 15 мая 2024 г.
RPC method for few-shot text classification.
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.
Field | Description |
---|---|
modelUri | string The identifier of the classification 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[] | object Optional set of text samples with expected labels that may be used as an additional hint for the classifier. |
samples[]. text |
string Text sample. |
samples[]. label |
string Expected label for a given text. |
Response
HTTP Code: 200 - OK
{
"predictions": [
{
"label": "string",
"confidence": "number"
}
],
"modelVersion": "string"
}
Response containing classifier predictions.
Field | Description |
---|---|
predictions[] | object Result of classification - a list of label-confidence pairs. |
predictions[]. label |
string A label with a class name. |
predictions[]. confidence |
number (double) Confidence of item's belonging to a class. |
modelVersion | string Model version (changes with model releases). |