|
|
@@ -1629,6 +1629,43 @@ describe("ProviderTransform.message - claude w/bedrock custom inference profile"
|
|
|
})
|
|
|
})
|
|
|
|
|
|
+describe("ProviderTransform.message - bedrock caching with non-bedrock providerID", () => {
|
|
|
+ test("applies cache options at message level when npm package is amazon-bedrock", () => {
|
|
|
+ const model = {
|
|
|
+ id: "aws/us.anthropic.claude-opus-4-6-v1",
|
|
|
+ providerID: "aws",
|
|
|
+ api: {
|
|
|
+ id: "us.anthropic.claude-opus-4-6-v1",
|
|
|
+ url: "https://bedrock-runtime.us-east-1.amazonaws.com",
|
|
|
+ npm: "@ai-sdk/amazon-bedrock",
|
|
|
+ },
|
|
|
+ name: "Claude Opus 4.6",
|
|
|
+ capabilities: {},
|
|
|
+ options: {},
|
|
|
+ headers: {},
|
|
|
+ } as any
|
|
|
+
|
|
|
+ const msgs = [
|
|
|
+ {
|
|
|
+ role: "system",
|
|
|
+ content: [{ type: "text", text: "You are a helpful assistant" }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ role: "user",
|
|
|
+ content: [{ type: "text", text: "Hello" }],
|
|
|
+ },
|
|
|
+ ] as any[]
|
|
|
+
|
|
|
+ const result = ProviderTransform.message(msgs, model, {}) as any[]
|
|
|
+
|
|
|
+ // Cache should be at the message level and not the content-part level
|
|
|
+ expect(result[0].providerOptions?.bedrock).toEqual({
|
|
|
+ cachePoint: { type: "default" },
|
|
|
+ })
|
|
|
+ expect(result[0].content[0].providerOptions?.bedrock).toBeUndefined()
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
describe("ProviderTransform.message - cache control on gateway", () => {
|
|
|
const createModel = (overrides: Partial<any> = {}) =>
|
|
|
({
|