Class AnthropicCacheOptions

java.lang.Object
org.springframework.ai.anthropic.AnthropicCacheOptions

public class AnthropicCacheOptions extends Object
Anthropic cache options for configuring prompt caching behavior with the Anthropic Java SDK.
Since:
1.1.0
Author:
Austin Dase, Soby Chacko, Sebastien Deleuze
  • Constructor Details

  • Method Details

    • disabled

      public static AnthropicCacheOptions disabled()
      Returns a new disabled cache options instance with strategy NONE. Each call returns a fresh instance to avoid shared mutable state.
    • builder

      public static AnthropicCacheOptions.Builder builder()
    • getStrategy

      public AnthropicCacheStrategy getStrategy()
    • getContentLengthFunction

      public Function<@Nullable String,Integer> getContentLengthFunction()
    • getMessageTypeTtl

      public Map<MessageType,AnthropicCacheTtl> getMessageTypeTtl()
    • getMessageTypeMinContentLengths

      public Map<MessageType,Integer> getMessageTypeMinContentLengths()
    • isMultiBlockSystemCaching

      public boolean isMultiBlockSystemCaching()
    • isCacheToolResults

      public boolean isCacheToolResults()
      Whether a cache_control breakpoint 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:
      true if tool result caching is enabled
      Since:
      2.0.0
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object