Class: OpenAI::Models::Realtime::RealtimeSession

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

Defined Under Namespace

Modules: Include, InputAudioFormat, MaxResponseOutputTokens, Modality, Model, Object, OutputAudioFormat, Tracing, TurnDetection, Voice Classes: InputAudioNoiseReduction

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(group_id: nil, metadata: nil, workflow_name: nil) ⇒ Object

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

Granular configuration for tracing.



# File 'lib/openai/models/realtime/realtime_session.rb', line 265


Instance Attribute Details

#expires_atInteger?

Expiration timestamp for the session, in seconds since epoch.



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

optional :expires_at, Integer

#idString?

Unique identifier for the session that looks like ‘sess_1234567890abcdef`.



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

optional :id, String

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

Additional fields to include in server outputs.

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



26
27
28
# File 'lib/openai/models/realtime/realtime_session.rb', line 26

optional :include,
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeSession::Include] },
nil?: true

#input_audio_formatSymbol, ...

The format of input audio. Options are ‘pcm16`, `g711_ulaw`, or `g711_alaw`. For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel (mono), and little-endian byte order.



36
# File 'lib/openai/models/realtime/realtime_session.rb', line 36

optional :input_audio_format, enum: -> { OpenAI::Realtime::RealtimeSession::InputAudioFormat }

#input_audio_noise_reductionOpenAI::Models::Realtime::RealtimeSession::InputAudioNoiseReduction?

Configuration for input audio noise reduction. This can be set to ‘null` to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.



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

optional :input_audio_noise_reduction, -> { OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction }

#input_audio_transcriptionOpenAI::Models::Realtime::AudioTranscription?

Configuration for input audio transcription, defaults to off and can be set to ‘null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](platform.openai.com/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.



59
# File 'lib/openai/models/realtime/realtime_session.rb', line 59

optional :input_audio_transcription, -> { OpenAI::Realtime::AudioTranscription }, nil?: true

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



75
# File 'lib/openai/models/realtime/realtime_session.rb', line 75

optional :instructions, String

#max_response_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`.



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

optional :max_response_output_tokens,
union: -> { OpenAI::Realtime::RealtimeSession::MaxResponseOutputTokens }

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

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



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

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

#modelString, ...

The Realtime model used for this session.



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

optional :model, union: -> { OpenAI::Realtime::RealtimeSession::Model }

#objectSymbol, ...

The object type. Always ‘realtime.session`.



104
# File 'lib/openai/models/realtime/realtime_session.rb', line 104

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

#output_audio_formatSymbol, ...

The format of output audio. Options are ‘pcm16`, `g711_ulaw`, or `g711_alaw`. For `pcm16`, output audio is sampled at a rate of 24kHz.



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

optional :output_audio_format, enum: -> { OpenAI::Realtime::RealtimeSession::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).



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

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

#speedFloat?

The speed of the model’s spoken response. 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.



126
# File 'lib/openai/models/realtime/realtime_session.rb', line 126

optional :speed, Float

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



133
# File 'lib/openai/models/realtime/realtime_session.rb', line 133

optional :temperature, Float

#tool_choiceString?

How the model chooses tools. Options are ‘auto`, `none`, `required`, or specify a function.



140
# File 'lib/openai/models/realtime/realtime_session.rb', line 140

optional :tool_choice, String

#toolsArray<OpenAI::Models::Realtime::RealtimeFunctionTool>?

Tools (functions) available to the model.



146
# File 'lib/openai/models/realtime/realtime_session.rb', line 146

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

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



156
# File 'lib/openai/models/realtime/realtime_session.rb', line 156

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

#turn_detectionOpenAI::Models::Realtime::RealtimeSession::TurnDetection::ServerVad, ...

Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to ‘null` to turn off, in which case the client must manually trigger model response.

Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.

Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with “uhhm”, the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.



174
# File 'lib/openai/models/realtime/realtime_session.rb', line 174

optional :turn_detection, union: -> { OpenAI::Realtime::RealtimeSession::TurnDetection }, nil?: true

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



182
# File 'lib/openai/models/realtime/realtime_session.rb', line 182

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

Class Method Details

.valuesArray<Symbol>



# File 'lib/openai/models/realtime/realtime_session.rb', line 235


.variantsArray(OpenAI::Models::Realtime::RealtimeSession::TurnDetection::ServerVad, OpenAI::Models::Realtime::RealtimeSession::TurnDetection::SemanticVad)



# File 'lib/openai/models/realtime/realtime_session.rb', line 291