Class BetaToolUseCaller
-
- All Implemented Interfaces:
public final class BetaToolUseCallerWhich party invoked the tool call: the model directly, or a server tool on its behalf.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaToolUseCaller.VisitorAn interface that defines how to map each variant of BetaToolUseCaller to a value of type T.
public final classBetaToolUseCaller.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaDirectCaller>direct()Tool invocation directly from the model. final Optional<BetaServerToolCaller>codeExecution20250825()Tool invocation generated by a server-side tool. final Optional<BetaServerToolCaller20260120>codeExecution20260120()final Optional<JsonValue>_json()final BetaToolUseCaller.Typetype()final Optional<String>toolId()final BooleanisDirect()final BooleanisCodeExecution20250825()final BooleanisCodeExecution20260120()final BetaDirectCallerasDirect()Tool invocation directly from the model. final BetaServerToolCallerasCodeExecution20250825()Tool invocation generated by a server-side tool. final BetaServerToolCaller20260120asCodeExecution20260120()final <T extends Any> Taccept(BetaToolUseCaller.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaToolUseCallervalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaToolUseCallerofDirect(BetaDirectCaller direct)Tool invocation directly from the model. final static BetaToolUseCallerofCodeExecution20250825(BetaServerToolCaller codeExecution20250825)Tool invocation generated by a server-side tool. final static BetaToolUseCallerofCodeExecution20250825(String toolId)Returns an immutable instance of BetaToolUseCaller whose ofCodeExecution20250825 variant is built from the given required toolId. final static BetaToolUseCallerofCodeExecution20260120(BetaServerToolCaller20260120 codeExecution20260120)final static BetaToolUseCallerofCodeExecution20260120(String toolId)Returns an immutable instance of BetaToolUseCaller whose ofCodeExecution20260120 variant is built from the given required toolId. -
-
Method Detail
-
direct
final Optional<BetaDirectCaller> direct()
Tool invocation directly from the model.
-
codeExecution20250825
final Optional<BetaServerToolCaller> codeExecution20250825()
Tool invocation generated by a server-side tool.
-
codeExecution20260120
final Optional<BetaServerToolCaller20260120> codeExecution20260120()
-
type
final BetaToolUseCaller.Type type()
-
isCodeExecution20250825
final Boolean isCodeExecution20250825()
-
isCodeExecution20260120
final Boolean isCodeExecution20260120()
-
asDirect
final BetaDirectCaller asDirect()
Tool invocation directly from the model.
-
asCodeExecution20250825
final BetaServerToolCaller asCodeExecution20250825()
Tool invocation generated by a server-side tool.
-
asCodeExecution20260120
final BetaServerToolCaller20260120 asCodeExecution20260120()
-
accept
final <T extends Any> T accept(BetaToolUseCaller.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 = betaToolUseCaller.accept(new BetaToolUseCaller.Visitor<Optional<String>>() { @Override public Optional<String> visitDirect(BetaDirectCaller direct) { return Optional.of(direct.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaToolUseCaller 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.
-
ofDirect
final static BetaToolUseCaller ofDirect(BetaDirectCaller direct)
Tool invocation directly from the model.
-
ofCodeExecution20250825
final static BetaToolUseCaller ofCodeExecution20250825(BetaServerToolCaller codeExecution20250825)
Tool invocation generated by a server-side tool.
-
ofCodeExecution20250825
final static BetaToolUseCaller ofCodeExecution20250825(String toolId)
Returns an immutable instance of BetaToolUseCaller whose ofCodeExecution20250825 variant is built from the given required toolId.
-
ofCodeExecution20260120
final static BetaToolUseCaller ofCodeExecution20260120(BetaServerToolCaller20260120 codeExecution20260120)
-
ofCodeExecution20260120
final static BetaToolUseCaller ofCodeExecution20260120(String toolId)
Returns an immutable instance of BetaToolUseCaller whose ofCodeExecution20260120 variant is built from the given required toolId.
-
-
-
-