Class BetaToolResultBlockParam.Content.Block
-
- All Implemented Interfaces:
public final class BetaToolResultBlockParam.Content.Block
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaToolResultBlockParam.Content.Block.VisitorAn interface that defines how to map each variant of Block to a value of type T.
public final classBetaToolResultBlockParam.Content.Block.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaTextBlockParam>text()final Optional<BetaImageBlockParam>image()final Optional<BetaSearchResultBlockParam>searchResult()final Optional<BetaRequestDocumentBlock>document()final Optional<BetaToolReferenceBlockParam>toolReference()Tool reference block that can be included in tool_result content. final Optional<BetaBrowserStateBlockParam>browserState()The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced. final Optional<JsonValue>_json()final BetaToolResultBlockParam.Content.Block.Typetype()final Optional<BetaCacheControlEphemeral>cacheControl()final Optional<String>title()final BooleanisText()final BooleanisImage()final BooleanisSearchResult()final BooleanisDocument()final BooleanisToolReference()final BooleanisBrowserState()final BetaTextBlockParamasText()final BetaImageBlockParamasImage()final BetaSearchResultBlockParamasSearchResult()final BetaRequestDocumentBlockasDocument()final BetaToolReferenceBlockParamasToolReference()Tool reference block that can be included in tool_result content. final BetaBrowserStateBlockParamasBrowserState()The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced. final <T extends Any> Taccept(BetaToolResultBlockParam.Content.Block.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaToolResultBlockParam.Content.Blockvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaToolResultBlockParam.Content.BlockofText(BetaTextBlockParam text)final static BetaToolResultBlockParam.Content.BlockofText(String text)Returns an immutable instance of Block whose ofText variant is built from the given required text. final static BetaToolResultBlockParam.Content.BlockofImage(BetaImageBlockParam image)final static BetaToolResultBlockParam.Content.BlockofImage(BetaImageBlockParam.Source source)Returns an immutable instance of Block whose ofImage variant is built from the given required source. final static BetaToolResultBlockParam.Content.BlockofImage(BetaBase64ImageSource base64)Alias for calling ofImage with BetaImageBlockParam.Source.ofBase64(base64).final static BetaToolResultBlockParam.Content.BlockofImage(BetaUrlImageSource url)Alias for calling ofImage with BetaImageBlockParam.Source.ofUrl(url).final static BetaToolResultBlockParam.Content.BlockofImage(BetaFileImageSource file)Alias for calling ofImage with BetaImageBlockParam.Source.ofFile(file).final static BetaToolResultBlockParam.Content.BlockofSearchResult(BetaSearchResultBlockParam searchResult)final static BetaToolResultBlockParam.Content.BlockofDocument(BetaRequestDocumentBlock document)final static BetaToolResultBlockParam.Content.BlockofDocument(BetaRequestDocumentBlock.Source source)Returns an immutable instance of Block whose ofDocument variant is built from the given required source. final static BetaToolResultBlockParam.Content.BlockofDocument(BetaBase64PdfSource base64)Alias for calling ofDocument with BetaRequestDocumentBlock.Source.ofBase64(base64).final static BetaToolResultBlockParam.Content.BlockofDocument(BetaPlainTextSource text)Alias for calling ofDocument with BetaRequestDocumentBlock.Source.ofText(text).final static BetaToolResultBlockParam.Content.BlockofDocument(BetaContentBlockSource content)Alias for calling ofDocument with BetaRequestDocumentBlock.Source.ofContent(content).final static BetaToolResultBlockParam.Content.BlockofDocument(BetaUrlPdfSource url)Alias for calling ofDocument with BetaRequestDocumentBlock.Source.ofUrl(url).final static BetaToolResultBlockParam.Content.BlockofDocument(BetaFileDocumentSource file)Alias for calling ofDocument with BetaRequestDocumentBlock.Source.ofFile(file).final static BetaToolResultBlockParam.Content.BlockofToolReference(BetaToolReferenceBlockParam toolReference)Tool reference block that can be included in tool_result content. final static BetaToolResultBlockParam.Content.BlockofToolReference(String toolName)Returns an immutable instance of Block whose ofToolReference variant is built from the given required toolName. final static BetaToolResultBlockParam.Content.BlockofBrowserState(BetaBrowserStateBlockParam browserState)The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced. final static BetaToolResultBlockParam.Content.BlockofBrowserState(List<BetaBrowserStateTabEntry> tabs)Returns an immutable instance of Block whose ofBrowserState variant is built from the given required tabs. -
-
Method Detail
-
text
final Optional<BetaTextBlockParam> text()
-
image
final Optional<BetaImageBlockParam> image()
-
searchResult
final Optional<BetaSearchResultBlockParam> searchResult()
-
document
final Optional<BetaRequestDocumentBlock> document()
-
toolReference
final Optional<BetaToolReferenceBlockParam> toolReference()
Tool reference block that can be included in tool_result content.
-
browserState
final Optional<BetaBrowserStateBlockParam> browserState()
The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced.
At most one per
tool_result, only on a non-error result answering a browser toolset membertool_use. The server renders the model-visible text from it; the model never sees the raw fields.
-
type
final BetaToolResultBlockParam.Content.Block.Type type()
-
cacheControl
final Optional<BetaCacheControlEphemeral> cacheControl()
-
isSearchResult
final Boolean isSearchResult()
-
isDocument
final Boolean isDocument()
-
isToolReference
final Boolean isToolReference()
-
isBrowserState
final Boolean isBrowserState()
-
asText
final BetaTextBlockParam asText()
-
asImage
final BetaImageBlockParam asImage()
-
asSearchResult
final BetaSearchResultBlockParam asSearchResult()
-
asDocument
final BetaRequestDocumentBlock asDocument()
-
asToolReference
final BetaToolReferenceBlockParam asToolReference()
Tool reference block that can be included in tool_result content.
-
asBrowserState
final BetaBrowserStateBlockParam asBrowserState()
The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced.
At most one per
tool_result, only on a non-error result answering a browser toolset membertool_use. The server renders the model-visible text from it; the model never sees the raw fields.
-
accept
final <T extends Any> T accept(BetaToolResultBlockParam.Content.Block.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.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = block.accept(new Block.Visitor<Optional<String>>() { @Override public Optional<String> visitText(BetaTextBlockParam text) { return Optional.of(text.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaToolResultBlockParam.Content.Block 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.
-
ofText
final static BetaToolResultBlockParam.Content.Block ofText(BetaTextBlockParam text)
-
ofText
final static BetaToolResultBlockParam.Content.Block ofText(String text)
-
ofImage
final static BetaToolResultBlockParam.Content.Block ofImage(BetaImageBlockParam image)
-
ofImage
final static BetaToolResultBlockParam.Content.Block ofImage(BetaImageBlockParam.Source source)
Returns an immutable instance of Block whose ofImage variant is built from the given required source.
-
ofImage
final static BetaToolResultBlockParam.Content.Block ofImage(BetaBase64ImageSource base64)
Alias for calling ofImage with
BetaImageBlockParam.Source.ofBase64(base64).
-
ofImage
final static BetaToolResultBlockParam.Content.Block ofImage(BetaUrlImageSource url)
Alias for calling ofImage with
BetaImageBlockParam.Source.ofUrl(url).
-
ofImage
final static BetaToolResultBlockParam.Content.Block ofImage(BetaFileImageSource file)
Alias for calling ofImage with
BetaImageBlockParam.Source.ofFile(file).
-
ofSearchResult
final static BetaToolResultBlockParam.Content.Block ofSearchResult(BetaSearchResultBlockParam searchResult)
-
ofDocument
final static BetaToolResultBlockParam.Content.Block ofDocument(BetaRequestDocumentBlock document)
-
ofDocument
final static BetaToolResultBlockParam.Content.Block ofDocument(BetaRequestDocumentBlock.Source source)
Returns an immutable instance of Block whose ofDocument variant is built from the given required source.
-
ofDocument
final static BetaToolResultBlockParam.Content.Block ofDocument(BetaBase64PdfSource base64)
Alias for calling ofDocument with
BetaRequestDocumentBlock.Source.ofBase64(base64).
-
ofDocument
final static BetaToolResultBlockParam.Content.Block ofDocument(BetaPlainTextSource text)
Alias for calling ofDocument with
BetaRequestDocumentBlock.Source.ofText(text).
-
ofDocument
final static BetaToolResultBlockParam.Content.Block ofDocument(BetaContentBlockSource content)
Alias for calling ofDocument with
BetaRequestDocumentBlock.Source.ofContent(content).
-
ofDocument
final static BetaToolResultBlockParam.Content.Block ofDocument(BetaUrlPdfSource url)
Alias for calling ofDocument with
BetaRequestDocumentBlock.Source.ofUrl(url).
-
ofDocument
final static BetaToolResultBlockParam.Content.Block ofDocument(BetaFileDocumentSource file)
Alias for calling ofDocument with
BetaRequestDocumentBlock.Source.ofFile(file).
-
ofToolReference
final static BetaToolResultBlockParam.Content.Block ofToolReference(BetaToolReferenceBlockParam toolReference)
Tool reference block that can be included in tool_result content.
-
ofToolReference
final static BetaToolResultBlockParam.Content.Block ofToolReference(String toolName)
Returns an immutable instance of Block whose ofToolReference variant is built from the given required toolName.
-
ofBrowserState
final static BetaToolResultBlockParam.Content.Block ofBrowserState(BetaBrowserStateBlockParam browserState)
The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced.
At most one per
tool_result, only on a non-error result answering a browser toolset membertool_use. The server renders the model-visible text from it; the model never sees the raw fields.
-
ofBrowserState
final static BetaToolResultBlockParam.Content.Block ofBrowserState(List<BetaBrowserStateTabEntry> tabs)
Returns an immutable instance of Block whose ofBrowserState variant is built from the given required tabs.
-
-
-
-