Class GoogleGenAiCachedContent

java.lang.Object
org.springframework.ai.google.genai.cache.GoogleGenAiCachedContent

public final class GoogleGenAiCachedContent extends Object
Represents cached content in Google GenAI for reusing large contexts across multiple requests.
Since:
1.1.0
Author:
Dan Dobrin
  • Method Details

    • from

      public static GoogleGenAiCachedContent from(com.google.genai.types.CachedContent cachedContent)
      Creates a GoogleGenAiCachedContent from the SDK's CachedContent.
      Parameters:
      cachedContent - the SDK cached content
      Returns:
      a new GoogleGenAiCachedContent instance
    • getName

      public String getName()
    • getModel

      public String getModel()
    • getDisplayName

      public String getDisplayName()
    • getCreateTime

      public Instant getCreateTime()
    • getUpdateTime

      public Instant getUpdateTime()
    • getExpireTime

      public Instant getExpireTime()
    • getTtl

      public Duration getTtl()
    • getContents

      public List<com.google.genai.types.Content> getContents()
    • getSystemInstruction

      public com.google.genai.types.Content getSystemInstruction()
    • getUsageMetadata

      public com.google.genai.types.CachedContentUsageMetadata getUsageMetadata()
    • isExpired

      public boolean isExpired()
      Checks if the cached content has expired.
      Returns:
      true if expired, false otherwise
    • getRemainingTtl

      public Duration getRemainingTtl()
      Gets the remaining time to live for the cached content.
      Returns:
      the remaining TTL, or null if no expiration
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static GoogleGenAiCachedContent.Builder builder()