Class ResponseCreateEvent.Response.Builder
-
- All Implemented Interfaces:
public final class ResponseCreateEvent.Response.Builder
A builder for Response.
-
-
Method Summary
-
-
Method Detail
-
conversation
final ResponseCreateEvent.Response.Builder conversation(ResponseCreateEvent.Response.Conversation conversation)
Controls which conversation the response is added to. Currently supports
auto
andnone
, withauto
as the default value. Theauto
value means that the contents of the response will be added to the default conversation. Set this tonone
to create an out-of-band response which will not add items to default conversation.
-
conversation
final ResponseCreateEvent.Response.Builder conversation(JsonField<ResponseCreateEvent.Response.Conversation> conversation)
Sets Builder.conversation to an arbitrary JSON value.
You should usually call Builder.conversation with a well-typed Conversation value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
conversation
final ResponseCreateEvent.Response.Builder conversation(String value)
Sets conversation to an arbitrary String.
You should usually call conversation with a well-typed Conversation constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
input
final ResponseCreateEvent.Response.Builder input(List<ConversationItemWithReference> input)
Input items to include in the prompt for the model. Using this field creates a new context for this Response instead of using the default conversation. An empty array
[]
will clear the context for this Response. Note that this can include references to items from the default conversation.
-
input
final ResponseCreateEvent.Response.Builder input(JsonField<List<ConversationItemWithReference>> input)
Sets Builder.input to an arbitrary JSON value.
You should usually call Builder.input with a well-typed
List<ConversationItemWithReference>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addInput
final ResponseCreateEvent.Response.Builder addInput(ConversationItemWithReference input)
Adds a single ConversationItemWithReference to Builder.input.
-
instructions
final ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder maxResponseOutputTokens(ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder maxResponseOutputTokens(JsonField<ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder maxResponseOutputTokens(Long integer)
Alias for calling maxResponseOutputTokens with
MaxResponseOutputTokens.ofInteger(integer)
.
-
maxResponseOutputTokensInf
final ResponseCreateEvent.Response.Builder maxResponseOutputTokensInf()
Alias for calling maxResponseOutputTokens with
MaxResponseOutputTokens.ofInf()
.
-
metadata
final ResponseCreateEvent.Response.Builder metadata(ResponseCreateEvent.Response.Metadata metadata)
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
metadata
final ResponseCreateEvent.Response.Builder metadata(Optional<ResponseCreateEvent.Response.Metadata> metadata)
Alias for calling Builder.metadata with
metadata.orElse(null)
.
-
metadata
final ResponseCreateEvent.Response.Builder metadata(JsonField<ResponseCreateEvent.Response.Metadata> metadata)
Sets Builder.metadata to an arbitrary JSON value.
You should usually call Builder.metadata with a well-typed Metadata value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
modalities
final ResponseCreateEvent.Response.Builder modalities(List<ResponseCreateEvent.Response.Modality> modalities)
The set of modalities the model can respond with. To disable audio, set this to "text".
-
modalities
final ResponseCreateEvent.Response.Builder modalities(JsonField<List<ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder addModality(ResponseCreateEvent.Response.Modality modality)
Adds a single Modality to modalities.
-
outputAudioFormat
final ResponseCreateEvent.Response.Builder outputAudioFormat(ResponseCreateEvent.Response.OutputAudioFormat outputAudioFormat)
The format of output audio. Options are
pcm16
,g711_ulaw
, org711_alaw
.
-
outputAudioFormat
final ResponseCreateEvent.Response.Builder outputAudioFormat(JsonField<ResponseCreateEvent.Response.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.
-
temperature
final ResponseCreateEvent.Response.Builder temperature(Double temperature)
Sampling temperature for the model, limited to 0.6, 1.2. Defaults to 0.8.
-
temperature
final ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder toolChoice(String toolChoice)
How the model chooses tools. Options are
auto
,none
,required
, or specify a function, like{"type": "function", "function": {"name": "my_function"}}
.
-
toolChoice
final ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder tools(List<ResponseCreateEvent.Response.Tool> tools)
Tools (functions) available to the model.
-
tools
final ResponseCreateEvent.Response.Builder tools(JsonField<List<ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder addTool(ResponseCreateEvent.Response.Tool tool)
-
voice
final ResponseCreateEvent.Response.Builder voice(ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder voice(JsonField<ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.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 ResponseCreateEvent.Response.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final ResponseCreateEvent.Response.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final ResponseCreateEvent.Response.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final ResponseCreateEvent.Response.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final ResponseCreateEvent.Response.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final ResponseCreateEvent.Response build()
Returns an immutable instance of Response.
Further updates to this Builder will not mutate the returned instance.
-
-
-
-