Class SessionCreateParams.Builder
-
- All Implemented Interfaces:
public final class SessionCreateParams.Builder
A builder for SessionCreateParams.
-
-
Method Summary
-
-
Method Detail
-
body
final SessionCreateParams.Builder body(SessionCreateParams.Body body)
Sets the entire request body.
This is generally only useful if you are already constructing the body separately. Otherwise, it's more convenient to use the top-level setters instead:
-
clientSecret
final SessionCreateParams.Builder clientSecret(SessionCreateParams.ClientSecret clientSecret)
Configuration options for the generated client secret.
-
clientSecret
final SessionCreateParams.Builder clientSecret(JsonField<SessionCreateParams.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 SessionCreateParams.Builder inputAudioFormat(SessionCreateParams.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 SessionCreateParams.Builder inputAudioFormat(JsonField<SessionCreateParams.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 SessionCreateParams.Builder inputAudioNoiseReduction(SessionCreateParams.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 SessionCreateParams.Builder inputAudioNoiseReduction(JsonField<SessionCreateParams.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 SessionCreateParams.Builder inputAudioTranscription(SessionCreateParams.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 SessionCreateParams.Builder inputAudioTranscription(JsonField<SessionCreateParams.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 SessionCreateParams.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 SessionCreateParams.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 SessionCreateParams.Builder maxResponseOutputTokens(SessionCreateParams.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 SessionCreateParams.Builder maxResponseOutputTokens(JsonField<SessionCreateParams.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 SessionCreateParams.Builder maxResponseOutputTokens(Long integer)
Alias for calling maxResponseOutputTokens with
MaxResponseOutputTokens.ofInteger(integer)
.
-
maxResponseOutputTokensInf
final SessionCreateParams.Builder maxResponseOutputTokensInf()
Alias for calling maxResponseOutputTokens with
MaxResponseOutputTokens.ofInf()
.
-
modalities
final SessionCreateParams.Builder modalities(List<SessionCreateParams.Modality> modalities)
The set of modalities the model can respond with. To disable audio, set this to "text".
-
modalities
final SessionCreateParams.Builder modalities(JsonField<List<SessionCreateParams.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 SessionCreateParams.Builder addModality(SessionCreateParams.Modality modality)
Adds a single Modality to modalities.
-
model
final SessionCreateParams.Builder model(SessionCreateParams.Model model)
The Realtime model used for this session.
-
model
final SessionCreateParams.Builder model(JsonField<SessionCreateParams.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 SessionCreateParams.Builder outputAudioFormat(SessionCreateParams.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 SessionCreateParams.Builder outputAudioFormat(JsonField<SessionCreateParams.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 SessionCreateParams.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 SessionCreateParams.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 SessionCreateParams.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 SessionCreateParams.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 SessionCreateParams.Builder toolChoice(String toolChoice)
How the model chooses tools. Options are
auto
,none
,required
, or specify a function.
-
toolChoice
final SessionCreateParams.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 SessionCreateParams.Builder tools(List<SessionCreateParams.Tool> tools)
Tools (functions) available to the model.
-
tools
final SessionCreateParams.Builder tools(JsonField<List<SessionCreateParams.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 SessionCreateParams.Builder addTool(SessionCreateParams.Tool tool)
-
tracing
final SessionCreateParams.Builder tracing(SessionCreateParams.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 SessionCreateParams.Builder tracing(JsonField<SessionCreateParams.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 SessionCreateParams.Builder tracing(SessionCreateParams.Tracing.TracingConfiguration configuration)
Alias for calling tracing with
Tracing.ofConfiguration(configuration)
.
-
tracingAuto
final SessionCreateParams.Builder tracingAuto()
Alias for calling tracing with
Tracing.ofAuto()
.
-
turnDetection
final SessionCreateParams.Builder turnDetection(SessionCreateParams.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 conjuction 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 SessionCreateParams.Builder turnDetection(JsonField<SessionCreateParams.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 SessionCreateParams.Builder voice(SessionCreateParams.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 SessionCreateParams.Builder voice(JsonField<SessionCreateParams.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 SessionCreateParams.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.
-
additionalBodyProperties
final SessionCreateParams.Builder additionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
putAdditionalBodyProperty
final SessionCreateParams.Builder putAdditionalBodyProperty(String key, JsonValue value)
-
putAllAdditionalBodyProperties
final SessionCreateParams.Builder putAllAdditionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
removeAdditionalBodyProperty
final SessionCreateParams.Builder removeAdditionalBodyProperty(String key)
-
removeAllAdditionalBodyProperties
final SessionCreateParams.Builder removeAllAdditionalBodyProperties(Set<String> keys)
-
additionalHeaders
final SessionCreateParams.Builder additionalHeaders(Headers additionalHeaders)
-
additionalHeaders
final SessionCreateParams.Builder additionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
putAdditionalHeader
final SessionCreateParams.Builder putAdditionalHeader(String name, String value)
-
putAdditionalHeaders
final SessionCreateParams.Builder putAdditionalHeaders(String name, Iterable<String> values)
-
putAllAdditionalHeaders
final SessionCreateParams.Builder putAllAdditionalHeaders(Headers additionalHeaders)
-
putAllAdditionalHeaders
final SessionCreateParams.Builder putAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
replaceAdditionalHeaders
final SessionCreateParams.Builder replaceAdditionalHeaders(String name, String value)
-
replaceAdditionalHeaders
final SessionCreateParams.Builder replaceAdditionalHeaders(String name, Iterable<String> values)
-
replaceAllAdditionalHeaders
final SessionCreateParams.Builder replaceAllAdditionalHeaders(Headers additionalHeaders)
-
replaceAllAdditionalHeaders
final SessionCreateParams.Builder replaceAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
removeAdditionalHeaders
final SessionCreateParams.Builder removeAdditionalHeaders(String name)
-
removeAllAdditionalHeaders
final SessionCreateParams.Builder removeAllAdditionalHeaders(Set<String> names)
-
additionalQueryParams
final SessionCreateParams.Builder additionalQueryParams(QueryParams additionalQueryParams)
-
additionalQueryParams
final SessionCreateParams.Builder additionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
putAdditionalQueryParam
final SessionCreateParams.Builder putAdditionalQueryParam(String key, String value)
-
putAdditionalQueryParams
final SessionCreateParams.Builder putAdditionalQueryParams(String key, Iterable<String> values)
-
putAllAdditionalQueryParams
final SessionCreateParams.Builder putAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
putAllAdditionalQueryParams
final SessionCreateParams.Builder putAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
replaceAdditionalQueryParams
final SessionCreateParams.Builder replaceAdditionalQueryParams(String key, String value)
-
replaceAdditionalQueryParams
final SessionCreateParams.Builder replaceAdditionalQueryParams(String key, Iterable<String> values)
-
replaceAllAdditionalQueryParams
final SessionCreateParams.Builder replaceAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
replaceAllAdditionalQueryParams
final SessionCreateParams.Builder replaceAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
removeAdditionalQueryParams
final SessionCreateParams.Builder removeAdditionalQueryParams(String key)
-
removeAllAdditionalQueryParams
final SessionCreateParams.Builder removeAllAdditionalQueryParams(Set<String> keys)
-
build
final SessionCreateParams build()
Returns an immutable instance of SessionCreateParams.
Further updates to this Builder will not mutate the returned instance.
-
-
-
-