Yandex Cloud
Поиск
Связаться с намиПодключиться
  • Истории успеха
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
    • Доступны в регионе
    • Инфраструктура и сеть
    • Платформа данных
    • Контейнеры
    • Инструменты разработчика
    • Бессерверные вычисления
    • Безопасность
    • Мониторинг и управление ресурсами
    • ИИ для бизнеса
    • Бизнес-инструменты
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Партнёрская программа
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Тарифы Yandex Cloud
    • Промоакции и free tier
    • Правила тарификации
  • Истории успеха
  • Документация
  • Блог
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»
Yandex AI Studio
  • Начало работы с Model Gallery
    • О сервисе Yandex AI Studio
    • Yandex Workflows
    • Квоты и лимиты
    • Термины и определения
  • Переход с AI Assistant API на Responses API
  • Совместимость с OpenAI
    • О Yandex Cloud ML SDK
      • Overview
      • Authentication
        • Overview
        • Assistant types
        • Tools
        • Operation
        • Tuning
        • Result types for models
        • Datasets
        • Search API
        • Messages
        • Run types
        • Search index types
        • Other types
        • Batch
      • Request retries
  • Управление доступом
  • Правила тарификации
  • Аудитные логи Audit Trails
  • Публичные материалы
  • История изменений

В этой статье:

  • Assistant-related message types
  • class yandex_cloud_ml_sdk._messages.message.Message
  • class yandex_cloud_ml_sdk._messages.message.PartialMessage
  • class yandex_cloud_ml_sdk._messages.message.Author
  • class yandex_cloud_ml_sdk._messages.message.MessageStatus
  • class yandex_cloud_ml_sdk._messages.citations.Citation
  • class yandex_cloud_ml_sdk._messages.citations.Source
  • Completions-related message types
  • class yandex_cloud_ml_sdk._types.message.TextMessage
  • class yandex_cloud_ml_sdk._types.message.TextMessageProtocol
  • class yandex_cloud_ml_sdk._models.completions.token.Token
  • Chat completions related message types
  • Image generation messages
  • class yandex_cloud_ml_sdk._models.image_generation.message.ImageMessage
  • class yandex_cloud_ml_sdk._models.image_generation.message.AnyMessage
  1. Yandex Cloud ML SDK
  2. Справочник SDK (англ.)
  3. Types
  4. Messages

Messages

Статья создана
Yandex Cloud
Обновлена 7 ноября 2025 г.
  • Assistant-related message types
    • class yandex_cloud_ml_sdk._messages.message.Message
    • class yandex_cloud_ml_sdk._messages.message.PartialMessage
    • class yandex_cloud_ml_sdk._messages.message.Author
    • class yandex_cloud_ml_sdk._messages.message.MessageStatus
    • class yandex_cloud_ml_sdk._messages.citations.Citation
    • class yandex_cloud_ml_sdk._messages.citations.Source
  • Completions-related message types
    • class yandex_cloud_ml_sdk._types.message.TextMessage
    • class yandex_cloud_ml_sdk._types.message.TextMessageProtocol
    • class yandex_cloud_ml_sdk._models.completions.token.Token
  • Chat completions related message types
  • Image generation messages
    • class yandex_cloud_ml_sdk._models.image_generation.message.ImageMessage
    • class yandex_cloud_ml_sdk._models.image_generation.message.AnyMessage

Assistant-related message typesAssistant-related message types

class yandexcloudmlsdk.messages.message.Messageclass yandex_cloud_ml_sdk._messages.message.Message

Represents a message in a conversation thread.

thread_id: str

ID of the thread containing this message

created_by: str

ID of the user/assistant who created the message

created_at: datetime

Timestamp when the message was created

labels: dict[str, str] | None

A set of labels for the message.

author: Author

Author information

citations: tuple[Citation]... ,

Tuple of citations in this message

status: MessageStatus

Current status of the message

property role: str

Get the role of the message author.

property text: str

Get concatenated string of all text parts in the message by joining all string parts.

parts: tuple[Any]... ,

Tuple containing message parts (can be strings or other types)

id: str

class yandexcloudmlsdk.messages.message.PartialMessageclass yandex_cloud_ml_sdk._messages.message.PartialMessage

Represents a partial message. Used for streaming responses where content arrives in chunks.

property text: str

Get concatenated string of all text parts in the message by joining all string parts.

parts: tuple[Any]... ,

Tuple containing message parts (can be strings or other types)

id: str

class yandexcloudmlsdk.messages.message.Authorclass yandex_cloud_ml_sdk._messages.message.Author

Represents the author of a message.

id: str

Unique identifier of the message author

role: str

Role of the author (e.g., ‘user’, ‘assistant’)

class yandexcloudmlsdk.messages.message.MessageStatusclass yandex_cloud_ml_sdk._messages.message.MessageStatus

Enum representing possible message statuses.

Примечание

Values are inherited from protobuf definitions.

MESSAGE_STATUS_UNSPECIFIED = 0

COMPLETED = 1

Message was successfully created by a user or generated by an assistant.

TRUNCATED = 2

Message generation was truncated due to reaching the maximum allowed number of tokens.

FILTERED_CONTENT = 3

Message generation was stopped because potentially sensitive content was detected either in the prompt or in the generated response.

__new__(value)

class yandexcloudmlsdk.messages.citations.Citationclass yandex_cloud_ml_sdk._messages.citations.Citation

Represents a citation from search results with multiple sources.

A citation contains references to one or more sources from search indexes that were used to generate or support the content. This is typically used in generative AI responses to provide attribution for factual information.

sources: tuple[Source]... ,

Tuple of Source objects referenced in this citation

class yandexcloudmlsdk.messages.citations.Sourceclass yandex_cloud_ml_sdk._messages.citations.Source

Abstract base class for citation sources.

abstract property type: str

Get the type identifier of this source.

Completions-related message typesCompletions-related message types

class yandexcloudmlsdk.types.message.TextMessageclass yandex_cloud_ml_sdk._types.message.TextMessage

TextMessage(role: ‘str’, text: ‘str’)

role: str

text: str

class yandexcloudmlsdk.types.message.TextMessageProtocolclass yandex_cloud_ml_sdk._types.message.TextMessageProtocol

property role: str

property text: str

typeddict yandex_cloud_ml_sdk._types.message.TextMessageDict

typing.TypedDict.

Required Keys

  • role (str)
  • text (str)

yandex_cloud_ml_sdk._types.message.coerce_to_text_message_dict(message)

Parameters

message (TextMessage | TextMessageDict | TextMessageProtocol | str)

Return type

TextMessageDict

typeddict yandex_cloud_ml_sdk._models.completions.message.FunctionResultMessageDict

A class with the TypedDict representing the structure of a function result message. The dictionary contains the role of the message sender and the results of tool calls.

Required Keys

  • role (str)
  • tool_results (Iterable[FunctionResultDict])

typeddict yandex_cloud_ml_sdk._tools.tool_result.FunctionResultDict

typing.TypedDict.

Required Keys

  • name (str)
  • content (str)
  • type (str)

typeddict yandex_cloud_ml_sdk._types.tools.function.FunctionDictType

typing.TypedDict.

Required Keys

  • type (Literal['function'])
  • function (FunctionNameType)

typeddict yandex_cloud_ml_sdk._types.tools.function.FunctionNameType

typing.TypedDict.

Required Keys

  • name (str)
  • instruction (str)

class yandexcloudmlsdk.models.completions.token.Tokenclass yandex_cloud_ml_sdk._models.completions.token.Token

This class encapsulates the properties of a token and represents it in a text processing context.

id: int

a unique identifier for the token

special: bool

a flag indicating if the token is a special one

text: str

the textual representation of the token

Chat completions related message typesChat completions related message types

typeddict yandex_cloud_ml_sdk._chat.completions.message.ChatFunctionResultMessageDict

Function call result message in chat domain format.

Used to represent the result of a function/tool call in chat conversations.

Required Keys

  • role (str) – Role of the message (optional)
  • tool_call_id (str) – ID of the tool call this result corresponds to
  • content (str) – Mixed content including text and/or images

typeddict yandex_cloud_ml_sdk._chat.completions.message.MultimodalMessageDict

Multimodal message supporting both text and image content.

Allows passing multiple content types (text and images) in a single message.

Required Keys

  • role (str) – Role of the message (optional)
  • content (Sequence[Union[ImageUrlDict, TextContent]]) – Mixed content including text and/or images

typeddict yandex_cloud_ml_sdk._chat.completions.message.TextContent

Text content type for multimodal messages.

Used to include text data in multimodal chat messages.

Required Keys

  • type (Literal['text']) – Content type identifier for text
  • text (str) – Text content

typeddict yandex_cloud_ml_sdk._chat.completions.message.ImageUrlContent

Image content type for multimodal messages.

Used to include image data in multimodal chat messages.

Required Keys

  • type (Literal['image_url']) – Content type identifier for text
  • image_url (ImageUrlDict) – Image URL information

typeddict yandex_cloud_ml_sdk._chat.completions.message.ImageUrlDict

Dictionary for passing image URL in multimodal messages.

Required Keys

  • url (str) – URL of the image

Image generation messagesImage generation messages

class yandexcloudmlsdk.models.imagegeneration.message.ImageMessageclass yandex_cloud_ml_sdk._models.image_generation.message.ImageMessage

This class represents a message for using in image generation models with optional weight field.

text: str

the text content of the message for using in image generation models

weight: float | None = None

the weight associated with the message

typeddict yandex_cloud_ml_sdk._models.image_generation.message.ImageMessageDict

The class with TypedDict representing the structure of an image message.

Required Keys

  • text (str) – the text content of the message for using in image generation models
  • weight (float) – the weight associated with the message

class yandexcloudmlsdk.models.imagegeneration.message.AnyMessageclass yandex_cloud_ml_sdk._models.image_generation.message.AnyMessage

The class with a protocol which defines an object with a text field. The protocol can be used to check if an object has a text attribute.

text: str

yandex_cloud_ml_sdk._models.image_generation.message.ImageMessageType

type alias for different types of messages that can be processed by image generation models

Alias of Union[ImageMessage, ImageMessageDict, AnyMessage, str]

yandex_cloud_ml_sdk._models.image_generation.message.ImageMessageInputType

type alias for input types accepted by the messages_to_proto function

Alias of Union[ImageMessage, ImageMessageDict, AnyMessage, str, Iterable[Union[ImageMessage, ImageMessageDict, AnyMessage, str]]]

Была ли статья полезна?

Предыдущая
Search API
Следующая
Run types
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»