Class BetaCacheMissReason
-
- All Implemented Interfaces:
public final class BetaCacheMissReason
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaCacheMissReason.VisitorAn interface that defines how to map each variant of BetaCacheMissReason to a value of type T.
public final classBetaCacheMissReason.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaCacheMissModelChanged>modelChanged()A cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.final Optional<BetaCacheMissSystemChanged>systemChanged()A cache_miss_reasonfor a request whosesystemdiffers from the previous request's.final Optional<BetaCacheMissToolsChanged>toolsChanged()A cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.final Optional<BetaCacheMissMessagesChanged>messagesChanged()A cache_miss_reasonfor a request whosemessagesdiffer from the previous request's in an earlier entry, instead of only having entries appended.final Optional<BetaCacheMissPreviousMessageNotFound>previousMessageNotFound()A cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.final Optional<BetaCacheMissUnavailable>unavailable()A cache_miss_reasonfor when the API can't give a diagnosis.final Optional<JsonValue>_json()final BetaCacheMissReason.Typetype()final Optional<Long>cacheMissedInputTokens()final BooleanisModelChanged()final BooleanisSystemChanged()final BooleanisToolsChanged()final BooleanisMessagesChanged()final BooleanisPreviousMessageNotFound()final BooleanisUnavailable()final BetaCacheMissModelChangedasModelChanged()A cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.final BetaCacheMissSystemChangedasSystemChanged()A cache_miss_reasonfor a request whosesystemdiffers from the previous request's.final BetaCacheMissToolsChangedasToolsChanged()A cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.final BetaCacheMissMessagesChangedasMessagesChanged()A cache_miss_reasonfor a request whosemessagesdiffer from the previous request's in an earlier entry, instead of only having entries appended.final BetaCacheMissPreviousMessageNotFoundasPreviousMessageNotFound()A cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.final BetaCacheMissUnavailableasUnavailable()A cache_miss_reasonfor when the API can't give a diagnosis.final <T extends Any> Taccept(BetaCacheMissReason.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaCacheMissReasonvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaCacheMissReasonofModelChanged(BetaCacheMissModelChanged modelChanged)A cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.final static BetaCacheMissReasonofModelChanged(Long cacheMissedInputTokens)Returns an immutable instance of BetaCacheMissReason whose ofModelChanged variant is built from the given required cacheMissedInputTokens. final static BetaCacheMissReasonofSystemChanged(BetaCacheMissSystemChanged systemChanged)A cache_miss_reasonfor a request whosesystemdiffers from the previous request's.final static BetaCacheMissReasonofSystemChanged(Long cacheMissedInputTokens)Returns an immutable instance of BetaCacheMissReason whose ofSystemChanged variant is built from the given required cacheMissedInputTokens. final static BetaCacheMissReasonofToolsChanged(BetaCacheMissToolsChanged toolsChanged)A cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.final static BetaCacheMissReasonofToolsChanged(Long cacheMissedInputTokens)Returns an immutable instance of BetaCacheMissReason whose ofToolsChanged variant is built from the given required cacheMissedInputTokens. final static BetaCacheMissReasonofMessagesChanged(BetaCacheMissMessagesChanged messagesChanged)A cache_miss_reasonfor a request whosemessagesdiffer from the previous request's in an earlier entry, instead of only having entries appended.final static BetaCacheMissReasonofMessagesChanged(Long cacheMissedInputTokens)Returns an immutable instance of BetaCacheMissReason whose ofMessagesChanged variant is built from the given required cacheMissedInputTokens. final static BetaCacheMissReasonofPreviousMessageNotFound(BetaCacheMissPreviousMessageNotFound previousMessageNotFound)A cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.final static BetaCacheMissReasonofUnavailable(BetaCacheMissUnavailable unavailable)A cache_miss_reasonfor when the API can't give a diagnosis.-
-
Method Detail
-
modelChanged
final Optional<BetaCacheMissModelChanged> modelChanged()
A
cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.See the cache diagnostics guide to learn what to change for each reason.
-
systemChanged
final Optional<BetaCacheMissSystemChanged> systemChanged()
A
cache_miss_reasonfor a request whosesystemdiffers from the previous request's.See the cache diagnostics guide to learn what to change for each reason.
-
toolsChanged
final Optional<BetaCacheMissToolsChanged> toolsChanged()
A
cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.See the cache diagnostics guide to learn what to change for each reason.
-
messagesChanged
final Optional<BetaCacheMissMessagesChanged> messagesChanged()
A
cache_miss_reasonfor a request whosemessagesdiffer from the previous request's in an earlier entry, instead of only having entries appended. Themodel,system, andtoolsmatch.See the cache diagnostics guide to learn what to change for each reason.
-
previousMessageNotFound
final Optional<BetaCacheMissPreviousMessageNotFound> previousMessageNotFound()
A
cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.This doesn't mean that this request changed.
See the cache diagnostics guide to learn what to change for each reason.
-
unavailable
final Optional<BetaCacheMissUnavailable> unavailable()
A
cache_miss_reasonfor when the API can't give a diagnosis. The request itself was processed normally.This includes a request whose
model,system, andtoolsmatch the previous request's but whose other prompt-affecting parameters, such asthinkingortool_choice, differ.See the cache diagnostics guide to learn what to change for each reason.
-
type
final BetaCacheMissReason.Type type()
-
cacheMissedInputTokens
final Optional<Long> cacheMissedInputTokens()
-
isModelChanged
final Boolean isModelChanged()
-
isSystemChanged
final Boolean isSystemChanged()
-
isToolsChanged
final Boolean isToolsChanged()
-
isMessagesChanged
final Boolean isMessagesChanged()
-
isPreviousMessageNotFound
final Boolean isPreviousMessageNotFound()
-
isUnavailable
final Boolean isUnavailable()
-
asModelChanged
final BetaCacheMissModelChanged asModelChanged()
A
cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.See the cache diagnostics guide to learn what to change for each reason.
-
asSystemChanged
final BetaCacheMissSystemChanged asSystemChanged()
A
cache_miss_reasonfor a request whosesystemdiffers from the previous request's.See the cache diagnostics guide to learn what to change for each reason.
-
asToolsChanged
final BetaCacheMissToolsChanged asToolsChanged()
A
cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.See the cache diagnostics guide to learn what to change for each reason.
-
asMessagesChanged
final BetaCacheMissMessagesChanged asMessagesChanged()
A
cache_miss_reasonfor a request whosemessagesdiffer from the previous request's in an earlier entry, instead of only having entries appended. Themodel,system, andtoolsmatch.See the cache diagnostics guide to learn what to change for each reason.
-
asPreviousMessageNotFound
final BetaCacheMissPreviousMessageNotFound asPreviousMessageNotFound()
A
cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.This doesn't mean that this request changed.
See the cache diagnostics guide to learn what to change for each reason.
-
asUnavailable
final BetaCacheMissUnavailable asUnavailable()
A
cache_miss_reasonfor when the API can't give a diagnosis. The request itself was processed normally.This includes a request whose
model,system, andtoolsmatch the previous request's but whose other prompt-affecting parameters, such asthinkingortool_choice, differ.See the cache diagnostics guide to learn what to change for each reason.
-
accept
final <T extends Any> T accept(BetaCacheMissReason.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 = betaCacheMissReason.accept(new BetaCacheMissReason.Visitor<Optional<String>>() { @Override public Optional<String> visitModelChanged(BetaCacheMissModelChanged modelChanged) { return Optional.of(modelChanged.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaCacheMissReason 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.
-
ofModelChanged
final static BetaCacheMissReason ofModelChanged(BetaCacheMissModelChanged modelChanged)
A
cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.See the cache diagnostics guide to learn what to change for each reason.
-
ofModelChanged
final static BetaCacheMissReason ofModelChanged(Long cacheMissedInputTokens)
Returns an immutable instance of BetaCacheMissReason whose ofModelChanged variant is built from the given required cacheMissedInputTokens.
-
ofSystemChanged
final static BetaCacheMissReason ofSystemChanged(BetaCacheMissSystemChanged systemChanged)
A
cache_miss_reasonfor a request whosesystemdiffers from the previous request's.See the cache diagnostics guide to learn what to change for each reason.
-
ofSystemChanged
final static BetaCacheMissReason ofSystemChanged(Long cacheMissedInputTokens)
Returns an immutable instance of BetaCacheMissReason whose ofSystemChanged variant is built from the given required cacheMissedInputTokens.
-
ofToolsChanged
final static BetaCacheMissReason ofToolsChanged(BetaCacheMissToolsChanged toolsChanged)
A
cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.See the cache diagnostics guide to learn what to change for each reason.
-
ofToolsChanged
final static BetaCacheMissReason ofToolsChanged(Long cacheMissedInputTokens)
Returns an immutable instance of BetaCacheMissReason whose ofToolsChanged variant is built from the given required cacheMissedInputTokens.
-
ofMessagesChanged
final static BetaCacheMissReason ofMessagesChanged(BetaCacheMissMessagesChanged messagesChanged)
A
cache_miss_reasonfor a request whosemessagesdiffer from the previous request's in an earlier entry, instead of only having entries appended. Themodel,system, andtoolsmatch.See the cache diagnostics guide to learn what to change for each reason.
-
ofMessagesChanged
final static BetaCacheMissReason ofMessagesChanged(Long cacheMissedInputTokens)
Returns an immutable instance of BetaCacheMissReason whose ofMessagesChanged variant is built from the given required cacheMissedInputTokens.
-
ofPreviousMessageNotFound
final static BetaCacheMissReason ofPreviousMessageNotFound(BetaCacheMissPreviousMessageNotFound previousMessageNotFound)
A
cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.This doesn't mean that this request changed.
See the cache diagnostics guide to learn what to change for each reason.
-
ofUnavailable
final static BetaCacheMissReason ofUnavailable(BetaCacheMissUnavailable unavailable)
A
cache_miss_reasonfor when the API can't give a diagnosis. The request itself was processed normally.This includes a request whose
model,system, andtoolsmatch the previous request's but whose other prompt-affecting parameters, such asthinkingortool_choice, differ.See the cache diagnostics guide to learn what to change for each reason.
-
-
-
-