Class: OpenAI::Models::Realtime::ResponseCreateEvent::Response

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/realtime/response_create_event.rb

Overview

See Also:

Defined Under Namespace

Modules: Conversation, MaxOutputTokens, Modality, OutputAudioFormat, ToolChoice, Voice Classes: Tool

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, 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, #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(conversation: nil, input: nil, instructions: nil, max_output_tokens: nil, metadata: nil, modalities: nil, output_audio_format: nil, prompt: nil, temperature: nil, tool_choice: nil, tools: nil, voice: nil) ⇒ Object

Some parameter documentations has been truncated, see OpenAI::Models::Realtime::ResponseCreateEvent::Response for more details.

Create a new Realtime response with these parameters

Parameters:



# File 'lib/openai/models/realtime/response_create_event.rb', line 155

Instance Attribute Details

#conversationString, ...

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.



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

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

#inputArray<OpenAI::Models::Realtime::RealtimeConversationItemSystemMessage, OpenAI::Models::Realtime::RealtimeConversationItemUserMessage, OpenAI::Models::Realtime::RealtimeConversationItemAssistantMessage, OpenAI::Models::Realtime::RealtimeConversationItemFunctionCall, OpenAI::Models::Realtime::RealtimeConversationItemFunctionCallOutput, OpenAI::Models::Realtime::RealtimeMcpApprovalResponse, OpenAI::Models::Realtime::RealtimeMcpListTools, OpenAI::Models::Realtime::RealtimeMcpToolCall, OpenAI::Models::Realtime::RealtimeMcpApprovalRequest>?

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 from the default conversation.



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

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

#instructionsString?

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)


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

optional :instructions, String

#max_output_tokensInteger, ...

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:

  • (Integer, Symbol, :inf, nil)


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

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

#metadataHash{Symbol=>String}?

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:

  • (Hash{Symbol=>String}, nil)


103
# File 'lib/openai/models/realtime/response_create_event.rb', line 103

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

#modalitiesArray<Symbol, OpenAI::Models::Realtime::ResponseCreateEvent::Response::Modality>?

The set of modalities the model can respond with. To disable audio, set this to [“text”].



110
111
# File 'lib/openai/models/realtime/response_create_event.rb', line 110

optional :modalities,
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::ResponseCreateEvent::Response::Modality] }

#output_audio_formatSymbol, ...

The format of output audio. Options are ‘pcm16`, `g711_ulaw`, or `g711_alaw`.



117
118
# File 'lib/openai/models/realtime/response_create_event.rb', line 117

optional :output_audio_format,
enum: -> { OpenAI::Realtime::ResponseCreateEvent::Response::OutputAudioFormat }

#promptOpenAI::Models::Responses::ResponsePrompt?

Reference to a prompt template and its variables. [Learn more](platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).



125
# File 'lib/openai/models/realtime/response_create_event.rb', line 125

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

#temperatureFloat?

Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.

Returns:

  • (Float, nil)


131
# File 'lib/openai/models/realtime/response_create_event.rb', line 131

optional :temperature, Float

#tool_choiceSymbol, ...

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



138
# File 'lib/openai/models/realtime/response_create_event.rb', line 138

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

#toolsArray<OpenAI::Models::Realtime::ResponseCreateEvent::Response::Tool>?

Tools (functions) available to the model.



144
145
# File 'lib/openai/models/realtime/response_create_event.rb', line 144

optional :tools,
-> { OpenAI::Internal::Type::ArrayOf[OpenAI::Realtime::ResponseCreateEvent::Response::Tool] }

#voiceString, ...

The voice the model uses to respond. Voice cannot be changed during the session once the model has responded with audio at least once. Current voice options are ‘alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`.



153
# File 'lib/openai/models/realtime/response_create_event.rb', line 153

optional :voice, union: -> { OpenAI::Realtime::ResponseCreateEvent::Response::Voice }

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/realtime/response_create_event.rb', line 238