Class: OpenAI::Models::Realtime::RealtimeResponse

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

Defined Under Namespace

Modules: MaxOutputTokens, Object, OutputModality, Status Classes: Audio

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

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(id: nil, audio: nil, conversation_id: nil, max_output_tokens: nil, metadata: nil, object: nil, output: nil, output_modalities: nil, status: nil, status_details: nil, usage: nil) ⇒ Object

Parameters:

  • id (defaults to: nil) —

    The unique ID of the response, will look like resp_1234.

  • audio (defaults to: nil) —

    Configuration for audio output.

  • conversation_id (defaults to: nil) —

    Which conversation the response is added to, determined by the conversation field in the response.create event. If auto, the response will be added to the default conversation and the value of conversation_id will be an id like conv_1234. If none, the response will not be added to any conversation and the value of conversation_id will be null. If responses are being triggered automatically by VAD the response will be added to the default conversation

  • max_output_tokens (defaults to: nil) —

    Maximum number of output tokens for a single assistant response, inclusive of tool calls, that was used in this response.

  • metadata (defaults to: nil) —

    Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

    Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

  • object (defaults to: nil) —

    The object type, must be realtime.response.

  • output (defaults to: nil) —

    The list of output items generated by the response.

  • output_modalities (defaults to: nil) —

    The set of modalities the model used to respond, currently the only possible values are [\"audio\"], [\"text\"]. Audio output always include a text transcript. Setting the output to mode text will disable audio output from the model.

  • status (defaults to: nil) —

    The final status of the response (completed, cancelled, failed, or incomplete, in_progress).

  • status_details (defaults to: nil) —

    Additional details about the status.

  • usage (defaults to: nil) —

    Usage statistics for the Response, this will correspond to billing. A Realtime API session will maintain a conversation context and append new Items to the Conversation, thus output from previous turns (text and audio tokens) will become the input for later turns.



# File 'lib/openai/models/realtime/realtime_response.rb', line 94

Instance Attribute Details

#audio ⇒ OpenAI::Realtime::RealtimeResponse::Audio?

Configuration for audio output.

Returns:

  • (OpenAI::Realtime::RealtimeResponse::Audio, nil)


17
# File 'lib/openai/models/realtime/realtime_response.rb', line 17

optional :audio, -> { OpenAI::Realtime::RealtimeResponse::Audio }

#conversation_id ⇒ String?

Which conversation the response is added to, determined by the conversation field in the response.create event. If auto, the response will be added to the default conversation and the value of conversation_id will be an id like conv_1234. If none, the response will not be added to any conversation and the value of conversation_id will be null. If responses are being triggered automatically by VAD the response will be added to the default conversation

Returns:

  • (String, nil)


28
# File 'lib/openai/models/realtime/realtime_response.rb', line 28

optional :conversation_id, String

#id ⇒ String?

The unique ID of the response, will look like resp_1234.

Returns:

  • (String, nil)


11
# File 'lib/openai/models/realtime/realtime_response.rb', line 11

optional :id, String

#max_output_tokens ⇒ OpenAI::Models::Realtime::RealtimeResponse::max_output_tokens?

Maximum number of output tokens for a single assistant response, inclusive of tool calls, that was used in this response.

Returns:

  • (OpenAI::Models::Realtime::RealtimeResponse::max_output_tokens, nil)


35
# File 'lib/openai/models/realtime/realtime_response.rb', line 35

optional :max_output_tokens, union: -> { OpenAI::Realtime::RealtimeResponse::MaxOutputTokens }

#metadata ⇒ OpenAI::Models::metadata?

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Returns:

  • (OpenAI::Models::metadata, nil)


46
# File 'lib/openai/models/realtime/realtime_response.rb', line 46

optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true

#object ⇒ OpenAI::Models::Realtime::RealtimeResponse::object?

The object type, must be realtime.response.

Returns:

  • (OpenAI::Models::Realtime::RealtimeResponse::object, nil)


52
# File 'lib/openai/models/realtime/realtime_response.rb', line 52

optional :object, enum: -> { OpenAI::Realtime::RealtimeResponse::Object }

#output ⇒ ::Array[OpenAI::Models::Realtime::conversation_item]?

The list of output items generated by the response.

Returns:

  • (::Array[OpenAI::Models::Realtime::conversation_item], nil)


58
# File 'lib/openai/models/realtime/realtime_response.rb', line 58

optional :output, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::ConversationItem] }

#output_modalities ⇒ ::Array[OpenAI::Models::Realtime::RealtimeResponse::output_modality]?

The set of modalities the model used to respond, currently the only possible values are [\"audio\"], [\"text\"]. Audio output always include a text transcript. Setting the output to mode text will disable audio output from the model.

Returns:

  • (::Array[OpenAI::Models::Realtime::RealtimeResponse::output_modality], nil)


67
68
69
70
# File 'lib/openai/models/realtime/realtime_response.rb', line 67

optional(
  :output_modalities,
  -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeResponse::OutputModality] }
)

#status ⇒ OpenAI::Models::Realtime::RealtimeResponse::status?

The final status of the response (completed, cancelled, failed, or incomplete, in_progress).

Returns:

  • (OpenAI::Models::Realtime::RealtimeResponse::status, nil)


77
# File 'lib/openai/models/realtime/realtime_response.rb', line 77

optional :status, enum: -> { OpenAI::Realtime::RealtimeResponse::Status }

#status_details ⇒ OpenAI::Realtime::RealtimeResponseStatus?

Additional details about the status.

Returns:

  • (OpenAI::Realtime::RealtimeResponseStatus, nil)


83
# File 'lib/openai/models/realtime/realtime_response.rb', line 83

optional :status_details, -> { OpenAI::Realtime::RealtimeResponseStatus }

#usage ⇒ OpenAI::Realtime::RealtimeResponseUsage?

Usage statistics for the Response, this will correspond to billing. A Realtime API session will maintain a conversation context and append new Items to the Conversation, thus output from previous turns (text and audio tokens) will become the input for later turns.

Returns:

  • (OpenAI::Realtime::RealtimeResponseUsage, nil)


92
# File 'lib/openai/models/realtime/realtime_response.rb', line 92

optional :usage, -> { OpenAI::Realtime::RealtimeResponseUsage }

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/realtime/realtime_response.rb', line 266

.variants ⇒ Array(Integer, Symbol, :inf)

Returns:

  • (Array(Integer, Symbol, :inf))


# File 'lib/openai/models/realtime/realtime_response.rb', line 254

Instance Method Details

#to_hash ⇒ {

Returns:

  • ({)


184
# File 'sig/openai/models/realtime/realtime_response.rbs', line 184

def to_hash: -> {