Package org.springframework.ai.anthropic
Class AnthropicCacheOptions
java.lang.Object
org.springframework.ai.anthropic.AnthropicCacheOptions
Anthropic cache options for configuring prompt caching behavior with the Anthropic Java
SDK.
- Since:
- 1.1.0
- Author:
- Austin Dase, Soby Chacko, Sebastien Deleuze
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAnthropicCacheOptions(@Nullable AnthropicCacheStrategy strategy, @Nullable Function<@Nullable String, Integer> contentLengthFunction, @Nullable Map<MessageType, AnthropicCacheTtl> messageTypeTtl, @Nullable Map<MessageType, Integer> messageTypeMinContentLengths, @Nullable Boolean multiBlockSystemCaching, @Nullable Boolean cacheToolResults) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()static AnthropicCacheOptionsdisabled()Returns a new disabled cache options instance with strategyNONE.booleaninthashCode()booleanWhether acache_controlbreakpoint is placed on the last tool result message of a request, so that tool outputs are written to (and read from) the cache across tool-calling rounds.boolean
-
Constructor Details
-
AnthropicCacheOptions
protected AnthropicCacheOptions(@Nullable AnthropicCacheStrategy strategy, @Nullable Function<@Nullable String, Integer> contentLengthFunction, @Nullable Map<MessageType, AnthropicCacheTtl> messageTypeTtl, @Nullable Map<MessageType, Integer> messageTypeMinContentLengths, @Nullable Boolean multiBlockSystemCaching, @Nullable Boolean cacheToolResults)
-
-
Method Details
-
disabled
Returns a new disabled cache options instance with strategyNONE. Each call returns a fresh instance to avoid shared mutable state. -
builder
-
getStrategy
-
getContentLengthFunction
-
getMessageTypeTtl
-
getMessageTypeMinContentLengths
-
isMultiBlockSystemCaching
public boolean isMultiBlockSystemCaching() -
isCacheToolResults
public boolean isCacheToolResults()Whether acache_controlbreakpoint is placed on the last tool result message of a request, so that tool outputs are written to (and read from) the cache across tool-calling rounds. Takes effect with strategies whose eligible message types include tool results, i.e.AnthropicCacheStrategy.CONVERSATION_HISTORY; it is a no-op for strategies that only target tool definitions or system messages.- Returns:
trueif tool result caching is enabled- Since:
- 2.0.0
-
equals
-
hashCode
public int hashCode()
-