Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex AI Studio
    • About Yandex AI Studio
    • Yandex Workflows
    • Quotas and limits
    • Terms and definitions
  • Compatibility with OpenAI
    • About 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
  • Access management
  • Pricing policy
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • class yandex_cloud_ml_sdk._types.expiration.ExpirationPolicy
  • class yandex_cloud_ml_sdk._types.expiration.ExpirationConfig
  • class yandex_cloud_ml_sdk._types.expiration.ExpirationPolicyAlias
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.PromptTruncationOptions
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.BasePromptTruncationStrategy
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.AutoPromptTruncationStrategy
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.LastMessagesPromptTruncationStrategy
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.PromptTruncationStrategyType
  • class yandex_cloud_ml_sdk._assistants.assistant.ReadOnlyAssistant
  • class yandex_cloud_ml_sdk._assistants.assistant.AssistantVersion
  1. Yandex Cloud ML SDK
  2. SDK reference
  3. Types
  4. Assistant types

Assistant types

Written by
Yandex Cloud
Updated at November 7, 2025
  • class yandex_cloud_ml_sdk._types.expiration.ExpirationPolicy
  • class yandex_cloud_ml_sdk._types.expiration.ExpirationConfig
  • class yandex_cloud_ml_sdk._types.expiration.ExpirationPolicyAlias
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.PromptTruncationOptions
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.BasePromptTruncationStrategy
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.AutoPromptTruncationStrategy
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.LastMessagesPromptTruncationStrategy
  • class yandex_cloud_ml_sdk._assistants.prompt_truncation_options.PromptTruncationStrategyType
  • class yandex_cloud_ml_sdk._assistants.assistant.ReadOnlyAssistant
  • class yandex_cloud_ml_sdk._assistants.assistant.AssistantVersion

yandex_cloud_ml_sdk._types.expiration.ExpirationProtoTypeT_contra = TypeVar(ExpirationProtoTypeT_contra, bound=Union, contravariant=True)

Type:TypeVar

Contravariant TypeVar bound to typing.Union[yandex.cloud.ai.assistants.v1.assistant_pb2.Assistant, yandex.cloud.ai.assistants.v1.searchindex.search_index_pb2.SearchIndex, yandex.cloud.ai.assistants.v1.threads.thread_pb2.Thread, yandex.cloud.ai.files.v1.file_pb2.File].

class yandexcloudmlsdk.types.expiration.ExpirationPolicyclass yandex_cloud_ml_sdk._types.expiration.ExpirationPolicy

STATIC = 1

SINCE_LAST_ACTIVE = 2

class yandexcloudmlsdk.types.expiration.ExpirationConfigclass yandex_cloud_ml_sdk._types.expiration.ExpirationConfig

ExpirationConfig(ttl_days: ‘int | None’ = None, expiration_policy: ‘ExpirationPolicy | None’ = None)

ttl_days: int | None = None

expiration_policy: ExpirationPolicy | None = None

classmethod coerce(ttl_days, expiration_policy)

Parameters

  • ttl_days (int | Undefined)
  • 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)

Return type

ExpirationConfig

to_proto()

Return type

ExpirationConfig | None

__init__(ttl_days=None, expiration_policy=None)

Parameters

  • ttl_days (int | None)
  • expiration_policy (ExpirationPolicy | None)

Return type

None

yandex_cloud_ml_sdk._types.expiration.ExpirationPolicyAlias

alias of ExpirationPolicy | Literal[1, 2] | Literal[‘STATIC’, ‘SINCE_LAST_ACTIVE’] | Literal[‘static’, ‘since_last_active’]

class yandexcloudmlsdk.types.expiration.ExpirationPolicyAliasclass yandex_cloud_ml_sdk._types.expiration.ExpirationPolicyAlias

class yandexcloudmlsdk.assistants.prompttruncationoptions.PromptTruncationOptionsclass yandex_cloud_ml_sdk._assistants.prompt_truncation_options.PromptTruncationOptions

Configuration options for prompt truncation in assistant conversations.

This class defines how to handle prompt truncation when the conversation exceeds the maximum token limit. It allows specifying both the maximum token limit and the strategy for truncation.

max_prompt_tokens: int | None = None

The maximum number of tokens allowed in the prompt. If the prompt exceeds this limit, the thread messages will be truncated. Default max_prompt_tokens: 7000

strategy: BasePromptTruncationStrategy | None = None

The truncation strategy to use when the prompt exceeds the token limit. Can be either ‘auto’ for automatic strategy or a specific strategy instance. If None, no truncation strategy is applied.

class yandexcloudmlsdk.assistants.prompttruncationoptions.BasePromptTruncationStrategyclass yandex_cloud_ml_sdk._assistants.prompt_truncation_options.BasePromptTruncationStrategy

Base class for prompt truncation strategies.

This abstract base class defines the interface for different truncation strategies that can be used when the prompt exceeds the maximum token limit. Concrete implementations should override the abstract methods to provide specific truncation behavior.

class yandexcloudmlsdk.assistants.prompttruncationoptions.AutoPromptTruncationStrategyclass yandex_cloud_ml_sdk._assistants.prompt_truncation_options.AutoPromptTruncationStrategy

Automatic prompt truncation strategy.

The system will handle truncation in a way that aims to preserve the most relevant context. This strategy lets the AI service automatically determine the best approach for truncating the prompt while maintaining conversation coherence.

class yandexcloudmlsdk.assistants.prompttruncationoptions.LastMessagesPromptTruncationStrategyclass yandex_cloud_ml_sdk._assistants.prompt_truncation_options.LastMessagesPromptTruncationStrategy

Last messages prompt truncation strategy.

This strategy specifies that when truncation is needed, the system should retain the most recent messages up to the specified number, and truncate older messages to fit within the token limit.

num_messages: int

The number of most recent messages to retain in the prompt. If these messages exceed max_prompt_tokens, older messages will be further truncated to fit the limit.

yandex_cloud_ml_sdk._assistants.prompt_truncation_options.PromptTruncationStrategyType

alias of Literal[‘auto’] | BasePromptTruncationStrategy

class yandexcloudmlsdk.assistants.prompttruncationoptions.PromptTruncationStrategyTypeclass yandex_cloud_ml_sdk._assistants.prompt_truncation_options.PromptTruncationStrategyType

class yandexcloudmlsdk.assistants.assistant.ReadOnlyAssistantclass yandex_cloud_ml_sdk._assistants.assistant.ReadOnlyAssistant

Base class providing read-only access to Yandex Cloud ML Assistant configuration and metadata.

This class implements the core interface for interacting with Yandex Cloud ML Assistant API in a read-only manner. It serves as the parent class for both synchronous (Assistant) and asynchronous (AsyncAssistant) implementations.

name: str | None

The name of the assistant.

description: str | None

The description of the assistant.

created_by: str

The identifier of the user who created the assistant.

created_at: datetime

The timestamp when the assistant was created.

updated_by: str

The identifier of the user who last updated the assistant.

updated_at: datetime

The timestamp when the assistant was last updated.

expires_at: datetime

The timestamp when the assistant will expire.

labels: dict[str, str] | None

Additional labels associated with the assistant.

property max_prompt_tokens: int | None

Returns the maximum number of prompt tokens allowed for the assistant.

expiration_config: ExpirationConfig

Expiration configuration for the assistant.

model: BaseGPTModel

The GPT model used by the assistant.

instruction: str | None

Instructions or guidelines that the assistant should follow. These instructions guide the assistant’s behavior and responses.

prompt_truncation_options: PromptTruncationOptions

Options for truncating thread messages. Controls how messages are truncated when forming the prompt.

tools: tuple[BaseTool]... ,

Tools available to the assistant. Can be a sequence or a single tool. Tools must implement BaseTool interface.

response_format: ResponseType | None

A format of the response returned by the model. Could be a JsonSchema, a JSON string, or a pydantic model

id: str

class yandexcloudmlsdk.assistants.assistant.AssistantVersionclass yandex_cloud_ml_sdk._assistants.assistant.AssistantVersion

Represents a specific version of an Assistant.

id: str

ID of the assistant version.

assistant: ReadOnlyAssistant

The assistant instance for this version.

update_mask: tuple[str]... ,

Mask specifying which fields were updated in this version. Mask also have a custom JSON encoding

Was the article helpful?

Previous
Overview
Next
Tools
© 2025 Direct Cursus Technology L.L.C.