Interface ConversationItem.Visitor
-
- All Implemented Interfaces:
public interface ConversationItem.Visitor<T extends Object>
An interface that defines how to map each variant of ConversationItem to a value of type T.
-
-
Method Summary
Modifier and Type Method Description abstract T
visitMessage(Message message)
A message to or from the model. abstract T
visitFunctionCall(ResponseFunctionToolCallItem functionCall)
A tool call to run a function. abstract T
visitFunctionCallOutput(ResponseFunctionToolCallOutputItem functionCallOutput)
abstract T
visitFileSearchCall(ResponseFileSearchToolCall fileSearchCall)
The results of a file search tool call. abstract T
visitWebSearchCall(ResponseFunctionWebSearch webSearchCall)
The results of a web search tool call. abstract T
visitImageGenerationCall(ConversationItem.ImageGenerationCall imageGenerationCall)
An image generation request made by the model. abstract T
visitComputerCall(ResponseComputerToolCall computerCall)
A tool call to a computer use tool. abstract T
visitComputerCallOutput(ResponseComputerToolCallOutputItem computerCallOutput)
abstract T
visitReasoning(ResponseReasoningItem reasoning)
A description of the chain of thought used by a reasoning model while generating a response. abstract T
visitCodeInterpreterCall(ResponseCodeInterpreterToolCall codeInterpreterCall)
A tool call to run code. abstract T
visitLocalShellCall(ConversationItem.LocalShellCall localShellCall)
A tool call to run a command on the local shell. abstract T
visitLocalShellCallOutput(ConversationItem.LocalShellCallOutput localShellCallOutput)
The output of a local shell tool call. abstract T
visitMcpListTools(ConversationItem.McpListTools mcpListTools)
A list of tools available on an MCP server. abstract T
visitMcpApprovalRequest(ConversationItem.McpApprovalRequest mcpApprovalRequest)
A request for human approval of a tool invocation. abstract T
visitMcpApprovalResponse(ConversationItem.McpApprovalResponse mcpApprovalResponse)
A response to an MCP approval request. abstract T
visitMcpCall(ConversationItem.McpCall mcpCall)
An invocation of a tool on an MCP server. abstract T
visitCustomToolCall(ResponseCustomToolCall customToolCall)
A call to a custom tool created by the model. abstract T
visitCustomToolCallOutput(ResponseCustomToolCallOutput customToolCallOutput)
The output of a custom tool call from your code, being sent back to the model. T
unknown(JsonValue json)
Maps an unknown variant of ConversationItem to a value of type T. -
-
Method Detail
-
visitMessage
abstract T visitMessage(Message message)
A message to or from the model.
-
visitFunctionCall
abstract T visitFunctionCall(ResponseFunctionToolCallItem functionCall)
A tool call to run a function. See the function calling guide for more information.
-
visitFunctionCallOutput
abstract T visitFunctionCallOutput(ResponseFunctionToolCallOutputItem functionCallOutput)
-
visitFileSearchCall
abstract T visitFileSearchCall(ResponseFileSearchToolCall fileSearchCall)
The results of a file search tool call. See the file search guide for more information.
-
visitWebSearchCall
abstract T visitWebSearchCall(ResponseFunctionWebSearch webSearchCall)
The results of a web search tool call. See the web search guide for more information.
-
visitImageGenerationCall
abstract T visitImageGenerationCall(ConversationItem.ImageGenerationCall imageGenerationCall)
An image generation request made by the model.
-
visitComputerCall
abstract T visitComputerCall(ResponseComputerToolCall computerCall)
A tool call to a computer use tool. See the computer use guide for more information.
-
visitComputerCallOutput
abstract T visitComputerCallOutput(ResponseComputerToolCallOutputItem computerCallOutput)
-
visitReasoning
abstract T visitReasoning(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.
-
visitCodeInterpreterCall
abstract T visitCodeInterpreterCall(ResponseCodeInterpreterToolCall codeInterpreterCall)
A tool call to run code.
-
visitLocalShellCall
abstract T visitLocalShellCall(ConversationItem.LocalShellCall localShellCall)
A tool call to run a command on the local shell.
-
visitLocalShellCallOutput
abstract T visitLocalShellCallOutput(ConversationItem.LocalShellCallOutput localShellCallOutput)
The output of a local shell tool call.
-
visitMcpListTools
abstract T visitMcpListTools(ConversationItem.McpListTools mcpListTools)
A list of tools available on an MCP server.
-
visitMcpApprovalRequest
abstract T visitMcpApprovalRequest(ConversationItem.McpApprovalRequest mcpApprovalRequest)
A request for human approval of a tool invocation.
-
visitMcpApprovalResponse
abstract T visitMcpApprovalResponse(ConversationItem.McpApprovalResponse mcpApprovalResponse)
A response to an MCP approval request.
-
visitMcpCall
abstract T visitMcpCall(ConversationItem.McpCall mcpCall)
An invocation of a tool on an MCP server.
-
visitCustomToolCall
abstract T visitCustomToolCall(ResponseCustomToolCall customToolCall)
A call to a custom tool created by the model.
-
visitCustomToolCallOutput
abstract T visitCustomToolCallOutput(ResponseCustomToolCallOutput customToolCallOutput)
The output of a custom tool call from your code, being sent back to the model.
-
unknown
T unknown(JsonValue json)
Maps an unknown variant of ConversationItem to a value of type T.
An instance of ConversationItem can contain an unknown variant if it was deserialized from data that doesn't match any known variant. For example, if the SDK is on an older version than the API, then the API may respond with new variants that the SDK is unaware of.
-
-
-
-