Class SessionUpdateEvent.Session.Builder
-
- All Implemented Interfaces:
public final class SessionUpdateEvent.Session.Builder
A builder for Session.
-
-
Method Summary
-
-
Method Detail
-
clientSecret
final SessionUpdateEvent.Session.Builder clientSecret(SessionUpdateEvent.Session.ClientSecret clientSecret)
Configuration options for the generated client secret.
-
clientSecret
final SessionUpdateEvent.Session.Builder clientSecret(JsonField<SessionUpdateEvent.Session.ClientSecret> clientSecret)
Sets Builder.clientSecret to an arbitrary JSON value.
You should usually call Builder.clientSecret with a well-typed ClientSecret value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
inputAudioFormat
final SessionUpdateEvent.Session.Builder inputAudioFormat(SessionUpdateEvent.Session.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.
-
inputAudioFormat
final SessionUpdateEvent.Session.Builder inputAudioFormat(JsonField<SessionUpdateEvent.Session.InputAudioFormat> inputAudioFormat)
Sets Builder.inputAudioFormat to an arbitrary JSON value.
You should usually call Builder.inputAudioFormat with a well-typed InputAudioFormat value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
inputAudioNoiseReduction
final SessionUpdateEvent.Session.Builder inputAudioNoiseReduction(SessionUpdateEvent.Session.InputAudioNoiseReduction 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.
-
inputAudioNoiseReduction
final SessionUpdateEvent.Session.Builder inputAudioNoiseReduction(JsonField<SessionUpdateEvent.Session.InputAudioNoiseReduction> inputAudioNoiseReduction)
Sets Builder.inputAudioNoiseReduction to an arbitrary JSON value.
You should usually call Builder.inputAudioNoiseReduction with a well-typed InputAudioNoiseReduction value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
inputAudioTranscription
final SessionUpdateEvent.Session.Builder inputAudioTranscription(SessionUpdateEvent.Session.InputAudioTranscription inputAudioTranscription)
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 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.
-
inputAudioTranscription
final SessionUpdateEvent.Session.Builder inputAudioTranscription(JsonField<SessionUpdateEvent.Session.InputAudioTranscription> inputAudioTranscription)
Sets Builder.inputAudioTranscription to an arbitrary JSON value.
You should usually call Builder.inputAudioTranscription with a well-typed InputAudioTranscription value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
instructions
final SessionUpdateEvent.Session.Builder instructions(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.
-
instructions
final SessionUpdateEvent.Session.Builder instructions(JsonField<String> instructions)
Sets Builder.instructions to an arbitrary JSON value.
You should usually call Builder.instructions with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
maxResponseOutputTokens
final SessionUpdateEvent.Session.Builder maxResponseOutputTokens(SessionUpdateEvent.Session.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
inf
for the maximum available tokens for a given model. Defaults toinf
.
-
maxResponseOutputTokens
final SessionUpdateEvent.Session.Builder maxResponseOutputTokens(JsonField<SessionUpdateEvent.Session.MaxResponseOutputTokens> maxResponseOutputTokens)
Sets Builder.maxResponseOutputTokens to an arbitrary JSON value.
You should usually call Builder.maxResponseOutputTokens with a well-typed MaxResponseOutputTokens value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
maxResponseOutputTokens
final SessionUpdateEvent.Session.Builder maxResponseOutputTokens(Long integer)
Alias for calling maxResponseOutputTokens with
MaxResponseOutputTokens.ofInteger(integer)
.
-
maxResponseOutputTokensInf
final SessionUpdateEvent.Session.Builder maxResponseOutputTokensInf()
Alias for calling maxResponseOutputTokens with
MaxResponseOutputTokens.ofInf()
.
-
modalities
final SessionUpdateEvent.Session.Builder modalities(List<SessionUpdateEvent.Session.Modality> modalities)
The set of modalities the model can respond with. To disable audio, set this to "text".
-
modalities
final SessionUpdateEvent.Session.Builder modalities(JsonField<List<SessionUpdateEvent.Session.Modality>> modalities)
Sets Builder.modalities to an arbitrary JSON value.
You should usually call Builder.modalities with a well-typed
List<Modality>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addModality
final SessionUpdateEvent.Session.Builder addModality(SessionUpdateEvent.Session.Modality modality)
Adds a single Modality to modalities.
-
model
final SessionUpdateEvent.Session.Builder model(SessionUpdateEvent.Session.Model model)
The Realtime model used for this session.
-
model
final SessionUpdateEvent.Session.Builder model(JsonField<SessionUpdateEvent.Session.Model> model)
Sets Builder.model to an arbitrary JSON value.
You should usually call Builder.model with a well-typed Model value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
outputAudioFormat
final SessionUpdateEvent.Session.Builder outputAudioFormat(SessionUpdateEvent.Session.OutputAudioFormat outputAudioFormat)
The format of output audio. Options are
pcm16
,g711_ulaw
, org711_alaw
. Forpcm16
, output audio is sampled at a rate of 24kHz.
-
outputAudioFormat
final SessionUpdateEvent.Session.Builder outputAudioFormat(JsonField<SessionUpdateEvent.Session.OutputAudioFormat> outputAudioFormat)
Sets Builder.outputAudioFormat to an arbitrary JSON value.
You should usually call Builder.outputAudioFormat with a well-typed OutputAudioFormat value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
speed
final SessionUpdateEvent.Session.Builder speed(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.
-
speed
final SessionUpdateEvent.Session.Builder speed(JsonField<Double> speed)
Sets Builder.speed to an arbitrary JSON value.
You should usually call Builder.speed with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
temperature
final SessionUpdateEvent.Session.Builder temperature(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.
-
temperature
final SessionUpdateEvent.Session.Builder temperature(JsonField<Double> temperature)
Sets Builder.temperature to an arbitrary JSON value.
You should usually call Builder.temperature with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
toolChoice
final SessionUpdateEvent.Session.Builder toolChoice(String toolChoice)
How the model chooses tools. Options are
auto
,none
,required
, or specify a function.
-
toolChoice
final SessionUpdateEvent.Session.Builder toolChoice(JsonField<String> toolChoice)
Sets Builder.toolChoice to an arbitrary JSON value.
You should usually call Builder.toolChoice with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
tools
final SessionUpdateEvent.Session.Builder tools(List<SessionUpdateEvent.Session.Tool> tools)
Tools (functions) available to the model.
-
tools
final SessionUpdateEvent.Session.Builder tools(JsonField<List<SessionUpdateEvent.Session.Tool>> tools)
Sets Builder.tools to an arbitrary JSON value.
You should usually call Builder.tools with a well-typed
List<Tool>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addTool
final SessionUpdateEvent.Session.Builder addTool(SessionUpdateEvent.Session.Tool tool)
-
tracing
final SessionUpdateEvent.Session.Builder tracing(SessionUpdateEvent.Session.Tracing 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.
-
tracing
final SessionUpdateEvent.Session.Builder tracing(JsonField<SessionUpdateEvent.Session.Tracing> tracing)
Sets Builder.tracing to an arbitrary JSON value.
You should usually call Builder.tracing with a well-typed Tracing value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
tracing
final SessionUpdateEvent.Session.Builder tracing(SessionUpdateEvent.Session.Tracing.TracingConfiguration configuration)
Alias for calling tracing with
Tracing.ofConfiguration(configuration)
.
-
tracingAuto
final SessionUpdateEvent.Session.Builder tracingAuto()
Alias for calling tracing with
Tracing.ofAuto()
.
-
turnDetection
final SessionUpdateEvent.Session.Builder turnDetection(SessionUpdateEvent.Session.TurnDetection turnDetection)
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.
-
turnDetection
final SessionUpdateEvent.Session.Builder turnDetection(JsonField<SessionUpdateEvent.Session.TurnDetection> turnDetection)
Sets Builder.turnDetection to an arbitrary JSON value.
You should usually call Builder.turnDetection with a well-typed TurnDetection value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
voice
final SessionUpdateEvent.Session.Builder voice(SessionUpdateEvent.Session.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
.
-
voice
final SessionUpdateEvent.Session.Builder voice(JsonField<SessionUpdateEvent.Session.Voice> voice)
Sets Builder.voice to an arbitrary JSON value.
You should usually call Builder.voice with a well-typed Voice value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
voice
final SessionUpdateEvent.Session.Builder voice(String value)
Sets voice to an arbitrary String.
You should usually call voice with a well-typed Voice constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final SessionUpdateEvent.Session.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final SessionUpdateEvent.Session.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final SessionUpdateEvent.Session.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final SessionUpdateEvent.Session.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final SessionUpdateEvent.Session.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final SessionUpdateEvent.Session build()
Returns an immutable instance of Session.
Further updates to this Builder will not mutate the returned instance.
-
-
-
-