Applying additional cache fixes

This commit is contained in:
Ryan Ward
2026-06-01 13:02:22 -05:00
parent 8c0a2d67cb
commit 7f039d2c08
12 changed files with 1326 additions and 187 deletions
+7 -3
View File
@@ -1,9 +1,10 @@
use std::collections::HashMap;
use aws_sdk_bedrockruntime::types::{
CachePointBlock, CachePointType, ContentBlock, ConversationRole, InferenceConfiguration,
Message as BedrockMessage, SystemContentBlock, Tool, ToolConfiguration, ToolInputSchema,
ToolResultBlock, ToolResultContentBlock, ToolResultStatus, ToolSpecification, ToolUseBlock,
CachePointBlock, CachePointType, CacheTtl, ContentBlock, ConversationRole,
InferenceConfiguration, Message as BedrockMessage, SystemContentBlock, Tool,
ToolConfiguration, ToolInputSchema, ToolResultBlock, ToolResultContentBlock, ToolResultStatus,
ToolSpecification, ToolUseBlock,
};
use aws_smithy_types::Document;
use serde_json::Value as JsonValue;
@@ -220,6 +221,7 @@ fn convert_messages(messages: Vec<ConversationMessage>) -> Vec<BedrockMessage> {
content.push(ContentBlock::CachePoint(
CachePointBlock::builder()
.r#type(CachePointType::Default)
.ttl(CacheTtl::OneHour)
.build()
.expect("valid cache point"),
));
@@ -273,6 +275,7 @@ fn convert_system_prompt(system_prompt: Option<String>) -> Vec<SystemContentBloc
SystemContentBlock::CachePoint(
CachePointBlock::builder()
.r#type(CachePointType::Default)
.ttl(CacheTtl::OneHour)
.build()
.expect("valid cache point"),
),
@@ -326,6 +329,7 @@ fn build_tool_config(tools: Vec<ToolDefinition>) -> Option<ToolConfiguration> {
tool_specs.push(Tool::CachePoint(
CachePointBlock::builder()
.r#type(CachePointType::Default)
.ttl(CacheTtl::OneHour)
.build()
.expect("valid cache point"),
));