Class: OpenAI::Models::Realtime::RealtimeSessionCreateRequest

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

Defined Under Namespace

Modules: Include, MaxOutputTokens, Model, OutputModality

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(model: , audio: nil, client_secret: nil, include: nil, instructions: nil, max_output_tokens: nil, output_modalities: nil, prompt: nil, temperature: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: :realtime) ⇒ Object

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

Realtime session object configuration.

Parameters:



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

Instance Attribute Details

#audioOpenAI::Models::Realtime::RealtimeAudioConfig?

Configuration for input and output audio.



23
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 23

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

#client_secretOpenAI::Models::Realtime::RealtimeClientSecretConfig?

Configuration options for the generated client secret.



29
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 29

optional :client_secret, -> { OpenAI::Realtime::RealtimeClientSecretConfig }

#includeArray<Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateRequest::Include>?

Additional fields to include in server outputs.

  • ‘item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.



38
39
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 38

optional :include,
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeSessionCreateRequest::Include] }

#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)


55
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 55

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)


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

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

#modelString, ...

The Realtime model used for this session.



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

required :model, union: -> { OpenAI::Realtime::RealtimeSessionCreateRequest::Model }

#output_modalitiesArray<Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateRequest::OutputModality>?

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



70
71
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 70

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

#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).



78
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 78

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

#temperatureFloat?

Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance.

Returns:

  • (Float, nil)


85
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 85

optional :temperature, Float

#tool_choiceSymbol, ...

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



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

optional :tool_choice, union: -> { OpenAI::Realtime::RealtimeToolChoiceConfig }

#toolsArray<OpenAI::Models::Realtime::RealtimeToolsConfigUnion::Function, OpenAI::Models::Realtime::RealtimeToolsConfigUnion::Mcp>?

Tools available to the model.



98
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 98

optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::RealtimeToolsConfigUnion] }

#tracingSymbol, ...

Configuration options for tracing. 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.



108
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 108

optional :tracing, union: -> { OpenAI::Realtime::RealtimeTracingConfig }, nil?: true

#truncationSymbol, ...

Controls how the realtime conversation is truncated prior to model inference. The default is ‘auto`. When set to `retention_ratio`, the server retains a fraction of the conversation tokens prior to the instructions.



116
# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 116

optional :truncation, union: -> { OpenAI::Realtime::RealtimeTruncation }

#typeSymbol, :realtime

The type of session to create. Always ‘realtime` for the Realtime API.

Returns:

  • (Symbol, :realtime)


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

required :type, const: :realtime

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 202

.variantsArray(Integer, Symbol, :inf)

Returns:

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


# File 'lib/openai/models/realtime/realtime_session_create_request.rb', line 218