Class ResponseCreateParams.Body
-
- All Implemented Interfaces:
public final class ResponseCreateParams.Body
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
ResponseCreateParams.Body.Builder
A builder for Body.
-
Method Summary
Modifier and Type Method Description final ResponseCreateParams.Input
input()
Text, image, or file inputs to the model, used to generate a response. final ChatModel
model()
Model ID used to generate the response, like gpt-4o
oro1
.final Optional<List<ResponseIncludable>>
include()
Specify additional output data to include in the model response. final Optional<String>
instructions()
Inserts a system (or developer) message as the first item in the model's context. final Optional<Long>
maxOutputTokens()
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens. final Optional<Metadata>
metadata()
Set of 16 key-value pairs that can be attached to an object. final Optional<Boolean>
parallelToolCalls()
Whether to allow the model to run tool calls in parallel. final Optional<String>
previousResponseId()
The unique ID of the previous response to the model. final Optional<Reasoning>
reasoning()
o-series models onlyConfiguration options for reasoning models. final Optional<Boolean>
store()
Whether to store the generated model response for later retrieval via API. final Optional<Double>
temperature()
What sampling temperature to use, between 0 and 2. final Optional<ResponseTextConfig>
text()
Configuration options for a text response from the model. final Optional<ResponseCreateParams.ToolChoice>
toolChoice()
How the model should select which tool (or tools) to use when generating a response. final Optional<List<Tool>>
tools()
An array of tools the model may call while generating a response. final Optional<Double>
topP()
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. final Optional<ResponseCreateParams.Truncation>
truncation()
The truncation strategy to use for the model response. final Optional<String>
user()
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. final JsonField<ResponseCreateParams.Input>
_input()
Text, image, or file inputs to the model, used to generate a response. final JsonField<ChatModel>
_model()
Model ID used to generate the response, like gpt-4o
oro1
.final JsonField<List<ResponseIncludable>>
_include()
Specify additional output data to include in the model response. final JsonField<String>
_instructions()
Inserts a system (or developer) message as the first item in the model's context. final JsonField<Long>
_maxOutputTokens()
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens. final JsonField<Metadata>
_metadata()
Set of 16 key-value pairs that can be attached to an object. final JsonField<Boolean>
_parallelToolCalls()
Whether to allow the model to run tool calls in parallel. final JsonField<String>
_previousResponseId()
The unique ID of the previous response to the model. final JsonField<Reasoning>
_reasoning()
o-series models onlyConfiguration options for reasoning models. final JsonField<Boolean>
_store()
Whether to store the generated model response for later retrieval via API. final JsonField<Double>
_temperature()
What sampling temperature to use, between 0 and 2. final JsonField<ResponseTextConfig>
_text()
Configuration options for a text response from the model. final JsonField<ResponseCreateParams.ToolChoice>
_toolChoice()
How the model should select which tool (or tools) to use when generating a response. final JsonField<List<Tool>>
_tools()
An array of tools the model may call while generating a response. final JsonField<Double>
_topP()
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. final JsonField<ResponseCreateParams.Truncation>
_truncation()
The truncation strategy to use for the model response. final JsonField<String>
_user()
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. final Map<String, JsonValue>
_additionalProperties()
final ResponseCreateParams.Body
validate()
final ResponseCreateParams.Body.Builder
toBuilder()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static ResponseCreateParams.Body.Builder
builder()
Returns a mutable builder for constructing an instance of Body. -
-
Method Detail
-
input
final ResponseCreateParams.Input input()
Text, image, or file inputs to the model, used to generate a response.
Learn more:
-
model
final ChatModel model()
Model ID used to generate the response, like
gpt-4o
oro1
. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.
-
include
final Optional<List<ResponseIncludable>> include()
Specify additional output data to include in the model response. Currently supported values are:
file_search_call.results
: Include the search results of the file search tool call.message.input_image.image_url
: Include image urls from the input message.computer_call_output.output.image_url
: Include image urls from the computer call output.
-
instructions
final Optional<String> instructions()
Inserts a system (or developer) message as the first item in the model's context.
When using along with
previous_response_id
, the instructions from a previous response will be not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
-
maxOutputTokens
final Optional<Long> maxOutputTokens()
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
-
metadata
final Optional<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.
-
parallelToolCalls
final Optional<Boolean> parallelToolCalls()
Whether to allow the model to run tool calls in parallel.
-
previousResponseId
final Optional<String> previousResponseId()
The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state.
-
reasoning
final Optional<Reasoning> reasoning()
o-series models only
Configuration options for reasoning models.
-
store
final Optional<Boolean> store()
Whether to store the generated model response for later retrieval via API.
-
temperature
final Optional<Double> temperature()
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or
top_p
but not both.
-
text
final Optional<ResponseTextConfig> text()
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
toolChoice
final Optional<ResponseCreateParams.ToolChoice> toolChoice()
How the model should select which tool (or tools) to use when generating a response. See the
tools
parameter to see how to specify which tools the model can call.
-
tools
final Optional<List<Tool>> tools()
An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choice
parameter.The two categories of tools you can provide the model are:
Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
topP
final Optional<Double> topP()
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
We generally recommend altering this or
temperature
but not both.
-
truncation
final Optional<ResponseCreateParams.Truncation> truncation()
The truncation strategy to use for the model response.
auto
: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.disabled
(default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.
-
user
final Optional<String> user()
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
-
_input
final JsonField<ResponseCreateParams.Input> _input()
Text, image, or file inputs to the model, used to generate a response.
Learn more:
-
_model
final JsonField<ChatModel> _model()
Model ID used to generate the response, like
gpt-4o
oro1
. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.
-
_include
final JsonField<List<ResponseIncludable>> _include()
Specify additional output data to include in the model response. Currently supported values are:
file_search_call.results
: Include the search results of the file search tool call.message.input_image.image_url
: Include image urls from the input message.computer_call_output.output.image_url
: Include image urls from the computer call output.
-
_instructions
final JsonField<String> _instructions()
Inserts a system (or developer) message as the first item in the model's context.
When using along with
previous_response_id
, the instructions from a previous response will be not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
-
_maxOutputTokens
final JsonField<Long> _maxOutputTokens()
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
-
_metadata
final JsonField<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.
-
_parallelToolCalls
final JsonField<Boolean> _parallelToolCalls()
Whether to allow the model to run tool calls in parallel.
-
_previousResponseId
final JsonField<String> _previousResponseId()
The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state.
-
_reasoning
final JsonField<Reasoning> _reasoning()
o-series models only
Configuration options for reasoning models.
-
_store
final JsonField<Boolean> _store()
Whether to store the generated model response for later retrieval via API.
-
_temperature
final JsonField<Double> _temperature()
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or
top_p
but not both.
-
_text
final JsonField<ResponseTextConfig> _text()
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
_toolChoice
final JsonField<ResponseCreateParams.ToolChoice> _toolChoice()
How the model should select which tool (or tools) to use when generating a response. See the
tools
parameter to see how to specify which tools the model can call.
-
_tools
final JsonField<List<Tool>> _tools()
An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choice
parameter.The two categories of tools you can provide the model are:
Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling.
-
_topP
final JsonField<Double> _topP()
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
We generally recommend altering this or
temperature
but not both.
-
_truncation
final JsonField<ResponseCreateParams.Truncation> _truncation()
The truncation strategy to use for the model response.
auto
: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.disabled
(default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.
-
_user
final JsonField<String> _user()
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
validate
final ResponseCreateParams.Body validate()
-
toBuilder
final ResponseCreateParams.Body.Builder toBuilder()
-
builder
final static ResponseCreateParams.Body.Builder builder()
Returns a mutable builder for constructing an instance of Body.
The following fields are required:
.input() .model()
-
-
-
-