diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 860618243..980d193d8 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -7,6 +7,7 @@ - Fixed GitHub Copilot device-code login polling to wait before the first token poll, avoiding incorrect device-code failures for some users after browser authorization ([#6187](https://github.com/earendil-works/pi/issues/6187)). - Fixed OpenAI Codex user-agent construction to synchronously load Node OS metadata, avoiding a startup race that could report `pi (browser)` in Node/Bun. - Fixed Fireworks GLM 5.2 Fast to use the OpenAI-compatible endpoint and `thinkingLevelMap`, aligning it with GLM 5.2 ([#6195](https://github.com/earendil-works/pi/issues/6195)). +- Fixed Amazon Bedrock prompt-cache points for Claude Fable 5 and Claude Sonnet 5 ([#6235](https://github.com/earendil-works/pi/issues/6235)). ### Added diff --git a/packages/ai/src/api/bedrock-converse-stream.ts b/packages/ai/src/api/bedrock-converse-stream.ts index 997965a30..e548f6fc9 100644 --- a/packages/ai/src/api/bedrock-converse-stream.ts +++ b/packages/ai/src/api/bedrock-converse-stream.ts @@ -640,7 +640,7 @@ function isAnthropicClaudeModel(model: Model<"bedrock-converse-stream">): boolea /** * Check if the model supports prompt caching. - * Supported: Claude 3.5 Haiku, Claude 3.7 Sonnet, Claude 4.x models + * Supported: Claude 3.5 Haiku, Claude 3.7 Sonnet, Claude 4.x models, Claude 5 models * * For base models and system-defined inference profiles the model ID / ARN * contains the model name, so we can decide locally. @@ -660,6 +660,8 @@ function supportsPromptCaching(model: Model<"bedrock-converse-stream">, env?: Pr if (getProviderEnvValue("AWS_BEDROCK_FORCE_CACHE", env) === "1") return true; return false; } + // Claude 5 models (fable-5, sonnet-5) + if (candidates.some((s) => s.includes("fable-5") || s.includes("sonnet-5"))) return true; // Claude 4.x models (opus-4, sonnet-4, haiku-4) if (candidates.some((s) => s.includes("-4-"))) return true; // Claude 3.7 Sonnet