Class CacheEligibilityResolver
java.lang.Object
org.springframework.ai.anthropic.api.utils.CacheEligibilityResolver
Resolves cache eligibility for messages based on the provided
AnthropicCacheOptions.
Note: Tool definition messages are always considered for caching if the strategy
includes system messages. The minimum content length check is not applied to tool
definition messages.- Since:
- 1.1.0
- Author:
- Austin Dase, Soby Chacko
-
Constructor Summary
ConstructorsConstructorDescriptionCacheEligibilityResolver(AnthropicCacheStrategy cacheStrategy, Map<org.springframework.ai.chat.messages.MessageType, AnthropicCacheTtl> messageTypeTtl, Map<org.springframework.ai.chat.messages.MessageType, Integer> messageTypeMinContentLengths, Function<String, Integer> contentLengthFunction, Set<org.springframework.ai.chat.messages.MessageType> cacheEligibleMessageTypes) -
Method Summary
Modifier and TypeMethodDescriptionstatic CacheEligibilityResolverfrom(AnthropicCacheOptions anthropicCacheOptions) booleanvoid
-
Constructor Details
-
CacheEligibilityResolver
public CacheEligibilityResolver(AnthropicCacheStrategy cacheStrategy, Map<org.springframework.ai.chat.messages.MessageType, AnthropicCacheTtl> messageTypeTtl, Map<org.springframework.ai.chat.messages.MessageType, Integer> messageTypeMinContentLengths, Function<String, Integer> contentLengthFunction, Set<org.springframework.ai.chat.messages.MessageType> cacheEligibleMessageTypes)
-
-
Method Details
-
from
-
resolve
public AnthropicApi.ChatCompletionRequest.CacheControl resolve(org.springframework.ai.chat.messages.MessageType messageType, String content) -
resolveToolCacheControl
-
isCachingEnabled
public boolean isCachingEnabled() -
useCacheBlock
public void useCacheBlock()
-