@ai-sdk/amazon-bedrock 4.0.42 → 4.0.44
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 +13 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +15 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/bedrock-api-types.ts +24 -4
- package/src/convert-to-bedrock-chat-messages.ts +18 -8
package/dist/index.mjs
CHANGED
|
@@ -20,9 +20,6 @@ import {
|
|
|
20
20
|
import { z as z3 } from "zod/v4";
|
|
21
21
|
|
|
22
22
|
// src/bedrock-api-types.ts
|
|
23
|
-
var BEDROCK_CACHE_POINT = {
|
|
24
|
-
cachePoint: { type: "default" }
|
|
25
|
-
};
|
|
26
23
|
var BEDROCK_STOP_REASONS = [
|
|
27
24
|
"stop",
|
|
28
25
|
"stop_sequence",
|
|
@@ -384,7 +381,11 @@ function normalizeToolCallId(toolCallId, isMistral) {
|
|
|
384
381
|
// src/convert-to-bedrock-chat-messages.ts
|
|
385
382
|
function getCachePoint(providerMetadata) {
|
|
386
383
|
var _a;
|
|
387
|
-
|
|
384
|
+
const cachePointConfig = (_a = providerMetadata == null ? void 0 : providerMetadata.bedrock) == null ? void 0 : _a.cachePoint;
|
|
385
|
+
if (!cachePointConfig) {
|
|
386
|
+
return void 0;
|
|
387
|
+
}
|
|
388
|
+
return { cachePoint: cachePointConfig };
|
|
388
389
|
}
|
|
389
390
|
async function shouldEnableCitations(providerMetadata) {
|
|
390
391
|
var _a, _b;
|
|
@@ -415,8 +416,9 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
|
|
|
415
416
|
}
|
|
416
417
|
for (const message of block.messages) {
|
|
417
418
|
system.push({ text: message.content });
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
const cachePoint = getCachePoint(message.providerOptions);
|
|
420
|
+
if (cachePoint) {
|
|
421
|
+
system.push(cachePoint);
|
|
420
422
|
}
|
|
421
423
|
}
|
|
422
424
|
break;
|
|
@@ -544,8 +546,9 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
|
|
|
544
546
|
throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
|
|
545
547
|
}
|
|
546
548
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
+
const cachePoint = getCachePoint(providerOptions);
|
|
550
|
+
if (cachePoint) {
|
|
551
|
+
bedrockContent.push(cachePoint);
|
|
549
552
|
}
|
|
550
553
|
}
|
|
551
554
|
messages.push({ role: "user", content: bedrockContent });
|
|
@@ -628,8 +631,9 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
|
|
|
628
631
|
}
|
|
629
632
|
}
|
|
630
633
|
}
|
|
631
|
-
|
|
632
|
-
|
|
634
|
+
const cachePoint = getCachePoint(message.providerOptions);
|
|
635
|
+
if (cachePoint) {
|
|
636
|
+
bedrockContent.push(cachePoint);
|
|
633
637
|
}
|
|
634
638
|
}
|
|
635
639
|
messages.push({ role: "assistant", content: bedrockContent });
|
|
@@ -1891,7 +1895,7 @@ import {
|
|
|
1891
1895
|
import { AwsV4Signer } from "aws4fetch";
|
|
1892
1896
|
|
|
1893
1897
|
// src/version.ts
|
|
1894
|
-
var VERSION = true ? "4.0.
|
|
1898
|
+
var VERSION = true ? "4.0.44" : "0.0.0-test";
|
|
1895
1899
|
|
|
1896
1900
|
// src/bedrock-sigv4-fetch.ts
|
|
1897
1901
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|