Class BetaUsage.BetaIterationsUsageItems
-
- All Implemented Interfaces:
public final class BetaUsage.BetaIterationsUsageItemsToken usage for a sampling iteration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaUsage.BetaIterationsUsageItems.VisitorAn interface that defines how to map each variant of BetaIterationsUsageItems to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<BetaMessageIterationUsage>message()Token usage for a sampling iteration. final Optional<BetaCompactionIterationUsage>compaction()Token usage for a compaction iteration. final Optional<BetaAdvisorMessageIterationUsage>advisorMessage()Token usage for an advisor sub-inference iteration. final Optional<BetaFallbackMessageIterationUsage>fallbackMessage()Token usage for the fallback-model attempt of a server-side fallback request. final BooleanisMessage()final BooleanisCompaction()final BooleanisAdvisorMessage()final BooleanisFallbackMessage()final BetaMessageIterationUsageasMessage()Token usage for a sampling iteration. final BetaCompactionIterationUsageasCompaction()Token usage for a compaction iteration. final BetaAdvisorMessageIterationUsageasAdvisorMessage()Token usage for an advisor sub-inference iteration. final BetaFallbackMessageIterationUsageasFallbackMessage()Token usage for the fallback-model attempt of a server-side fallback request. final Optional<JsonValue>_json()final <T extends Any> Taccept(BetaUsage.BetaIterationsUsageItems.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaUsage.BetaIterationsUsageItemsvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaUsage.BetaIterationsUsageItemsofMessage(BetaMessageIterationUsage message)Token usage for a sampling iteration. final static BetaUsage.BetaIterationsUsageItemsofCompaction(BetaCompactionIterationUsage compaction)Token usage for a compaction iteration. final static BetaUsage.BetaIterationsUsageItemsofAdvisorMessage(BetaAdvisorMessageIterationUsage advisorMessage)Token usage for an advisor sub-inference iteration. final static BetaUsage.BetaIterationsUsageItemsofFallbackMessage(BetaFallbackMessageIterationUsage fallbackMessage)Token usage for the fallback-model attempt of a server-side fallback request. -
-
Method Detail
-
message
final Optional<BetaMessageIterationUsage> message()
Token usage for a sampling iteration.
-
compaction
final Optional<BetaCompactionIterationUsage> compaction()
Token usage for a compaction iteration.
-
advisorMessage
final Optional<BetaAdvisorMessageIterationUsage> advisorMessage()
Token usage for an advisor sub-inference iteration.
-
fallbackMessage
final Optional<BetaFallbackMessageIterationUsage> fallbackMessage()
Token usage for the fallback-model attempt of a server-side fallback request.
Produced in place of a
messageentry for whichever hop served the response. A declined hop produces the existingmessageentry. Whether a fallback model served the response is signalled by the presence of this entry inusage.iterations.
-
isCompaction
final Boolean isCompaction()
-
isAdvisorMessage
final Boolean isAdvisorMessage()
-
isFallbackMessage
final Boolean isFallbackMessage()
-
asMessage
final BetaMessageIterationUsage asMessage()
Token usage for a sampling iteration.
-
asCompaction
final BetaCompactionIterationUsage asCompaction()
Token usage for a compaction iteration.
-
asAdvisorMessage
final BetaAdvisorMessageIterationUsage asAdvisorMessage()
Token usage for an advisor sub-inference iteration.
-
asFallbackMessage
final BetaFallbackMessageIterationUsage asFallbackMessage()
Token usage for the fallback-model attempt of a server-side fallback request.
Produced in place of a
messageentry for whichever hop served the response. A declined hop produces the existingmessageentry. Whether a fallback model served the response is signalled by the presence of this entry inusage.iterations.
-
accept
final <T extends Any> T accept(BetaUsage.BetaIterationsUsageItems.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 = betaIterationsUsageItems.accept(new BetaIterationsUsageItems.Visitor<Optional<String>>() { @Override public Optional<String> visitMessage(BetaMessageIterationUsage message) { return Optional.of(message.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaUsage.BetaIterationsUsageItems 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.
-
ofMessage
final static BetaUsage.BetaIterationsUsageItems ofMessage(BetaMessageIterationUsage message)
Token usage for a sampling iteration.
-
ofCompaction
final static BetaUsage.BetaIterationsUsageItems ofCompaction(BetaCompactionIterationUsage compaction)
Token usage for a compaction iteration.
-
ofAdvisorMessage
final static BetaUsage.BetaIterationsUsageItems ofAdvisorMessage(BetaAdvisorMessageIterationUsage advisorMessage)
Token usage for an advisor sub-inference iteration.
-
ofFallbackMessage
final static BetaUsage.BetaIterationsUsageItems ofFallbackMessage(BetaFallbackMessageIterationUsage fallbackMessage)
Token usage for the fallback-model attempt of a server-side fallback request.
Produced in place of a
messageentry for whichever hop served the response. A declined hop produces the existingmessageentry. Whether a fallback model served the response is signalled by the presence of this entry inusage.iterations.
-
-
-
-