Class: OpenAI::Models::Responses::ResponseTextDoneEvent::Logprob

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/responses/response_text_done_event.rb,
sig/openai/models/responses/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:, 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.



75
76
77
78
79
80
81
82
83
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
# File 'lib/openai/models/responses/response_text_done_event.rb', line 75

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::Responses::ResponseTextDoneEvent::Logprob::TopLogprob>, nil]
  optional(
    :top_logprobs,
    -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Responses::ResponseTextDoneEvent::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::Responses::ResponseTextDoneEvent::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)


86
# File 'lib/openai/models/responses/response_text_done_event.rb', line 86

required :logprob, Float

#tokenString

A possible text token.

Returns:

  • (String)


80
# File 'lib/openai/models/responses/response_text_done_event.rb', line 80

required :token, String

#top_logprobs::Array[OpenAI::Responses::ResponseTextDoneEvent::Logprob::TopLogprob]?

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

Returns:

  • (::Array[OpenAI::Responses::ResponseTextDoneEvent::Logprob::TopLogprob], nil)


92
93
94
95
# File 'lib/openai/models/responses/response_text_done_event.rb', line 92

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

Instance Method Details

#to_hash{

Returns:

  • ({)


105
# File 'sig/openai/models/responses/response_text_done_event.rbs', line 105

def to_hash: -> {