Package org.springframework.ai.anthropic
Class CacheEligibilityResolver
java.lang.Object
org.springframework.ai.anthropic.CacheEligibilityResolver
Resolves cache eligibility for messages based on the provided
AnthropicCacheOptions. Returns SDK CacheControlEphemeral instances
instead of raw cache control records.- Since:
- 1.1.0
- Author:
- Austin Dase, Soby Chacko
-
Constructor Summary
ConstructorsConstructorDescriptionCacheEligibilityResolver(AnthropicCacheStrategy cacheStrategy, Map<MessageType, AnthropicCacheTtl> messageTypeTtl, Map<MessageType, Integer> messageTypeMinContentLengths, Function<@Nullable String, Integer> contentLengthFunction, Set<MessageType> cacheEligibleMessageTypes) -
Method Summary
Modifier and TypeMethodDescriptionstatic CacheEligibilityResolverfrom(AnthropicCacheOptions cacheOptions) boolean@Nullable com.anthropic.models.messages.CacheControlEphemeralresolve(MessageType messageType, @Nullable String content) @Nullable com.anthropic.models.messages.CacheControlEphemeralvoid
-
Constructor Details
-
CacheEligibilityResolver
public CacheEligibilityResolver(AnthropicCacheStrategy cacheStrategy, Map<MessageType, AnthropicCacheTtl> messageTypeTtl, Map<MessageType, Integer> messageTypeMinContentLengths, Function<@Nullable String, Integer> contentLengthFunction, Set<MessageType> cacheEligibleMessageTypes)
-
-
Method Details
-
from
-
resolve
public @Nullable com.anthropic.models.messages.CacheControlEphemeral resolve(MessageType messageType, @Nullable String content) -
resolveToolCacheControl
public @Nullable com.anthropic.models.messages.CacheControlEphemeral resolveToolCacheControl() -
isCachingEnabled
public boolean isCachingEnabled() -
useCacheBlock
public void useCacheBlock()
-