@ai-sdk/amazon-bedrock 4.0.101 → 4.0.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/amazon-bedrock",
3
- "version": "4.0.101",
3
+ "version": "4.0.103",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -38,9 +38,9 @@
38
38
  "@smithy/eventstream-codec": "^4.0.1",
39
39
  "@smithy/util-utf8": "^4.0.0",
40
40
  "aws4fetch": "^1.0.20",
41
- "@ai-sdk/anthropic": "3.0.75",
41
+ "@ai-sdk/anthropic": "3.0.76",
42
42
  "@ai-sdk/provider": "3.0.10",
43
- "@ai-sdk/provider-utils": "4.0.26"
43
+ "@ai-sdk/provider-utils": "4.0.27"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "20.17.24",
@@ -41,6 +41,16 @@ function getCachePoint(
41
41
  return { cachePoint: cachePointConfig };
42
42
  }
43
43
 
44
+ function pushCachePoint(
45
+ content: BedrockUserMessage['content'] | BedrockAssistantMessage['content'],
46
+ providerMetadata: SharedV3ProviderMetadata | undefined,
47
+ ) {
48
+ const cachePoint = getCachePoint(providerMetadata);
49
+ if (cachePoint) {
50
+ content.push(cachePoint);
51
+ }
52
+ }
53
+
44
54
  async function shouldEnableCitations(
45
55
  providerMetadata: SharedV3ProviderMetadata | undefined,
46
56
  ): Promise<boolean> {
@@ -156,6 +166,8 @@ export async function convertToBedrockChatMessages(
156
166
  break;
157
167
  }
158
168
  }
169
+
170
+ pushCachePoint(bedrockContent, part.providerOptions);
159
171
  }
160
172
 
161
173
  break;
@@ -224,6 +236,7 @@ export async function convertToBedrockChatMessages(
224
236
  content: toolResultContent,
225
237
  },
226
238
  });
239
+ pushCachePoint(bedrockContent, part.providerOptions);
227
240
  }
228
241
 
229
242
  break;
@@ -234,10 +247,7 @@ export async function convertToBedrockChatMessages(
234
247
  }
235
248
  }
236
249
 
237
- const cachePoint = getCachePoint(providerOptions);
238
- if (cachePoint) {
239
- bedrockContent.push(cachePoint);
240
- }
250
+ pushCachePoint(bedrockContent, providerOptions);
241
251
  }
242
252
 
243
253
  messages.push({ role: 'user', content: bedrockContent });
@@ -352,11 +362,10 @@ export async function convertToBedrockChatMessages(
352
362
  break;
353
363
  }
354
364
  }
365
+
366
+ pushCachePoint(bedrockContent, part.providerOptions);
355
367
  }
356
- const cachePoint = getCachePoint(message.providerOptions);
357
- if (cachePoint) {
358
- bedrockContent.push(cachePoint);
359
- }
368
+ pushCachePoint(bedrockContent, message.providerOptions);
360
369
  }
361
370
 
362
371
  messages.push({ role: 'assistant', content: bedrockContent });