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

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

  • class yandex_cloud_ml_sdk._threads.domain.Threads
  • class yandex_cloud_ml_sdk._threads.thread.Thread
  1. Yandex Cloud ML SDK
  2. Справочник SDK (англ.)
  3. SDK
  4. Threads domain

Threads domain

Статья создана
Yandex Cloud
Обновлена 25 августа 2025 г.
  • class yandex_cloud_ml_sdk._threads.domain.Threads
  • class yandex_cloud_ml_sdk._threads.thread.Thread

class yandexcloudmlsdk.threads.domain.Threadsclass yandex_cloud_ml_sdk._threads.domain.Threads

A class for managing threads. It is a part of Assistants API.

This class provides methods to create, retrieve, and list threads.

create(*, name=Undefined, description=Undefined, labels=Undefined, ttl_days=Undefined, expiration_policy=Undefined, timeout=60)

Create a new thread.

This method creates a new thread with the specified parameters.

Parameters

  • name (str | Undefined) – the name of the thread.
  • description (str | Undefined) – a description for the thread.
  • labels (dict[str, str] | Undefined) – a set of labels for the thread.
  • ttl_days (int | Undefined) – time-to-live in days for the thread.
  • expiration_policy (ExpirationPolicy | Literal[1, 2] | ~typing.Literal['STATIC', 'SINCE_LAST_ACTIVE'] | ~typing.Literal['static', 'since_last_active'] | ~yandex_cloud_ml_sdk._types.misc.Undefined) – expiration policy for the file. Assepts for passing static or since_last_active strings. Should be defined if ttl_days has been defined, otherwise both parameters should be undefined.
  • timeout (float) – timeout for the service call in seconds. Defaults to 60 seconds.

Return type

Thread

get(thread_id, *, timeout=60)

Retrieve a thread by its id.

This method fetches an already created thread using its unique identifier.

Parameters

  • thread_id (str) – the unique identifier of the thread to retrieve.
  • timeout (float) – timeout for the service call in seconds. Defaults to 60 seconds.

Return type

Thread

list(*, page_size=Undefined, timeout=60)

List threads in the specified folder.

This method retrieves a list of threads. It continues to fetch threads until there are no more available.

Parameters

  • page_size (int | Undefined) – the maximum number of threads to return per page.
  • timeout (float) – timeout for the service call in seconds. Defaults to 60 seconds.

Return type

Iterator[Thread]

class yandexcloudmlsdk.threads.thread.Threadclass yandex_cloud_ml_sdk._threads.thread.Thread

update(*, name=Undefined, description=Undefined, labels=Undefined, ttl_days=Undefined, expiration_policy=Undefined, timeout=60)

Update the thread’s properties, including the name, the description, labels, ttl days, and the expiration policy of the thread.

Parameters

  • name (str | Undefined) – the new name of the thread.
  • description (str | Undefined) – the new description for the thread.
  • labels (dict[str, str] | Undefined) – a set of new labels for the thread.
  • ttl_days (int | Undefined) – the updated time-to-live in days for the thread.
  • expiration_policy (ExpirationPolicy | Literal[1, 2] | ~typing.Literal['STATIC', 'SINCE_LAST_ACTIVE'] | ~typing.Literal['static', 'since_last_active'] | ~yandex_cloud_ml_sdk._types.misc.Undefined) – an updated expiration policy for the file.
  • timeout (float) – timeout for the operation in seconds. Defaults to 60 seconds.

Return type

Self

delete(*, timeout=60)

Delete the thread.

This method deletes the thread and marks it as deleted. Raises an exception if the deletion fails.

Parameters

timeout (float) – timeout for the operation. Defaults to 60 seconds.

Return type

None

write(message, *, labels=Undefined, timeout=60)

Write a message to the thread.

This method allows sending a message to the thread with optional labels.

Parameters

  • message (TextMessage | TextMessageDict | TextMessageProtocol | str) – the message to be sent to the thread. Could be a string, a dictionary, or a result object. Read more about other possible message types in the documentation.
  • labels (dict[str, str] | Undefined) – optional labels for the message.
  • timeout (float) – timeout for the operation. Defaults to 60 seconds.

Return type

Message

read(*, timeout=60)

Read messages from the thread.

This method allows iterating over messages in the thread.

Parameters

timeout (float) – timeout for the operation. Defaults to 60 seconds.

Return type

Iterator[Message]

name: str | None

the name of the thread

description: str | None

the description of the thread

created_by: str

the identifier of the user who created the thread

created_at: datetime

the timestamp when the thread was created

updated_by: str

the identifier of the user who last updated the thread

updated_at: datetime

the timestamp when the thread was last updated

expires_at: datetime

the timestamp when the thread will expire

labels: dict[str, str] | None

additional labels associated with the thread

expiration_config: ExpirationConfig

id: str

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

Предыдущая
Files domain
Следующая
Runs domain
Проект Яндекса
© 2025 ООО «Яндекс.Облако»