Result types for models
- Completions
- class yandex_cloud_ml_sdk._models.completions.result.GPTModelResult
- class yandex_cloud_ml_sdk._models.completions.result.Alternative
- class yandex_cloud_ml_sdk._models.completions.result.AlternativeStatus
- class yandex_cloud_ml_sdk._models.completions.result.Usage
- class yandex_cloud_ml_sdk._models.completions.result.CompletionUsage
- Embeddings
- Text classifiers
- class yandex_cloud_ml_sdk._models.text_classifiers.result.TextClassifiersModelResultBase
- class yandex_cloud_ml_sdk._models.text_classifiers.result.TextClassifiersModelResult
- class yandex_cloud_ml_sdk._models.text_classifiers.result.FewShotTextClassifiersModelResult
- class yandex_cloud_ml_sdk._models.text_classifiers.types.TextClassificationLabel
- Image generation
- Chat completions
Completions
class yandex_cloud_ml_sdk._models.completions.result.GPTModelResult
A class representing the result of a GPT model completion request.
alternatives: tuple
a tuple of alternatives generated by the model
usage: CompletionUsage
a usage statistics related to the completion request
model_version: str
the version of the GPT model used for generating the result
property role: str
property text: str
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.
property status: AlternativeStatus
property tool_calls: ToolCallList[ToolCallList, ToolCallTypeT] | None
class yandex_cloud_ml_sdk._models.completions.result.Alternative
A class representing one of the generated completion alternatives, including its content and generation status.
status: AlternativeStatus
the status of the alternative
tool_calls: ToolCallList[ToolCallList, ToolCallTypeT] | None
a list of tool calls associated with this alternative, or None if no tool calls are present
role: str
text: str
class yandex_cloud_ml_sdk._models.completions.result.AlternativeStatus
A class with an enumeration representing the status of an alternative. This enum defines various statuses that an alternative can have during processing.
UNSPECIFIED = 0
the status is not specified
PARTIAL = 1
the alternative is partially complete
TRUNCATED_FINAL = 2
the alternative is truncated but considered final
FINAL = 3
the alternative is complete and final
CONTENT_FILTER = 4
the alternative has been filtered for content
TOOL_CALLS = 5
the alternative involves tool calls
UNKNOWN = -1
represents an unknown status (-1)
USAGE = -2
special status for message with only usage data; used in some SDK places
__new__(value)
class yandex_cloud_ml_sdk._models.completions.result.Usage
A class representing usage statistics for a completion request.
completion_tokens: int
the number of tokens generated in the completion
input_text_tokens: int
the number of tokens in the input text
total_tokens: int
the total number of tokens used
class yandex_cloud_ml_sdk._models.completions.result.CompletionUsage
A class representing detailed usage statistics for a completion request, including reasoning tokens. Inherits from Usage and includes additional information about reasoning tokens.
reasoning_tokens: int
the number of tokens used for reasoning in the completion
completion_tokens: int
the number of tokens generated in the completion
input_text_tokens: int
the number of tokens in the input text
total_tokens: int
the total number of tokens used
Embeddings
class yandex_cloud_ml_sdk._models.text_embeddings.result.TextEmbeddingsModelResult
Represents the result of a text embeddings model.
It holds the embedding vector, the number of tokens, and the version of the model that is used to generate embeggings.
the embedding vector as a tuple of floats
num_tokens: int
the number of tokens processed by the model
model_version: str
the version of the model used for generating embeddings
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.
class yandex_cloud_ml_sdk._chat.text_embeddings.result.ChatEmbeddingsModelResult
Represents the result of a text embeddings model.
It holds the embedding vector, the number of tokens, and the version of the model that is used to generate embeggings.
the embedding vector as a tuple of floats
model: str
URI of the chat model used for generating the result
usage: EmbeddingsUsage | None
Usage statistics for the embedding request
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.
class yandex_cloud_ml_sdk._chat.text_embeddings.result.EmbeddingsUsage
A class representing usage statistics for chat embedding requests.
property prompt_tokens: int
Alias for input_text_tokens for compatibility with chat naming.
input_text_tokens: int
the number of tokens in the input text
total_tokens: int
the total number of tokens used
Text classifiers
class yandex_cloud_ml_sdk._models.text_classifiers.result.TextClassifiersModelResultBase
A class for text classifiers model results. It represents the common structure for the results returned by text classification models.
predictions: tuple
a tuple containing the predicted labels
model_version: str
the version of the model used for prediction
input_tokens: int
Number of input tokens provided to the model.
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.
class yandex_cloud_ml_sdk._models.text_classifiers.result.TextClassifiersModelResult
TextClassifiersModelResult(predictions: ‘tuple[TextClassificationLabel, …]’, model_version: ‘str’, input_tokens: ‘int’)
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.
predictions: tuple
a tuple containing the predicted labels
model_version: str
the version of the model used for prediction
input_tokens: int
Number of input tokens provided to the model.
class yandex_cloud_ml_sdk._models.text_classifiers.result.FewShotTextClassifiersModelResult
FewShotTextClassifiersModelResult(predictions: ‘tuple[TextClassificationLabel, …]’, model_version: ‘str’, input_tokens: ‘int’)
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.
predictions: tuple
a tuple containing the predicted labels
model_version: str
the version of the model used for prediction
input_tokens: int
Number of input tokens provided to the model.
yandex_cloud_ml_sdk._models.text_classifiers.result.TextClassificationResponseT = TypeVar(TextClassificationResponseT, TextClassificationResponse, FewShotTextClassificationResponse)
Type:TypeVar
Invariant TypeVar
class yandex_cloud_ml_sdk._models.text_classifiers.types.TextClassificationLabel
This class represents a label for text classification with an associated confidence score.
label: str
the label for the classification
confidence: float
the confidence score associated with the label
get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
values() → an object providing a view on D's values
typeddict yandex_cloud_ml_sdk._models.text_classifiers.types.TextClassificationSample
This class represents a sample of text for classification.
|
Required Keys |
Image generation
class yandex_cloud_ml_sdk._models.image_generation.result.ImageGenerationModelResult
This class represents the result of an image generation model inference.
image_bytes: bytes
the generated image in bytes
model_version: str
the version of the model used for generation
_repr_jpeg_()
|
Return type |
bytes |
Chat completions
class yandex_cloud_ml_sdk._chat.completions.result.ChatModelResult
Result of a chat model completion request.
Contains all completion choices, usage statistics, and metadata from the chat completion API response.
choices: tuple
Tuple of choices/alternatives generated by the model
Usage statistics for the completion request
created: datetime
Date and time when completion request was performed
model: str
URI of the chat model used for generating the result
id: str
ID of the completion request (for debugging purposes)
property alternatives: tuple
Synonym for choices attribute for compatibility with sdk.models.completions naming.
property role: str
Shortcut for result.choice[0].role
property content: str
Shortcut for result.choice[0].content
property text: str
Shortcut for result.choice[0].text
property reasoning_text: str
Shortcut for result.choice[0].reasoning_text
property reasoning_content: str
Shortcut for result.choice[0].reasoning_content
property status: AlternativeStatus
Shortcut for result.choice[0].status
count(value) → integer -- return number of occurrences of value
property finish_reason: FinishReason
Shortcut for result.choice[0].finish_reason
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.
property tool_calls: HttpToolCallList[ToolCallTypeT] | None
Shortcut for result.choice[0].tool_calls
class yandex_cloud_ml_sdk._chat.completions.result.ChatChoice
A class representing one completion choice/alternative from a chat model.
Contains the generated text, tool calls, reasoning text, and metadata about how the completion was finished.
finish_reason: FinishReason
Reason why completion request was finished
status: AlternativeStatus
Request status (semantic synonym for finish_reason), but with sdk.models.completions flavour
tool_calls: HttpToolCallList[ToolCallTypeT] | None
Tool call objects if model returned them
Reasoning text if model generated any
property content: str
Alias for text property for compatibility with chat naming.
property reasoning_content: str
Alias for reasoning_text property for compatibility with chat naming.
role: str
text: str
class yandex_cloud_ml_sdk._chat.completions.result.FinishReason
Enumeration of possible completion request finish reasons.
Defines all possible reasons why a chat completion request was terminated.
STOP = 'stop'
Completion request completed successfully
LENGTH = 'length'
Completion request was terminated due to max_tokens limit
CONTENT_FILTER = 'content_filter'
Completion request was terminated by content filter
TOOL_CALLS = 'tool_calls'
Completion request returned tool calls
NULL = 'null'
Streaming completion request in progress
USAGE = 'usage'
Special finish reason for streaming messages with only usage information
class yandex_cloud_ml_sdk._chat.completions.result.ChatUsage
A class representing usage statistics for chat completion requests.
Extends the base Usage class with chat-specific convenience properties.
property prompt_tokens: int
Alias for input_text_tokens for compatibility with chat naming.
completion_tokens: int
the number of tokens generated in the completion
input_text_tokens: int
the number of tokens in the input text
total_tokens: int
the total number of tokens used