Logprobs

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

Bases: object

Includes the logarithmic probabilities for the most likely output tokens and the chosen tokens.

For example, if the log probability is 5, the API returns a list of the 5 most likely tokens. The API returns the log probability of the sampled token, so there might be up to logprobs+1 elements in the response.

Methods

__init__(**kwargs) Initializes a new Logprobs object with values from keyword arguments.

Attributes

text_offset Gets the text_offset of this Logprobs.
token_logprobs Gets the token_logprobs of this Logprobs.
tokens Gets the tokens of this Logprobs.
top_logprobs Gets the top_logprobs of this Logprobs.
__init__(**kwargs)

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

Parameters:
  • text_offset (list[int]) – The value to assign to the text_offset property of this Logprobs.
  • token_logprobs (list[float]) – The value to assign to the token_logprobs property of this Logprobs.
  • tokens (list[str]) – The value to assign to the tokens property of this Logprobs.
  • top_logprobs (list[dict(str, str)]) – The value to assign to the top_logprobs property of this Logprobs.
text_offset

Gets the text_offset of this Logprobs. The text offset.

Returns:The text_offset of this Logprobs.
Return type:list[int]
token_logprobs

Gets the token_logprobs of this Logprobs. The logarithmic probabilites of the output token.

Returns:The token_logprobs of this Logprobs.
Return type:list[float]
tokens

Gets the tokens of this Logprobs. The list of output tokens.

Returns:The tokens of this Logprobs.
Return type:list[str]
top_logprobs

Gets the top_logprobs of this Logprobs. The logarithmic probabilities of each of the top k tokens.

Returns:The top_logprobs of this Logprobs.
Return type:list[dict(str, str)]