Base classes
- class yandex_cloud_ml_sdk._sdk.BaseSDK
- class yandex_cloud_ml_sdk._types.domain.BaseDomain
- class yandex_cloud_ml_sdk._types.model.BaseModel
- class yandex_cloud_ml_sdk._types.model_config.BaseModelConfig
- class yandex_cloud_ml_sdk._auth.BaseAuth
- class yandex_cloud_ml_sdk._tools.domain.BaseTools
- class yandex_cloud_ml_sdk._tools.function.BaseFunctionTools
- class yandex_cloud_ml_sdk._tools.tool.BaseTool
- class yandex_cloud_ml_sdk._tools.tool_call.BaseToolCall
- class yandex_cloud_ml_sdk._tools.tool_call_list.ToolCallList
- class yandex_cloud_ml_sdk._tools.function_call.BaseFunctionCall
- class yandex_cloud_ml_sdk._models.BaseModels
- class yandex_cloud_ml_sdk._models.completions.function.BaseCompletions
- class yandex_cloud_ml_sdk._models.completions.model.BaseGPTModel
- class yandex_cloud_ml_sdk._models.text_classifiers.function.BaseTextClassifiers
- class yandex_cloud_ml_sdk._models.text_embeddings.function.BaseTextEmbeddings
- class yandex_cloud_ml_sdk._models.image_generation.function.BaseImageGeneration
- class yandex_cloud_ml_sdk._threads.domain.BaseThreads
- class yandex_cloud_ml_sdk._threads.thread.BaseThread
- class yandex_cloud_ml_sdk._files.domain.BaseFiles
- class yandex_cloud_ml_sdk._files.file.BaseFile
- class yandex_cloud_ml_sdk._assistants.domain.BaseAssistants
- class yandex_cloud_ml_sdk._assistants.assistant.BaseAssistant
- class yandex_cloud_ml_sdk._runs.domain.BaseRuns
- class yandex_cloud_ml_sdk._runs.run.BaseRun
- class yandex_cloud_ml_sdk._search_api.domain.BaseSearchAPIDomain
- class yandex_cloud_ml_sdk._search_api.generative.function.BaseGenerativeSearchFunction
- class yandex_cloud_ml_sdk._search_api.generative.generative.BaseGenerativeSearch
- class yandex_cloud_ml_sdk._search_indexes.domain.BaseSearchIndexes
- class yandex_cloud_ml_sdk._search_indexes.search_index.BaseSearchIndex
- class yandex_cloud_ml_sdk._datasets.domain.BaseDatasets
- class yandex_cloud_ml_sdk._datasets.dataset.BaseDataset
- class yandex_cloud_ml_sdk._datasets.draft.BaseDatasetDraft
- class yandex_cloud_ml_sdk._tuning.domain.BaseTuning
- class yandex_cloud_ml_sdk._types.batch.domain.BaseBatchSubdomain
- class yandex_cloud_ml_sdk._messages.base.BaseMessage
- class yandex_cloud_ml_sdk._batch.domain.BaseBatch
- class yandex_cloud_ml_sdk._types.batch.operation.BaseBatchTaskOperation
- class yandex_cloud_ml_sdk._chat.BaseChat
- class yandex_cloud_ml_sdk._chat.completions.function.BaseChatCompletions
- class yandex_cloud_ml_sdk._chat.completions.model.BaseChatModel
- class yandex_cloud_ml_sdk._chat.text_embeddings.function.BaseChatEmbeddings
- class yandex_cloud_ml_sdk._chat.text_embeddings.model.BaseChatEmbeddingsModel
- class yandex_cloud_ml_sdk._search_api.web.function.BaseWebSearchFunction
- class yandex_cloud_ml_sdk._search_api.image.function.BaseImageSearchFunction
- class yandex_cloud_ml_sdk._search_api.by_image.function.BaseByImageSearchFunction
class yandex_cloud_ml_sdk._sdk.BaseSDK
The main class that needs to be instantiated to work with SDK.
tools: BaseTools
Domain for creating various tools for assistants and function calling
models: BaseModels
Domain for working with models (inference and tuning)
threads: BaseThreads
Domain for working with threads (a part of the Assistants API)
files: BaseFiles
Domain for working with files (a part of the Asssistants API)
assistants: BaseAssistants
Domain for working with assistants (a part of the Assistants API)
runs: BaseRuns
Domain for working with assistants’ runs (a part of the Assistants API)
search_api: BaseSearchAPIDomain
Domain for working with Search API
search_indexes: BaseSearchIndexes
Domain for working with search indexes (a part of the Assistants API)
datasets: BaseDatasets
Domain for working with datasets
tuning: BaseTuning
Domain for working with tuning
batch: BaseBatch
Domain for working with batch tasks
chat: BaseChat
Domain for working with Yandex Cloud OpenAI Compatible API_BaseSDK_URL.
setup_default_logging(log_level='INFO', log_format='[%(levelname)1.1s %(asctime)s %(name)s:%(lineno)d] %(message)s', date_format='%Y-%m-%d %H:%M:%S')
Sets up the default logging configuration.
Read more about log_levels, log_format, and date_format in Python documentation (logging)
|
Parameters |
|
|
Returns |
The instance of the SDK with logging configured. |
|
Return type |
class yandex_cloud_ml_sdk._types.domain.BaseDomain
class yandex_cloud_ml_sdk._types.model.BaseModel
property uri: str
property config: ConfigTypeT
configure(**kwargs)
|
Return type |
Self |
class yandex_cloud_ml_sdk._types.model_config.BaseModelConfig
BaseModelConfig()
class yandex_cloud_ml_sdk._auth.BaseAuth
Abstract base class for authentication methods.
This class defines the interface for obtaining authentication metadata and checking if the authentication method is applicable from environment variables.
class yandex_cloud_ml_sdk._tools.domain.BaseTools
property function: FunctionToolsTypeT
property rephraser: RephraserFunction
search_index(indexes, *, max_num_results=Undefined, rephraser=Undefined, call_strategy=Undefined)
Creates SearchIndexTool (not to be confused with SearchIndex/AsyncSearchIndex).
|
Parameters |
|
|
Return type |
generative_search(*, description, site=Undefined, host=Undefined, url=Undefined, enable_nrfm_docs=Undefined, search_filters=Undefined)
Creates GeberativeSearch tool which provide access to generative search by Search API for LLMs.
Not to be confused with sdk.search_api.generative. Tools domain is for creating tools for using in LLMs/Assistants and search_api domain is for using Search API directly.
To learn more about parameters and their formats and possible values, refer to generative search documentation
NB: All of the site, host, url parameters are mutually exclusive.
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._tools.function.BaseFunctionTools
__call__(parameters, *, name=Undefined, description=Undefined, strict=Undefined)
Call self as a function.
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._tools.tool.BaseTool
class yandex_cloud_ml_sdk._tools.tool_call.BaseToolCall
BaseToolCall(id: ‘str | None’, function: ‘FunctionCallTypeT | None’, _proto_origin: ‘ProtoToolCall | None’, _json_origin: ‘JsonObject | None’)
function: FunctionCallTypeT | None
class yandex_cloud_ml_sdk._tools.tool_call_list.ToolCallList
ToolCallList(tool_calls: ‘tuple[ToolCallTypeT, …]’, _proto_origin: ‘ProtoToolCallListTypeT’)
count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
tool_calls: tuple
class yandex_cloud_ml_sdk._tools.function_call.BaseFunctionCall
BaseFunctionCall(name: ‘str’, arguments: ‘JsonObject’, _proto_origin: ‘ProtoFunctionCall | None’)
name: str
arguments: JsonObject
class yandex_cloud_ml_sdk._models.BaseModels
Domain for working with Yandex Foundation Models.
completions: BaseCompletions
text_classifiers: BaseTextClassifiers
image_generation: BaseImageGeneration
text_embeddings: BaseTextEmbeddings
class yandex_cloud_ml_sdk._models.completions.function.BaseCompletions
A class for handling completions models.
It defines the core functionality for calling a model to generate completions based on the provided model name and version.
__call__(model_name, *, model_version='latest')
Create a model object to call for generating completions.
This method constructs the URI for the model based on the provided name and version. If the name contains ://, it is treated as a full URI. Otherwise, it looks up the model name in the well-known names dictionary. But after this, in any case, we construct a URI in the form gpt://<folder_id>/
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._models.completions.model.BaseGPTModel
A class for GPT models providing various functionalities including tuning, and batch processing.
langchain(model_type='chat', timeout=60)
Initializes a langchain model based on the specified model type.
|
Parameters |
|
|
Return type |
BaseYandexLanguageModel |
configure(*, temperature=Undefined, max_tokens=Undefined, reasoning_mode=Undefined, response_format=Undefined, tools=Undefined, parallel_tool_calls=Undefined, tool_choice=Undefined)
Configures the model with specified parameters.
|
Parameters |
|
|
Returns |
new model instance with provided configuration. |
|
Return type |
property batch: BatchSubdomainTypeT
property config: ConfigTypeT
property uri: str
class yandex_cloud_ml_sdk._models.text_classifiers.function.BaseTextClassifiers
A class for text classifiers.
It provides a common interface for text classification models and constructs the model URI based on the provided model name and version.
__call__(model_name, *, model_version='latest')
Call the text classification model.
Constructs the URI for the model based on the provided model’s name and version. If the name contains ://, it is treated as a complete URI. Otherwise, it looks up the model name in the well-known names dictionary. But after this, in any case, we construct a URI in the form cls://<folder_id>/
|
Parameters |
class yandex_cloud_ml_sdk._models.text_embeddings.function.BaseTextEmbeddings
A class for text embeddings models.
It provides the functionality to call a text embeddings model either by a well-known name or a full URI.
__call__(model_name, *, model_version='latest')
Call the specified model for text embeddings. It returns an instance of the specified type of the model.
This method constructs the URI for the model based on the provided name and version. If the name contains ://, it is treated as a full URI. Otherwise, it looks up the model name in the well-known names dictionary. But after this, in any case, we construct a URI in the form emb://<folder_id>/
|
Parameters |
class yandex_cloud_ml_sdk._models.image_generation.function.BaseImageGeneration
A class for image generation models.
It provides the functionality to call an image generation model by constructing the appropriate URI based on the provided model name and version.
Returns a model’s object through which requests to the backend are made.
>>> model = sdk.models.image_generation('yandex-art') # this is how the model is created
__call__(model_name, *, model_version='latest')
Call the image generation model with the specified name and version.
Constructs the URI for the model based on the provided model’s name and version. If the name contains ://, it is treated as a complete URI. Otherwise, it looks up the model name in the well-known names dictionary. But after this, in any case, we construct a URI in the form art://<folder_id>/
|
Parameters |
class yandex_cloud_ml_sdk._threads.domain.BaseThreads
A class for managing threads. It is a part of Assistants API.
This class provides methods to create, retrieve, and list threads.
class yandex_cloud_ml_sdk._threads.thread.BaseThread
A class for a thread resource.
It provides methods for working with messages that the thread contains (e.g. updating, deleting, writing to, and reading from).
expiration_config: ExpirationConfig
id: str
class yandex_cloud_ml_sdk._files.domain.BaseFiles
Files domain, which contains API for working with files.
Files is a part of Assistants API, which is the only place you could use it. Provides upload, get and list methods that allow you to work with remote file objects you created earlier.
class yandex_cloud_ml_sdk._files.file.BaseFile
BaseFile(id: ‘str’, _sdk: ‘BaseSDK’, _lock: ‘asyncio.Lock’, _deleted: ‘bool’, expiration_config: ‘ExpirationConfig’)
expiration_config: ExpirationConfig
id: str
class yandex_cloud_ml_sdk._assistants.domain.BaseAssistants
Base class for assistants management.
Provides common functionality for creating, getting and listing assistants.
class yandex_cloud_ml_sdk._assistants.assistant.BaseAssistant
BaseAssistant(id: ‘str’, _sdk: ‘BaseSDK’, _lock: ‘asyncio.Lock’, _deleted: ‘bool’, expiration_config: ‘ExpirationConfig’, model: ‘BaseGPTModel’, instruction: ‘str | None’, prompt_truncation_options: ‘PromptTruncationOptions’, tools: ‘tuple[BaseTool, …]’, response_format: ‘ResponseType | None’)
expiration_config: ExpirationConfig
Expiration configuration for the assistant.
model: BaseGPTModel
The GPT model used by the assistant.
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 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
property max_prompt_tokens: int
Returns the maximum number of prompt tokens allowed for the assistant.
id: str
class yandex_cloud_ml_sdk._runs.domain.BaseRuns
Class for Runs operations. Provides core functionality for managing assistant execution in streams.
For usage examples see runs example
class yandex_cloud_ml_sdk._runs.run.BaseRun
BaseRun(id: ‘str’, _sdk: ‘BaseSDK’, assistant_id: ‘str’, thread_id: ‘str’, created_by: ‘str’, created_at: ‘datetime’, labels: ‘dict[str, str] | None’, custom_temperature: ‘float | None’, custom_max_tokens: ‘int | None’, custom_prompt_truncation_options: ‘PromptTruncationOptions | None’, custom_response_format: ‘ResponseType | None’)
id: str
Unique run identifier
assistant_id: str
ID of the assistant used
thread_id: str
ID of the thread used
created_by: str
Creator of the run
created_at: datetime
Creation timestamp
Optional metadata labels
custom_temperature: float
Custom temperature setting
Custom max tokens setting
custom_prompt_truncation_options: PromptTruncationOptions | None
Custom prompt truncation options
custom_response_format: ResponseType | None
Custom response format
property custom_max_prompt_tokens: int
Get max prompt tokens from truncation options if set.
class yandex_cloud_ml_sdk._search_api.domain.BaseSearchAPIDomain
Domain for working with Yandex Search API services.
generative: BaseGenerativeSearchFunction
API for generative response service
API for web search service
image: BaseImageSearchFunction
API for text image search service
by_image: BaseByImageSearchFunction
API for search by image service
class yandex_cloud_ml_sdk._search_api.generative.function.BaseGenerativeSearchFunction
Generative search function for creating search object which provides methods for invoking generative search.
__call__(*, site=Undefined, host=Undefined, url=Undefined, fix_misspell=Undefined, enable_nrfm_docs=Undefined, search_filters=Undefined)
Creates generative search object which provides methods for invoking generative search.
Not to be confused with sdk.tools.generative_search. Tools domain is for creating tools for using in LLMs/Assistants and search_api domain is for using Search API directly.
To learn more about parameters and their formats and possible values, refer to generative search documentation
NB: All of the site, host, url parameters are mutually exclusive.
|
Parameters |
|
|
Return type |
property available_formats
class yandex_cloud_ml_sdk._search_api.generative.generative.BaseGenerativeSearch
Generative search class which provides concrete methods for working with Search API and incapsulates search setting.
configure(*, site=Undefined, host=Undefined, url=Undefined, fix_misspell=Undefined, enable_nrfm_docs=Undefined, search_filters=Undefined)
Returns the new object with config fields overrode by passed values.
To learn more about parameters and their formats and possible values, refer to generative search documentation
NB: All of the site, host, url parameters are mutually exclusive and using one of them is mandatory.
|
Parameters |
|
|
Return type |
as_tool(description)
Converts generative search instance to GenerativeSearchTool object which is eligible to use as tools in LLMs/Assistants.
|
Parameters |
description (str |
|
Return type |
property config: ConfigTypeT
property uri: str
class yandex_cloud_ml_sdk._search_indexes.domain.BaseSearchIndexes
A class for search indexes. It is a part of Assistants API and it provides the foundation for creating and managing search indexes.
class yandex_cloud_ml_sdk._search_indexes.search_index.BaseSearchIndex
This class represents a search index with associated operations.
expiration_config: ExpirationConfig
id: str
class yandex_cloud_ml_sdk._datasets.domain.BaseDatasets
This class provides methods to create and manage datasets of a specific type.
completions
a helper for autocompletion text-to-text generation tasks
text_classifiers_multilabel
a helper for autocompletion multilabel text classification tasks
text_classifiers_multiclass
a helper for autocompletion multiclass text classification tasks
text_classifiers_binary
a helper for autocompletion binary text classification tasks
text_embeddings_pair
a helper for autocompletion pairwise text embeddings tasks
text_embeddings_triplet
a helper for autocompletion triplet text embeddings tasks
draft_from_path(path, *, task_type=Undefined, upload_format=Undefined, name=Undefined, description=Undefined, metadata=Undefined, labels=Undefined, allow_data_logging=Undefined)
Create a new dataset draft from a specified path.
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._datasets.dataset.BaseDataset
This class represents methods for operating with datasets.
folder_id: str
the ID of the folder which contains the dataset
the name of the dataset
a description of the dataset
metadata associated with the dataset
created_by: str
the user who created the dataset
created_at: datetime
the timestamp when the dataset was created
updated_at: datetime
the timestamp when the dataset was last updated
a dictionary of labels associated with the dataset
allow_data_logging: bool
indicates if data logging is allowed for this dataset
status: DatasetStatus
the current status of the dataset
task_type: str
the type of task associated with the dataset
rows: int
the number of rows in the dataset
size_bytes: int
the size of the dataset in bytes
validation_errors: tuple
a tuple of validation errors associated with the dataset
id: str
class yandex_cloud_ml_sdk._datasets.draft.BaseDatasetDraft
This class allows users to create a draft representation of a dataset without immediately interacting with the server. This draft serves as a structure for storing configuration settings, enabling users to edit the dataset’s properties before finalizing the upload.
the type of task associated with the dataset
the file path to the dataset
upload_format: str
the format in which the dataset will be uploaded
the name of the dataset
description: str
a description of the dataset
metadata associated with the dataset
labels: dict
labels for categorizing the dataset
allow_data_logging: bool
a flag indicating if iyt is allowed to use the dataset to improve the models quality. Default false.
configure(**kwargs)
|
Parameters |
kwargs (Any |
|
Return type |
validate()
|
Return type |
None |
class yandex_cloud_ml_sdk._tuning.domain.BaseTuning
class yandex_cloud_ml_sdk._types.batch.domain.BaseBatchSubdomain
class yandex_cloud_ml_sdk._messages.base.BaseMessage
Abstract class for messages in Yandex Cloud ML Assistant service.
Provides core functionality for all message types including: - Storage and processing of message parts (text, citations, etc.) - Basic text content operations - Protocol buffer support via BaseProtoResult[ProtoMessageTypeT_contra]
Extended by: - Message: Complete assistant messages - PartialMessage: Intermediate message content during streaming
Tuple containing message parts (can be strings or other types)
property text: str
Get concatenated string of all text parts in the message by joining all string parts.
class yandex_cloud_ml_sdk._batch.domain.BaseBatch
Сlass for managing batch operations in Yandex Cloud ML SDK.
For usage examples see batch example
class yandex_cloud_ml_sdk._types.batch.operation.BaseBatchTaskOperation
property id: str
property task_id: str
class yandex_cloud_ml_sdk._chat.BaseChat
A class for Chat API domain operations.
This class provides functionality for working with the Yandex Cloud OpenAI Compatible API_BaseChat_URL. It serves as the foundation for chat operations.
completions: BaseChatCompletions
Chat API subdomain for working with text-generation models
text_embeddings: BaseChatEmbeddings
class yandex_cloud_ml_sdk._chat.completions.function.BaseChatCompletions
A class for working with chat completions models.
This class provides the core functionality for creating chat model instances and managing completions. It handles model URI construction and provides methods for listing available models.
__call__(model_name, *, model_version='latest')
Create a model instance in selected chat subdomain (completions, embeddings, etc)
Constructs the model URI based on the provided name and version. If the name contains ‘://’, it is treated as a full URI. Otherwise constructs a URI in the form ‘gpt://<folder_id>/
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._chat.completions.model.BaseChatModel
A class for working with chat models providing inference functionality.
This class provides the foundation for chat model implementations, handling configuration, request building, and response processing.
configure(*, temperature=Undefined, max_tokens=Undefined, reasoning_mode=Undefined, response_format=Undefined, tools=Undefined, parallel_tool_calls=Undefined, tool_choice=Undefined, extra_query=Undefined)
Configure the model with specified parameters.
|
Parameters |
|
|
Return type |
Self |
property config: ConfigTypeT
property uri: str
class yandex_cloud_ml_sdk._chat.text_embeddings.function.BaseChatEmbeddings
__call__(model_name, *, model_version='latest')
Create a model instance in selected chat subdomain (completions, embeddings, etc)
Constructs the model URI based on the provided name and version. If the name contains ‘://’, it is treated as a full URI. Otherwise constructs a URI in the form ‘gpt://<folder_id>/
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._chat.text_embeddings.model.BaseChatEmbeddingsModel
configure(*, dimensions=Undefined, encoding_format=Undefined, extra_query=Undefined)
|
Parameters |
|
|
Return type |
Self |
property config: ConfigTypeT
property uri: str
class yandex_cloud_ml_sdk._search_api.web.function.BaseWebSearchFunction
Web search function for creating search object which provides methods for invoking web search.
__call__(search_type, *, family_mode=Undefined, fix_typo_mode=Undefined, localization=Undefined, sort_order=Undefined, sort_mode=Undefined, group_mode=Undefined, groups_on_page=Undefined, docs_in_group=Undefined, max_passages=Undefined, region=Undefined, user_agent=Undefined, metadata=Undefined)
Creates web search object which provides methods for web search.
To learn more about parameters and their formats and possible values, refer to web search documentation
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._search_api.image.function.BaseImageSearchFunction
Image search function for creating search object which provides methods for invoking image search.
__call__(search_type, *, family_mode=Undefined, fix_typo_mode=Undefined, format=Undefined, size=Undefined, orientation=Undefined, color=Undefined, site=Undefined, docs_on_page=Undefined, user_agent=Undefined)
Creates image search object which provides methods for image search.
To learn more about parameters and their formats and possible values, refer to image search documentation
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._search_api.by_image.function.BaseByImageSearchFunction
ByImage search function for creating search object which provides methods for invoking by_image search.
__call__(*, family_mode=Undefined, site=Undefined)
Creates by_image search object which provides methods for search by image.
To learn more about parameters and their formats and possible values, refer to search by image documentation
|
Parameters |
|
|
Return type |