Class ConversationItem
-
- All Implemented Interfaces:
public final class ConversationItem
A single item within a conversation. The set of possible types are the same as the
output
type of a Response object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
ConversationItem.Visitor
An interface that defines how to map each variant of ConversationItem to a value of type T.
public final class
ConversationItem.ImageGenerationCall
An image generation request made by the model.
public final class
ConversationItem.LocalShellCall
A tool call to run a command on the local shell.
public final class
ConversationItem.LocalShellCallOutput
The output of a local shell tool call.
public final class
ConversationItem.McpListTools
A list of tools available on an MCP server.
public final class
ConversationItem.McpApprovalRequest
A request for human approval of a tool invocation.
public final class
ConversationItem.McpApprovalResponse
A response to an MCP approval request.
public final class
ConversationItem.McpCall
An invocation of a tool on an MCP server.
-
Method Summary
-
-
Method Detail
-
functionCall
final Optional<ResponseFunctionToolCallItem> functionCall()
A tool call to run a function. See the function calling guide for more information.
-
functionCallOutput
final Optional<ResponseFunctionToolCallOutputItem> functionCallOutput()
-
fileSearchCall
final Optional<ResponseFileSearchToolCall> fileSearchCall()
The results of a file search tool call. See the file search guide for more information.
-
webSearchCall
final Optional<ResponseFunctionWebSearch> webSearchCall()
The results of a web search tool call. See the web search guide for more information.
-
imageGenerationCall
final Optional<ConversationItem.ImageGenerationCall> imageGenerationCall()
An image generation request made by the model.
-
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
input
to the Responses API for subsequent turns of a conversation if you are manually managing context.
-
codeInterpreterCall
final Optional<ResponseCodeInterpreterToolCall> codeInterpreterCall()
A tool call to run code.
-
localShellCall
final Optional<ConversationItem.LocalShellCall> localShellCall()
A tool call to run a command on the local shell.
-
localShellCallOutput
final Optional<ConversationItem.LocalShellCallOutput> localShellCallOutput()
The output of a local shell tool call.
-
mcpListTools
final Optional<ConversationItem.McpListTools> mcpListTools()
A list of tools available on an MCP server.
-
mcpApprovalRequest
final Optional<ConversationItem.McpApprovalRequest> mcpApprovalRequest()
A request for human approval of a tool invocation.
-
mcpApprovalResponse
final Optional<ConversationItem.McpApprovalResponse> mcpApprovalResponse()
A response to an MCP approval request.
-
mcpCall
final Optional<ConversationItem.McpCall> mcpCall()
An invocation of a tool on an MCP server.
-
customToolCall
final Optional<ResponseCustomToolCall> customToolCall()
A call to a custom tool created by the model.
-
customToolCallOutput
final Optional<ResponseCustomToolCallOutput> customToolCallOutput()
The output of a custom tool call from your code, being sent back to the model.
-
isFunctionCall
final Boolean isFunctionCall()
-
isFunctionCallOutput
final Boolean isFunctionCallOutput()
-
isFileSearchCall
final Boolean isFileSearchCall()
-
isWebSearchCall
final Boolean isWebSearchCall()
-
isImageGenerationCall
final Boolean isImageGenerationCall()
-
isComputerCall
final Boolean isComputerCall()
-
isComputerCallOutput
final Boolean isComputerCallOutput()
-
isReasoning
final Boolean isReasoning()
-
isCodeInterpreterCall
final Boolean isCodeInterpreterCall()
-
isLocalShellCall
final Boolean isLocalShellCall()
-
isLocalShellCallOutput
final Boolean isLocalShellCallOutput()
-
isMcpListTools
final Boolean isMcpListTools()
-
isMcpApprovalRequest
final Boolean isMcpApprovalRequest()
-
isMcpApprovalResponse
final Boolean isMcpApprovalResponse()
-
isCustomToolCall
final Boolean isCustomToolCall()
-
isCustomToolCallOutput
final Boolean isCustomToolCallOutput()
-
asFunctionCall
final ResponseFunctionToolCallItem asFunctionCall()
A tool call to run a function. See the function calling guide for more information.
-
asFunctionCallOutput
final ResponseFunctionToolCallOutputItem asFunctionCallOutput()
-
asFileSearchCall
final ResponseFileSearchToolCall asFileSearchCall()
The results of a file search tool call. See the file search guide for more information.
-
asWebSearchCall
final ResponseFunctionWebSearch asWebSearchCall()
The results of a web search tool call. See the web search guide for more information.
-
asImageGenerationCall
final ConversationItem.ImageGenerationCall asImageGenerationCall()
An image generation request made by the model.
-
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
input
to the Responses API for subsequent turns of a conversation if you are manually managing context.
-
asCodeInterpreterCall
final ResponseCodeInterpreterToolCall asCodeInterpreterCall()
A tool call to run code.
-
asLocalShellCall
final ConversationItem.LocalShellCall asLocalShellCall()
A tool call to run a command on the local shell.
-
asLocalShellCallOutput
final ConversationItem.LocalShellCallOutput asLocalShellCallOutput()
The output of a local shell tool call.
-
asMcpListTools
final ConversationItem.McpListTools asMcpListTools()
A list of tools available on an MCP server.
-
asMcpApprovalRequest
final ConversationItem.McpApprovalRequest asMcpApprovalRequest()
A request for human approval of a tool invocation.
-
asMcpApprovalResponse
final ConversationItem.McpApprovalResponse asMcpApprovalResponse()
A response to an MCP approval request.
-
asMcpCall
final ConversationItem.McpCall asMcpCall()
An invocation of a tool on an MCP server.
-
asCustomToolCall
final ResponseCustomToolCall asCustomToolCall()
A call to a custom tool created by the model.
-
asCustomToolCallOutput
final ResponseCustomToolCallOutput asCustomToolCallOutput()
The output of a custom tool call from your code, being sent back to the model.
-
accept
final <T extends Any> T accept(ConversationItem.Visitor<T> visitor)
-
validate
final ConversationItem validate()
-
ofMessage
final static ConversationItem ofMessage(Message message)
-
ofFunctionCall
final static ConversationItem ofFunctionCall(ResponseFunctionToolCallItem functionCall)
A tool call to run a function. See the function calling guide for more information.
-
ofFunctionCallOutput
final static ConversationItem ofFunctionCallOutput(ResponseFunctionToolCallOutputItem functionCallOutput)
-
ofFileSearchCall
final static ConversationItem ofFileSearchCall(ResponseFileSearchToolCall fileSearchCall)
The results of a file search tool call. See the file search guide for more information.
-
ofWebSearchCall
final static ConversationItem ofWebSearchCall(ResponseFunctionWebSearch webSearchCall)
The results of a web search tool call. See the web search guide for more information.
-
ofImageGenerationCall
final static ConversationItem ofImageGenerationCall(ConversationItem.ImageGenerationCall imageGenerationCall)
An image generation request made by the model.
-
ofComputerCall
final static ConversationItem ofComputerCall(ResponseComputerToolCall computerCall)
A tool call to a computer use tool. See the computer use guide for more information.
-
ofComputerCallOutput
final static ConversationItem ofComputerCallOutput(ResponseComputerToolCallOutputItem computerCallOutput)
-
ofReasoning
final static ConversationItem 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
input
to the Responses API for subsequent turns of a conversation if you are manually managing context.
-
ofCodeInterpreterCall
final static ConversationItem ofCodeInterpreterCall(ResponseCodeInterpreterToolCall codeInterpreterCall)
A tool call to run code.
-
ofLocalShellCall
final static ConversationItem ofLocalShellCall(ConversationItem.LocalShellCall localShellCall)
A tool call to run a command on the local shell.
-
ofLocalShellCallOutput
final static ConversationItem ofLocalShellCallOutput(ConversationItem.LocalShellCallOutput localShellCallOutput)
The output of a local shell tool call.
-
ofMcpListTools
final static ConversationItem ofMcpListTools(ConversationItem.McpListTools mcpListTools)
A list of tools available on an MCP server.
-
ofMcpApprovalRequest
final static ConversationItem ofMcpApprovalRequest(ConversationItem.McpApprovalRequest mcpApprovalRequest)
A request for human approval of a tool invocation.
-
ofMcpApprovalResponse
final static ConversationItem ofMcpApprovalResponse(ConversationItem.McpApprovalResponse mcpApprovalResponse)
A response to an MCP approval request.
-
ofMcpCall
final static ConversationItem ofMcpCall(ConversationItem.McpCall mcpCall)
An invocation of a tool on an MCP server.
-
ofCustomToolCall
final static ConversationItem ofCustomToolCall(ResponseCustomToolCall customToolCall)
A call to a custom tool created by the model.
-
ofCustomToolCallOutput
final static ConversationItem ofCustomToolCallOutput(ResponseCustomToolCallOutput customToolCallOutput)
The output of a custom tool call from your code, being sent back to the model.
-
-
-
-