Class: OpenAI::Models::Chat::ChatCompletionTokenLogprob::TopLogprob

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/chat/chat_completion_token_logprob.rb,
sig/openai/models/chat/chat_completion_token_logprob.rbs

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, fields, hash, #hash, inherited, #inspect, inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(token:, bytes:, logprob:, top_logprobs:) ⇒ TopLogprob

Returns a new instance of TopLogprob.

Parameters:

  • token —

    The token.

  • bytes —

    A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token.

  • logprob —

    The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.

  • token: (String)
  • bytes: (::Array[Integer], nil)
  • logprob: (Float)


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/openai/models/chat/chat_completion_token_logprob.rb', line 58

class TopLogprob < OpenAI::Internal::Type::BaseModel
  # @!attribute token
  #   The token.
  #
  #   @return [String]
  required :token, String

  # @!attribute bytes
  #   A list of integers representing the UTF-8 bytes representation of the token.
  #   Useful in instances where characters are represented by multiple tokens and
  #   their byte representations must be combined to generate the correct text
  #   representation. Can be `null` if there is no bytes representation for the token.
  #
  #   @return [Array<Integer>, nil]
  required :bytes, OpenAI::Internal::Type::ArrayOf[Integer], nil?: true

  # @!attribute logprob
  #   The log probability of this token, if it is within the top 20 most likely
  #   tokens. Otherwise, the value `-9999.0` is used to signify that the token is very
  #   unlikely.
  #
  #   @return [Float]
  required :logprob, Float

  # @!method initialize(token:, bytes:, logprob:)
  #   @param token [String]
  #     The token.
  #
  #   @param bytes [Array<Integer>, nil]
  #     A list of integers representing the UTF-8 bytes representation of the token.
  #     Useful in instances where characters are represented by multiple tokens and
  #     their byte representations must be combined to generate the correct text
  #     representation. Can be `null` if there is no bytes representation for the token.
  #
  #   @param logprob [Float]
  #     The log probability of this token, if it is within the top 20 most likely
  #     tokens. Otherwise, the value `-9999.0` is used to signify that the token is very
  #     unlikely.
end

Instance Attribute Details

#bytes ⇒ ::Array[Integer]?

A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token.

Returns:

  • (::Array[Integer], nil)


72
# File 'lib/openai/models/chat/chat_completion_token_logprob.rb', line 72

required :bytes, OpenAI::Internal::Type::ArrayOf[Integer], nil?: true

#logprob ⇒ Float

The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.

Returns:

  • (Float)


80
# File 'lib/openai/models/chat/chat_completion_token_logprob.rb', line 80

required :logprob, Float

#token ⇒ String

The token.

Returns:

  • (String)


63
# File 'lib/openai/models/chat/chat_completion_token_logprob.rb', line 63

required :token, String

Instance Method Details

#to_hash ⇒ { token: String, bytes: ::Array[Integer]?, logprob: Float }

Returns:

  • ({ token: String, bytes: ::Array[Integer]?, logprob: Float })


96
97
98
99
100
# File 'sig/openai/models/chat/chat_completion_token_logprob.rbs', line 96

def to_hash: -> {
  token: String,
  bytes: ::Array[Integer]?,
  logprob: Float
}