Class: OpenAI::Models::Beta::BetaResponseTextDoneEvent::Logprob

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

Defined Under Namespace

Classes: TopLogprob

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_with_error, dump, #dump, #inspect, inspect, meta_info, new_coerce_state, 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(content_index:, item_id:, logprobs:, output_index:, sequence_number:, text:, agent: nil, type: :"response.output_text.done") ⇒ Object

Parameters:

  • token

    A possible text token.

  • logprob

    The log probability of this token.

  • top_logprobs

    The log probabilities of up to 20 of the most likely tokens.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/openai/models/beta/beta_response_text_done_event.rb', line 84

class Logprob < OpenAI::Internal::Type::BaseModel
  # @!attribute token
  #   A possible text token.
  #
  #   @return [String]
  required :token, String

  # @!attribute logprob
  #   The log probability of this token.
  #
  #   @return [Float]
  required :logprob, Float

  # @!attribute top_logprobs
  #   The log probabilities of up to 20 of the most likely tokens.
  #
  #   @return [Array<OpenAI::Models::Beta::BetaResponseTextDoneEvent::Logprob::TopLogprob>, nil]
  optional(
    :top_logprobs,
    -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::BetaResponseTextDoneEvent::Logprob::TopLogprob] }
  )

  # @!method initialize(token:, logprob:, top_logprobs: nil)
  #   A logprob is the logarithmic probability that the model assigns to producing a
  #   particular token at a given position in the sequence. Less-negative (higher)
  #   logprob values indicate greater model confidence in that token choice.
  #
  #   @param token [String]
  #     A possible text token.
  #
  #   @param logprob [Float]
  #     The log probability of this token.
  #
  #   @param top_logprobs [Array<OpenAI::Models::Beta::BetaResponseTextDoneEvent::Logprob::TopLogprob>]
  #     The log probabilities of up to 20 of the most likely tokens.
  class TopLogprob < OpenAI::Internal::Type::BaseModel
    # @!attribute token
    #   A possible text token.
    #
    #   @return [String, nil]
    optional :token, String

    # @!attribute logprob
    #   The log probability of this token.
    #
    #   @return [Float, nil]
    optional :logprob, Float

    # @!method initialize(token: nil, logprob: nil)
    #   @param token [String]
    #     A possible text token.
    #
    #   @param logprob [Float]
    #     The log probability of this token.
  end
end

Instance Attribute Details

#logprobFloat

The log probability of this token.

Returns:

  • (Float)


95
# File 'lib/openai/models/beta/beta_response_text_done_event.rb', line 95

required :logprob, Float

#tokenString

A possible text token.

Returns:

  • (String)


89
# File 'lib/openai/models/beta/beta_response_text_done_event.rb', line 89

required :token, String

#top_logprobs::Array[OpenAI::Beta::BetaResponseTextDoneEvent::Logprob::TopLogprob]?

The log probabilities of up to 20 of the most likely tokens.

Returns:

  • (::Array[OpenAI::Beta::BetaResponseTextDoneEvent::Logprob::TopLogprob], nil)


101
102
103
104
# File 'lib/openai/models/beta/beta_response_text_done_event.rb', line 101

optional(
  :top_logprobs,
  -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::BetaResponseTextDoneEvent::Logprob::TopLogprob] }
)

Instance Method Details

#to_hash{

Returns:

  • ({)


115
# File 'sig/openai/models/beta/beta_response_text_done_event.rbs', line 115

def to_hash: -> {