Class ResponseOutputItem
-
- All Implemented Interfaces:
public final class ResponseOutputItemAn output message from the model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResponseOutputItem.VisitorAn interface that defines how to map each variant of ResponseOutputItem to a value of type T.
public final classResponseOutputItem.AdditionalToolspublic final classResponseOutputItem.ImageGenerationCallAn image generation request made by the model.
public final classResponseOutputItem.LocalShellCallA tool call to run a command on the local shell.
public final classResponseOutputItem.LocalShellCallOutputThe output of a local shell tool call.
public final classResponseOutputItem.McpCallAn invocation of a tool on an MCP server.
public final classResponseOutputItem.McpListToolsA list of tools available on an MCP server.
public final classResponseOutputItem.McpApprovalRequestA request for human approval of a tool invocation.
public final classResponseOutputItem.McpApprovalResponseA response to an MCP approval request.
-
Method Summary
-
-
Method Detail
-
message
final Optional<ResponseOutputMessage> message()
An output message from the model.
-
fileSearchCall
final Optional<ResponseFileSearchToolCall> fileSearchCall()
The results of a file search tool call. See the file search guide for more information.
-
functionCall
final Optional<ResponseFunctionToolCall> functionCall()
A tool call to run a function. See the function calling guide for more information.
-
functionCallOutput
final Optional<ResponseFunctionToolCallOutputItem> functionCallOutput()
-
webSearchCall
final Optional<ResponseFunctionWebSearch> webSearchCall()
The results of a web search tool call. See the web search guide for more information.
-
computerCall
final Optional<ResponseComputerToolCall> computerCall()
A tool call to a computer use tool. See the computer use guide for more information.
-
computerCallOutput
final Optional<ResponseComputerToolCallOutputItem> computerCallOutput()
-
reasoning
final Optional<ResponseReasoningItem> 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.
-
toolSearchCall
final Optional<ResponseToolSearchCall> toolSearchCall()
-
toolSearchOutput
final Optional<ResponseToolSearchOutputItem> toolSearchOutput()
-
additionalTools
final Optional<ResponseOutputItem.AdditionalTools> additionalTools()
-
compaction
final Optional<ResponseCompactionItem> compaction()
A compaction item generated by the
v1/responses/compactAPI.
-
imageGenerationCall
final Optional<ResponseOutputItem.ImageGenerationCall> imageGenerationCall()
An image generation request made by the model.
-
codeInterpreterCall
final Optional<ResponseCodeInterpreterToolCall> codeInterpreterCall()
A tool call to run code.
-
localShellCall
final Optional<ResponseOutputItem.LocalShellCall> localShellCall()
A tool call to run a command on the local shell.
-
localShellCallOutput
final Optional<ResponseOutputItem.LocalShellCallOutput> localShellCallOutput()
The output of a local shell tool call.
-
shellCall
final Optional<ResponseFunctionShellToolCall> shellCall()
A tool call that executes one or more shell commands in a managed environment.
-
shellCallOutput
final Optional<ResponseFunctionShellToolCallOutput> shellCallOutput()
The output of a shell tool call that was emitted.
-
applyPatchCall
final Optional<ResponseApplyPatchToolCall> applyPatchCall()
A tool call that applies file diffs by creating, deleting, or updating files.
-
applyPatchCallOutput
final Optional<ResponseApplyPatchToolCallOutput> applyPatchCallOutput()
The output emitted by an apply patch tool call.
-
mcpCall
final Optional<ResponseOutputItem.McpCall> mcpCall()
An invocation of a tool on an MCP server.
-
mcpListTools
final Optional<ResponseOutputItem.McpListTools> mcpListTools()
A list of tools available on an MCP server.
-
mcpApprovalRequest
final Optional<ResponseOutputItem.McpApprovalRequest> mcpApprovalRequest()
A request for human approval of a tool invocation.
-
mcpApprovalResponse
final Optional<ResponseOutputItem.McpApprovalResponse> mcpApprovalResponse()
A response to an MCP approval request.
-
customToolCall
final Optional<ResponseCustomToolCall> customToolCall()
A call to a custom tool created by the model.
-
customToolCallOutput
final Optional<ResponseCustomToolCallOutputItem> 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()
-
isWebSearchCall
final Boolean isWebSearchCall()
-
isComputerCall
final Boolean isComputerCall()
-
isComputerCallOutput
final Boolean isComputerCallOutput()
-
isReasoning
final Boolean isReasoning()
-
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 ResponseOutputMessage asMessage()
An output message from the model.
-
asFileSearchCall
final ResponseFileSearchToolCall asFileSearchCall()
The results of a file search tool call. See the file search guide for more information.
-
asFunctionCall
final ResponseFunctionToolCall asFunctionCall()
A tool call to run a function. See the function calling guide for more information.
-
asFunctionCallOutput
final ResponseFunctionToolCallOutputItem asFunctionCallOutput()
-
asWebSearchCall
final ResponseFunctionWebSearch asWebSearchCall()
The results of a web search tool call. See the web search guide for more information.
-
asComputerCall
final ResponseComputerToolCall asComputerCall()
A tool call to a computer use tool. See the computer use guide for more information.
-
asComputerCallOutput
final ResponseComputerToolCallOutputItem asComputerCallOutput()
-
asReasoning
final ResponseReasoningItem 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.
-
asToolSearchCall
final ResponseToolSearchCall asToolSearchCall()
-
asToolSearchOutput
final ResponseToolSearchOutputItem asToolSearchOutput()
-
asAdditionalTools
final ResponseOutputItem.AdditionalTools asAdditionalTools()
-
asCompaction
final ResponseCompactionItem asCompaction()
A compaction item generated by the
v1/responses/compactAPI.
-
asImageGenerationCall
final ResponseOutputItem.ImageGenerationCall asImageGenerationCall()
An image generation request made by the model.
-
asCodeInterpreterCall
final ResponseCodeInterpreterToolCall asCodeInterpreterCall()
A tool call to run code.
-
asLocalShellCall
final ResponseOutputItem.LocalShellCall asLocalShellCall()
A tool call to run a command on the local shell.
-
asLocalShellCallOutput
final ResponseOutputItem.LocalShellCallOutput asLocalShellCallOutput()
The output of a local shell tool call.
-
asShellCall
final ResponseFunctionShellToolCall asShellCall()
A tool call that executes one or more shell commands in a managed environment.
-
asShellCallOutput
final ResponseFunctionShellToolCallOutput asShellCallOutput()
The output of a shell tool call that was emitted.
-
asApplyPatchCall
final ResponseApplyPatchToolCall asApplyPatchCall()
A tool call that applies file diffs by creating, deleting, or updating files.
-
asApplyPatchCallOutput
final ResponseApplyPatchToolCallOutput asApplyPatchCallOutput()
The output emitted by an apply patch tool call.
-
asMcpCall
final ResponseOutputItem.McpCall asMcpCall()
An invocation of a tool on an MCP server.
-
asMcpListTools
final ResponseOutputItem.McpListTools asMcpListTools()
A list of tools available on an MCP server.
-
asMcpApprovalRequest
final ResponseOutputItem.McpApprovalRequest asMcpApprovalRequest()
A request for human approval of a tool invocation.
-
asMcpApprovalResponse
final ResponseOutputItem.McpApprovalResponse asMcpApprovalResponse()
A response to an MCP approval request.
-
asCustomToolCall
final ResponseCustomToolCall asCustomToolCall()
A call to a custom tool created by the model.
-
asCustomToolCallOutput
final ResponseCustomToolCallOutputItem asCustomToolCallOutput()
The output of a custom tool call from your code, being sent back to the model.
-
accept
final <T extends Any> T accept(ResponseOutputItem.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 = responseOutputItem.accept(new ResponseOutputItem.Visitor<Optional<String>>() { @Override public Optional<String> visitMessage(ResponseOutputMessage message) { return Optional.of(message.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ResponseOutputItem 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 ResponseOutputItem ofMessage(ResponseOutputMessage message)
An output message from the model.
-
ofFileSearchCall
final static ResponseOutputItem ofFileSearchCall(ResponseFileSearchToolCall fileSearchCall)
The results of a file search tool call. See the file search guide for more information.
-
ofFunctionCall
final static ResponseOutputItem ofFunctionCall(ResponseFunctionToolCall functionCall)
A tool call to run a function. See the function calling guide for more information.
-
ofFunctionCallOutput
final static ResponseOutputItem ofFunctionCallOutput(ResponseFunctionToolCallOutputItem functionCallOutput)
-
ofWebSearchCall
final static ResponseOutputItem ofWebSearchCall(ResponseFunctionWebSearch webSearchCall)
The results of a web search tool call. See the web search guide for more information.
-
ofComputerCall
final static ResponseOutputItem ofComputerCall(ResponseComputerToolCall computerCall)
A tool call to a computer use tool. See the computer use guide for more information.
-
ofComputerCallOutput
final static ResponseOutputItem ofComputerCallOutput(ResponseComputerToolCallOutputItem computerCallOutput)
-
ofReasoning
final static ResponseOutputItem ofReasoning(ResponseReasoningItem 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.
-
ofToolSearchCall
final static ResponseOutputItem ofToolSearchCall(ResponseToolSearchCall toolSearchCall)
-
ofToolSearchOutput
final static ResponseOutputItem ofToolSearchOutput(ResponseToolSearchOutputItem toolSearchOutput)
-
ofAdditionalTools
final static ResponseOutputItem ofAdditionalTools(ResponseOutputItem.AdditionalTools additionalTools)
-
ofCompaction
final static ResponseOutputItem ofCompaction(ResponseCompactionItem compaction)
A compaction item generated by the
v1/responses/compactAPI.
-
ofImageGenerationCall
final static ResponseOutputItem ofImageGenerationCall(ResponseOutputItem.ImageGenerationCall imageGenerationCall)
An image generation request made by the model.
-
ofCodeInterpreterCall
final static ResponseOutputItem ofCodeInterpreterCall(ResponseCodeInterpreterToolCall codeInterpreterCall)
A tool call to run code.
-
ofLocalShellCall
final static ResponseOutputItem ofLocalShellCall(ResponseOutputItem.LocalShellCall localShellCall)
A tool call to run a command on the local shell.
-
ofLocalShellCallOutput
final static ResponseOutputItem ofLocalShellCallOutput(ResponseOutputItem.LocalShellCallOutput localShellCallOutput)
The output of a local shell tool call.
-
ofShellCall
final static ResponseOutputItem ofShellCall(ResponseFunctionShellToolCall shellCall)
A tool call that executes one or more shell commands in a managed environment.
-
ofShellCallOutput
final static ResponseOutputItem ofShellCallOutput(ResponseFunctionShellToolCallOutput shellCallOutput)
The output of a shell tool call that was emitted.
-
ofApplyPatchCall
final static ResponseOutputItem ofApplyPatchCall(ResponseApplyPatchToolCall applyPatchCall)
A tool call that applies file diffs by creating, deleting, or updating files.
-
ofApplyPatchCallOutput
final static ResponseOutputItem ofApplyPatchCallOutput(ResponseApplyPatchToolCallOutput applyPatchCallOutput)
The output emitted by an apply patch tool call.
-
ofMcpCall
final static ResponseOutputItem ofMcpCall(ResponseOutputItem.McpCall mcpCall)
An invocation of a tool on an MCP server.
-
ofMcpListTools
final static ResponseOutputItem ofMcpListTools(ResponseOutputItem.McpListTools mcpListTools)
A list of tools available on an MCP server.
-
ofMcpApprovalRequest
final static ResponseOutputItem ofMcpApprovalRequest(ResponseOutputItem.McpApprovalRequest mcpApprovalRequest)
A request for human approval of a tool invocation.
-
ofMcpApprovalResponse
final static ResponseOutputItem ofMcpApprovalResponse(ResponseOutputItem.McpApprovalResponse mcpApprovalResponse)
A response to an MCP approval request.
-
ofCustomToolCall
final static ResponseOutputItem ofCustomToolCall(ResponseCustomToolCall customToolCall)
A call to a custom tool created by the model.
-
ofCustomToolCallOutput
final static ResponseOutputItem ofCustomToolCallOutput(ResponseCustomToolCallOutputItem customToolCallOutput)
The output of a custom tool call from your code, being sent back to the model.
-
-
-
-