mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
fix: prompt caching for opus on bedrock (#11664)
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user