Class RealtimeSessionCreateRequest.Builder
-
- All Implemented Interfaces:
public final class RealtimeSessionCreateRequest.Builder
A builder for RealtimeSessionCreateRequest.
-
-
Method Summary
-
-
Method Detail
-
model
final RealtimeSessionCreateRequest.Builder model(RealtimeSessionCreateRequest.Model model)
The Realtime model used for this session.
-
model
final RealtimeSessionCreateRequest.Builder model(JsonField<RealtimeSessionCreateRequest.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.
-
model
final RealtimeSessionCreateRequest.Builder model(String value)
Sets model to an arbitrary String.
You should usually call model with a well-typed Model constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
type
final RealtimeSessionCreateRequest.Builder type(JsonValue type)
Sets the field to an arbitrary JSON value.
It is usually unnecessary to call this method because the field defaults to the following:
JsonValue.from("realtime")
This method is primarily for setting the field to an undocumented or not yet supported value.
-
audio
final RealtimeSessionCreateRequest.Builder audio(RealtimeAudioConfig audio)
Configuration for input and output audio.
-
audio
final RealtimeSessionCreateRequest.Builder audio(JsonField<RealtimeAudioConfig> audio)
Sets Builder.audio to an arbitrary JSON value.
You should usually call Builder.audio with a well-typed RealtimeAudioConfig value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
clientSecret
final RealtimeSessionCreateRequest.Builder clientSecret(RealtimeClientSecretConfig clientSecret)
Configuration options for the generated client secret.
-
clientSecret
final RealtimeSessionCreateRequest.Builder clientSecret(JsonField<RealtimeClientSecretConfig> clientSecret)
Sets Builder.clientSecret to an arbitrary JSON value.
You should usually call Builder.clientSecret with a well-typed RealtimeClientSecretConfig value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
include
final RealtimeSessionCreateRequest.Builder include(List<RealtimeSessionCreateRequest.Include> include)
Additional fields to include in server outputs.
item.input_audio_transcription.logprobs
: Include logprobs for input audio transcription.
-
include
final RealtimeSessionCreateRequest.Builder include(JsonField<List<RealtimeSessionCreateRequest.Include>> include)
Sets Builder.include to an arbitrary JSON value.
You should usually call Builder.include with a well-typed
List<Include>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addInclude
final RealtimeSessionCreateRequest.Builder addInclude(RealtimeSessionCreateRequest.Include include)
Adds a single Include to Builder.include.
-
instructions
final RealtimeSessionCreateRequest.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 RealtimeSessionCreateRequest.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.
-
maxOutputTokens
final RealtimeSessionCreateRequest.Builder maxOutputTokens(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
.
-
maxOutputTokens
final RealtimeSessionCreateRequest.Builder maxOutputTokens(JsonField<RealtimeSessionCreateRequest.MaxOutputTokens> maxOutputTokens)
Sets Builder.maxOutputTokens to an arbitrary JSON value.
You should usually call Builder.maxOutputTokens with a well-typed MaxOutputTokens value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
maxOutputTokens
final RealtimeSessionCreateRequest.Builder maxOutputTokens(Long integer)
Alias for calling maxOutputTokens with
MaxOutputTokens.ofInteger(integer)
.
-
maxOutputTokensInf
final RealtimeSessionCreateRequest.Builder maxOutputTokensInf()
Alias for calling maxOutputTokens with
MaxOutputTokens.ofInf()
.
-
outputModalities
final RealtimeSessionCreateRequest.Builder outputModalities(List<RealtimeSessionCreateRequest.OutputModality> outputModalities)
The set of modalities the model can respond with. To disable audio, set this to "text".
-
outputModalities
final RealtimeSessionCreateRequest.Builder outputModalities(JsonField<List<RealtimeSessionCreateRequest.OutputModality>> outputModalities)
Sets Builder.outputModalities to an arbitrary JSON value.
You should usually call Builder.outputModalities with a well-typed
List<OutputModality>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addOutputModality
final RealtimeSessionCreateRequest.Builder addOutputModality(RealtimeSessionCreateRequest.OutputModality outputModality)
Adds a single OutputModality to outputModalities.
-
prompt
final RealtimeSessionCreateRequest.Builder prompt(ResponsePrompt prompt)
Reference to a prompt template and its variables. Learn more.
-
prompt
final RealtimeSessionCreateRequest.Builder prompt(Optional<ResponsePrompt> prompt)
Alias for calling Builder.prompt with
prompt.orElse(null)
.
-
prompt
final RealtimeSessionCreateRequest.Builder prompt(JsonField<ResponsePrompt> prompt)
Sets Builder.prompt to an arbitrary JSON value.
You should usually call Builder.prompt with a well-typed ResponsePrompt value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
temperature
final RealtimeSessionCreateRequest.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 RealtimeSessionCreateRequest.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 RealtimeSessionCreateRequest.Builder toolChoice(RealtimeToolChoiceConfig toolChoice)
How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
-
toolChoice
final RealtimeSessionCreateRequest.Builder toolChoice(JsonField<RealtimeToolChoiceConfig> toolChoice)
Sets Builder.toolChoice to an arbitrary JSON value.
You should usually call Builder.toolChoice with a well-typed RealtimeToolChoiceConfig value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
toolChoice
final RealtimeSessionCreateRequest.Builder toolChoice(ToolChoiceOptions toolChoiceOptions)
Alias for calling toolChoice with
RealtimeToolChoiceConfig.ofToolChoiceOptions(toolChoiceOptions)
.
-
toolChoice
final RealtimeSessionCreateRequest.Builder toolChoice(ToolChoiceFunction toolChoiceFunction)
Alias for calling toolChoice with
RealtimeToolChoiceConfig.ofToolChoiceFunction(toolChoiceFunction)
.
-
toolChoice
final RealtimeSessionCreateRequest.Builder toolChoice(ToolChoiceMcp toolChoiceMcp)
Alias for calling toolChoice with
RealtimeToolChoiceConfig.ofToolChoiceMcp(toolChoiceMcp)
.
-
tools
final RealtimeSessionCreateRequest.Builder tools(List<RealtimeToolsConfigUnion> tools)
Tools available to the model.
-
tools
final RealtimeSessionCreateRequest.Builder tools(JsonField<List<RealtimeToolsConfigUnion>> tools)
Sets Builder.tools to an arbitrary JSON value.
You should usually call Builder.tools with a well-typed
List<RealtimeToolsConfigUnion>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addTool
final RealtimeSessionCreateRequest.Builder addTool(RealtimeToolsConfigUnion tool)
Adds a single RealtimeToolsConfigUnion to tools.
-
addTool
final RealtimeSessionCreateRequest.Builder addTool(RealtimeToolsConfigUnion.Function function)
Alias for calling addTool with
RealtimeToolsConfigUnion.ofFunction(function)
.
-
addTool
final RealtimeSessionCreateRequest.Builder addTool(RealtimeToolsConfigUnion.Mcp mcp)
Alias for calling addTool with
RealtimeToolsConfigUnion.ofMcp(mcp)
.
-
addMcpTool
final RealtimeSessionCreateRequest.Builder addMcpTool(String serverLabel)
Alias for calling addTool with the following:
RealtimeToolsConfigUnion.Mcp.builder() .serverLabel(serverLabel) .build()
-
tracing
final RealtimeSessionCreateRequest.Builder tracing(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.
-
tracing
final RealtimeSessionCreateRequest.Builder tracing(Optional<RealtimeTracingConfig> tracing)
Alias for calling Builder.tracing with
tracing.orElse(null)
.
-
tracing
final RealtimeSessionCreateRequest.Builder tracing(JsonField<RealtimeTracingConfig> tracing)
Sets Builder.tracing to an arbitrary JSON value.
You should usually call Builder.tracing with a well-typed RealtimeTracingConfig value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
tracing
final RealtimeSessionCreateRequest.Builder tracing(RealtimeTracingConfig.TracingConfiguration tracingConfiguration)
Alias for calling tracing with
RealtimeTracingConfig.ofTracingConfiguration(tracingConfiguration)
.
-
tracingAuto
final RealtimeSessionCreateRequest.Builder tracingAuto()
Alias for calling tracing with
RealtimeTracingConfig.ofAuto()
.
-
truncation
final RealtimeSessionCreateRequest.Builder truncation(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.
-
truncation
final RealtimeSessionCreateRequest.Builder truncation(JsonField<RealtimeTruncation> truncation)
Sets Builder.truncation to an arbitrary JSON value.
You should usually call Builder.truncation with a well-typed RealtimeTruncation value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
truncation
final RealtimeSessionCreateRequest.Builder truncation(RealtimeTruncation.RealtimeTruncationStrategy strategy)
Alias for calling truncation with
RealtimeTruncation.ofStrategy(strategy)
.
-
truncation
final RealtimeSessionCreateRequest.Builder truncation(RealtimeTruncation.RetentionRatioTruncation retentionRatio)
Alias for calling truncation with
RealtimeTruncation.ofRetentionRatio(retentionRatio)
.
-
additionalProperties
final RealtimeSessionCreateRequest.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final RealtimeSessionCreateRequest.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final RealtimeSessionCreateRequest.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final RealtimeSessionCreateRequest.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final RealtimeSessionCreateRequest.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final RealtimeSessionCreateRequest build()
Returns an immutable instance of RealtimeSessionCreateRequest.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.model()
-
-
-
-