Class BetaToolResultBlockParam.Content.Block
-
- All Implemented Interfaces:
public final class BetaToolResultBlockParam.Content.BlockTool reference block that can be included in tool_result content.
-
-
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.
-
Method Summary
-
-
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.
-
isSearchResult
final Boolean isSearchResult()
-
isDocument
final Boolean isDocument()
-
isToolReference
final Boolean isToolReference()
-
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.
-
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)
-
ofImage
final static BetaToolResultBlockParam.Content.Block ofImage(BetaImageBlockParam image)
-
ofSearchResult
final static BetaToolResultBlockParam.Content.Block ofSearchResult(BetaSearchResultBlockParam searchResult)
-
ofDocument
final static BetaToolResultBlockParam.Content.Block ofDocument(BetaRequestDocumentBlock document)
-
ofToolReference
final static BetaToolResultBlockParam.Content.Block ofToolReference(BetaToolReferenceBlockParam toolReference)
Tool reference block that can be included in tool_result content.
-
-
-
-