Class RealtimeSessionCreateRequest
-
- All Implemented Interfaces:
public final class RealtimeSessionCreateRequest
Realtime session object configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
RealtimeSessionCreateRequest.Builder
A builder for RealtimeSessionCreateRequest.
public final class
RealtimeSessionCreateRequest.Model
The Realtime model used for this session.
public final class
RealtimeSessionCreateRequest.Include
public final class
RealtimeSessionCreateRequest.MaxOutputTokens
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 toinf
.public final class
RealtimeSessionCreateRequest.OutputModality
-
Method Summary
Modifier and Type Method Description final RealtimeSessionCreateRequest.Model
model()
The Realtime model used for this session. final JsonValue
_type()
The type of session to create. final Optional<RealtimeAudioConfig>
audio()
Configuration for input and output audio. final Optional<RealtimeClientSecretConfig>
clientSecret()
Configuration options for the generated client secret. final Optional<List<RealtimeSessionCreateRequest.Include>>
include()
Additional fields to include in server outputs. final Optional<String>
instructions()
The default system instructions (i.e. final Optional<RealtimeSessionCreateRequest.MaxOutputTokens>
maxOutputTokens()
Maximum number of output tokens for a single assistant response, inclusive of tool calls. final Optional<List<RealtimeSessionCreateRequest.OutputModality>>
outputModalities()
The set of modalities the model can respond with. final Optional<ResponsePrompt>
prompt()
Reference to a prompt template and its variables. final Optional<Double>
temperature()
Sampling temperature for the model, limited to 0.6, 1. final Optional<RealtimeToolChoiceConfig>
toolChoice()
How the model chooses tools. final Optional<List<RealtimeToolsConfigUnion>>
tools()
Tools available to the model. final Optional<RealtimeTracingConfig>
tracing()
Configuration options for tracing. final Optional<RealtimeTruncation>
truncation()
Controls how the realtime conversation is truncated prior to model inference. final JsonField<RealtimeSessionCreateRequest.Model>
_model()
Returns the raw JSON value of model. final JsonField<RealtimeAudioConfig>
_audio()
Returns the raw JSON value of audio. final JsonField<RealtimeClientSecretConfig>
_clientSecret()
Returns the raw JSON value of clientSecret. final JsonField<List<RealtimeSessionCreateRequest.Include>>
_include()
Returns the raw JSON value of include. final JsonField<String>
_instructions()
Returns the raw JSON value of instructions. final JsonField<RealtimeSessionCreateRequest.MaxOutputTokens>
_maxOutputTokens()
Returns the raw JSON value of maxOutputTokens. final JsonField<List<RealtimeSessionCreateRequest.OutputModality>>
_outputModalities()
Returns the raw JSON value of outputModalities. final JsonField<ResponsePrompt>
_prompt()
Returns the raw JSON value of prompt. final JsonField<Double>
_temperature()
Returns the raw JSON value of temperature. final JsonField<RealtimeToolChoiceConfig>
_toolChoice()
Returns the raw JSON value of toolChoice. final JsonField<List<RealtimeToolsConfigUnion>>
_tools()
Returns the raw JSON value of tools. final JsonField<RealtimeTracingConfig>
_tracing()
Returns the raw JSON value of tracing. final JsonField<RealtimeTruncation>
_truncation()
Returns the raw JSON value of truncation. final Map<String, JsonValue>
_additionalProperties()
final RealtimeSessionCreateRequest.Builder
toBuilder()
final RealtimeSessionCreateRequest
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static RealtimeSessionCreateRequest.Builder
builder()
Returns a mutable builder for constructing an instance of RealtimeSessionCreateRequest. -
-
Method Detail
-
model
final RealtimeSessionCreateRequest.Model model()
The Realtime model used for this session.
-
_type
final JsonValue _type()
The type of session to create. Always
realtime
for the Realtime API.Expected to always return the following:
JsonValue.from("realtime")
However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
audio
final Optional<RealtimeAudioConfig> audio()
Configuration for input and output audio.
-
clientSecret
final Optional<RealtimeClientSecretConfig> clientSecret()
Configuration options for the generated client secret.
-
include
final Optional<List<RealtimeSessionCreateRequest.Include>> include()
Additional fields to include in server outputs.
item.input_audio_transcription.logprobs
: Include logprobs for input audio transcription.
-
instructions
final 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.created
event at the start of the session.
-
maxOutputTokens
final Optional<RealtimeSessionCreateRequest.MaxOutputTokens> maxOutputTokens()
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 toinf
.
-
outputModalities
final Optional<List<RealtimeSessionCreateRequest.OutputModality>> outputModalities()
The set of modalities the model can respond with. To disable audio, set this to "text".
-
prompt
final Optional<ResponsePrompt> prompt()
Reference to a prompt template and its variables. Learn more.
-
temperature
final 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.
-
toolChoice
final Optional<RealtimeToolChoiceConfig> toolChoice()
How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
-
tools
final Optional<List<RealtimeToolsConfigUnion>> tools()
Tools available to the model.
-
tracing
final Optional<RealtimeTracingConfig> tracing()
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.
-
truncation
final Optional<RealtimeTruncation> truncation()
Controls how the realtime conversation is truncated prior to model inference. The default is
auto
. When set toretention_ratio
, the server retains a fraction of the conversation tokens prior to the instructions.
-
_model
final JsonField<RealtimeSessionCreateRequest.Model> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_audio
final JsonField<RealtimeAudioConfig> _audio()
Returns the raw JSON value of audio.
Unlike audio, this method doesn't throw if the JSON field has an unexpected type.
-
_clientSecret
final JsonField<RealtimeClientSecretConfig> _clientSecret()
Returns the raw JSON value of clientSecret.
Unlike clientSecret, this method doesn't throw if the JSON field has an unexpected type.
-
_include
final JsonField<List<RealtimeSessionCreateRequest.Include>> _include()
Returns the raw JSON value of include.
Unlike include, this method doesn't throw if the JSON field has an unexpected type.
-
_instructions
final 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.
-
_maxOutputTokens
final JsonField<RealtimeSessionCreateRequest.MaxOutputTokens> _maxOutputTokens()
Returns the raw JSON value of maxOutputTokens.
Unlike maxOutputTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_outputModalities
final JsonField<List<RealtimeSessionCreateRequest.OutputModality>> _outputModalities()
Returns the raw JSON value of outputModalities.
Unlike outputModalities, this method doesn't throw if the JSON field has an unexpected type.
-
_prompt
final 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.
-
_temperature
final 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.
-
_toolChoice
final JsonField<RealtimeToolChoiceConfig> _toolChoice()
Returns the raw JSON value of toolChoice.
Unlike toolChoice, this method doesn't throw if the JSON field has an unexpected type.
-
_tools
final JsonField<List<RealtimeToolsConfigUnion>> _tools()
Returns the raw JSON value of tools.
Unlike tools, this method doesn't throw if the JSON field has an unexpected type.
-
_tracing
final JsonField<RealtimeTracingConfig> _tracing()
Returns the raw JSON value of tracing.
Unlike tracing, this method doesn't throw if the JSON field has an unexpected type.
-
_truncation
final JsonField<RealtimeTruncation> _truncation()
Returns the raw JSON value of truncation.
Unlike truncation, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final RealtimeSessionCreateRequest.Builder toBuilder()
-
validate
final RealtimeSessionCreateRequest validate()
-
builder
final static RealtimeSessionCreateRequest.Builder builder()
Returns a mutable builder for constructing an instance of RealtimeSessionCreateRequest.
The following fields are required:
.model()
-
-
-
-