Class: OpenAI::Models::Realtime::RealtimeResponseCreateParams

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

Defined Under Namespace

Modules: Conversation, MaxOutputTokens, OutputModality, Tool, ToolChoice

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_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(audio: nil, conversation: nil, input: nil, instructions: nil, max_output_tokens: nil, metadata: nil, output_modalities: nil, parallel_tool_calls: nil, prompt: nil, reasoning: nil, tool_choice: nil, tools: nil) ⇒ RealtimeResponseCreateParams

Returns a new instance of RealtimeResponseCreateParams.

Parameters:

  • audio (defaults to: nil) —

    Configuration for audio input and output.

  • conversation (defaults to: nil) —

    Controls which conversation the response is added to. Currently supports auto and none, with auto as the default value. The auto value means that the contents of the response will be added to the default conversation. Set this to none to create an out-of-band response which will not add items to default conversation.

  • input (defaults to: nil) —

    Input items to include in the prompt for the model. Using this field creates a new context for this Response instead of using the default conversation. An empty array [] will clear the context for this Response. Note that this can include references to items that previously appeared in the session using their id.

  • instructions (defaults to: nil) —

    The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. Note that the server sets default instructions which will be used if this field is not set and are visible in the session.created event at the start of the session.

  • max_output_tokens (defaults to: nil) —

    Maximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or inf for the maximum available tokens for a given model. Defaults to inf.

  • 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.

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

  • 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.

  • parallel_tool_calls (defaults to: nil) —

    Whether the model may call multiple tools in parallel. Only supported by reasoning Realtime models such as gpt-realtime-2.

  • prompt (defaults to: nil) —

    Reference to a prompt template and its variables. Learn more.

  • reasoning (defaults to: nil) —

    Configuration for reasoning-capable Realtime models such as gpt-realtime-2.

  • tool_choice (defaults to: nil) —

    How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.

  • tools (defaults to: nil) —

    Tools available to the model.

  • audio: (OpenAI::Realtime::RealtimeResponseCreateAudioOutput) (defaults to: nil)
  • conversation: (OpenAI::Models::Realtime::RealtimeResponseCreateParams::conversation) (defaults to: nil)
  • input: (::Array[OpenAI::Models::Realtime::conversation_item]) (defaults to: nil)
  • instructions: (String) (defaults to: nil)
  • max_output_tokens: (OpenAI::Models::Realtime::RealtimeResponseCreateParams::max_output_tokens) (defaults to: nil)
  • metadata: (OpenAI::Models::metadata, nil) (defaults to: nil)
  • output_modalities: (::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality]) (defaults to: nil)
  • parallel_tool_calls: (Boolean) (defaults to: nil)
  • prompt: (OpenAI::Responses::ResponsePrompt, nil) (defaults to: nil)
  • reasoning: (OpenAI::Realtime::RealtimeReasoning) (defaults to: nil)
  • tool_choice: (OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice) (defaults to: nil)
  • tools: (::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool]) (defaults to: nil)


# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 113

Instance Attribute Details

#audio ⇒ OpenAI::Realtime::RealtimeResponseCreateAudioOutput?

Configuration for audio input and output.

Returns:

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


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

optional :audio, -> { OpenAI::Realtime::RealtimeResponseCreateAudioOutput }

#conversation ⇒ OpenAI::Models::Realtime::RealtimeResponseCreateParams::conversation?

Controls which conversation the response is added to. Currently supports auto and none, with auto as the default value. The auto value means that the contents of the response will be added to the default conversation. Set this to none to create an out-of-band response which will not add items to default conversation.

Returns:

  • (OpenAI::Models::Realtime::RealtimeResponseCreateParams::conversation, nil)


21
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 21

optional :conversation, union: -> { OpenAI::Realtime::RealtimeResponseCreateParams::Conversation }

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

Input items to include in the prompt for the model. Using this field creates a new context for this Response instead of using the default conversation. An empty array [] will clear the context for this Response. Note that this can include references to items that previously appeared in the session using their id.

Returns:

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


31
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 31

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

#instructions ⇒ String?

The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. Note that the server sets default instructions which will be used if this field is not set and are visible in the session.created event at the start of the session.

Returns:

  • (String, nil)


45
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 45

optional :instructions, String

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

Maximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or inf for the maximum available tokens for a given model. Defaults to inf.

Returns:

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


53
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 53

optional :max_output_tokens, union: -> { OpenAI::Realtime::RealtimeResponseCreateParams::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.

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)


63
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 63

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

#output_modalities ⇒ ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::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::RealtimeResponseCreateParams::output_modality], nil)


72
73
74
75
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 72

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

#parallel_tool_calls ⇒ Boolean?

Whether the model may call multiple tools in parallel. Only supported by reasoning Realtime models such as gpt-realtime-2.

Returns:



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

optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean

#prompt ⇒ OpenAI::Responses::ResponsePrompt?

Reference to a prompt template and its variables. Learn more.

Returns:

  • (OpenAI::Responses::ResponsePrompt, nil)


89
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 89

optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true

#reasoning ⇒ OpenAI::Realtime::RealtimeReasoning?

Configuration for reasoning-capable Realtime models such as gpt-realtime-2.

Returns:

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


95
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 95

optional :reasoning, -> { OpenAI::Realtime::RealtimeReasoning }

#tool_choice ⇒ OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice?

How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.

Returns:

  • (OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice, nil)


102
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 102

optional :tool_choice, union: -> { OpenAI::Realtime::RealtimeResponseCreateParams::ToolChoice }

#tools ⇒ ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool]?

Tools available to the model.

Returns:

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


108
109
110
111
# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 108

optional(
  :tools,
  -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::RealtimeResponseCreateParams::Tool] }
)

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 233

.variants ⇒ Array(Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp)



# File 'lib/openai/models/realtime/realtime_response_create_params.rb', line 223

Instance Method Details

#to_hash ⇒ { ?audio: OpenAI::Realtime::RealtimeResponseCreateAudioOutput, ?conversation: OpenAI::Models::Realtime::RealtimeResponseCreateParams::conversation, ?input: ::Array[OpenAI::Models::Realtime::conversation_item], ?instructions: String, ?max_output_tokens: OpenAI::Models::Realtime::RealtimeResponseCreateParams::max_output_tokens, ?metadata: OpenAI::Models::metadata?, ?output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality], ?parallel_tool_calls: bool, ?prompt: OpenAI::Responses::ResponsePrompt?, ?reasoning: OpenAI::Realtime::RealtimeReasoning, ?tool_choice: OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice, ?tools: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool] }

Returns:

  • ({ ?audio: OpenAI::Realtime::RealtimeResponseCreateAudioOutput, ?conversation: OpenAI::Models::Realtime::RealtimeResponseCreateParams::conversation, ?input: ::Array[OpenAI::Models::Realtime::conversation_item], ?instructions: String, ?max_output_tokens: OpenAI::Models::Realtime::RealtimeResponseCreateParams::max_output_tokens, ?metadata: OpenAI::Models::metadata?, ?output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality], ?parallel_tool_calls: bool, ?prompt: OpenAI::Responses::ResponsePrompt?, ?reasoning: OpenAI::Realtime::RealtimeReasoning, ?tool_choice: OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice, ?tools: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool] })


221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'sig/openai/models/realtime/realtime_response_create_params.rbs', line 221

def to_hash: -> {
  ?audio: OpenAI::Realtime::RealtimeResponseCreateAudioOutput,
  ?conversation: OpenAI::Models::Realtime::RealtimeResponseCreateParams::conversation,
  ?input: ::Array[OpenAI::Models::Realtime::conversation_item],
  ?instructions: String,
  ?max_output_tokens: OpenAI::Models::Realtime::RealtimeResponseCreateParams::max_output_tokens,
  ?metadata: OpenAI::Models::metadata?,
  ?output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality],
  ?parallel_tool_calls: bool,
  ?prompt: OpenAI::Responses::ResponsePrompt?,
  ?reasoning: OpenAI::Realtime::RealtimeReasoning,
  ?tool_choice: OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice,
  ?tools: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool]
}