Class: OpenAI::Models::CompletionUsage::CompletionTokensDetails

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

Overview

See Also:

  • OpenAI::Models::CompletionUsage#completion_tokens_details

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 ⇒ CompletionTokensDetails

Returns a new instance of CompletionTokensDetails.

Parameters:

  • accepted_prediction_tokens —

    When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.

  • audio_tokens —

    Audio input tokens generated by the model.

  • reasoning_tokens —

    Tokens generated by the model for reasoning.

  • rejected_prediction_tokens —

    When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.

  • text_tokens —

    Text output tokens generated by the model.

  • accepted_prediction_tokens: (Integer)
  • audio_tokens: (Integer)
  • reasoning_tokens: (Integer)
  • rejected_prediction_tokens: (Integer)
  • text_tokens: (Integer)


126
127
128
129
130
131
132
# File 'sig/openai/models/completion_usage.rbs', line 126

def initialize: (
  ?accepted_prediction_tokens: Integer,
  ?audio_tokens: Integer,
  ?reasoning_tokens: Integer,
  ?rejected_prediction_tokens: Integer,
  ?text_tokens: Integer
) -> void

Instance Attribute Details

#accepted_prediction_tokens ⇒ Integer?

When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.

Returns:

  • (Integer, nil)


61
# File 'lib/openai/models/completion_usage.rb', line 61

optional :accepted_prediction_tokens, Integer

#audio_tokens ⇒ Integer?

Audio input tokens generated by the model.

Returns:

  • (Integer, nil)


67
# File 'lib/openai/models/completion_usage.rb', line 67

optional :audio_tokens, Integer

#reasoning_tokens ⇒ Integer?

Tokens generated by the model for reasoning.

Returns:

  • (Integer, nil)


73
# File 'lib/openai/models/completion_usage.rb', line 73

optional :reasoning_tokens, Integer

#rejected_prediction_tokens ⇒ Integer?

When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.

Returns:

  • (Integer, nil)


82
# File 'lib/openai/models/completion_usage.rb', line 82

optional :rejected_prediction_tokens, Integer

#text_tokens ⇒ Integer?

Text output tokens generated by the model.

Returns:

  • (Integer, nil)


88
# File 'lib/openai/models/completion_usage.rb', line 88

optional :text_tokens, Integer

Instance Method Details

#to_hash ⇒ { ?accepted_prediction_tokens: Integer, ?audio_tokens: Integer, ?reasoning_tokens: Integer, ?rejected_prediction_tokens: Integer, ?text_tokens: Integer }

Returns:

  • ({ ?accepted_prediction_tokens: Integer, ?audio_tokens: Integer, ?reasoning_tokens: Integer, ?rejected_prediction_tokens: Integer, ?text_tokens: Integer })


134
135
136
137
138
139
140
# File 'sig/openai/models/completion_usage.rbs', line 134

def to_hash: -> {
  ?accepted_prediction_tokens: Integer,
  ?audio_tokens: Integer,
  ?reasoning_tokens: Integer,
  ?rejected_prediction_tokens: Integer,
  ?text_tokens: Integer
}