Class CacheMissReason
-
- All Implemented Interfaces:
public final class CacheMissReason
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceCacheMissReason.VisitorAn interface that defines how to map each variant of CacheMissReason to a value of type T.
public final classCacheMissReason.Type
-
Method Summary
Modifier and Type Method Description final Optional<CacheMissModelChanged>modelChanged()A cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.final Optional<CacheMissSystemChanged>systemChanged()A cache_miss_reasonfor a request whosesystemdiffers from the previous request's.final Optional<CacheMissToolsChanged>toolsChanged()A cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.final Optional<CacheMissMessagesChanged>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<CacheMissPreviousMessageNotFound>previousMessageNotFound()A cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.final Optional<CacheMissUnavailable>unavailable()A cache_miss_reasonfor when the API can't give a diagnosis.final Optional<JsonValue>_json()final CacheMissReason.Typetype()final Optional<Long>cacheMissedInputTokens()final BooleanisModelChanged()final BooleanisSystemChanged()final BooleanisToolsChanged()final BooleanisMessagesChanged()final BooleanisPreviousMessageNotFound()final BooleanisUnavailable()final CacheMissModelChangedasModelChanged()A cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.final CacheMissSystemChangedasSystemChanged()A cache_miss_reasonfor a request whosesystemdiffers from the previous request's.final CacheMissToolsChangedasToolsChanged()A cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.final CacheMissMessagesChangedasMessagesChanged()A cache_miss_reasonfor a request whosemessagesdiffer from the previous request's in an earlier entry, instead of only having entries appended.final CacheMissPreviousMessageNotFoundasPreviousMessageNotFound()A cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.final CacheMissUnavailableasUnavailable()A cache_miss_reasonfor when the API can't give a diagnosis.final <T extends Any> Taccept(CacheMissReason.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final CacheMissReasonvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static CacheMissReasonofModelChanged(CacheMissModelChanged modelChanged)A cache_miss_reasonfor a request whosemodelorspeeddiffers from the previous request's.final static CacheMissReasonofModelChanged(Long cacheMissedInputTokens)Returns an immutable instance of CacheMissReason whose ofModelChanged variant is built from the given required cacheMissedInputTokens. final static CacheMissReasonofSystemChanged(CacheMissSystemChanged systemChanged)A cache_miss_reasonfor a request whosesystemdiffers from the previous request's.final static CacheMissReasonofSystemChanged(Long cacheMissedInputTokens)Returns an immutable instance of CacheMissReason whose ofSystemChanged variant is built from the given required cacheMissedInputTokens. final static CacheMissReasonofToolsChanged(CacheMissToolsChanged toolsChanged)A cache_miss_reasonfor a request whosetoolsdiffer from the previous request's, for example because tools were added, removed, or reordered.final static CacheMissReasonofToolsChanged(Long cacheMissedInputTokens)Returns an immutable instance of CacheMissReason whose ofToolsChanged variant is built from the given required cacheMissedInputTokens. final static CacheMissReasonofMessagesChanged(CacheMissMessagesChanged 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 CacheMissReasonofMessagesChanged(Long cacheMissedInputTokens)Returns an immutable instance of CacheMissReason whose ofMessagesChanged variant is built from the given required cacheMissedInputTokens. final static CacheMissReasonofPreviousMessageNotFound(CacheMissPreviousMessageNotFound previousMessageNotFound)A cache_miss_reasonfor when the API doesn't have a stored record of the request thatdiagnostics.previous_message_idreferences.final static CacheMissReasonofUnavailable(CacheMissUnavailable unavailable)A cache_miss_reasonfor when the API can't give a diagnosis.-
-
Method Detail
-
modelChanged
final Optional<CacheMissModelChanged> 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<CacheMissSystemChanged> 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<CacheMissToolsChanged> 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<CacheMissMessagesChanged> 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<CacheMissPreviousMessageNotFound> 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<CacheMissUnavailable> 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 CacheMissReason.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 CacheMissModelChanged 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 CacheMissSystemChanged 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 CacheMissToolsChanged 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 CacheMissMessagesChanged 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 CacheMissPreviousMessageNotFound 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 CacheMissUnavailable 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(CacheMissReason.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 = cacheMissReason.accept(new CacheMissReason.Visitor<Optional<String>>() { @Override public Optional<String> visitModelChanged(CacheMissModelChanged modelChanged) { return Optional.of(modelChanged.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final CacheMissReason 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 CacheMissReason ofModelChanged(CacheMissModelChanged 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 CacheMissReason ofModelChanged(Long cacheMissedInputTokens)
Returns an immutable instance of CacheMissReason whose ofModelChanged variant is built from the given required cacheMissedInputTokens.
-
ofSystemChanged
final static CacheMissReason ofSystemChanged(CacheMissSystemChanged 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 CacheMissReason ofSystemChanged(Long cacheMissedInputTokens)
Returns an immutable instance of CacheMissReason whose ofSystemChanged variant is built from the given required cacheMissedInputTokens.
-
ofToolsChanged
final static CacheMissReason ofToolsChanged(CacheMissToolsChanged 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 CacheMissReason ofToolsChanged(Long cacheMissedInputTokens)
Returns an immutable instance of CacheMissReason whose ofToolsChanged variant is built from the given required cacheMissedInputTokens.
-
ofMessagesChanged
final static CacheMissReason ofMessagesChanged(CacheMissMessagesChanged 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 CacheMissReason ofMessagesChanged(Long cacheMissedInputTokens)
Returns an immutable instance of CacheMissReason whose ofMessagesChanged variant is built from the given required cacheMissedInputTokens.
-
ofPreviousMessageNotFound
final static CacheMissReason ofPreviousMessageNotFound(CacheMissPreviousMessageNotFound 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 CacheMissReason ofUnavailable(CacheMissUnavailable 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.
-
-
-
-