GeneratedText

class oci.generative_ai_inference.models.GeneratedText(**kwargs)

Bases: object

The text generated during each run.

Methods:

__init__(**kwargs)

Initializes a new GeneratedText object with values from keyword arguments.

Attributes:

finish_reason

Gets the finish_reason of this GeneratedText.

id

[Required] Gets the id of this GeneratedText.

likelihood

[Required] Gets the likelihood of this GeneratedText.

text

[Required] Gets the text of this GeneratedText.

token_likelihoods

Gets the token_likelihoods of this GeneratedText.

__init__(**kwargs)

Initializes a new GeneratedText object with values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters
  • id (str) – The value to assign to the id property of this GeneratedText.

  • text (str) – The value to assign to the text property of this GeneratedText.

  • likelihood (float) – The value to assign to the likelihood property of this GeneratedText.

  • finish_reason (str) – The value to assign to the finish_reason property of this GeneratedText.

  • token_likelihoods (list[oci.generative_ai_inference.models.TokenLikelihood]) – The value to assign to the token_likelihoods property of this GeneratedText.

property finish_reason

Gets the finish_reason of this GeneratedText. The reason why the model stopped generating tokens.

A model stops generating tokens if the model hits a natural stop point or reaches a provided stop sequence.

Returns

The finish_reason of this GeneratedText.

Return type

str

property id

[Required] Gets the id of this GeneratedText. A unique identifier for this text generation.

Returns

The id of this GeneratedText.

Return type

str

property likelihood

[Required] Gets the likelihood of this GeneratedText. The overall likelihood of the generated text.

When a large language model generates a new token for the output text, a likelihood is assigned to all tokens, where tokens with higher likelihoods are more likely to follow the current token. For example, it’s more likely that the word favorite is followed by the word food or book rather than the word zebra. A lower likelihood means that it’s less likely that token follows the current token.

Returns

The likelihood of this GeneratedText.

Return type

float

property text

[Required] Gets the text of this GeneratedText. The generated text.

Returns

The text of this GeneratedText.

Return type

str

property token_likelihoods

Gets the token_likelihoods of this GeneratedText. A collection of generated tokens and their corresponding likelihoods.

Returns

The token_likelihoods of this GeneratedText.

Return type

list[oci.generative_ai_inference.models.TokenLikelihood]