Class BetaResponse.Builder
-
- All Implemented Interfaces:
public final class BetaResponse.BuilderA builder for BetaResponse.
-
-
Method Summary
Modifier and Type Method Description final BetaResponse.Builderid(String id)Unique identifier for this Response. final BetaResponse.Builderid(JsonField<String> id)Sets Builder.id to an arbitrary JSON value. final BetaResponse.BuildercreatedAt(Double createdAt)Unix timestamp (in seconds) of when this Response was created. final BetaResponse.BuildercreatedAt(JsonField<Double> createdAt)Sets Builder.createdAt to an arbitrary JSON value. final BetaResponse.Buildererror(BetaResponseError error)An error object returned when the model fails to generate a Response. final BetaResponse.Buildererror(Optional<BetaResponseError> error)Alias for calling Builder.error with error.orElse(null).final BetaResponse.Buildererror(JsonField<BetaResponseError> error)Sets Builder.error to an arbitrary JSON value. final BetaResponse.BuilderincompleteDetails(BetaResponse.IncompleteDetails incompleteDetails)Details about why the response is incomplete. final BetaResponse.BuilderincompleteDetails(Optional<BetaResponse.IncompleteDetails> incompleteDetails)Alias for calling Builder.incompleteDetails with incompleteDetails.orElse(null).final BetaResponse.BuilderincompleteDetails(JsonField<BetaResponse.IncompleteDetails> incompleteDetails)Sets Builder.incompleteDetails to an arbitrary JSON value. final BetaResponse.Builderinstructions(BetaResponse.Instructions instructions)A system (or developer) message inserted into the model's context. final BetaResponse.Builderinstructions(Optional<BetaResponse.Instructions> instructions)Alias for calling Builder.instructions with instructions.orElse(null).final BetaResponse.Builderinstructions(JsonField<BetaResponse.Instructions> instructions)Sets Builder.instructions to an arbitrary JSON value. final BetaResponse.Builderinstructions(String string)Alias for calling instructions with Instructions.ofString(string).final BetaResponse.BuilderinstructionsOfInputItemList(List<BetaResponseInputItem> inputItemList)Alias for calling instructions with Instructions.ofInputItemList(inputItemList).final BetaResponse.Buildermetadata(BetaResponse.Metadata metadata)Set of 16 key-value pairs that can be attached to an object. final BetaResponse.Buildermetadata(Optional<BetaResponse.Metadata> metadata)Alias for calling Builder.metadata with metadata.orElse(null).final BetaResponse.Buildermetadata(JsonField<BetaResponse.Metadata> metadata)Sets Builder.metadata to an arbitrary JSON value. final BetaResponse.Buildermodel(BetaResponse.Model model)Model ID used to generate the response, like gpt-4ooro3.final BetaResponse.Buildermodel(JsonField<BetaResponse.Model> model)Sets Builder.model to an arbitrary JSON value. final BetaResponse.Buildermodel(String value)Sets model to an arbitrary String. final BetaResponse.Builderobject_(JsonValue object_)Sets the field to an arbitrary JSON value. final BetaResponse.Builderoutput(List<BetaResponseOutputItem> output)An array of content items generated by the model. final BetaResponse.Builderoutput(JsonField<List<BetaResponseOutputItem>> output)Sets Builder.output to an arbitrary JSON value. final BetaResponse.BuilderaddOutput(BetaResponseOutputItem output)Adds a single BetaResponseOutputItem to Builder.output. final BetaResponse.BuilderaddOutput(BetaResponseOutputMessage message)Alias for calling addOutput with BetaResponseOutputItem.ofMessage(message).final BetaResponse.BuilderaddOutput(BetaResponseFileSearchToolCall fileSearchCall)Alias for calling addOutput with BetaResponseOutputItem.ofFileSearchCall(fileSearchCall).final BetaResponse.BuilderaddOutput(BetaResponseFunctionToolCall functionCall)Alias for calling addOutput with BetaResponseOutputItem.ofFunctionCall(functionCall).final BetaResponse.BuilderaddOutput(BetaResponseFunctionToolCallOutputItem functionCallOutput)Alias for calling addOutput with BetaResponseOutputItem.ofFunctionCallOutput(functionCallOutput).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.AgentMessage agentMessage)Alias for calling addOutput with BetaResponseOutputItem.ofAgentMessage(agentMessage).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.MultiAgentCall multiAgentCall)Alias for calling addOutput with BetaResponseOutputItem.ofMultiAgentCall(multiAgentCall).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.MultiAgentCallOutput multiAgentCallOutput)Alias for calling addOutput with BetaResponseOutputItem.ofMultiAgentCallOutput(multiAgentCallOutput).final BetaResponse.BuilderaddOutput(BetaResponseFunctionWebSearch webSearchCall)Alias for calling addOutput with BetaResponseOutputItem.ofWebSearchCall(webSearchCall).final BetaResponse.BuilderaddOutput(BetaResponseComputerToolCall computerCall)Alias for calling addOutput with BetaResponseOutputItem.ofComputerCall(computerCall).final BetaResponse.BuilderaddOutput(BetaResponseComputerToolCallOutputItem computerCallOutput)Alias for calling addOutput with BetaResponseOutputItem.ofComputerCallOutput(computerCallOutput).final BetaResponse.BuilderaddOutput(BetaResponseReasoningItem reasoning)Alias for calling addOutput with BetaResponseOutputItem.ofReasoning(reasoning).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.Program program)Alias for calling addOutput with BetaResponseOutputItem.ofProgram(program).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.ProgramOutput programOutput)Alias for calling addOutput with BetaResponseOutputItem.ofProgramOutput(programOutput).final BetaResponse.BuilderaddOutput(BetaResponseToolSearchCall toolSearchCall)Alias for calling addOutput with BetaResponseOutputItem.ofToolSearchCall(toolSearchCall).final BetaResponse.BuilderaddOutput(BetaResponseToolSearchOutputItem toolSearchOutput)Alias for calling addOutput with BetaResponseOutputItem.ofToolSearchOutput(toolSearchOutput).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.AdditionalTools additionalTools)Alias for calling addOutput with BetaResponseOutputItem.ofAdditionalTools(additionalTools).final BetaResponse.BuilderaddOutput(BetaResponseCompactionItem compaction)Alias for calling addOutput with BetaResponseOutputItem.ofCompaction(compaction).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.ImageGenerationCall imageGenerationCall)Alias for calling addOutput with BetaResponseOutputItem.ofImageGenerationCall(imageGenerationCall).final BetaResponse.BuilderaddOutput(BetaResponseCodeInterpreterToolCall codeInterpreterCall)Alias for calling addOutput with BetaResponseOutputItem.ofCodeInterpreterCall(codeInterpreterCall).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.LocalShellCall localShellCall)Alias for calling addOutput with BetaResponseOutputItem.ofLocalShellCall(localShellCall).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.LocalShellCallOutput localShellCallOutput)Alias for calling addOutput with BetaResponseOutputItem.ofLocalShellCallOutput(localShellCallOutput).final BetaResponse.BuilderaddOutput(BetaResponseFunctionShellToolCall shellCall)Alias for calling addOutput with BetaResponseOutputItem.ofShellCall(shellCall).final BetaResponse.BuilderaddOutput(BetaResponseFunctionShellToolCallOutput shellCallOutput)Alias for calling addOutput with BetaResponseOutputItem.ofShellCallOutput(shellCallOutput).final BetaResponse.BuilderaddOutput(BetaResponseApplyPatchToolCall applyPatchCall)Alias for calling addOutput with BetaResponseOutputItem.ofApplyPatchCall(applyPatchCall).final BetaResponse.BuilderaddOutput(BetaResponseApplyPatchToolCallOutput applyPatchCallOutput)Alias for calling addOutput with BetaResponseOutputItem.ofApplyPatchCallOutput(applyPatchCallOutput).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.McpCall mcpCall)Alias for calling addOutput with BetaResponseOutputItem.ofMcpCall(mcpCall).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.McpListTools mcpListTools)Alias for calling addOutput with BetaResponseOutputItem.ofMcpListTools(mcpListTools).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.McpApprovalRequest mcpApprovalRequest)Alias for calling addOutput with BetaResponseOutputItem.ofMcpApprovalRequest(mcpApprovalRequest).final BetaResponse.BuilderaddOutput(BetaResponseOutputItem.McpApprovalResponse mcpApprovalResponse)Alias for calling addOutput with BetaResponseOutputItem.ofMcpApprovalResponse(mcpApprovalResponse).final BetaResponse.BuilderaddOutput(BetaResponseCustomToolCall customToolCall)Alias for calling addOutput with BetaResponseOutputItem.ofCustomToolCall(customToolCall).final BetaResponse.BuilderaddOutput(BetaResponseCustomToolCallOutputItem customToolCallOutput)Alias for calling addOutput with BetaResponseOutputItem.ofCustomToolCallOutput(customToolCallOutput).final BetaResponse.BuilderparallelToolCalls(Boolean parallelToolCalls)Whether to allow the model to run tool calls in parallel. final BetaResponse.BuilderparallelToolCalls(JsonField<Boolean> parallelToolCalls)Sets Builder.parallelToolCalls to an arbitrary JSON value. final BetaResponse.Buildertemperature(Double temperature)What sampling temperature to use, between 0 and 2. final BetaResponse.Buildertemperature(Double temperature)Alias for Builder.temperature. final BetaResponse.Buildertemperature(Optional<Double> temperature)Alias for calling Builder.temperature with temperature.orElse(null).final BetaResponse.Buildertemperature(JsonField<Double> temperature)Sets Builder.temperature to an arbitrary JSON value. final BetaResponse.BuildertoolChoice(BetaResponse.ToolChoice toolChoice)How the model should select which tool (or tools) to use when generating a response. final BetaResponse.BuildertoolChoice(JsonField<BetaResponse.ToolChoice> toolChoice)Sets Builder.toolChoice to an arbitrary JSON value. final BetaResponse.BuildertoolChoice(BetaToolChoiceOptions betaToolChoiceOptions)Alias for calling toolChoice with ToolChoice.ofBetaToolChoiceOptions(betaToolChoiceOptions).final BetaResponse.BuildertoolChoice(BetaToolChoiceAllowed betaToolChoiceAllowed)Alias for calling toolChoice with ToolChoice.ofBetaToolChoiceAllowed(betaToolChoiceAllowed).final BetaResponse.BuildertoolChoice(BetaToolChoiceTypes betaToolChoiceTypes)Alias for calling toolChoice with ToolChoice.ofBetaToolChoiceTypes(betaToolChoiceTypes).final BetaResponse.BuildertoolChoice(BetaToolChoiceFunction betaToolChoiceFunction)Alias for calling toolChoice with ToolChoice.ofBetaToolChoiceFunction(betaToolChoiceFunction).final BetaResponse.BuildertoolChoice(BetaToolChoiceMcp betaToolChoiceMcp)Alias for calling toolChoice with ToolChoice.ofBetaToolChoiceMcp(betaToolChoiceMcp).final BetaResponse.BuildertoolChoice(BetaToolChoiceCustom betaToolChoiceCustom)Alias for calling toolChoice with ToolChoice.ofBetaToolChoiceCustom(betaToolChoiceCustom).final BetaResponse.BuildertoolChoice(BetaToolChoiceApplyPatch betaToolChoiceApplyPatch)Alias for calling toolChoice with ToolChoice.ofBetaToolChoiceApplyPatch(betaToolChoiceApplyPatch).final BetaResponse.BuildertoolChoice(BetaToolChoiceShell betaToolChoiceShell)Alias for calling toolChoice with ToolChoice.ofBetaToolChoiceShell(betaToolChoiceShell).final BetaResponse.BuildertoolChoiceBetaSpecificProgrammaticToolCallingParam()Alias for calling toolChoice with ToolChoice.ofBetaSpecificProgrammaticToolCallingParam().final BetaResponse.Buildertools(List<BetaTool> tools)An array of tools the model may call while generating a response. final BetaResponse.Buildertools(JsonField<List<BetaTool>> tools)Sets Builder.tools to an arbitrary JSON value. final BetaResponse.BuilderaddTool(BetaTool tool)Adds a single BetaTool to tools. final BetaResponse.BuilderaddTool(BetaFunctionTool function)Alias for calling addTool with BetaTool.ofFunction(function).final BetaResponse.BuilderaddTool(BetaFileSearchTool fileSearch)Alias for calling addTool with BetaTool.ofFileSearch(fileSearch).final BetaResponse.BuilderaddTool(BetaComputerTool computer)Alias for calling addTool with BetaTool.ofComputer(computer).final BetaResponse.BuilderaddTool(BetaComputerUsePreviewTool computerUsePreview)Alias for calling addTool with BetaTool.ofComputerUsePreview(computerUsePreview).final BetaResponse.BuilderaddTool(BetaWebSearchTool webSearch)Alias for calling addTool with BetaTool.ofWebSearch(webSearch).final BetaResponse.BuilderaddTool(BetaTool.Mcp mcp)Alias for calling addTool with BetaTool.ofMcp(mcp).final BetaResponse.BuilderaddTool(BetaTool.CodeInterpreter codeInterpreter)Alias for calling addTool with BetaTool.ofCodeInterpreter(codeInterpreter).final BetaResponse.BuilderaddTool(BetaTool.ImageGeneration imageGeneration)Alias for calling addTool with BetaTool.ofImageGeneration(imageGeneration).final BetaResponse.BuilderaddTool(BetaFunctionShellTool shell)Alias for calling addTool with BetaTool.ofShell(shell).final BetaResponse.BuilderaddTool(BetaCustomTool custom)Alias for calling addTool with BetaTool.ofCustom(custom).final BetaResponse.BuilderaddTool(BetaNamespaceTool namespace)Alias for calling addTool with BetaTool.ofNamespace(namespace).final BetaResponse.BuilderaddTool(BetaToolSearchTool toolSearch)Alias for calling addTool with BetaTool.ofToolSearch(toolSearch).final BetaResponse.BuilderaddTool(BetaWebSearchPreviewTool webSearchPreview)Alias for calling addTool with BetaTool.ofWebSearchPreview(webSearchPreview).final BetaResponse.BuilderaddTool(BetaApplyPatchTool applyPatch)Alias for calling addTool with BetaTool.ofApplyPatch(applyPatch).final BetaResponse.BuilderaddFileSearchTool(List<String> vectorStoreIds)Alias for calling addTool with the following: BetaFileSearchTool.builder() .vectorStoreIds(vectorStoreIds) .build()final BetaResponse.BuilderaddMcpTool(String serverLabel)Alias for calling addTool with the following: BetaTool.Mcp.builder() .serverLabel(serverLabel) .build()final BetaResponse.BuilderaddCodeInterpreterTool(BetaTool.CodeInterpreter.Container container)Alias for calling addTool with the following: BetaTool.CodeInterpreter.builder() .container(container) .build()final BetaResponse.BuilderaddCodeInterpreterTool(String string)Alias for calling addCodeInterpreterTool with BetaTool.CodeInterpreter.Container.ofString(string).final BetaResponse.BuilderaddCodeInterpreterTool(BetaTool.CodeInterpreter.Container.CodeInterpreterToolAuto codeInterpreterToolAuto)Alias for calling addCodeInterpreterTool with BetaTool.CodeInterpreter.Container.ofCodeInterpreterToolAuto(codeInterpreterToolAuto).final BetaResponse.BuilderaddToolProgrammaticToolCalling()Alias for calling addTool with BetaTool.ofProgrammaticToolCalling().final BetaResponse.BuilderaddToolLocalShell()Alias for calling addTool with BetaTool.ofLocalShell().final BetaResponse.BuilderaddCustomTool(String name)Alias for calling addTool with the following: BetaCustomTool.builder() .name(name) .build()final BetaResponse.BuildertopP(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 BetaResponse.BuildertopP(Double topP)Alias for Builder.topP. final BetaResponse.BuildertopP(Optional<Double> topP)Alias for calling Builder.topP with topP.orElse(null).final BetaResponse.BuildertopP(JsonField<Double> topP)Sets Builder.topP to an arbitrary JSON value. final BetaResponse.Builderbackground(Boolean background)Whether to run the model response in the background. final BetaResponse.Builderbackground(Boolean background)Alias for Builder.background. final BetaResponse.Builderbackground(Optional<Boolean> background)Alias for calling Builder.background with background.orElse(null).final BetaResponse.Builderbackground(JsonField<Boolean> background)Sets Builder.background to an arbitrary JSON value. final BetaResponse.BuildercompletedAt(Double completedAt)Unix timestamp (in seconds) of when this Response was completed. final BetaResponse.BuildercompletedAt(Double completedAt)Alias for Builder.completedAt. final BetaResponse.BuildercompletedAt(Optional<Double> completedAt)Alias for calling Builder.completedAt with completedAt.orElse(null).final BetaResponse.BuildercompletedAt(JsonField<Double> completedAt)Sets Builder.completedAt to an arbitrary JSON value. final BetaResponse.Builderconversation(BetaResponse.Conversation conversation)The conversation that this response belonged to. final BetaResponse.Builderconversation(Optional<BetaResponse.Conversation> conversation)Alias for calling Builder.conversation with conversation.orElse(null).final BetaResponse.Builderconversation(JsonField<BetaResponse.Conversation> conversation)Sets Builder.conversation to an arbitrary JSON value. final BetaResponse.BuildermaxOutputTokens(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 BetaResponse.BuildermaxOutputTokens(Long maxOutputTokens)Alias for Builder.maxOutputTokens. final BetaResponse.BuildermaxOutputTokens(Optional<Long> maxOutputTokens)Alias for calling Builder.maxOutputTokens with maxOutputTokens.orElse(null).final BetaResponse.BuildermaxOutputTokens(JsonField<Long> maxOutputTokens)Sets Builder.maxOutputTokens to an arbitrary JSON value. final BetaResponse.BuildermaxToolCalls(Long maxToolCalls)The maximum number of total calls to built-in tools that can be processed in a response. final BetaResponse.BuildermaxToolCalls(Long maxToolCalls)Alias for Builder.maxToolCalls. final BetaResponse.BuildermaxToolCalls(Optional<Long> maxToolCalls)Alias for calling Builder.maxToolCalls with maxToolCalls.orElse(null).final BetaResponse.BuildermaxToolCalls(JsonField<Long> maxToolCalls)Sets Builder.maxToolCalls to an arbitrary JSON value. final BetaResponse.Buildermoderation(BetaResponse.Moderation moderation)Moderation results for the response input and output, if moderated completions were requested. final BetaResponse.Buildermoderation(Optional<BetaResponse.Moderation> moderation)Alias for calling Builder.moderation with moderation.orElse(null).final BetaResponse.Buildermoderation(JsonField<BetaResponse.Moderation> moderation)Sets Builder.moderation to an arbitrary JSON value. final BetaResponse.BuilderpreviousResponseId(String previousResponseId)The unique ID of the previous response to the model. final BetaResponse.BuilderpreviousResponseId(Optional<String> previousResponseId)Alias for calling Builder.previousResponseId with previousResponseId.orElse(null).final BetaResponse.BuilderpreviousResponseId(JsonField<String> previousResponseId)Sets Builder.previousResponseId to an arbitrary JSON value. final BetaResponse.Builderprompt(BetaResponsePrompt prompt)Reference to a prompt template and its variables. final BetaResponse.Builderprompt(Optional<BetaResponsePrompt> prompt)Alias for calling Builder.prompt with prompt.orElse(null).final BetaResponse.Builderprompt(JsonField<BetaResponsePrompt> prompt)Sets Builder.prompt to an arbitrary JSON value. final BetaResponse.BuilderpromptCacheKey(String promptCacheKey)Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. final BetaResponse.BuilderpromptCacheKey(JsonField<String> promptCacheKey)Sets Builder.promptCacheKey to an arbitrary JSON value. final BetaResponse.BuilderpromptCacheOptions(BetaResponse.PromptCacheOptions promptCacheOptions)The prompt-caching options that were applied to the response. final BetaResponse.BuilderpromptCacheOptions(JsonField<BetaResponse.PromptCacheOptions> promptCacheOptions)Sets Builder.promptCacheOptions to an arbitrary JSON value. final BetaResponse.BuilderpromptCacheRetention(BetaResponse.PromptCacheRetention promptCacheRetention)Deprecated. final BetaResponse.BuilderpromptCacheRetention(Optional<BetaResponse.PromptCacheRetention> promptCacheRetention)Alias for calling Builder.promptCacheRetention with promptCacheRetention.orElse(null).final BetaResponse.BuilderpromptCacheRetention(JsonField<BetaResponse.PromptCacheRetention> promptCacheRetention)Sets Builder.promptCacheRetention to an arbitrary JSON value. final BetaResponse.Builderreasoning(BetaResponse.Reasoning reasoning)gpt-5 and o-series models onlyConfiguration options for reasoning models. final BetaResponse.Builderreasoning(Optional<BetaResponse.Reasoning> reasoning)Alias for calling Builder.reasoning with reasoning.orElse(null).final BetaResponse.Builderreasoning(JsonField<BetaResponse.Reasoning> reasoning)Sets Builder.reasoning to an arbitrary JSON value. final BetaResponse.BuildersafetyIdentifier(String safetyIdentifier)A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. final BetaResponse.BuildersafetyIdentifier(JsonField<String> safetyIdentifier)Sets Builder.safetyIdentifier to an arbitrary JSON value. final BetaResponse.BuilderserviceTier(BetaResponse.ServiceTier serviceTier)Specifies the processing type used for serving the request. final BetaResponse.BuilderserviceTier(Optional<BetaResponse.ServiceTier> serviceTier)Alias for calling Builder.serviceTier with serviceTier.orElse(null).final BetaResponse.BuilderserviceTier(JsonField<BetaResponse.ServiceTier> serviceTier)Sets Builder.serviceTier to an arbitrary JSON value. final BetaResponse.Builderstatus(BetaResponseStatus status)The status of the response generation. final BetaResponse.Builderstatus(JsonField<BetaResponseStatus> status)Sets Builder.status to an arbitrary JSON value. final BetaResponse.Buildertext(BetaResponseTextConfig text)Configuration options for a text response from the model. final BetaResponse.Buildertext(JsonField<BetaResponseTextConfig> text)Sets Builder.text to an arbitrary JSON value. final BetaResponse.BuildertopLogprobs(Long topLogprobs)An integer between 0 and 20 specifying the maximum number of most likely tokens to return at each token position, each with an associated log probability. final BetaResponse.BuildertopLogprobs(Long topLogprobs)Alias for Builder.topLogprobs. final BetaResponse.BuildertopLogprobs(Optional<Long> topLogprobs)Alias for calling Builder.topLogprobs with topLogprobs.orElse(null).final BetaResponse.BuildertopLogprobs(JsonField<Long> topLogprobs)Sets Builder.topLogprobs to an arbitrary JSON value. final BetaResponse.Buildertruncation(BetaResponse.Truncation truncation)The truncation strategy to use for the model response. final BetaResponse.Buildertruncation(Optional<BetaResponse.Truncation> truncation)Alias for calling Builder.truncation with truncation.orElse(null).final BetaResponse.Buildertruncation(JsonField<BetaResponse.Truncation> truncation)Sets Builder.truncation to an arbitrary JSON value. final BetaResponse.Builderusage(BetaResponseUsage usage)Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used. final BetaResponse.Builderusage(JsonField<BetaResponseUsage> usage)Sets Builder.usage to an arbitrary JSON value. final BetaResponse.Builderuser(String user)This field is being replaced by safety_identifierandprompt_cache_key.final BetaResponse.Builderuser(JsonField<String> user)Sets Builder.user to an arbitrary JSON value. final BetaResponse.BuilderadditionalProperties(Map<String, JsonValue> additionalProperties)final BetaResponse.BuilderputAdditionalProperty(String key, JsonValue value)final BetaResponse.BuilderputAllAdditionalProperties(Map<String, JsonValue> additionalProperties)final BetaResponse.BuilderremoveAdditionalProperty(String key)final BetaResponse.BuilderremoveAllAdditionalProperties(Set<String> keys)final BetaResponsebuild()Returns an immutable instance of BetaResponse. -
-
Method Detail
-
id
final BetaResponse.Builder id(String id)
Unique identifier for this Response.
-
id
final BetaResponse.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 BetaResponse.Builder createdAt(Double createdAt)
Unix timestamp (in seconds) of when this Response was created.
-
createdAt
final BetaResponse.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 BetaResponse.Builder error(BetaResponseError error)
An error object returned when the model fails to generate a Response.
-
error
final BetaResponse.Builder error(Optional<BetaResponseError> error)
Alias for calling Builder.error with
error.orElse(null).
-
error
final BetaResponse.Builder error(JsonField<BetaResponseError> error)
Sets Builder.error to an arbitrary JSON value.
You should usually call Builder.error with a well-typed BetaResponseError value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
incompleteDetails
final BetaResponse.Builder incompleteDetails(BetaResponse.IncompleteDetails incompleteDetails)
Details about why the response is incomplete.
-
incompleteDetails
final BetaResponse.Builder incompleteDetails(Optional<BetaResponse.IncompleteDetails> incompleteDetails)
Alias for calling Builder.incompleteDetails with
incompleteDetails.orElse(null).
-
incompleteDetails
final BetaResponse.Builder incompleteDetails(JsonField<BetaResponse.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 BetaResponse.Builder instructions(BetaResponse.Instructions instructions)
A system (or developer) message inserted into 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 BetaResponse.Builder instructions(Optional<BetaResponse.Instructions> instructions)
Alias for calling Builder.instructions with
instructions.orElse(null).
-
instructions
final BetaResponse.Builder instructions(JsonField<BetaResponse.Instructions> instructions)
Sets Builder.instructions to an arbitrary JSON value.
You should usually call Builder.instructions with a well-typed Instructions value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
instructions
final BetaResponse.Builder instructions(String string)
Alias for calling instructions with
Instructions.ofString(string).
-
instructionsOfInputItemList
final BetaResponse.Builder instructionsOfInputItemList(List<BetaResponseInputItem> inputItemList)
Alias for calling instructions with
Instructions.ofInputItemList(inputItemList).
-
metadata
final BetaResponse.Builder metadata(BetaResponse.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 BetaResponse.Builder metadata(Optional<BetaResponse.Metadata> metadata)
Alias for calling Builder.metadata with
metadata.orElse(null).
-
metadata
final BetaResponse.Builder metadata(JsonField<BetaResponse.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 BetaResponse.Builder model(BetaResponse.Model model)
Model ID used to generate the response, like
gpt-4ooro3. 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 BetaResponse.Builder model(JsonField<BetaResponse.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 BetaResponse.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.
-
object_
final BetaResponse.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 BetaResponse.Builder output(List<BetaResponseOutputItem> output)
An array of content items generated by the model.
The length and order of items in the
outputarray is dependent on the model's response.Rather than accessing the first item in the
outputarray and assuming it's anassistantmessage with the content generated by the model, you might consider using theoutput_textproperty where supported in SDKs.
-
output
final BetaResponse.Builder output(JsonField<List<BetaResponseOutputItem>> output)
Sets Builder.output to an arbitrary JSON value.
You should usually call Builder.output with a well-typed
List<BetaResponseOutputItem>value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem output)
Adds a single BetaResponseOutputItem to Builder.output.
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputMessage message)
Alias for calling addOutput with
BetaResponseOutputItem.ofMessage(message).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseFileSearchToolCall fileSearchCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofFileSearchCall(fileSearchCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseFunctionToolCall functionCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofFunctionCall(functionCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseFunctionToolCallOutputItem functionCallOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofFunctionCallOutput(functionCallOutput).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.AgentMessage agentMessage)
Alias for calling addOutput with
BetaResponseOutputItem.ofAgentMessage(agentMessage).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.MultiAgentCall multiAgentCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofMultiAgentCall(multiAgentCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.MultiAgentCallOutput multiAgentCallOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofMultiAgentCallOutput(multiAgentCallOutput).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseFunctionWebSearch webSearchCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofWebSearchCall(webSearchCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseComputerToolCall computerCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofComputerCall(computerCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseComputerToolCallOutputItem computerCallOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofComputerCallOutput(computerCallOutput).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseReasoningItem reasoning)
Alias for calling addOutput with
BetaResponseOutputItem.ofReasoning(reasoning).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.Program program)
Alias for calling addOutput with
BetaResponseOutputItem.ofProgram(program).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.ProgramOutput programOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofProgramOutput(programOutput).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseToolSearchCall toolSearchCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofToolSearchCall(toolSearchCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseToolSearchOutputItem toolSearchOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofToolSearchOutput(toolSearchOutput).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.AdditionalTools additionalTools)
Alias for calling addOutput with
BetaResponseOutputItem.ofAdditionalTools(additionalTools).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseCompactionItem compaction)
Alias for calling addOutput with
BetaResponseOutputItem.ofCompaction(compaction).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.ImageGenerationCall imageGenerationCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofImageGenerationCall(imageGenerationCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseCodeInterpreterToolCall codeInterpreterCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofCodeInterpreterCall(codeInterpreterCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.LocalShellCall localShellCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofLocalShellCall(localShellCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.LocalShellCallOutput localShellCallOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofLocalShellCallOutput(localShellCallOutput).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseFunctionShellToolCall shellCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofShellCall(shellCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseFunctionShellToolCallOutput shellCallOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofShellCallOutput(shellCallOutput).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseApplyPatchToolCall applyPatchCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofApplyPatchCall(applyPatchCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseApplyPatchToolCallOutput applyPatchCallOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofApplyPatchCallOutput(applyPatchCallOutput).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.McpCall mcpCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofMcpCall(mcpCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.McpListTools mcpListTools)
Alias for calling addOutput with
BetaResponseOutputItem.ofMcpListTools(mcpListTools).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.McpApprovalRequest mcpApprovalRequest)
Alias for calling addOutput with
BetaResponseOutputItem.ofMcpApprovalRequest(mcpApprovalRequest).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseOutputItem.McpApprovalResponse mcpApprovalResponse)
Alias for calling addOutput with
BetaResponseOutputItem.ofMcpApprovalResponse(mcpApprovalResponse).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseCustomToolCall customToolCall)
Alias for calling addOutput with
BetaResponseOutputItem.ofCustomToolCall(customToolCall).
-
addOutput
final BetaResponse.Builder addOutput(BetaResponseCustomToolCallOutputItem customToolCallOutput)
Alias for calling addOutput with
BetaResponseOutputItem.ofCustomToolCallOutput(customToolCallOutput).
-
parallelToolCalls
final BetaResponse.Builder parallelToolCalls(Boolean parallelToolCalls)
Whether to allow the model to run tool calls in parallel.
-
parallelToolCalls
final BetaResponse.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 BetaResponse.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_pbut not both.
-
temperature
final BetaResponse.Builder temperature(Double temperature)
Alias for Builder.temperature.
This unboxed primitive overload exists for backwards compatibility.
-
temperature
final BetaResponse.Builder temperature(Optional<Double> temperature)
Alias for calling Builder.temperature with
temperature.orElse(null).
-
temperature
final BetaResponse.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 BetaResponse.Builder toolChoice(BetaResponse.ToolChoice toolChoice)
How the model should select which tool (or tools) to use when generating a response. See the
toolsparameter to see how to specify which tools the model can call.
-
toolChoice
final BetaResponse.Builder toolChoice(JsonField<BetaResponse.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 BetaResponse.Builder toolChoice(BetaToolChoiceOptions betaToolChoiceOptions)
Alias for calling toolChoice with
ToolChoice.ofBetaToolChoiceOptions(betaToolChoiceOptions).
-
toolChoice
final BetaResponse.Builder toolChoice(BetaToolChoiceAllowed betaToolChoiceAllowed)
Alias for calling toolChoice with
ToolChoice.ofBetaToolChoiceAllowed(betaToolChoiceAllowed).
-
toolChoice
final BetaResponse.Builder toolChoice(BetaToolChoiceTypes betaToolChoiceTypes)
Alias for calling toolChoice with
ToolChoice.ofBetaToolChoiceTypes(betaToolChoiceTypes).
-
toolChoice
final BetaResponse.Builder toolChoice(BetaToolChoiceFunction betaToolChoiceFunction)
Alias for calling toolChoice with
ToolChoice.ofBetaToolChoiceFunction(betaToolChoiceFunction).
-
toolChoice
final BetaResponse.Builder toolChoice(BetaToolChoiceMcp betaToolChoiceMcp)
Alias for calling toolChoice with
ToolChoice.ofBetaToolChoiceMcp(betaToolChoiceMcp).
-
toolChoice
final BetaResponse.Builder toolChoice(BetaToolChoiceCustom betaToolChoiceCustom)
Alias for calling toolChoice with
ToolChoice.ofBetaToolChoiceCustom(betaToolChoiceCustom).
-
toolChoice
final BetaResponse.Builder toolChoice(BetaToolChoiceApplyPatch betaToolChoiceApplyPatch)
Alias for calling toolChoice with
ToolChoice.ofBetaToolChoiceApplyPatch(betaToolChoiceApplyPatch).
-
toolChoice
final BetaResponse.Builder toolChoice(BetaToolChoiceShell betaToolChoiceShell)
Alias for calling toolChoice with
ToolChoice.ofBetaToolChoiceShell(betaToolChoiceShell).
-
toolChoiceBetaSpecificProgrammaticToolCallingParam
final BetaResponse.Builder toolChoiceBetaSpecificProgrammaticToolCallingParam()
Alias for calling toolChoice with
ToolChoice.ofBetaSpecificProgrammaticToolCallingParam().
-
tools
final BetaResponse.Builder tools(List<BetaTool> tools)
An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.We support the following categories of tools:
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.
MCP Tools: Integrations with third-party systems via custom MCP servers or predefined connectors such as Google Drive and SharePoint. Learn more about MCP Tools.
Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code with strongly typed arguments and outputs. Learn more about function calling. You can also use custom tools to call your own code.
-
tools
final BetaResponse.Builder tools(JsonField<List<BetaTool>> tools)
Sets Builder.tools to an arbitrary JSON value.
You should usually call Builder.tools with a well-typed
List<BetaTool>value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addTool
final BetaResponse.Builder addTool(BetaTool tool)
-
addTool
final BetaResponse.Builder addTool(BetaFunctionTool function)
Alias for calling addTool with
BetaTool.ofFunction(function).
-
addTool
final BetaResponse.Builder addTool(BetaFileSearchTool fileSearch)
Alias for calling addTool with
BetaTool.ofFileSearch(fileSearch).
-
addTool
final BetaResponse.Builder addTool(BetaComputerTool computer)
Alias for calling addTool with
BetaTool.ofComputer(computer).
-
addTool
final BetaResponse.Builder addTool(BetaComputerUsePreviewTool computerUsePreview)
Alias for calling addTool with
BetaTool.ofComputerUsePreview(computerUsePreview).
-
addTool
final BetaResponse.Builder addTool(BetaWebSearchTool webSearch)
Alias for calling addTool with
BetaTool.ofWebSearch(webSearch).
-
addTool
final BetaResponse.Builder addTool(BetaTool.Mcp mcp)
Alias for calling addTool with
BetaTool.ofMcp(mcp).
-
addTool
final BetaResponse.Builder addTool(BetaTool.CodeInterpreter codeInterpreter)
Alias for calling addTool with
BetaTool.ofCodeInterpreter(codeInterpreter).
-
addTool
final BetaResponse.Builder addTool(BetaTool.ImageGeneration imageGeneration)
Alias for calling addTool with
BetaTool.ofImageGeneration(imageGeneration).
-
addTool
final BetaResponse.Builder addTool(BetaFunctionShellTool shell)
Alias for calling addTool with
BetaTool.ofShell(shell).
-
addTool
final BetaResponse.Builder addTool(BetaCustomTool custom)
Alias for calling addTool with
BetaTool.ofCustom(custom).
-
addTool
final BetaResponse.Builder addTool(BetaNamespaceTool namespace)
Alias for calling addTool with
BetaTool.ofNamespace(namespace).
-
addTool
final BetaResponse.Builder addTool(BetaToolSearchTool toolSearch)
Alias for calling addTool with
BetaTool.ofToolSearch(toolSearch).
-
addTool
final BetaResponse.Builder addTool(BetaWebSearchPreviewTool webSearchPreview)
Alias for calling addTool with
BetaTool.ofWebSearchPreview(webSearchPreview).
-
addTool
final BetaResponse.Builder addTool(BetaApplyPatchTool applyPatch)
Alias for calling addTool with
BetaTool.ofApplyPatch(applyPatch).
-
addFileSearchTool
final BetaResponse.Builder addFileSearchTool(List<String> vectorStoreIds)
Alias for calling addTool with the following:
BetaFileSearchTool.builder() .vectorStoreIds(vectorStoreIds) .build()
-
addMcpTool
final BetaResponse.Builder addMcpTool(String serverLabel)
Alias for calling addTool with the following:
BetaTool.Mcp.builder() .serverLabel(serverLabel) .build()
-
addCodeInterpreterTool
final BetaResponse.Builder addCodeInterpreterTool(BetaTool.CodeInterpreter.Container container)
Alias for calling addTool with the following:
BetaTool.CodeInterpreter.builder() .container(container) .build()
-
addCodeInterpreterTool
final BetaResponse.Builder addCodeInterpreterTool(String string)
Alias for calling addCodeInterpreterTool with
BetaTool.CodeInterpreter.Container.ofString(string).
-
addCodeInterpreterTool
final BetaResponse.Builder addCodeInterpreterTool(BetaTool.CodeInterpreter.Container.CodeInterpreterToolAuto codeInterpreterToolAuto)
Alias for calling addCodeInterpreterTool with
BetaTool.CodeInterpreter.Container.ofCodeInterpreterToolAuto(codeInterpreterToolAuto).
-
addToolProgrammaticToolCalling
final BetaResponse.Builder addToolProgrammaticToolCalling()
Alias for calling addTool with
BetaTool.ofProgrammaticToolCalling().
-
addToolLocalShell
final BetaResponse.Builder addToolLocalShell()
Alias for calling addTool with
BetaTool.ofLocalShell().
-
addCustomTool
final BetaResponse.Builder addCustomTool(String name)
Alias for calling addTool with the following:
BetaCustomTool.builder() .name(name) .build()
-
topP
final BetaResponse.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
temperaturebut not both.
-
topP
final BetaResponse.Builder topP(Double topP)
Alias for Builder.topP.
This unboxed primitive overload exists for backwards compatibility.
-
topP
final BetaResponse.Builder topP(Optional<Double> topP)
Alias for calling Builder.topP with
topP.orElse(null).
-
topP
final BetaResponse.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.
-
background
final BetaResponse.Builder background(Boolean background)
Whether to run the model response in the background. Learn more.
-
background
final BetaResponse.Builder background(Boolean background)
Alias for Builder.background.
This unboxed primitive overload exists for backwards compatibility.
-
background
final BetaResponse.Builder background(Optional<Boolean> background)
Alias for calling Builder.background with
background.orElse(null).
-
background
final BetaResponse.Builder background(JsonField<Boolean> background)
Sets Builder.background to an arbitrary JSON value.
You should usually call Builder.background with a well-typed Boolean value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
completedAt
final BetaResponse.Builder completedAt(Double completedAt)
Unix timestamp (in seconds) of when this Response was completed. Only present when the status is
completed.
-
completedAt
final BetaResponse.Builder completedAt(Double completedAt)
Alias for Builder.completedAt.
This unboxed primitive overload exists for backwards compatibility.
-
completedAt
final BetaResponse.Builder completedAt(Optional<Double> completedAt)
Alias for calling Builder.completedAt with
completedAt.orElse(null).
-
completedAt
final BetaResponse.Builder completedAt(JsonField<Double> completedAt)
Sets Builder.completedAt to an arbitrary JSON value.
You should usually call Builder.completedAt with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
conversation
final BetaResponse.Builder conversation(BetaResponse.Conversation conversation)
The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation.
-
conversation
final BetaResponse.Builder conversation(Optional<BetaResponse.Conversation> conversation)
Alias for calling Builder.conversation with
conversation.orElse(null).
-
conversation
final BetaResponse.Builder conversation(JsonField<BetaResponse.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.
-
maxOutputTokens
final BetaResponse.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 BetaResponse.Builder maxOutputTokens(Long maxOutputTokens)
Alias for Builder.maxOutputTokens.
This unboxed primitive overload exists for backwards compatibility.
-
maxOutputTokens
final BetaResponse.Builder maxOutputTokens(Optional<Long> maxOutputTokens)
Alias for calling Builder.maxOutputTokens with
maxOutputTokens.orElse(null).
-
maxOutputTokens
final BetaResponse.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.
-
maxToolCalls
final BetaResponse.Builder maxToolCalls(Long maxToolCalls)
The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.
-
maxToolCalls
final BetaResponse.Builder maxToolCalls(Long maxToolCalls)
Alias for Builder.maxToolCalls.
This unboxed primitive overload exists for backwards compatibility.
-
maxToolCalls
final BetaResponse.Builder maxToolCalls(Optional<Long> maxToolCalls)
Alias for calling Builder.maxToolCalls with
maxToolCalls.orElse(null).
-
maxToolCalls
final BetaResponse.Builder maxToolCalls(JsonField<Long> maxToolCalls)
Sets Builder.maxToolCalls to an arbitrary JSON value.
You should usually call Builder.maxToolCalls with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
moderation
final BetaResponse.Builder moderation(BetaResponse.Moderation moderation)
Moderation results for the response input and output, if moderated completions were requested.
-
moderation
final BetaResponse.Builder moderation(Optional<BetaResponse.Moderation> moderation)
Alias for calling Builder.moderation with
moderation.orElse(null).
-
moderation
final BetaResponse.Builder moderation(JsonField<BetaResponse.Moderation> moderation)
Sets Builder.moderation to an arbitrary JSON value.
You should usually call Builder.moderation with a well-typed Moderation value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
previousResponseId
final BetaResponse.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. Cannot be used in conjunction with
conversation.
-
previousResponseId
final BetaResponse.Builder previousResponseId(Optional<String> previousResponseId)
Alias for calling Builder.previousResponseId with
previousResponseId.orElse(null).
-
previousResponseId
final BetaResponse.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.
-
prompt
final BetaResponse.Builder prompt(BetaResponsePrompt prompt)
Reference to a prompt template and its variables. Learn more.
-
prompt
final BetaResponse.Builder prompt(Optional<BetaResponsePrompt> prompt)
Alias for calling Builder.prompt with
prompt.orElse(null).
-
prompt
final BetaResponse.Builder prompt(JsonField<BetaResponsePrompt> prompt)
Sets Builder.prompt to an arbitrary JSON value.
You should usually call Builder.prompt with a well-typed BetaResponsePrompt value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
promptCacheKey
final BetaResponse.Builder promptCacheKey(String promptCacheKey)
Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the
userfield. Learn more.
-
promptCacheKey
final BetaResponse.Builder promptCacheKey(JsonField<String> promptCacheKey)
Sets Builder.promptCacheKey to an arbitrary JSON value.
You should usually call Builder.promptCacheKey with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
promptCacheOptions
final BetaResponse.Builder promptCacheOptions(BetaResponse.PromptCacheOptions promptCacheOptions)
The prompt-caching options that were applied to the response. Supported for
gpt-5.6and later models.
-
promptCacheOptions
final BetaResponse.Builder promptCacheOptions(JsonField<BetaResponse.PromptCacheOptions> promptCacheOptions)
Sets Builder.promptCacheOptions to an arbitrary JSON value.
You should usually call Builder.promptCacheOptions with a well-typed PromptCacheOptions value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
promptCacheRetention
@Deprecated(message = "deprecated") final BetaResponse.Builder promptCacheRetention(BetaResponse.PromptCacheRetention promptCacheRetention)
Deprecated. Use
prompt_cache_options.ttlinstead.The retention policy for the prompt cache. Set to
24hto enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. Learn more. This field expresses a maximum retention policy, whileprompt_cache_options.ttlexpresses a minimum cache lifetime. The two fields are independent and do not interact. Forgpt-5.5,gpt-5.5-pro, and future models, only24his supported.For older models that support both
in_memoryand24h, the default depends on your organization's data retention policy:Organizations without ZDR enabled default to
24h.Organizations with ZDR enabled default to
in_memorywhenprompt_cache_retentionis not specified.
-
promptCacheRetention
@Deprecated(message = "deprecated") final BetaResponse.Builder promptCacheRetention(Optional<BetaResponse.PromptCacheRetention> promptCacheRetention)
Alias for calling Builder.promptCacheRetention with
promptCacheRetention.orElse(null).
-
promptCacheRetention
@Deprecated(message = "deprecated") final BetaResponse.Builder promptCacheRetention(JsonField<BetaResponse.PromptCacheRetention> promptCacheRetention)
Sets Builder.promptCacheRetention to an arbitrary JSON value.
You should usually call Builder.promptCacheRetention with a well-typed PromptCacheRetention value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
reasoning
final BetaResponse.Builder reasoning(BetaResponse.Reasoning reasoning)
gpt-5 and o-series models only
Configuration options for reasoning models.
-
reasoning
final BetaResponse.Builder reasoning(Optional<BetaResponse.Reasoning> reasoning)
Alias for calling Builder.reasoning with
reasoning.orElse(null).
-
reasoning
final BetaResponse.Builder reasoning(JsonField<BetaResponse.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.
-
safetyIdentifier
final BetaResponse.Builder safetyIdentifier(String safetyIdentifier)
A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.
-
safetyIdentifier
final BetaResponse.Builder safetyIdentifier(JsonField<String> safetyIdentifier)
Sets Builder.safetyIdentifier to an arbitrary JSON value.
You should usually call Builder.safetyIdentifier with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
serviceTier
final BetaResponse.Builder serviceTier(BetaResponse.ServiceTier serviceTier)
Specifies the processing type used for serving the request.
If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
When not set, the default behavior is 'auto'.
When the
service_tierparameter is set, the response body will include theservice_tiervalue based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.
-
serviceTier
final BetaResponse.Builder serviceTier(Optional<BetaResponse.ServiceTier> serviceTier)
Alias for calling Builder.serviceTier with
serviceTier.orElse(null).
-
serviceTier
final BetaResponse.Builder serviceTier(JsonField<BetaResponse.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 BetaResponse.Builder status(BetaResponseStatus status)
The status of the response generation. One of
completed,failed,in_progress,cancelled,queued, orincomplete.
-
status
final BetaResponse.Builder status(JsonField<BetaResponseStatus> status)
Sets Builder.status to an arbitrary JSON value.
You should usually call Builder.status with a well-typed BetaResponseStatus value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
text
final BetaResponse.Builder text(BetaResponseTextConfig text)
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
text
final BetaResponse.Builder text(JsonField<BetaResponseTextConfig> text)
Sets Builder.text to an arbitrary JSON value.
You should usually call Builder.text with a well-typed BetaResponseTextConfig value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
topLogprobs
final BetaResponse.Builder topLogprobs(Long topLogprobs)
An integer between 0 and 20 specifying the maximum number of most likely tokens to return at each token position, each with an associated log probability. In some cases, the number of returned tokens may be fewer than requested.
-
topLogprobs
final BetaResponse.Builder topLogprobs(Long topLogprobs)
Alias for Builder.topLogprobs.
This unboxed primitive overload exists for backwards compatibility.
-
topLogprobs
final BetaResponse.Builder topLogprobs(Optional<Long> topLogprobs)
Alias for calling Builder.topLogprobs with
topLogprobs.orElse(null).
-
topLogprobs
final BetaResponse.Builder topLogprobs(JsonField<Long> topLogprobs)
Sets Builder.topLogprobs to an arbitrary JSON value.
You should usually call Builder.topLogprobs with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
truncation
final BetaResponse.Builder truncation(BetaResponse.Truncation truncation)
The truncation strategy to use for the model response.
auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation.disabled(default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
-
truncation
final BetaResponse.Builder truncation(Optional<BetaResponse.Truncation> truncation)
Alias for calling Builder.truncation with
truncation.orElse(null).
-
truncation
final BetaResponse.Builder truncation(JsonField<BetaResponse.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 BetaResponse.Builder usage(BetaResponseUsage usage)
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
-
usage
final BetaResponse.Builder usage(JsonField<BetaResponseUsage> usage)
Sets Builder.usage to an arbitrary JSON value.
You should usually call Builder.usage with a well-typed BetaResponseUsage value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
user
@Deprecated(message = "deprecated") final BetaResponse.Builder user(String user)
This field is being replaced by
safety_identifierandprompt_cache_key. Useprompt_cache_keyinstead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.
-
user
@Deprecated(message = "deprecated") final BetaResponse.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 BetaResponse.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final BetaResponse.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final BetaResponse.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final BetaResponse.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final BetaResponse.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final BetaResponse build()
Returns an immutable instance of BetaResponse.
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()
-
-
-
-