fix: prompt caching for opus on bedrock (#11664)

This commit is contained in:
Rohan Godha
2026-02-01 15:42:42 -05:00
committed by GitHub
parent 01cec84789
commit ca5e85d6ea
2 changed files with 4 additions and 3 deletions

View File

@@ -179,7 +179,7 @@ export namespace ProviderTransform {
cacheControl: { type: "ephemeral" },
},
bedrock: {
cachePoint: { type: "ephemeral" },
cachePoint: { type: "default" },
},
openaiCompatible: {
cache_control: { type: "ephemeral" },
@@ -190,7 +190,8 @@ export namespace ProviderTransform {
}
for (const msg of unique([...system, ...final])) {
const shouldUseContentOptions = providerID !== "anthropic" && Array.isArray(msg.content) && msg.content.length > 0
const useMessageLevelOptions = providerID === "anthropic" || providerID.includes("bedrock")
const shouldUseContentOptions = !useMessageLevelOptions && Array.isArray(msg.content) && msg.content.length > 0
if (shouldUseContentOptions) {
const lastContent = msg.content[msg.content.length - 1]

View File

@@ -1166,7 +1166,7 @@ describe("ProviderTransform.message - claude w/bedrock custom inference profile"
expect(result[0].providerOptions?.bedrock).toEqual(
expect.objectContaining({
cachePoint: {
type: "ephemeral",
type: "default",
},
}),
)