Class RealtimeSession
- 
                    
                    - All Implemented Interfaces:
 
 public final class RealtimeSessionRealtime session object for the beta interface. 
- 
                
                    
                    - 
                                
                            
                                Nested Class SummaryNested Classes Modifier and Type Class Description public final classRealtimeSession.BuilderA builder for RealtimeSession. public final classRealtimeSession.Includepublic final classRealtimeSession.InputAudioFormatThe format of input audio. Options are pcm16,g711_ulaw, org711_alaw. Forpcm16, input audio must be 16-bit PCM at a 24kHz sample rate, single channel (mono), and little-endian byte order.public final classRealtimeSession.InputAudioNoiseReductionConfiguration for input audio noise reduction. This can be set to nullto 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.public final classRealtimeSession.MaxResponseOutputTokensMaximum 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 inffor the maximum available tokens for a given model. Defaults toinf.public final classRealtimeSession.Modalitypublic final classRealtimeSession.ModelThe Realtime model used for this session. public final classRealtimeSession.ObjectThe object type. Always realtime.session.public final classRealtimeSession.OutputAudioFormatThe format of output audio. Options are pcm16,g711_ulaw, org711_alaw. Forpcm16, output audio is sampled at a rate of 24kHz.public final classRealtimeSession.TracingConfiguration options for tracing. Set to null to disable tracing. Once tracing is enabled for a session, the configuration cannot be modified. autowill create a trace for the session with default values for the workflow name, group id, and metadata.public final classRealtimeSession.TurnDetectionConfiguration for turn detection, ether Server VAD or Semantic VAD. This can be set to nullto 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. public final classRealtimeSession.VoiceThe 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, andverse.
 - 
                                
                            
                                Method SummaryModifier and Type Method Description final Optional<String>id()Unique identifier for the session that looks like sess_1234567890abcdef.final Optional<Long>expiresAt()Expiration timestamp for the session, in seconds since epoch. final Optional<List<RealtimeSession.Include>>include()Additional fields to include in server outputs. final Optional<RealtimeSession.InputAudioFormat>inputAudioFormat()The format of input audio. final Optional<RealtimeSession.InputAudioNoiseReduction>inputAudioNoiseReduction()Configuration for input audio noise reduction. final Optional<AudioTranscription>inputAudioTranscription()Configuration for input audio transcription, defaults to off and can be set to nullto turn off once on.final Optional<String>instructions()The default system instructions (i.e. final Optional<RealtimeSession.MaxResponseOutputTokens>maxResponseOutputTokens()Maximum number of output tokens for a single assistant response, inclusive of tool calls. final Optional<List<RealtimeSession.Modality>>modalities()The set of modalities the model can respond with. final Optional<RealtimeSession.Model>model()The Realtime model used for this session. final Optional<RealtimeSession.Object>object_()The object type. final Optional<RealtimeSession.OutputAudioFormat>outputAudioFormat()The format of output audio. final Optional<ResponsePrompt>prompt()Reference to a prompt template and its variables. final Optional<Double>speed()The speed of the model's spoken response. final Optional<Double>temperature()Sampling temperature for the model, limited to 0.6, 1. final Optional<String>toolChoice()How the model chooses tools. final Optional<List<RealtimeFunctionTool>>tools()Tools (functions) available to the model. final Optional<RealtimeSession.Tracing>tracing()Configuration options for tracing. final Optional<RealtimeSession.TurnDetection>turnDetection()Configuration for turn detection, ether Server VAD or Semantic VAD. final Optional<RealtimeSession.Voice>voice()The voice the model uses to respond. final JsonField<String>_id()Returns the raw JSON value of id. final JsonField<Long>_expiresAt()Returns the raw JSON value of expiresAt. final JsonField<List<RealtimeSession.Include>>_include()Returns the raw JSON value of include. final JsonField<RealtimeSession.InputAudioFormat>_inputAudioFormat()Returns the raw JSON value of inputAudioFormat. final JsonField<RealtimeSession.InputAudioNoiseReduction>_inputAudioNoiseReduction()Returns the raw JSON value of inputAudioNoiseReduction. final JsonField<AudioTranscription>_inputAudioTranscription()Returns the raw JSON value of inputAudioTranscription. final JsonField<String>_instructions()Returns the raw JSON value of instructions. final JsonField<RealtimeSession.MaxResponseOutputTokens>_maxResponseOutputTokens()Returns the raw JSON value of maxResponseOutputTokens. final JsonField<List<RealtimeSession.Modality>>_modalities()Returns the raw JSON value of modalities. final JsonField<RealtimeSession.Model>_model()Returns the raw JSON value of model. final JsonField<RealtimeSession.Object>_object_()Returns the raw JSON value of object_. final JsonField<RealtimeSession.OutputAudioFormat>_outputAudioFormat()Returns the raw JSON value of outputAudioFormat. final JsonField<ResponsePrompt>_prompt()Returns the raw JSON value of prompt. final JsonField<Double>_speed()Returns the raw JSON value of speed. final JsonField<Double>_temperature()Returns the raw JSON value of temperature. final JsonField<String>_toolChoice()Returns the raw JSON value of toolChoice. final JsonField<List<RealtimeFunctionTool>>_tools()Returns the raw JSON value of tools. final JsonField<RealtimeSession.Tracing>_tracing()Returns the raw JSON value of tracing. final JsonField<RealtimeSession.TurnDetection>_turnDetection()Returns the raw JSON value of turnDetection. final JsonField<RealtimeSession.Voice>_voice()Returns the raw JSON value of voice. final Map<String, JsonValue>_additionalProperties()final RealtimeSession.BuildertoBuilder()final RealtimeSessionvalidate()final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static RealtimeSession.Builderbuilder()Returns a mutable builder for constructing an instance of RealtimeSession. - 
                    
                    
                    - 
                                
                            
                                Method Detail- 
                                        idfinal Optional<String> id() Unique identifier for the session that looks like sess_1234567890abcdef.
 - 
                                        expiresAtfinal Optional<Long> expiresAt() Expiration timestamp for the session, in seconds since epoch. 
 - 
                                        includefinal Optional<List<RealtimeSession.Include>> include() Additional fields to include in server outputs. - item.input_audio_transcription.logprobs: Include logprobs for input audio transcription.
 
 - 
                                        inputAudioFormatfinal Optional<RealtimeSession.InputAudioFormat> inputAudioFormat() The format of input audio. Options are pcm16,g711_ulaw, org711_alaw. Forpcm16, input audio must be 16-bit PCM at a 24kHz sample rate, single channel (mono), and little-endian byte order.
 - 
                                        inputAudioNoiseReductionfinal Optional<RealtimeSession.InputAudioNoiseReduction> inputAudioNoiseReduction() Configuration for input audio noise reduction. This can be set to nullto 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.
 - 
                                        inputAudioTranscriptionfinal Optional<AudioTranscription> inputAudioTranscription() Configuration for input audio transcription, defaults to off and can be set to nullto 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 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.
 - 
                                        instructionsfinal Optional<String> instructions() 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.createdevent at the start of the session.
 - 
                                        maxResponseOutputTokensfinal Optional<RealtimeSession.MaxResponseOutputTokens> maxResponseOutputTokens() 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 inffor the maximum available tokens for a given model. Defaults toinf.
 - 
                                        modalitiesfinal Optional<List<RealtimeSession.Modality>> modalities() The set of modalities the model can respond with. To disable audio, set this to "text". 
 - 
                                        modelfinal Optional<RealtimeSession.Model> model() The Realtime model used for this session. 
 - 
                                        object_final Optional<RealtimeSession.Object> object_() The object type. Always realtime.session.
 - 
                                        outputAudioFormatfinal Optional<RealtimeSession.OutputAudioFormat> outputAudioFormat() The format of output audio. Options are pcm16,g711_ulaw, org711_alaw. Forpcm16, output audio is sampled at a rate of 24kHz.
 - 
                                        promptfinal Optional<ResponsePrompt> prompt() Reference to a prompt template and its variables. Learn more. 
 - 
                                        speedfinal Optional<Double> speed() 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. 
 - 
                                        temperaturefinal Optional<Double> temperature() 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. 
 - 
                                        toolChoicefinal Optional<String> toolChoice() How the model chooses tools. Options are auto,none,required, or specify a function.
 - 
                                        toolsfinal Optional<List<RealtimeFunctionTool>> tools() Tools (functions) available to the model. 
 - 
                                        tracingfinal Optional<RealtimeSession.Tracing> tracing() Configuration options for tracing. Set to null to disable tracing. Once tracing is enabled for a session, the configuration cannot be modified. autowill create a trace for the session with default values for the workflow name, group id, and metadata.
 - 
                                        turnDetectionfinal Optional<RealtimeSession.TurnDetection> turnDetection() Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to nullto 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. 
 - 
                                        voicefinal Optional<RealtimeSession.Voice> voice() 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, andverse.
 - 
                                        _idfinal JsonField<String> _id() Returns the raw JSON value of id. Unlike id, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _expiresAtfinal JsonField<Long> _expiresAt() Returns the raw JSON value of expiresAt. Unlike expiresAt, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _includefinal JsonField<List<RealtimeSession.Include>> _include() Returns the raw JSON value of include. Unlike include, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _inputAudioFormatfinal JsonField<RealtimeSession.InputAudioFormat> _inputAudioFormat() Returns the raw JSON value of inputAudioFormat. Unlike inputAudioFormat, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _inputAudioNoiseReductionfinal JsonField<RealtimeSession.InputAudioNoiseReduction> _inputAudioNoiseReduction() Returns the raw JSON value of inputAudioNoiseReduction. Unlike inputAudioNoiseReduction, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _inputAudioTranscriptionfinal JsonField<AudioTranscription> _inputAudioTranscription() Returns the raw JSON value of inputAudioTranscription. Unlike inputAudioTranscription, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _instructionsfinal JsonField<String> _instructions() Returns the raw JSON value of instructions. Unlike instructions, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _maxResponseOutputTokensfinal JsonField<RealtimeSession.MaxResponseOutputTokens> _maxResponseOutputTokens() Returns the raw JSON value of maxResponseOutputTokens. Unlike maxResponseOutputTokens, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _modalitiesfinal JsonField<List<RealtimeSession.Modality>> _modalities() Returns the raw JSON value of modalities. Unlike modalities, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _modelfinal JsonField<RealtimeSession.Model> _model() Returns the raw JSON value of model. Unlike model, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _object_final JsonField<RealtimeSession.Object> _object_() Returns the raw JSON value of object_. Unlike object_, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _outputAudioFormatfinal JsonField<RealtimeSession.OutputAudioFormat> _outputAudioFormat() Returns the raw JSON value of outputAudioFormat. Unlike outputAudioFormat, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _promptfinal JsonField<ResponsePrompt> _prompt() Returns the raw JSON value of prompt. Unlike prompt, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _speedfinal JsonField<Double> _speed() Returns the raw JSON value of speed. Unlike speed, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _temperaturefinal JsonField<Double> _temperature() Returns the raw JSON value of temperature. Unlike temperature, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _toolChoicefinal JsonField<String> _toolChoice() Returns the raw JSON value of toolChoice. Unlike toolChoice, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _toolsfinal JsonField<List<RealtimeFunctionTool>> _tools() Returns the raw JSON value of tools. Unlike tools, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _tracingfinal JsonField<RealtimeSession.Tracing> _tracing() Returns the raw JSON value of tracing. Unlike tracing, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _turnDetectionfinal JsonField<RealtimeSession.TurnDetection> _turnDetection() Returns the raw JSON value of turnDetection. Unlike turnDetection, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _voicefinal JsonField<RealtimeSession.Voice> _voice() Returns the raw JSON value of voice. Unlike voice, this method doesn't throw if the JSON field has an unexpected type. 
 - 
                                        _additionalPropertiesfinal Map<String, JsonValue> _additionalProperties() 
 - 
                                        toBuilderfinal RealtimeSession.Builder toBuilder() 
 - 
                                        validatefinal RealtimeSession validate() 
 - 
                                        builderfinal static RealtimeSession.Builder builder() Returns a mutable builder for constructing an instance of RealtimeSession. 
 
- 
                                        
 
- 
                                
                            
                                
 
- 
                    
                    
                    
 
-