Interface BetaContentBlockParam.Visitor
-
- All Implemented Interfaces:
public interface BetaContentBlockParam.Visitor<T extends Object>An interface that defines how to map each variant of BetaContentBlockParam to a value of type T.
-
-
Method Summary
Modifier and Type Method Description abstract TvisitText(BetaTextBlockParam text)Regular text content. abstract TvisitImage(BetaImageBlockParam image)Image content specified directly as base64 data or as a reference via a URL. abstract TvisitDocument(BetaRequestDocumentBlock document)Document content, either specified directly as base64 data, as text, or as a reference via a URL. abstract TvisitSearchResult(BetaSearchResultBlockParam searchResult)A search result block containing source, title, and content from search operations. abstract TvisitThinking(BetaThinkingBlockParam thinking)A block specifying internal thinking by the model. abstract TvisitRedactedThinking(BetaRedactedThinkingBlockParam redactedThinking)A block specifying internal, redacted thinking by the model. abstract TvisitToolUse(BetaToolUseBlockParam toolUse)A block indicating a tool use by the model. abstract TvisitToolResult(BetaToolResultBlockParam toolResult)A block specifying the results of a tool use by the model. abstract TvisitServerToolUse(BetaServerToolUseBlockParam serverToolUse)abstract TvisitWebSearchToolResult(BetaWebSearchToolResultBlockParam webSearchToolResult)abstract TvisitWebFetchToolResult(BetaWebFetchToolResultBlockParam webFetchToolResult)abstract TvisitAdvisorToolResult(BetaAdvisorToolResultBlockParam advisorToolResult)abstract TvisitCodeExecutionToolResult(BetaCodeExecutionToolResultBlockParam codeExecutionToolResult)abstract TvisitBashCodeExecutionToolResult(BetaBashCodeExecutionToolResultBlockParam bashCodeExecutionToolResult)abstract TvisitTextEditorCodeExecutionToolResult(BetaTextEditorCodeExecutionToolResultBlockParam textEditorCodeExecutionToolResult)abstract TvisitToolSearchToolResult(BetaToolSearchToolResultBlockParam toolSearchToolResult)abstract TvisitMcpToolUse(BetaMcpToolUseBlockParam mcpToolUse)abstract TvisitMcpToolResult(BetaRequestMcpToolResultBlockParam mcpToolResult)abstract TvisitContainerUpload(BetaContainerUploadBlockParam containerUpload)A content block that represents a file to be uploaded to the container Files uploaded via this block will be available in the container's input directory. abstract TvisitCompaction(BetaCompactionBlockParam compaction)A compaction block containing summary of previous context. abstract TvisitMidConvSystem(BetaMidConversationSystemBlockParam midConvSystem)System instructions that appear mid-conversation. abstract TvisitFallback(BetaFallbackBlockParam fallback)A fallbackblock echoed back from a prior response.Tunknown(JsonValue json)Maps an unknown variant of BetaContentBlockParam to a value of type T. -
-
Method Detail
-
visitText
abstract T visitText(BetaTextBlockParam text)
Regular text content.
-
visitImage
abstract T visitImage(BetaImageBlockParam image)
Image content specified directly as base64 data or as a reference via a URL.
-
visitDocument
abstract T visitDocument(BetaRequestDocumentBlock document)
Document content, either specified directly as base64 data, as text, or as a reference via a URL.
-
visitSearchResult
abstract T visitSearchResult(BetaSearchResultBlockParam searchResult)
A search result block containing source, title, and content from search operations.
-
visitThinking
abstract T visitThinking(BetaThinkingBlockParam thinking)
A block specifying internal thinking by the model.
-
visitRedactedThinking
abstract T visitRedactedThinking(BetaRedactedThinkingBlockParam redactedThinking)
A block specifying internal, redacted thinking by the model.
-
visitToolUse
abstract T visitToolUse(BetaToolUseBlockParam toolUse)
A block indicating a tool use by the model.
-
visitToolResult
abstract T visitToolResult(BetaToolResultBlockParam toolResult)
A block specifying the results of a tool use by the model.
-
visitServerToolUse
abstract T visitServerToolUse(BetaServerToolUseBlockParam serverToolUse)
-
visitWebSearchToolResult
abstract T visitWebSearchToolResult(BetaWebSearchToolResultBlockParam webSearchToolResult)
-
visitWebFetchToolResult
abstract T visitWebFetchToolResult(BetaWebFetchToolResultBlockParam webFetchToolResult)
-
visitAdvisorToolResult
abstract T visitAdvisorToolResult(BetaAdvisorToolResultBlockParam advisorToolResult)
-
visitCodeExecutionToolResult
abstract T visitCodeExecutionToolResult(BetaCodeExecutionToolResultBlockParam codeExecutionToolResult)
-
visitBashCodeExecutionToolResult
abstract T visitBashCodeExecutionToolResult(BetaBashCodeExecutionToolResultBlockParam bashCodeExecutionToolResult)
-
visitTextEditorCodeExecutionToolResult
abstract T visitTextEditorCodeExecutionToolResult(BetaTextEditorCodeExecutionToolResultBlockParam textEditorCodeExecutionToolResult)
-
visitToolSearchToolResult
abstract T visitToolSearchToolResult(BetaToolSearchToolResultBlockParam toolSearchToolResult)
-
visitMcpToolUse
abstract T visitMcpToolUse(BetaMcpToolUseBlockParam mcpToolUse)
-
visitMcpToolResult
abstract T visitMcpToolResult(BetaRequestMcpToolResultBlockParam mcpToolResult)
-
visitContainerUpload
abstract T visitContainerUpload(BetaContainerUploadBlockParam containerUpload)
A content block that represents a file to be uploaded to the container Files uploaded via this block will be available in the container's input directory.
-
visitCompaction
abstract T visitCompaction(BetaCompactionBlockParam compaction)
A compaction block containing summary of previous context.
Users should round-trip these blocks from responses to subsequent requests to maintain context across compaction boundaries.
When content is None, the block represents a failed compaction. The server treats these as no-ops. Empty string content is not allowed.
-
visitMidConvSystem
abstract T visitMidConvSystem(BetaMidConversationSystemBlockParam midConvSystem)
System instructions that appear mid-conversation.
Use this block to provide or update system-level instructions at a specific point in the conversation, rather than only via the top-level
systemparameter.
-
visitFallback
abstract T visitFallback(BetaFallbackBlockParam fallback)
A
fallbackblock echoed back from a prior response.Accepted in
messages[].contentand never rendered into the prompt, not validated against the request'sfallbackschain or top-levelmodel, and stripped before the sticky-routing cache key is computed.Callers should echo the assistant turn verbatim — block included. The block's position is load-bearing for thinking verification: the thinking runs on either side of a fallback hop carry independently-rooted verification hash chains, and this block is the only record of where one chain ends and the next begins. When thinking runs flank the boundary, omitting the block merges the runs into one contiguous span whose hashes cannot verify (the request is rejected), and moving it into the middle of a single run splits that run's chain and is likewise rejected; between non-thinking blocks the block's placement has no verification effect.
-
unknown
T unknown(JsonValue json)
Maps an unknown variant of BetaContentBlockParam to a value of type T.
An instance of BetaContentBlockParam 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.
-
-
-
-