Class BetaResponseItem
-
- All Implemented Interfaces:
public final class BetaResponseItemContent item used to generate a response.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaResponseItem.VisitorAn interface that defines how to map each variant of BetaResponseItem to a value of type T.
public final classBetaResponseItem.AgentMessagepublic final classBetaResponseItem.MultiAgentCallpublic final classBetaResponseItem.MultiAgentCallOutputpublic final classBetaResponseItem.AdditionalToolspublic final classBetaResponseItem.Programpublic final classBetaResponseItem.ProgramOutputpublic final classBetaResponseItem.ImageGenerationCallAn image generation request made by the model.
public final classBetaResponseItem.LocalShellCallA tool call to run a command on the local shell.
public final classBetaResponseItem.LocalShellCallOutputThe output of a local shell tool call.
public final classBetaResponseItem.McpListToolsA list of tools available on an MCP server.
public final classBetaResponseItem.McpApprovalRequestA request for human approval of a tool invocation.
public final classBetaResponseItem.McpApprovalResponseA response to an MCP approval request.
public final classBetaResponseItem.McpCallAn invocation of a tool on an MCP server.
-
Method Summary
-
-
Method Detail
-
betaResponseInputMessageItem
final Optional<BetaResponseInputMessageItem> betaResponseInputMessageItem()
-
betaResponseOutputMessage
final Optional<BetaResponseOutputMessage> betaResponseOutputMessage()
An output message from the model.
-
fileSearchCall
final Optional<BetaResponseFileSearchToolCall> fileSearchCall()
The results of a file search tool call. See the file search guide for more information.
-
computerCall
final Optional<BetaResponseComputerToolCall> computerCall()
A tool call to a computer use tool. See the computer use guide for more information.
-
computerCallOutput
final Optional<BetaResponseComputerToolCallOutputItem> computerCallOutput()
-
webSearchCall
final Optional<BetaResponseFunctionWebSearch> webSearchCall()
The results of a web search tool call. See the web search guide for more information.
-
functionCall
final Optional<BetaResponseFunctionToolCallItem> functionCall()
A tool call to run a function. See the function calling guide for more information.
-
functionCallOutput
final Optional<BetaResponseFunctionToolCallOutputItem> functionCallOutput()
-
agentMessage
final Optional<BetaResponseItem.AgentMessage> agentMessage()
-
multiAgentCall
final Optional<BetaResponseItem.MultiAgentCall> multiAgentCall()
-
multiAgentCallOutput
final Optional<BetaResponseItem.MultiAgentCallOutput> multiAgentCallOutput()
-
toolSearchCall
final Optional<BetaResponseToolSearchCall> toolSearchCall()
-
toolSearchOutput
final Optional<BetaResponseToolSearchOutputItem> toolSearchOutput()
-
additionalTools
final Optional<BetaResponseItem.AdditionalTools> additionalTools()
-
reasoning
final Optional<BetaResponseReasoningItem> reasoning()
A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your
inputto the Responses API for subsequent turns of a conversation if you are manually managing context.
-
program
final Optional<BetaResponseItem.Program> program()
-
programOutput
final Optional<BetaResponseItem.ProgramOutput> programOutput()
-
compaction
final Optional<BetaResponseCompactionItem> compaction()
A compaction item generated by the
v1/responses/compactAPI.
-
imageGenerationCall
final Optional<BetaResponseItem.ImageGenerationCall> imageGenerationCall()
An image generation request made by the model.
-
codeInterpreterCall
final Optional<BetaResponseCodeInterpreterToolCall> codeInterpreterCall()
A tool call to run code.
-
localShellCall
final Optional<BetaResponseItem.LocalShellCall> localShellCall()
A tool call to run a command on the local shell.
-
localShellCallOutput
final Optional<BetaResponseItem.LocalShellCallOutput> localShellCallOutput()
The output of a local shell tool call.
-
shellCall
final Optional<BetaResponseFunctionShellToolCall> shellCall()
A tool call that executes one or more shell commands in a managed environment.
-
shellCallOutput
final Optional<BetaResponseFunctionShellToolCallOutput> shellCallOutput()
The output of a shell tool call that was emitted.
-
applyPatchCall
final Optional<BetaResponseApplyPatchToolCall> applyPatchCall()
A tool call that applies file diffs by creating, deleting, or updating files.
-
applyPatchCallOutput
final Optional<BetaResponseApplyPatchToolCallOutput> applyPatchCallOutput()
The output emitted by an apply patch tool call.
-
mcpListTools
final Optional<BetaResponseItem.McpListTools> mcpListTools()
A list of tools available on an MCP server.
-
mcpApprovalRequest
final Optional<BetaResponseItem.McpApprovalRequest> mcpApprovalRequest()
A request for human approval of a tool invocation.
-
mcpApprovalResponse
final Optional<BetaResponseItem.McpApprovalResponse> mcpApprovalResponse()
A response to an MCP approval request.
-
mcpCall
final Optional<BetaResponseItem.McpCall> mcpCall()
An invocation of a tool on an MCP server.
-
customToolCall
final Optional<BetaResponseCustomToolCallItem> customToolCall()
A call to a custom tool created by the model.
-
customToolCallOutput
final Optional<BetaResponseCustomToolCallOutputItem> customToolCallOutput()
The output of a custom tool call from your code, being sent back to the model.
-
isBetaResponseInputMessageItem
final Boolean isBetaResponseInputMessageItem()
-
isBetaResponseOutputMessage
final Boolean isBetaResponseOutputMessage()
-
isFileSearchCall
final Boolean isFileSearchCall()
-
isComputerCall
final Boolean isComputerCall()
-
isComputerCallOutput
final Boolean isComputerCallOutput()
-
isWebSearchCall
final Boolean isWebSearchCall()
-
isFunctionCall
final Boolean isFunctionCall()
-
isFunctionCallOutput
final Boolean isFunctionCallOutput()
-
isAgentMessage
final Boolean isAgentMessage()
-
isMultiAgentCall
final Boolean isMultiAgentCall()
-
isMultiAgentCallOutput
final Boolean isMultiAgentCallOutput()
-
isToolSearchCall
final Boolean isToolSearchCall()
-
isToolSearchOutput
final Boolean isToolSearchOutput()
-
isAdditionalTools
final Boolean isAdditionalTools()
-
isReasoning
final Boolean isReasoning()
-
isProgramOutput
final Boolean isProgramOutput()
-
isCompaction
final Boolean isCompaction()
-
isImageGenerationCall
final Boolean isImageGenerationCall()
-
isCodeInterpreterCall
final Boolean isCodeInterpreterCall()
-
isLocalShellCall
final Boolean isLocalShellCall()
-
isLocalShellCallOutput
final Boolean isLocalShellCallOutput()
-
isShellCall
final Boolean isShellCall()
-
isShellCallOutput
final Boolean isShellCallOutput()
-
isApplyPatchCall
final Boolean isApplyPatchCall()
-
isApplyPatchCallOutput
final Boolean isApplyPatchCallOutput()
-
isMcpListTools
final Boolean isMcpListTools()
-
isMcpApprovalRequest
final Boolean isMcpApprovalRequest()
-
isMcpApprovalResponse
final Boolean isMcpApprovalResponse()
-
isCustomToolCall
final Boolean isCustomToolCall()
-
isCustomToolCallOutput
final Boolean isCustomToolCallOutput()
-
asBetaResponseInputMessageItem
final BetaResponseInputMessageItem asBetaResponseInputMessageItem()
-
asBetaResponseOutputMessage
final BetaResponseOutputMessage asBetaResponseOutputMessage()
An output message from the model.
-
asFileSearchCall
final BetaResponseFileSearchToolCall asFileSearchCall()
The results of a file search tool call. See the file search guide for more information.
-
asComputerCall
final BetaResponseComputerToolCall asComputerCall()
A tool call to a computer use tool. See the computer use guide for more information.
-
asComputerCallOutput
final BetaResponseComputerToolCallOutputItem asComputerCallOutput()
-
asWebSearchCall
final BetaResponseFunctionWebSearch asWebSearchCall()
The results of a web search tool call. See the web search guide for more information.
-
asFunctionCall
final BetaResponseFunctionToolCallItem asFunctionCall()
A tool call to run a function. See the function calling guide for more information.
-
asFunctionCallOutput
final BetaResponseFunctionToolCallOutputItem asFunctionCallOutput()
-
asAgentMessage
final BetaResponseItem.AgentMessage asAgentMessage()
-
asMultiAgentCall
final BetaResponseItem.MultiAgentCall asMultiAgentCall()
-
asMultiAgentCallOutput
final BetaResponseItem.MultiAgentCallOutput asMultiAgentCallOutput()
-
asToolSearchCall
final BetaResponseToolSearchCall asToolSearchCall()
-
asToolSearchOutput
final BetaResponseToolSearchOutputItem asToolSearchOutput()
-
asAdditionalTools
final BetaResponseItem.AdditionalTools asAdditionalTools()
-
asReasoning
final BetaResponseReasoningItem asReasoning()
A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your
inputto the Responses API for subsequent turns of a conversation if you are manually managing context.
-
asProgram
final BetaResponseItem.Program asProgram()
-
asProgramOutput
final BetaResponseItem.ProgramOutput asProgramOutput()
-
asCompaction
final BetaResponseCompactionItem asCompaction()
A compaction item generated by the
v1/responses/compactAPI.
-
asImageGenerationCall
final BetaResponseItem.ImageGenerationCall asImageGenerationCall()
An image generation request made by the model.
-
asCodeInterpreterCall
final BetaResponseCodeInterpreterToolCall asCodeInterpreterCall()
A tool call to run code.
-
asLocalShellCall
final BetaResponseItem.LocalShellCall asLocalShellCall()
A tool call to run a command on the local shell.
-
asLocalShellCallOutput
final BetaResponseItem.LocalShellCallOutput asLocalShellCallOutput()
The output of a local shell tool call.
-
asShellCall
final BetaResponseFunctionShellToolCall asShellCall()
A tool call that executes one or more shell commands in a managed environment.
-
asShellCallOutput
final BetaResponseFunctionShellToolCallOutput asShellCallOutput()
The output of a shell tool call that was emitted.
-
asApplyPatchCall
final BetaResponseApplyPatchToolCall asApplyPatchCall()
A tool call that applies file diffs by creating, deleting, or updating files.
-
asApplyPatchCallOutput
final BetaResponseApplyPatchToolCallOutput asApplyPatchCallOutput()
The output emitted by an apply patch tool call.
-
asMcpListTools
final BetaResponseItem.McpListTools asMcpListTools()
A list of tools available on an MCP server.
-
asMcpApprovalRequest
final BetaResponseItem.McpApprovalRequest asMcpApprovalRequest()
A request for human approval of a tool invocation.
-
asMcpApprovalResponse
final BetaResponseItem.McpApprovalResponse asMcpApprovalResponse()
A response to an MCP approval request.
-
asMcpCall
final BetaResponseItem.McpCall asMcpCall()
An invocation of a tool on an MCP server.
-
asCustomToolCall
final BetaResponseCustomToolCallItem asCustomToolCall()
A call to a custom tool created by the model.
-
asCustomToolCallOutput
final BetaResponseCustomToolCallOutputItem asCustomToolCallOutput()
The output of a custom tool call from your code, being sent back to the model.
-
accept
final <T extends Any> T accept(BetaResponseItem.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = betaResponseItem.accept(new BetaResponseItem.Visitor<Optional<String>>() { @Override public Optional<String> visitBetaResponseInputMessageItem(BetaResponseInputMessageItem betaResponseInputMessageItem) { return Optional.of(betaResponseInputMessageItem.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaResponseItem validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofBetaResponseInputMessageItem
final static BetaResponseItem ofBetaResponseInputMessageItem(BetaResponseInputMessageItem betaResponseInputMessageItem)
-
ofBetaResponseOutputMessage
final static BetaResponseItem ofBetaResponseOutputMessage(BetaResponseOutputMessage betaResponseOutputMessage)
An output message from the model.
-
ofFileSearchCall
final static BetaResponseItem ofFileSearchCall(BetaResponseFileSearchToolCall fileSearchCall)
The results of a file search tool call. See the file search guide for more information.
-
ofComputerCall
final static BetaResponseItem ofComputerCall(BetaResponseComputerToolCall computerCall)
A tool call to a computer use tool. See the computer use guide for more information.
-
ofComputerCallOutput
final static BetaResponseItem ofComputerCallOutput(BetaResponseComputerToolCallOutputItem computerCallOutput)
-
ofWebSearchCall
final static BetaResponseItem ofWebSearchCall(BetaResponseFunctionWebSearch webSearchCall)
The results of a web search tool call. See the web search guide for more information.
-
ofFunctionCall
final static BetaResponseItem ofFunctionCall(BetaResponseFunctionToolCallItem functionCall)
A tool call to run a function. See the function calling guide for more information.
-
ofFunctionCallOutput
final static BetaResponseItem ofFunctionCallOutput(BetaResponseFunctionToolCallOutputItem functionCallOutput)
-
ofAgentMessage
final static BetaResponseItem ofAgentMessage(BetaResponseItem.AgentMessage agentMessage)
-
ofMultiAgentCall
final static BetaResponseItem ofMultiAgentCall(BetaResponseItem.MultiAgentCall multiAgentCall)
-
ofMultiAgentCallOutput
final static BetaResponseItem ofMultiAgentCallOutput(BetaResponseItem.MultiAgentCallOutput multiAgentCallOutput)
-
ofToolSearchCall
final static BetaResponseItem ofToolSearchCall(BetaResponseToolSearchCall toolSearchCall)
-
ofToolSearchOutput
final static BetaResponseItem ofToolSearchOutput(BetaResponseToolSearchOutputItem toolSearchOutput)
-
ofAdditionalTools
final static BetaResponseItem ofAdditionalTools(BetaResponseItem.AdditionalTools additionalTools)
-
ofReasoning
final static BetaResponseItem ofReasoning(BetaResponseReasoningItem reasoning)
A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your
inputto the Responses API for subsequent turns of a conversation if you are manually managing context.
-
ofProgram
final static BetaResponseItem ofProgram(BetaResponseItem.Program program)
-
ofProgramOutput
final static BetaResponseItem ofProgramOutput(BetaResponseItem.ProgramOutput programOutput)
-
ofCompaction
final static BetaResponseItem ofCompaction(BetaResponseCompactionItem compaction)
A compaction item generated by the
v1/responses/compactAPI.
-
ofImageGenerationCall
final static BetaResponseItem ofImageGenerationCall(BetaResponseItem.ImageGenerationCall imageGenerationCall)
An image generation request made by the model.
-
ofCodeInterpreterCall
final static BetaResponseItem ofCodeInterpreterCall(BetaResponseCodeInterpreterToolCall codeInterpreterCall)
A tool call to run code.
-
ofLocalShellCall
final static BetaResponseItem ofLocalShellCall(BetaResponseItem.LocalShellCall localShellCall)
A tool call to run a command on the local shell.
-
ofLocalShellCallOutput
final static BetaResponseItem ofLocalShellCallOutput(BetaResponseItem.LocalShellCallOutput localShellCallOutput)
The output of a local shell tool call.
-
ofShellCall
final static BetaResponseItem ofShellCall(BetaResponseFunctionShellToolCall shellCall)
A tool call that executes one or more shell commands in a managed environment.
-
ofShellCallOutput
final static BetaResponseItem ofShellCallOutput(BetaResponseFunctionShellToolCallOutput shellCallOutput)
The output of a shell tool call that was emitted.
-
ofApplyPatchCall
final static BetaResponseItem ofApplyPatchCall(BetaResponseApplyPatchToolCall applyPatchCall)
A tool call that applies file diffs by creating, deleting, or updating files.
-
ofApplyPatchCallOutput
final static BetaResponseItem ofApplyPatchCallOutput(BetaResponseApplyPatchToolCallOutput applyPatchCallOutput)
The output emitted by an apply patch tool call.
-
ofMcpListTools
final static BetaResponseItem ofMcpListTools(BetaResponseItem.McpListTools mcpListTools)
A list of tools available on an MCP server.
-
ofMcpApprovalRequest
final static BetaResponseItem ofMcpApprovalRequest(BetaResponseItem.McpApprovalRequest mcpApprovalRequest)
A request for human approval of a tool invocation.
-
ofMcpApprovalResponse
final static BetaResponseItem ofMcpApprovalResponse(BetaResponseItem.McpApprovalResponse mcpApprovalResponse)
A response to an MCP approval request.
-
ofMcpCall
final static BetaResponseItem ofMcpCall(BetaResponseItem.McpCall mcpCall)
An invocation of a tool on an MCP server.
-
ofCustomToolCall
final static BetaResponseItem ofCustomToolCall(BetaResponseCustomToolCallItem customToolCall)
A call to a custom tool created by the model.
-
ofCustomToolCallOutput
final static BetaResponseItem ofCustomToolCallOutput(BetaResponseCustomToolCallOutputItem customToolCallOutput)
The output of a custom tool call from your code, being sent back to the model.
-
-
-
-