@ai-sdk/amazon-bedrock 4.0.43 → 4.0.45

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/amazon-bedrock
2
2
 
3
+ ## 4.0.45
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [96936e5]
8
+ - @ai-sdk/provider-utils@4.0.12
9
+ - @ai-sdk/anthropic@3.0.34
10
+
11
+ ## 4.0.44
12
+
13
+ ### Patch Changes
14
+
15
+ - b128d9b: add TTL support for prompt caching
16
+
3
17
  ## 4.0.43
4
18
 
5
19
  ### Patch Changes
@@ -35,7 +35,7 @@ var import_provider_utils = require("@ai-sdk/provider-utils");
35
35
  var import_aws4fetch = require("aws4fetch");
36
36
 
37
37
  // src/version.ts
38
- var VERSION = true ? "4.0.43" : "0.0.0-test";
38
+ var VERSION = true ? "4.0.45" : "0.0.0-test";
39
39
 
40
40
  // src/bedrock-sigv4-fetch.ts
41
41
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
@@ -24,7 +24,7 @@ import {
24
24
  import { AwsV4Signer } from "aws4fetch";
25
25
 
26
26
  // src/version.ts
27
- var VERSION = true ? "4.0.43" : "0.0.0-test";
27
+ var VERSION = true ? "4.0.45" : "0.0.0-test";
28
28
 
29
29
  // src/bedrock-sigv4-fetch.ts
30
30
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
package/dist/index.js CHANGED
@@ -35,9 +35,6 @@ var import_provider_utils4 = require("@ai-sdk/provider-utils");
35
35
  var import_v43 = require("zod/v4");
36
36
 
37
37
  // src/bedrock-api-types.ts
38
- var BEDROCK_CACHE_POINT = {
39
- cachePoint: { type: "default" }
40
- };
41
38
  var BEDROCK_STOP_REASONS = [
42
39
  "stop",
43
40
  "stop_sequence",
@@ -388,7 +385,11 @@ function normalizeToolCallId(toolCallId, isMistral) {
388
385
  // src/convert-to-bedrock-chat-messages.ts
389
386
  function getCachePoint(providerMetadata) {
390
387
  var _a;
391
- return (_a = providerMetadata == null ? void 0 : providerMetadata.bedrock) == null ? void 0 : _a.cachePoint;
388
+ const cachePointConfig = (_a = providerMetadata == null ? void 0 : providerMetadata.bedrock) == null ? void 0 : _a.cachePoint;
389
+ if (!cachePointConfig) {
390
+ return void 0;
391
+ }
392
+ return { cachePoint: cachePointConfig };
392
393
  }
393
394
  async function shouldEnableCitations(providerMetadata) {
394
395
  var _a, _b;
@@ -419,8 +420,9 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
419
420
  }
420
421
  for (const message of block.messages) {
421
422
  system.push({ text: message.content });
422
- if (getCachePoint(message.providerOptions)) {
423
- system.push(BEDROCK_CACHE_POINT);
423
+ const cachePoint = getCachePoint(message.providerOptions);
424
+ if (cachePoint) {
425
+ system.push(cachePoint);
424
426
  }
425
427
  }
426
428
  break;
@@ -548,8 +550,9 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
548
550
  throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
549
551
  }
550
552
  }
551
- if (getCachePoint(providerOptions)) {
552
- bedrockContent.push(BEDROCK_CACHE_POINT);
553
+ const cachePoint = getCachePoint(providerOptions);
554
+ if (cachePoint) {
555
+ bedrockContent.push(cachePoint);
553
556
  }
554
557
  }
555
558
  messages.push({ role: "user", content: bedrockContent });
@@ -632,8 +635,9 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
632
635
  }
633
636
  }
634
637
  }
635
- if (getCachePoint(message.providerOptions)) {
636
- bedrockContent.push(BEDROCK_CACHE_POINT);
638
+ const cachePoint = getCachePoint(message.providerOptions);
639
+ if (cachePoint) {
640
+ bedrockContent.push(cachePoint);
637
641
  }
638
642
  }
639
643
  messages.push({ role: "assistant", content: bedrockContent });
@@ -1874,7 +1878,7 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1874
1878
  var import_aws4fetch = require("aws4fetch");
1875
1879
 
1876
1880
  // src/version.ts
1877
- var VERSION = true ? "4.0.43" : "0.0.0-test";
1881
+ var VERSION = true ? "4.0.45" : "0.0.0-test";
1878
1882
 
1879
1883
  // src/bedrock-sigv4-fetch.ts
1880
1884
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {