Class: OpenAI::Models::Realtime::RealtimeSessionCreateResponse
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- OpenAI::Models::Realtime::RealtimeSessionCreateResponse
- Defined in:
- lib/openai/models/realtime/realtime_session_create_response.rb
Defined Under Namespace
Modules: Include, MaxOutputTokens, Model, OutputModality, Tool, ToolChoice, Tracing Classes: Audio
Instance Attribute Summary collapse
-
#audio ⇒ OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio?
Configuration for input and output audio.
-
#expires_at ⇒ Integer?
Expiration timestamp for the session, in seconds since epoch.
-
#id ⇒ String
Unique identifier for the session that looks like ‘sess_1234567890abcdef`.
-
#include ⇒ Array<Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Include>?
Additional fields to include in server outputs.
-
#instructions ⇒ String?
The default system instructions (i.e. system message) prepended to model calls.
-
#max_output_tokens ⇒ Integer, ...
Maximum number of output tokens for a single assistant response, inclusive of tool calls.
-
#model ⇒ String, ...
The Realtime model used for this session.
-
#object ⇒ Symbol, :"realtime.session"
The object type.
-
#output_modalities ⇒ Array<Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::OutputModality>?
The set of modalities the model can respond with.
-
#prompt ⇒ OpenAI::Models::Responses::ResponsePrompt?
Reference to a prompt template and its variables.
-
#reasoning ⇒ OpenAI::Models::Realtime::RealtimeReasoning?
Configuration for reasoning-capable Realtime models such as ‘gpt-realtime-2`.
-
#tool_choice ⇒ Symbol, ...
How the model chooses tools.
-
#tools ⇒ Array<OpenAI::Models::Realtime::RealtimeFunctionTool, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Tool::McpTool>?
Tools available to the model.
-
#tracing ⇒ Symbol, ...
Realtime API can write session traces to the [Traces Dashboard](platform.openai.com/logs?api=traces).
-
#truncation ⇒ Symbol, ...
When the number of tokens in a conversation exceeds the model’s input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model’s context.
-
#type ⇒ Symbol, :realtime
The type of session to create.
Class Method Summary collapse
- .values ⇒ Array<Symbol>
- .variants ⇒ Array(OpenAI::Models::Realtime::RealtimeFunctionTool, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Tool::McpTool)
Instance Method Summary collapse
-
#initialize(id:, audio: nil, expires_at: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, reasoning: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, object: :"realtime.session", type: :realtime) ⇒ Object
constructor
Some parameter documentations has been truncated, see RealtimeSessionCreateResponse for more details.
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(id:, audio: nil, expires_at: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, reasoning: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, object: :"realtime.session", type: :realtime) ⇒ Object
Some parameter documentations has been truncated, see OpenAI::Models::Realtime::RealtimeSessionCreateResponse for more details.
A Realtime session configuration object.
|
|
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 150
|
Instance Attribute Details
#audio ⇒ OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio?
Configuration for input and output audio.
29 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 29 optional :audio, -> { OpenAI::Realtime::RealtimeSessionCreateResponse::Audio } |
#expires_at ⇒ Integer?
Expiration timestamp for the session, in seconds since epoch.
35 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 35 optional :expires_at, Integer |
#id ⇒ String
Unique identifier for the session that looks like ‘sess_1234567890abcdef`.
11 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 11 required :id, String |
#include ⇒ Array<Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Include>?
Additional fields to include in server outputs.
‘item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
44 45 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 44 optional :include, -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeSessionCreateResponse::Include] } |
#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.
61 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 61 optional :instructions, String |
#max_output_tokens ⇒ Integer, ...
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`.
69 70 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 69 optional :max_output_tokens, union: -> { OpenAI::Realtime::RealtimeSessionCreateResponse::MaxOutputTokens } |
#model ⇒ String, ...
The Realtime model used for this session.
76 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 76 optional :model, union: -> { OpenAI::Realtime::RealtimeSessionCreateResponse::Model } |
#object ⇒ Symbol, :"realtime.session"
The object type. Always ‘realtime.session`.
17 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 17 required :object, const: :"realtime.session" |
#output_modalities ⇒ Array<Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::OutputModality>?
The set of modalities the model can respond with. It defaults to ‘[“audio”]`, indicating that the model will respond with audio plus a transcript. `[“text”]` can be used to make the model respond with text only. It is not possible to request both `text` and `audio` at the same time.
85 86 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 85 optional :output_modalities, -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeSessionCreateResponse::OutputModality] } |
#prompt ⇒ OpenAI::Models::Responses::ResponsePrompt?
Reference to a prompt template and its variables. [Learn more](platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
93 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 93 optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true |
#reasoning ⇒ OpenAI::Models::Realtime::RealtimeReasoning?
Configuration for reasoning-capable Realtime models such as ‘gpt-realtime-2`.
99 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 99 optional :reasoning, -> { OpenAI::Realtime::RealtimeReasoning } |
#tool_choice ⇒ Symbol, ...
How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
106 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 106 optional :tool_choice, union: -> { OpenAI::Realtime::RealtimeSessionCreateResponse::ToolChoice } |
#tools ⇒ Array<OpenAI::Models::Realtime::RealtimeFunctionTool, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Tool::McpTool>?
Tools available to the model.
112 113 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 112 optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::RealtimeSessionCreateResponse::Tool] } |
#tracing ⇒ Symbol, ...
Realtime API can write session traces to the [Traces Dashboard](platform.openai.com/logs?api=traces). Set to null to disable tracing. Once tracing is enabled for a session, the configuration cannot be modified.
‘auto` will create a trace for the session with default values for the workflow name, group id, and metadata.
125 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 125 optional :tracing, union: -> { OpenAI::Realtime::RealtimeSessionCreateResponse::Tracing }, nil?: true |
#truncation ⇒ Symbol, ...
When the number of tokens in a conversation exceeds the model’s input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model’s context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs.
Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.
Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate.
Truncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model’s input token limit.
148 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 148 optional :truncation, union: -> { OpenAI::Realtime::RealtimeTruncation } |
#type ⇒ Symbol, :realtime
The type of session to create. Always ‘realtime` for the Realtime API.
23 |
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 23 required :type, const: :realtime |
Class Method Details
.values ⇒ Array<Symbol>
|
|
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 589
|
.variants ⇒ Array(OpenAI::Models::Realtime::RealtimeFunctionTool, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Tool::McpTool)
|
|
# File 'lib/openai/models/realtime/realtime_session_create_response.rb', line 605
|