Class Response.Builder
-
- All Implemented Interfaces:
public final class Response.Builder
A builder for Response.
-
-
Method Summary
Modifier and Type Method Description final Response.Builder
id(String id)
Unique identifier for this Response. final Response.Builder
id(JsonField<String> id)
Sets Builder.id to an arbitrary JSON value. final Response.Builder
createdAt(Double createdAt)
Unix timestamp (in seconds) of when this Response was created. final Response.Builder
createdAt(JsonField<Double> createdAt)
Sets Builder.createdAt to an arbitrary JSON value. final Response.Builder
error(ResponseError error)
An error object returned when the model fails to generate a Response. final Response.Builder
error(Optional<ResponseError> error)
Alias for calling Builder.error with error.orElse(null)
.final Response.Builder
error(JsonField<ResponseError> error)
Sets Builder.error to an arbitrary JSON value. final Response.Builder
incompleteDetails(Response.IncompleteDetails incompleteDetails)
Details about why the response is incomplete. final Response.Builder
incompleteDetails(Optional<Response.IncompleteDetails> incompleteDetails)
Alias for calling Builder.incompleteDetails with incompleteDetails.orElse(null)
.final Response.Builder
incompleteDetails(JsonField<Response.IncompleteDetails> incompleteDetails)
Sets Builder.incompleteDetails to an arbitrary JSON value. final Response.Builder
instructions(String instructions)
Inserts a system (or developer) message as the first item in the model's context. final Response.Builder
instructions(Optional<String> instructions)
Alias for calling Builder.instructions with instructions.orElse(null)
.final Response.Builder
instructions(JsonField<String> instructions)
Sets Builder.instructions to an arbitrary JSON value. final Response.Builder
metadata(Response.Metadata metadata)
Set of 16 key-value pairs that can be attached to an object. final Response.Builder
metadata(Optional<Response.Metadata> metadata)
Alias for calling Builder.metadata with metadata.orElse(null)
.final Response.Builder
metadata(JsonField<Response.Metadata> metadata)
Sets Builder.metadata to an arbitrary JSON value. final Response.Builder
model(ResponsesModel model)
Model ID used to generate the response, like gpt-4o
oro3
.final Response.Builder
model(JsonField<ResponsesModel> model)
Sets Builder.model to an arbitrary JSON value. final Response.Builder
model(String string)
Alias for calling model with ResponsesModel.ofString(string)
.final Response.Builder
model(ChatModel chat)
Alias for calling model with ResponsesModel.ofChat(chat)
.final Response.Builder
model(ResponsesModel.ResponsesOnlyModel only)
Alias for calling model with ResponsesModel.ofOnly(only)
.final Response.Builder
object_(JsonValue object_)
Sets the field to an arbitrary JSON value. final Response.Builder
output(List<ResponseOutputItem> output)
An array of content items generated by the model. final Response.Builder
output(JsonField<List<ResponseOutputItem>> output)
Sets Builder.output to an arbitrary JSON value. final Response.Builder
addOutput(ResponseOutputItem output)
Adds a single ResponseOutputItem to Builder.output. final Response.Builder
addOutput(ResponseOutputMessage message)
Alias for calling addOutput with ResponseOutputItem.ofMessage(message)
.final Response.Builder
addOutput(ResponseFileSearchToolCall fileSearchCall)
Alias for calling addOutput with ResponseOutputItem.ofFileSearchCall(fileSearchCall)
.final Response.Builder
addOutput(ResponseFunctionToolCall functionCall)
Alias for calling addOutput with ResponseOutputItem.ofFunctionCall(functionCall)
.final Response.Builder
addOutput(ResponseFunctionWebSearch webSearchCall)
Alias for calling addOutput with ResponseOutputItem.ofWebSearchCall(webSearchCall)
.final Response.Builder
addOutput(ResponseComputerToolCall computerCall)
Alias for calling addOutput with ResponseOutputItem.ofComputerCall(computerCall)
.final Response.Builder
addOutput(ResponseReasoningItem reasoning)
Alias for calling addOutput with ResponseOutputItem.ofReasoning(reasoning)
.final Response.Builder
parallelToolCalls(Boolean parallelToolCalls)
Whether to allow the model to run tool calls in parallel. final Response.Builder
parallelToolCalls(JsonField<Boolean> parallelToolCalls)
Sets Builder.parallelToolCalls to an arbitrary JSON value. final Response.Builder
temperature(Double temperature)
What sampling temperature to use, between 0 and 2. final Response.Builder
temperature(Double temperature)
Alias for Builder.temperature. final Response.Builder
temperature(Optional<Double> temperature)
Alias for calling Builder.temperature with temperature.orElse(null)
.final Response.Builder
temperature(JsonField<Double> temperature)
Sets Builder.temperature to an arbitrary JSON value. final Response.Builder
toolChoice(Response.ToolChoice toolChoice)
How the model should select which tool (or tools) to use when generating a response. final Response.Builder
toolChoice(JsonField<Response.ToolChoice> toolChoice)
Sets Builder.toolChoice to an arbitrary JSON value. final Response.Builder
toolChoice(ToolChoiceOptions options)
Alias for calling toolChoice with ToolChoice.ofOptions(options)
.final Response.Builder
toolChoice(ToolChoiceTypes types)
Alias for calling toolChoice with ToolChoice.ofTypes(types)
.final Response.Builder
toolChoice(ToolChoiceFunction function)
Alias for calling toolChoice with ToolChoice.ofFunction(function)
.final Response.Builder
tools(List<Tool> tools)
An array of tools the model may call while generating a response. final Response.Builder
tools(JsonField<List<Tool>> tools)
Sets Builder.tools to an arbitrary JSON value. final Response.Builder
addTool(Tool tool)
Adds a single Tool to tools. final Response.Builder
addTool(FileSearchTool fileSearch)
Alias for calling addTool with Tool.ofFileSearch(fileSearch)
.final Response.Builder
addTool(FunctionTool function)
Alias for calling addTool with Tool.ofFunction(function)
.final Response.Builder
addTool(WebSearchTool webSearch)
Alias for calling addTool with Tool.ofWebSearch(webSearch)
.final Response.Builder
addTool(ComputerTool computerUsePreview)
Alias for calling addTool with Tool.ofComputerUsePreview(computerUsePreview)
.final Response.Builder
addFileSearchTool(List<String> vectorStoreIds)
Alias for calling addTool with the following: FileSearchTool.builder() .vectorStoreIds(vectorStoreIds) .build()
final Response.Builder
topP(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 Response.Builder
topP(Double topP)
Alias for Builder.topP. final Response.Builder
topP(Optional<Double> topP)
Alias for calling Builder.topP with topP.orElse(null)
.final Response.Builder
topP(JsonField<Double> topP)
Sets Builder.topP to an arbitrary JSON value. final Response.Builder
maxOutputTokens(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 Response.Builder
maxOutputTokens(Long maxOutputTokens)
Alias for Builder.maxOutputTokens. final Response.Builder
maxOutputTokens(Optional<Long> maxOutputTokens)
Alias for calling Builder.maxOutputTokens with maxOutputTokens.orElse(null)
.final Response.Builder
maxOutputTokens(JsonField<Long> maxOutputTokens)
Sets Builder.maxOutputTokens to an arbitrary JSON value. final Response.Builder
previousResponseId(String previousResponseId)
The unique ID of the previous response to the model. final Response.Builder
previousResponseId(Optional<String> previousResponseId)
Alias for calling Builder.previousResponseId with previousResponseId.orElse(null)
.final Response.Builder
previousResponseId(JsonField<String> previousResponseId)
Sets Builder.previousResponseId to an arbitrary JSON value. final Response.Builder
reasoning(Reasoning reasoning)
o-series models onlyConfiguration options for reasoning models. final Response.Builder
reasoning(Optional<Reasoning> reasoning)
Alias for calling Builder.reasoning with reasoning.orElse(null)
.final Response.Builder
reasoning(JsonField<Reasoning> reasoning)
Sets Builder.reasoning to an arbitrary JSON value. final Response.Builder
serviceTier(Response.ServiceTier serviceTier)
Specifies the latency tier to use for processing the request. final Response.Builder
serviceTier(Optional<Response.ServiceTier> serviceTier)
Alias for calling Builder.serviceTier with serviceTier.orElse(null)
.final Response.Builder
serviceTier(JsonField<Response.ServiceTier> serviceTier)
Sets Builder.serviceTier to an arbitrary JSON value. final Response.Builder
status(ResponseStatus status)
The status of the response generation. final Response.Builder
status(JsonField<ResponseStatus> status)
Sets Builder.status to an arbitrary JSON value. final Response.Builder
text(ResponseTextConfig text)
Configuration options for a text response from the model. final Response.Builder
text(JsonField<ResponseTextConfig> text)
Sets Builder.text to an arbitrary JSON value. final Response.Builder
truncation(Response.Truncation truncation)
The truncation strategy to use for the model response. final Response.Builder
truncation(Optional<Response.Truncation> truncation)
Alias for calling Builder.truncation with truncation.orElse(null)
.final Response.Builder
truncation(JsonField<Response.Truncation> truncation)
Sets Builder.truncation to an arbitrary JSON value. final Response.Builder
usage(ResponseUsage usage)
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used. final Response.Builder
usage(JsonField<ResponseUsage> usage)
Sets Builder.usage to an arbitrary JSON value. final Response.Builder
user(String user)
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. final Response.Builder
user(JsonField<String> user)
Sets Builder.user to an arbitrary JSON value. final Response.Builder
additionalProperties(Map<String, JsonValue> additionalProperties)
final Response.Builder
putAdditionalProperty(String key, JsonValue value)
final Response.Builder
putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
final Response.Builder
removeAdditionalProperty(String key)
final Response.Builder
removeAllAdditionalProperties(Set<String> keys)
final Response
build()
Returns an immutable instance of Response. -
-
Method Detail
-
id
final Response.Builder id(String id)
Unique identifier for this Response.
-
id
final Response.Builder id(JsonField<String> id)
Sets Builder.id to an arbitrary JSON value.
You should usually call Builder.id with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
createdAt
final Response.Builder createdAt(Double createdAt)
Unix timestamp (in seconds) of when this Response was created.
-
createdAt
final Response.Builder createdAt(JsonField<Double> createdAt)
Sets Builder.createdAt to an arbitrary JSON value.
You should usually call Builder.createdAt with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
error
final Response.Builder error(ResponseError error)
An error object returned when the model fails to generate a Response.
-
error
final Response.Builder error(Optional<ResponseError> error)
Alias for calling Builder.error with
error.orElse(null)
.
-
error
final Response.Builder error(JsonField<ResponseError> error)
Sets Builder.error to an arbitrary JSON value.
You should usually call Builder.error with a well-typed ResponseError value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
incompleteDetails
final Response.Builder incompleteDetails(Response.IncompleteDetails incompleteDetails)
Details about why the response is incomplete.
-
incompleteDetails
final Response.Builder incompleteDetails(Optional<Response.IncompleteDetails> incompleteDetails)
Alias for calling Builder.incompleteDetails with
incompleteDetails.orElse(null)
.
-
incompleteDetails
final Response.Builder incompleteDetails(JsonField<Response.IncompleteDetails> incompleteDetails)
Sets Builder.incompleteDetails to an arbitrary JSON value.
You should usually call Builder.incompleteDetails with a well-typed IncompleteDetails value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
instructions
final Response.Builder instructions(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 not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
-
instructions
final Response.Builder instructions(Optional<String> instructions)
Alias for calling Builder.instructions with
instructions.orElse(null)
.
-
instructions
final 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.
-
metadata
final Response.Builder metadata(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 Response.Builder metadata(Optional<Response.Metadata> metadata)
Alias for calling Builder.metadata with
metadata.orElse(null)
.
-
metadata
final Response.Builder metadata(JsonField<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.
-
model
final Response.Builder model(ResponsesModel model)
Model ID used to generate the response, like
gpt-4o
oro3
. 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.
-
model
final Response.Builder model(JsonField<ResponsesModel> model)
Sets Builder.model to an arbitrary JSON value.
You should usually call Builder.model with a well-typed ResponsesModel value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final Response.Builder model(String string)
Alias for calling model with
ResponsesModel.ofString(string)
.
-
model
final Response.Builder model(ChatModel chat)
Alias for calling model with
ResponsesModel.ofChat(chat)
.
-
model
final Response.Builder model(ResponsesModel.ResponsesOnlyModel only)
Alias for calling model with
ResponsesModel.ofOnly(only)
.
-
object_
final Response.Builder object_(JsonValue object_)
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("response")
This method is primarily for setting the field to an undocumented or not yet supported value.
-
output
final Response.Builder output(List<ResponseOutputItem> output)
An array of content items generated by the model.
The length and order of items in the
output
array is dependent on the model's response.Rather than accessing the first item in the
output
array and assuming it's anassistant
message with the content generated by the model, you might consider using theoutput_text
property where supported in SDKs.
-
output
final Response.Builder output(JsonField<List<ResponseOutputItem>> output)
Sets Builder.output to an arbitrary JSON value.
You should usually call Builder.output with a well-typed
List<ResponseOutputItem>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addOutput
final Response.Builder addOutput(ResponseOutputItem output)
Adds a single ResponseOutputItem to Builder.output.
-
addOutput
final Response.Builder addOutput(ResponseOutputMessage message)
Alias for calling addOutput with
ResponseOutputItem.ofMessage(message)
.
-
addOutput
final Response.Builder addOutput(ResponseFileSearchToolCall fileSearchCall)
Alias for calling addOutput with
ResponseOutputItem.ofFileSearchCall(fileSearchCall)
.
-
addOutput
final Response.Builder addOutput(ResponseFunctionToolCall functionCall)
Alias for calling addOutput with
ResponseOutputItem.ofFunctionCall(functionCall)
.
-
addOutput
final Response.Builder addOutput(ResponseFunctionWebSearch webSearchCall)
Alias for calling addOutput with
ResponseOutputItem.ofWebSearchCall(webSearchCall)
.
-
addOutput
final Response.Builder addOutput(ResponseComputerToolCall computerCall)
Alias for calling addOutput with
ResponseOutputItem.ofComputerCall(computerCall)
.
-
addOutput
final Response.Builder addOutput(ResponseReasoningItem reasoning)
Alias for calling addOutput with
ResponseOutputItem.ofReasoning(reasoning)
.
-
parallelToolCalls
final Response.Builder parallelToolCalls(Boolean parallelToolCalls)
Whether to allow the model to run tool calls in parallel.
-
parallelToolCalls
final Response.Builder parallelToolCalls(JsonField<Boolean> parallelToolCalls)
Sets Builder.parallelToolCalls to an arbitrary JSON value.
You should usually call Builder.parallelToolCalls with a well-typed Boolean value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
temperature
final Response.Builder temperature(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.
-
temperature
final Response.Builder temperature(Double temperature)
Alias for Builder.temperature.
This unboxed primitive overload exists for backwards compatibility.
-
temperature
final Response.Builder temperature(Optional<Double> temperature)
Alias for calling Builder.temperature with
temperature.orElse(null)
.
-
temperature
final 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 Response.Builder toolChoice(Response.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.
-
toolChoice
final Response.Builder toolChoice(JsonField<Response.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 Response.Builder toolChoice(ToolChoiceOptions options)
Alias for calling toolChoice with
ToolChoice.ofOptions(options)
.
-
toolChoice
final Response.Builder toolChoice(ToolChoiceTypes types)
Alias for calling toolChoice with
ToolChoice.ofTypes(types)
.
-
toolChoice
final Response.Builder toolChoice(ToolChoiceFunction function)
Alias for calling toolChoice with
ToolChoice.ofFunction(function)
.
-
tools
final Response.Builder tools(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.
-
tools
final Response.Builder tools(JsonField<List<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 Response.Builder addTool(Tool tool)
-
addTool
final Response.Builder addTool(FileSearchTool fileSearch)
Alias for calling addTool with
Tool.ofFileSearch(fileSearch)
.
-
addTool
final Response.Builder addTool(FunctionTool function)
Alias for calling addTool with
Tool.ofFunction(function)
.
-
addTool
final Response.Builder addTool(WebSearchTool webSearch)
Alias for calling addTool with
Tool.ofWebSearch(webSearch)
.
-
addTool
final Response.Builder addTool(ComputerTool computerUsePreview)
Alias for calling addTool with
Tool.ofComputerUsePreview(computerUsePreview)
.
-
addFileSearchTool
final Response.Builder addFileSearchTool(List<String> vectorStoreIds)
Alias for calling addTool with the following:
FileSearchTool.builder() .vectorStoreIds(vectorStoreIds) .build()
-
topP
final Response.Builder topP(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.
-
topP
final Response.Builder topP(Double topP)
Alias for Builder.topP.
This unboxed primitive overload exists for backwards compatibility.
-
topP
final Response.Builder topP(Optional<Double> topP)
Alias for calling Builder.topP with
topP.orElse(null)
.
-
topP
final Response.Builder topP(JsonField<Double> topP)
Sets Builder.topP to an arbitrary JSON value.
You should usually call Builder.topP with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
maxOutputTokens
final Response.Builder maxOutputTokens(Long maxOutputTokens)
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
-
maxOutputTokens
final Response.Builder maxOutputTokens(Long maxOutputTokens)
Alias for Builder.maxOutputTokens.
This unboxed primitive overload exists for backwards compatibility.
-
maxOutputTokens
final Response.Builder maxOutputTokens(Optional<Long> maxOutputTokens)
Alias for calling Builder.maxOutputTokens with
maxOutputTokens.orElse(null)
.
-
maxOutputTokens
final Response.Builder maxOutputTokens(JsonField<Long> maxOutputTokens)
Sets Builder.maxOutputTokens to an arbitrary JSON value.
You should usually call Builder.maxOutputTokens with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
previousResponseId
final Response.Builder previousResponseId(String previousResponseId)
The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state.
-
previousResponseId
final Response.Builder previousResponseId(Optional<String> previousResponseId)
Alias for calling Builder.previousResponseId with
previousResponseId.orElse(null)
.
-
previousResponseId
final Response.Builder previousResponseId(JsonField<String> previousResponseId)
Sets Builder.previousResponseId to an arbitrary JSON value.
You should usually call Builder.previousResponseId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
reasoning
final Response.Builder reasoning(Reasoning reasoning)
o-series models only
Configuration options for reasoning models.
-
reasoning
final Response.Builder reasoning(Optional<Reasoning> reasoning)
Alias for calling Builder.reasoning with
reasoning.orElse(null)
.
-
reasoning
final Response.Builder reasoning(JsonField<Reasoning> reasoning)
Sets Builder.reasoning to an arbitrary JSON value.
You should usually call Builder.reasoning with a well-typed Reasoning value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
serviceTier
final Response.Builder serviceTier(Response.ServiceTier serviceTier)
Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:
If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted.
If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.
If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.
If set to 'flex', the request will be processed with the Flex Processing service tier. Learn more.
When not set, the default behavior is 'auto'.
When this parameter is set, the response body will include the
service_tier
utilized.
-
serviceTier
final Response.Builder serviceTier(Optional<Response.ServiceTier> serviceTier)
Alias for calling Builder.serviceTier with
serviceTier.orElse(null)
.
-
serviceTier
final Response.Builder serviceTier(JsonField<Response.ServiceTier> serviceTier)
Sets Builder.serviceTier to an arbitrary JSON value.
You should usually call Builder.serviceTier with a well-typed ServiceTier value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
status
final Response.Builder status(ResponseStatus status)
The status of the response generation. One of
completed
,failed
,in_progress
, orincomplete
.
-
status
final Response.Builder status(JsonField<ResponseStatus> status)
Sets Builder.status to an arbitrary JSON value.
You should usually call Builder.status with a well-typed ResponseStatus value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
text
final Response.Builder text(ResponseTextConfig text)
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
text
final Response.Builder text(JsonField<ResponseTextConfig> text)
Sets Builder.text to an arbitrary JSON value.
You should usually call Builder.text with a well-typed ResponseTextConfig value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
truncation
final Response.Builder truncation(Response.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.
-
truncation
final Response.Builder truncation(Optional<Response.Truncation> truncation)
Alias for calling Builder.truncation with
truncation.orElse(null)
.
-
truncation
final Response.Builder truncation(JsonField<Response.Truncation> truncation)
Sets Builder.truncation to an arbitrary JSON value.
You should usually call Builder.truncation with a well-typed Truncation value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
usage
final Response.Builder usage(ResponseUsage usage)
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
-
usage
final Response.Builder usage(JsonField<ResponseUsage> usage)
Sets Builder.usage to an arbitrary JSON value.
You should usually call Builder.usage with a well-typed ResponseUsage value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
user
final Response.Builder user(String user)
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
-
user
final Response.Builder user(JsonField<String> user)
Sets Builder.user to an arbitrary JSON value.
You should usually call Builder.user with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final Response.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final Response.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final Response.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final Response.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final Response.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final Response build()
Returns an immutable instance of Response.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.id() .createdAt() .error() .incompleteDetails() .instructions() .metadata() .model() .output() .parallelToolCalls() .temperature() .toolChoice() .tools() .topP()
-
-
-
-