Class BedrockCacheOptions
java.lang.Object
org.springframework.ai.bedrock.converse.api.BedrockCacheOptions
AWS Bedrock cache options for configuring prompt caching behavior.
Prompt caching allows you to reduce latency and costs by reusing previously processed prompt content. Cached content has a fixed 5-minute Time To Live (TTL) that resets with each cache hit.
Example usage:
BedrockCacheOptions cacheOptions = BedrockCacheOptions.builder()
.strategy(BedrockCacheStrategy.SYSTEM_ONLY)
.build();
ChatResponse response = chatModel.call(new Prompt(
List.of(new SystemMessage(largeSystemPrompt), new UserMessage("Question")),
BedrockChatOptions.builder()
.cacheOptions(cacheOptions)
.build()
));
- Since:
- 1.1.0
- Author:
- Soby Chacko
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing BedrockCacheOptions instances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BedrockCacheOptions.Builderbuilder()Creates a new builder for constructing BedrockCacheOptions.Gets the caching strategy.voidsetStrategy(BedrockCacheStrategy strategy) Sets the caching strategy.toString()
-
Constructor Details
-
BedrockCacheOptions
public BedrockCacheOptions()
-
-
Method Details
-
builder
Creates a new builder for constructing BedrockCacheOptions.- Returns:
- a new Builder instance
-
getStrategy
Gets the caching strategy.- Returns:
- the configured BedrockCacheStrategy
-
setStrategy
Sets the caching strategy.- Parameters:
strategy- the BedrockCacheStrategy to use
-
toString
-