Class ResponseCreateEvent.Response
-
- All Implemented Interfaces:
public final class ResponseCreateEvent.Response
Create a new Realtime response with these parameters
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
ResponseCreateEvent.Response.Builder
A builder for Response.
public final class
ResponseCreateEvent.Response.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.public final class
ResponseCreateEvent.Response.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
.public final class
ResponseCreateEvent.Response.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.
public final class
ResponseCreateEvent.Response.Modality
public final class
ResponseCreateEvent.Response.OutputAudioFormat
The format of output audio. Options are
pcm16
,g711_ulaw
, org711_alaw
.public final class
ResponseCreateEvent.Response.ToolChoice
How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
public final class
ResponseCreateEvent.Response.Tool
public final class
ResponseCreateEvent.Response.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
.
-
Method Summary
-
-
Method Detail
-
conversation
final Optional<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.
-
input
final Optional<List<ConversationItem>> 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.
-
instructions
final Optional<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.
-
maxOutputTokens
final Optional<ResponseCreateEvent.Response.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
.
-
metadata
final Optional<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.
-
modalities
final Optional<List<ResponseCreateEvent.Response.Modality>> modalities()
The set of modalities the model can respond with. To disable audio, set this to "text".
-
outputAudioFormat
final Optional<ResponseCreateEvent.Response.OutputAudioFormat> outputAudioFormat()
The format of output audio. Options are
pcm16
,g711_ulaw
, org711_alaw
.
-
prompt
final Optional<ResponsePrompt> prompt()
Reference to a prompt template and its variables. Learn more.
-
temperature
final Optional<Double> temperature()
Sampling temperature for the model, limited to 0.6, 1.2. Defaults to 0.8.
-
toolChoice
final Optional<ResponseCreateEvent.Response.ToolChoice> toolChoice()
How the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
-
tools
final Optional<List<ResponseCreateEvent.Response.Tool>> tools()
Tools (functions) available to the model.
-
voice
final Optional<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
.
-
_conversation
final JsonField<ResponseCreateEvent.Response.Conversation> _conversation()
Returns the raw JSON value of conversation.
Unlike conversation, this method doesn't throw if the JSON field has an unexpected type.
-
_input
final JsonField<List<ConversationItem>> _input()
Returns the raw JSON value of input.
Unlike input, this method doesn't throw if the JSON field has an unexpected type.
-
_instructions
final JsonField<String> _instructions()
Returns the raw JSON value of instructions.
Unlike instructions, this method doesn't throw if the JSON field has an unexpected type.
-
_maxOutputTokens
final JsonField<ResponseCreateEvent.Response.MaxOutputTokens> _maxOutputTokens()
Returns the raw JSON value of maxOutputTokens.
Unlike maxOutputTokens, this method doesn't throw if the JSON field has an unexpected type.
-
_metadata
final JsonField<ResponseCreateEvent.Response.Metadata> _metadata()
Returns the raw JSON value of metadata.
Unlike metadata, this method doesn't throw if the JSON field has an unexpected type.
-
_modalities
final JsonField<List<ResponseCreateEvent.Response.Modality>> _modalities()
Returns the raw JSON value of modalities.
Unlike modalities, this method doesn't throw if the JSON field has an unexpected type.
-
_outputAudioFormat
final JsonField<ResponseCreateEvent.Response.OutputAudioFormat> _outputAudioFormat()
Returns the raw JSON value of outputAudioFormat.
Unlike outputAudioFormat, this method doesn't throw if the JSON field has an unexpected type.
-
_prompt
final JsonField<ResponsePrompt> _prompt()
Returns the raw JSON value of prompt.
Unlike prompt, this method doesn't throw if the JSON field has an unexpected type.
-
_temperature
final JsonField<Double> _temperature()
Returns the raw JSON value of temperature.
Unlike temperature, this method doesn't throw if the JSON field has an unexpected type.
-
_toolChoice
final JsonField<ResponseCreateEvent.Response.ToolChoice> _toolChoice()
Returns the raw JSON value of toolChoice.
Unlike toolChoice, this method doesn't throw if the JSON field has an unexpected type.
-
_tools
final JsonField<List<ResponseCreateEvent.Response.Tool>> _tools()
Returns the raw JSON value of tools.
Unlike tools, this method doesn't throw if the JSON field has an unexpected type.
-
_voice
final JsonField<ResponseCreateEvent.Response.Voice> _voice()
Returns the raw JSON value of voice.
Unlike voice, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final ResponseCreateEvent.Response.Builder toBuilder()
-
validate
final ResponseCreateEvent.Response validate()
-
builder
final static ResponseCreateEvent.Response.Builder builder()
Returns a mutable builder for constructing an instance of Response.
-
-
-
-