Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Foundation Models
    • About Yandex Foundation Models
      • Overview
      • Models
    • Embeddings
    • Datasets
    • Fine-tuning
    • Quotas and limits
  • Yandex Cloud ML SDK
  • Compatibility with OpenAI
  • Access management
  • Pricing policy
  • Public materials
  • Release notes

In this article:

  • Prompt-based classifiers
  • Zero-shot classifier
  • Few-shot classifier
  • Trainable classifiers
  • Response format
  1. Concepts
  2. Classification
  3. Overview

Classifiers based on YandexGPT

Written by
Yandex Cloud
Updated at April 21, 2025
  • Prompt-based classifiers
    • Zero-shot classifier
    • Few-shot classifier
  • Trainable classifiers
  • Response format

Yandex Foundation Models allows you to classify text requests provided in prompts. Classification in YandexGPT-based models is implemented in the Foundation Models Text Classification API.

There are three types of classification available in Foundation Models:

  • Binary classification assigns a request to one of two classes, e.g., spam or non-spam.
  • Multi-class classification puts a request into one (and only one) of more than two classes. For example, a computer CPU can belong to one generation only.
  • Multi-label classification allows you to assign a request to multiple different non-mutually exclusive classes at the same time. For example, a single social media post may have multiple hashtags at the same time.

Classification models are only available in synchronous mode.

Foundation Models provides classifiers of two types: promt classifiers based on YandexGPT Lite and YandexGPT Pro and trainable classifiers based on YandexGPT Lite.

To use the Yandex Foundation Models classifier models, you need the ai.languageModels.user role or higher for the folder.

Prompt-based classifiersPrompt-based classifiers

Foundation Models prompt-based classifiers support binary and multi-class classification, require no model tuning, and are prompt-controlled. The fewShotClassify Text Classification API method enables using these two prompt-based classifiers: Zero-shot and few-shot. You can provide between 2 and 20 classes to the fewShotClassify method.

Tip

Give meaningful names to label classes: this is essential for correct classification results. For example, use chemistry and physics rather than chm and phs for class names.

Zero-shot classifierZero-shot classifier

The zero-shot classifier allows you to perform binary and multi-class classification by providing only the model ID, task description, request text, and an array of class names in the request body.

Request body format for the zero-shot classifier:

{
  "modelUri": "string",
  "taskDescription": "string",
  "labels": [
    "string",
    "string",
    ...
    "string"
  ],
  "text": "string"
}

Where:

  • modelUri: ID of the model that will be used to classify the message. This parameter contains the Yandex Cloud folder ID.

  • taskDescription: Text description of the task for the classifier.

  • labels: Array of classes.

    Give meaningful names to label classes: this is essential for correct classification results. For example, use chemistry and physics rather than chm and phs for class names.

  • text: Message text.

Use the https://llm.api.cloud.yandex.net/foundationModels/v1/fewShotTextClassification endpoint for requests to zero-shot classifiers.

Few-shot classifierFew-shot classifier

The few-shot classifier enables binary and multi-class classification by providing the model with an array of sample requests for the classes specified in the labels field. You need to list these sample requests in the samples field of the request body to get more accurate results from the classifier.

Request body format for the few-shot classifier:

{
  "modelUri": "string",
  "taskDescription": "string",
  "labels": [
    "string",
    "string",
    ...
    "string"
  ],
  "text": "string",
  "samples": [
    {
      "text": "string",
      "label": "string"
    },
    {
      "text": "string",
      "label": "string"
    },
    ...
    {
      "text": "string",
      "label": "string"
    }
  ]
}

Where:

  • modelUri: ID of the model that will be used to classify the message. This parameter contains the Yandex Cloud folder ID.

  • taskDescription: Text description of the task for the classifier.

  • labels: Array of classes.

    Give meaningful names to label classes: this is essential for correct classification results. For example, use chemistry and physics rather than chm and phs for class names.

  • text: Message text.

  • samples: Array with examples of prompts for the classes specified in the labels field. Examples of prompts are provided as objects, each containing an example of a text query and the class to which such query should belong.

Use the https://llm.api.cloud.yandex.net/foundationModels/v1/fewShotTextClassification endpoint for requests to few-shot classifiers.

Warning

You can deliver multiple classification examples in a single request. All examples in the request must not exceed 6,000 tokens.

Trainable classifiersTrainable classifiers

If not satisfied with the output quality of the zero-shot and few-shot classifiers, tune your own one based on YandexGPT Lite. Trainable classifiers can be trained to offer all supported classification types.

To run a request to the classifier of a model fine-tuned in DataSphere, use the classify text classification API method. If you do so, you only need to provide the model ID and the request text to the model. The names of the classes between which the model will be distributing requests must be specified during model tuning and are not provided in the request.

Request body format for a fine-tuned classifier:

{
  "modelUri": "string",
  "text": "string"
}

Where:

  • modelUri: ID of the model that will be used to classify the message. This parameter contains the Yandex Cloud folder ID and the ID of the fine-tuned classifier.
  • text: Message text. The total number of tokens per request must not exceed 8,000.

Use the https://llm.api.cloud.yandex.net:443/foundationModels/v1/textClassification endpoint for requests to trainable classifiers.

The names of the classes between which the model will be distributing requests must be specified during model tuning and are not provided in the request.

Response formatResponse format

All Foundation Models classifier types return the result in the following format:

{
  "predictions": [
    {
      "label": "string",
      "confidence": "number",
    },
    {
      "label": "string",
      "confidence": "number",
    },
    ...
    {
      "label": "string",
      "confidence": "number",
    }
  ],
  "modelVersion": "string"
}

Where:

  • label: Class name.

  • confidence: Probability of assigning the request text to this class.

    In multi-class classification, the sum of the confidence values for all classes is always 1.

    In multi-label classification, the confidence value for each class is calculated independently (the sum of the values is not equal to 1).

Was the article helpful?

Previous
Models
Next
Models
© 2025 Direct Cursus Technology L.L.C.