Class BetaResponseOutputItem
-
- All Implemented Interfaces:
public final class BetaResponseOutputItemAn output message from the model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaResponseOutputItem.VisitorAn interface that defines how to map each variant of BetaResponseOutputItem to a value of type T.
public final classBetaResponseOutputItem.AgentMessagepublic final classBetaResponseOutputItem.MultiAgentCallpublic final classBetaResponseOutputItem.MultiAgentCallOutputpublic final classBetaResponseOutputItem.Programpublic final classBetaResponseOutputItem.ProgramOutputpublic final classBetaResponseOutputItem.AdditionalToolspublic final classBetaResponseOutputItem.ImageGenerationCallAn image generation request made by the model.
public final classBetaResponseOutputItem.LocalShellCallA tool call to run a command on the local shell.
public final classBetaResponseOutputItem.LocalShellCallOutputThe output of a local shell tool call.
public final classBetaResponseOutputItem.McpCallAn invocation of a tool on an MCP server.
public final classBetaResponseOutputItem.McpListToolsA list of tools available on an MCP server.
public final classBetaResponseOutputItem.McpApprovalRequestA request for human approval of a tool invocation.
public final classBetaResponseOutputItem.McpApprovalResponseA response to an MCP approval request.
-
Method Summary
-
-
Method Detail
-
message
final Optional<BetaResponseOutputMessage> message()
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.
-
functionCall
final Optional<BetaResponseFunctionToolCall> functionCall()
A tool call to run a function. See the function calling guide for more information.
-
functionCallOutput
final Optional<BetaResponseFunctionToolCallOutputItem> functionCallOutput()
-
agentMessage
final Optional<BetaResponseOutputItem.AgentMessage> agentMessage()
-
multiAgentCall
final Optional<BetaResponseOutputItem.MultiAgentCall> multiAgentCall()
-
multiAgentCallOutput
final Optional<BetaResponseOutputItem.MultiAgentCallOutput> multiAgentCallOutput()
-
webSearchCall
final Optional<BetaResponseFunctionWebSearch> webSearchCall()
The results of a web search tool call. See the web 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()
-
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<BetaResponseOutputItem.Program> program()
-
programOutput
final Optional<BetaResponseOutputItem.ProgramOutput> programOutput()
-
toolSearchCall
final Optional<BetaResponseToolSearchCall> toolSearchCall()
-
toolSearchOutput
final Optional<BetaResponseToolSearchOutputItem> toolSearchOutput()
-
additionalTools
final Optional<BetaResponseOutputItem.AdditionalTools> additionalTools()
-
compaction
final Optional<BetaResponseCompactionItem> compaction()
A compaction item generated by the
v1/responses/compactAPI.
-
imageGenerationCall
final Optional<BetaResponseOutputItem.ImageGenerationCall> imageGenerationCall()
An image generation request made by the model.
-
codeInterpreterCall
final Optional<BetaResponseCodeInterpreterToolCall> codeInterpreterCall()
A tool call to run code.
-
localShellCall
final Optional<BetaResponseOutputItem.LocalShellCall> localShellCall()
A tool call to run a command on the local shell.
-
localShellCallOutput
final Optional<BetaResponseOutputItem.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.
-
mcpCall
final Optional<BetaResponseOutputItem.McpCall> mcpCall()
An invocation of a tool on an MCP server.
-
mcpListTools
final Optional<BetaResponseOutputItem.McpListTools> mcpListTools()
A list of tools available on an MCP server.
-
mcpApprovalRequest
final Optional<BetaResponseOutputItem.McpApprovalRequest> mcpApprovalRequest()
A request for human approval of a tool invocation.
-
mcpApprovalResponse
final Optional<BetaResponseOutputItem.McpApprovalResponse> mcpApprovalResponse()
A response to an MCP approval request.
-
customToolCall
final Optional<BetaResponseCustomToolCall> 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.
-
isFileSearchCall
final Boolean isFileSearchCall()
-
isFunctionCall
final Boolean isFunctionCall()
-
isFunctionCallOutput
final Boolean isFunctionCallOutput()
-
isAgentMessage
final Boolean isAgentMessage()
-
isMultiAgentCall
final Boolean isMultiAgentCall()
-
isMultiAgentCallOutput
final Boolean isMultiAgentCallOutput()
-
isWebSearchCall
final Boolean isWebSearchCall()
-
isComputerCall
final Boolean isComputerCall()
-
isComputerCallOutput
final Boolean isComputerCallOutput()
-
isReasoning
final Boolean isReasoning()
-
isProgramOutput
final Boolean isProgramOutput()
-
isToolSearchCall
final Boolean isToolSearchCall()
-
isToolSearchOutput
final Boolean isToolSearchOutput()
-
isAdditionalTools
final Boolean isAdditionalTools()
-
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()
-
asMessage
final BetaResponseOutputMessage asMessage()
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.
-
asFunctionCall
final BetaResponseFunctionToolCall asFunctionCall()
A tool call to run a function. See the function calling guide for more information.
-
asFunctionCallOutput
final BetaResponseFunctionToolCallOutputItem asFunctionCallOutput()
-
asAgentMessage
final BetaResponseOutputItem.AgentMessage asAgentMessage()
-
asMultiAgentCall
final BetaResponseOutputItem.MultiAgentCall asMultiAgentCall()
-
asMultiAgentCallOutput
final BetaResponseOutputItem.MultiAgentCallOutput asMultiAgentCallOutput()
-
asWebSearchCall
final BetaResponseFunctionWebSearch asWebSearchCall()
The results of a web search tool call. See the web 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()
-
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 BetaResponseOutputItem.Program asProgram()
-
asProgramOutput
final BetaResponseOutputItem.ProgramOutput asProgramOutput()
-
asToolSearchCall
final BetaResponseToolSearchCall asToolSearchCall()
-
asToolSearchOutput
final BetaResponseToolSearchOutputItem asToolSearchOutput()
-
asAdditionalTools
final BetaResponseOutputItem.AdditionalTools asAdditionalTools()
-
asCompaction
final BetaResponseCompactionItem asCompaction()
A compaction item generated by the
v1/responses/compactAPI.
-
asImageGenerationCall
final BetaResponseOutputItem.ImageGenerationCall asImageGenerationCall()
An image generation request made by the model.
-
asCodeInterpreterCall
final BetaResponseCodeInterpreterToolCall asCodeInterpreterCall()
A tool call to run code.
-
asLocalShellCall
final BetaResponseOutputItem.LocalShellCall asLocalShellCall()
A tool call to run a command on the local shell.
-
asLocalShellCallOutput
final BetaResponseOutputItem.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.
-
asMcpCall
final BetaResponseOutputItem.McpCall asMcpCall()
An invocation of a tool on an MCP server.
-
asMcpListTools
final BetaResponseOutputItem.McpListTools asMcpListTools()
A list of tools available on an MCP server.
-
asMcpApprovalRequest
final BetaResponseOutputItem.McpApprovalRequest asMcpApprovalRequest()
A request for human approval of a tool invocation.
-
asMcpApprovalResponse
final BetaResponseOutputItem.McpApprovalResponse asMcpApprovalResponse()
A response to an MCP approval request.
-
asCustomToolCall
final BetaResponseCustomToolCall 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(BetaResponseOutputItem.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 = betaResponseOutputItem.accept(new BetaResponseOutputItem.Visitor<Optional<String>>() { @Override public Optional<String> visitMessage(BetaResponseOutputMessage message) { return Optional.of(message.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaResponseOutputItem 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.
-
ofMessage
final static BetaResponseOutputItem ofMessage(BetaResponseOutputMessage message)
An output message from the model.
-
ofFileSearchCall
final static BetaResponseOutputItem ofFileSearchCall(BetaResponseFileSearchToolCall fileSearchCall)
The results of a file search tool call. See the file search guide for more information.
-
ofFunctionCall
final static BetaResponseOutputItem ofFunctionCall(BetaResponseFunctionToolCall functionCall)
A tool call to run a function. See the function calling guide for more information.
-
ofFunctionCallOutput
final static BetaResponseOutputItem ofFunctionCallOutput(BetaResponseFunctionToolCallOutputItem functionCallOutput)
-
ofAgentMessage
final static BetaResponseOutputItem ofAgentMessage(BetaResponseOutputItem.AgentMessage agentMessage)
-
ofMultiAgentCall
final static BetaResponseOutputItem ofMultiAgentCall(BetaResponseOutputItem.MultiAgentCall multiAgentCall)
-
ofMultiAgentCallOutput
final static BetaResponseOutputItem ofMultiAgentCallOutput(BetaResponseOutputItem.MultiAgentCallOutput multiAgentCallOutput)
-
ofWebSearchCall
final static BetaResponseOutputItem ofWebSearchCall(BetaResponseFunctionWebSearch webSearchCall)
The results of a web search tool call. See the web search guide for more information.
-
ofComputerCall
final static BetaResponseOutputItem ofComputerCall(BetaResponseComputerToolCall computerCall)
A tool call to a computer use tool. See the computer use guide for more information.
-
ofComputerCallOutput
final static BetaResponseOutputItem ofComputerCallOutput(BetaResponseComputerToolCallOutputItem computerCallOutput)
-
ofReasoning
final static BetaResponseOutputItem 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 BetaResponseOutputItem ofProgram(BetaResponseOutputItem.Program program)
-
ofProgramOutput
final static BetaResponseOutputItem ofProgramOutput(BetaResponseOutputItem.ProgramOutput programOutput)
-
ofToolSearchCall
final static BetaResponseOutputItem ofToolSearchCall(BetaResponseToolSearchCall toolSearchCall)
-
ofToolSearchOutput
final static BetaResponseOutputItem ofToolSearchOutput(BetaResponseToolSearchOutputItem toolSearchOutput)
-
ofAdditionalTools
final static BetaResponseOutputItem ofAdditionalTools(BetaResponseOutputItem.AdditionalTools additionalTools)
-
ofCompaction
final static BetaResponseOutputItem ofCompaction(BetaResponseCompactionItem compaction)
A compaction item generated by the
v1/responses/compactAPI.
-
ofImageGenerationCall
final static BetaResponseOutputItem ofImageGenerationCall(BetaResponseOutputItem.ImageGenerationCall imageGenerationCall)
An image generation request made by the model.
-
ofCodeInterpreterCall
final static BetaResponseOutputItem ofCodeInterpreterCall(BetaResponseCodeInterpreterToolCall codeInterpreterCall)
A tool call to run code.
-
ofLocalShellCall
final static BetaResponseOutputItem ofLocalShellCall(BetaResponseOutputItem.LocalShellCall localShellCall)
A tool call to run a command on the local shell.
-
ofLocalShellCallOutput
final static BetaResponseOutputItem ofLocalShellCallOutput(BetaResponseOutputItem.LocalShellCallOutput localShellCallOutput)
The output of a local shell tool call.
-
ofShellCall
final static BetaResponseOutputItem ofShellCall(BetaResponseFunctionShellToolCall shellCall)
A tool call that executes one or more shell commands in a managed environment.
-
ofShellCallOutput
final static BetaResponseOutputItem ofShellCallOutput(BetaResponseFunctionShellToolCallOutput shellCallOutput)
The output of a shell tool call that was emitted.
-
ofApplyPatchCall
final static BetaResponseOutputItem ofApplyPatchCall(BetaResponseApplyPatchToolCall applyPatchCall)
A tool call that applies file diffs by creating, deleting, or updating files.
-
ofApplyPatchCallOutput
final static BetaResponseOutputItem ofApplyPatchCallOutput(BetaResponseApplyPatchToolCallOutput applyPatchCallOutput)
The output emitted by an apply patch tool call.
-
ofMcpCall
final static BetaResponseOutputItem ofMcpCall(BetaResponseOutputItem.McpCall mcpCall)
An invocation of a tool on an MCP server.
-
ofMcpListTools
final static BetaResponseOutputItem ofMcpListTools(BetaResponseOutputItem.McpListTools mcpListTools)
A list of tools available on an MCP server.
-
ofMcpApprovalRequest
final static BetaResponseOutputItem ofMcpApprovalRequest(BetaResponseOutputItem.McpApprovalRequest mcpApprovalRequest)
A request for human approval of a tool invocation.
-
ofMcpApprovalResponse
final static BetaResponseOutputItem ofMcpApprovalResponse(BetaResponseOutputItem.McpApprovalResponse mcpApprovalResponse)
A response to an MCP approval request.
-
ofCustomToolCall
final static BetaResponseOutputItem ofCustomToolCall(BetaResponseCustomToolCall customToolCall)
A call to a custom tool created by the model.
-
ofCustomToolCallOutput
final static BetaResponseOutputItem ofCustomToolCallOutput(BetaResponseCustomToolCallOutputItem customToolCallOutput)
The output of a custom tool call from your code, being sent back to the model.
-
-
-
-