Class RealtimeSessionCreateResponse.Builder
-
- All Implemented Interfaces:
public final class RealtimeSessionCreateResponse.Builder
A builder for RealtimeSessionCreateResponse.
-
-
Method Summary
-
-
Method Detail
-
clientSecret
final RealtimeSessionCreateResponse.Builder clientSecret(RealtimeSessionClientSecret clientSecret)
Ephemeral key returned by the API.
-
clientSecret
final RealtimeSessionCreateResponse.Builder clientSecret(JsonField<RealtimeSessionClientSecret> clientSecret)
Sets Builder.clientSecret to an arbitrary JSON value.
You should usually call Builder.clientSecret with a well-typed RealtimeSessionClientSecret value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
type
final RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder audio(RealtimeSessionCreateResponse.Audio audio)
Configuration for input and output audio.
-
audio
final RealtimeSessionCreateResponse.Builder audio(JsonField<RealtimeSessionCreateResponse.Audio> audio)
Sets Builder.audio to an arbitrary JSON value.
You should usually call Builder.audio with a well-typed Audio value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
include
final RealtimeSessionCreateResponse.Builder include(List<RealtimeSessionCreateResponse.Include> include)
Additional fields to include in server outputs.
item.input_audio_transcription.logprobs
: Include logprobs for input audio transcription.
-
include
final RealtimeSessionCreateResponse.Builder include(JsonField<List<RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder addInclude(RealtimeSessionCreateResponse.Include include)
Adds a single Include to Builder.include.
-
instructions
final RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder maxOutputTokens(RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder maxOutputTokens(JsonField<RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder maxOutputTokens(Long integer)
Alias for calling maxOutputTokens with
MaxOutputTokens.ofInteger(integer)
.
-
maxOutputTokensInf
final RealtimeSessionCreateResponse.Builder maxOutputTokensInf()
Alias for calling maxOutputTokens with
MaxOutputTokens.ofInf()
.
-
model
final RealtimeSessionCreateResponse.Builder model(RealtimeSessionCreateResponse.Model model)
The Realtime model used for this session.
-
model
final RealtimeSessionCreateResponse.Builder model(JsonField<RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.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.
-
outputModalities
final RealtimeSessionCreateResponse.Builder outputModalities(List<RealtimeSessionCreateResponse.OutputModality> outputModalities)
The set of modalities the model can respond with. It defaults to
["audio"]
, indicating that the model will respond with audio plus a transcript.["text"]
can be used to make the model respond with text only. It is not possible to request bothtext
andaudio
at the same time.
-
outputModalities
final RealtimeSessionCreateResponse.Builder outputModalities(JsonField<List<RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder addOutputModality(RealtimeSessionCreateResponse.OutputModality outputModality)
Adds a single OutputModality to outputModalities.
-
prompt
final RealtimeSessionCreateResponse.Builder prompt(ResponsePrompt prompt)
Reference to a prompt template and its variables. Learn more.
-
prompt
final RealtimeSessionCreateResponse.Builder prompt(Optional<ResponsePrompt> prompt)
Alias for calling Builder.prompt with
prompt.orElse(null)
.
-
prompt
final RealtimeSessionCreateResponse.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.
-
toolChoice
final RealtimeSessionCreateResponse.Builder toolChoice(RealtimeSessionCreateResponse.ToolChoice toolChoice)
How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
-
toolChoice
final RealtimeSessionCreateResponse.Builder toolChoice(JsonField<RealtimeSessionCreateResponse.ToolChoice> toolChoice)
Sets Builder.toolChoice to an arbitrary JSON value.
You should usually call Builder.toolChoice with a well-typed ToolChoice value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
toolChoice
final RealtimeSessionCreateResponse.Builder toolChoice(ToolChoiceOptions options)
Alias for calling toolChoice with
ToolChoice.ofOptions(options)
.
-
toolChoice
final RealtimeSessionCreateResponse.Builder toolChoice(ToolChoiceFunction function)
Alias for calling toolChoice with
ToolChoice.ofFunction(function)
.
-
toolChoice
final RealtimeSessionCreateResponse.Builder toolChoice(ToolChoiceMcp mcp)
Alias for calling toolChoice with
ToolChoice.ofMcp(mcp)
.
-
tools
final RealtimeSessionCreateResponse.Builder tools(List<RealtimeSessionCreateResponse.Tool> tools)
Tools available to the model.
-
tools
final RealtimeSessionCreateResponse.Builder tools(JsonField<List<RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder addTool(RealtimeSessionCreateResponse.Tool tool)
-
addTool
final RealtimeSessionCreateResponse.Builder addTool(RealtimeFunctionTool realtimeFunction)
Alias for calling addTool with
Tool.ofRealtimeFunction(realtimeFunction)
.
-
addTool
final RealtimeSessionCreateResponse.Builder addTool(RealtimeSessionCreateResponse.Tool.McpTool mcp)
Alias for calling addTool with
Tool.ofMcp(mcp)
.
-
tracing
final RealtimeSessionCreateResponse.Builder tracing(RealtimeSessionCreateResponse.Tracing tracing)
Realtime API can write session traces to the /logs?api=traces. 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 RealtimeSessionCreateResponse.Builder tracing(Optional<RealtimeSessionCreateResponse.Tracing> tracing)
Alias for calling Builder.tracing with
tracing.orElse(null)
.
-
tracing
final RealtimeSessionCreateResponse.Builder tracing(JsonField<RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder tracing(RealtimeSessionCreateResponse.Tracing.TracingConfiguration configuration)
Alias for calling tracing with
Tracing.ofConfiguration(configuration)
.
-
tracingAuto
final RealtimeSessionCreateResponse.Builder tracingAuto()
Alias for calling tracing with
Tracing.ofAuto()
.
-
truncation
final RealtimeSessionCreateResponse.Builder truncation(RealtimeTruncation truncation)
Controls how the realtime conversation is truncated prior to model inference. The default is
auto
.
-
truncation
final RealtimeSessionCreateResponse.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 RealtimeSessionCreateResponse.Builder truncation(RealtimeTruncation.RealtimeTruncationStrategy strategy)
Alias for calling truncation with
RealtimeTruncation.ofStrategy(strategy)
.
-
truncation
final RealtimeSessionCreateResponse.Builder truncation(RealtimeTruncationRetentionRatio retentionRatio)
Alias for calling truncation with
RealtimeTruncation.ofRetentionRatio(retentionRatio)
.
-
additionalProperties
final RealtimeSessionCreateResponse.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final RealtimeSessionCreateResponse.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final RealtimeSessionCreateResponse.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final RealtimeSessionCreateResponse.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final RealtimeSessionCreateResponse.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final RealtimeSessionCreateResponse build()
Returns an immutable instance of RealtimeSessionCreateResponse.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.clientSecret()
-
-
-
-