@ai-sdk/amazon-bedrock 3.0.117 → 3.0.118
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 +6 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +55 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/anthropic/index.js
CHANGED
|
@@ -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 ? "3.0.
|
|
38
|
+
var VERSION = true ? "3.0.118" : "0.0.0-test";
|
|
39
39
|
|
|
40
40
|
// src/bedrock-sigv4-fetch.ts
|
|
41
41
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
package/dist/anthropic/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { AwsV4Signer } from "aws4fetch";
|
|
25
25
|
|
|
26
26
|
// src/version.ts
|
|
27
|
-
var VERSION = true ? "3.0.
|
|
27
|
+
var VERSION = true ? "3.0.118" : "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
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "3.0.
|
|
33
|
+
var VERSION = true ? "3.0.118" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/bedrock-provider.ts
|
|
36
36
|
var import_internal3 = require("@ai-sdk/anthropic/internal");
|
|
@@ -363,7 +363,8 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
|
363
363
|
var import_v43 = require("zod/v4");
|
|
364
364
|
var bedrockReasoningMetadataSchema = import_v43.z.object({
|
|
365
365
|
signature: import_v43.z.string().optional(),
|
|
366
|
-
redactedData: import_v43.z.string().optional()
|
|
366
|
+
redactedData: import_v43.z.string().optional(),
|
|
367
|
+
redactedContent: import_v43.z.string().optional()
|
|
367
368
|
});
|
|
368
369
|
|
|
369
370
|
// src/convert-to-bedrock-chat-messages.ts
|
|
@@ -592,6 +593,12 @@ async function convertToBedrockChatMessages(prompt) {
|
|
|
592
593
|
}
|
|
593
594
|
}
|
|
594
595
|
});
|
|
596
|
+
} else if (reasoningMetadata.redactedContent != null) {
|
|
597
|
+
bedrockContent.push({
|
|
598
|
+
reasoningContent: {
|
|
599
|
+
redactedContent: reasoningMetadata.redactedContent
|
|
600
|
+
}
|
|
601
|
+
});
|
|
595
602
|
} else if (reasoningMetadata.redactedData != null) {
|
|
596
603
|
bedrockContent.push({
|
|
597
604
|
reasoningContent: {
|
|
@@ -1053,6 +1060,16 @@ var BedrockChatLanguageModel = class {
|
|
|
1053
1060
|
}
|
|
1054
1061
|
}
|
|
1055
1062
|
});
|
|
1063
|
+
} else if ("redactedContent" in part.reasoningContent) {
|
|
1064
|
+
content.push({
|
|
1065
|
+
type: "reasoning",
|
|
1066
|
+
text: "",
|
|
1067
|
+
providerMetadata: {
|
|
1068
|
+
bedrock: {
|
|
1069
|
+
redactedContent: part.reasoningContent.redactedContent
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1056
1073
|
}
|
|
1057
1074
|
}
|
|
1058
1075
|
if (part.toolUse) {
|
|
@@ -1142,7 +1159,7 @@ var BedrockChatLanguageModel = class {
|
|
|
1142
1159
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1143
1160
|
},
|
|
1144
1161
|
transform(chunk, controller) {
|
|
1145
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
1162
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
1146
1163
|
function enqueueError(bedrockError) {
|
|
1147
1164
|
finishReason = "error";
|
|
1148
1165
|
controller.enqueue({ type: "error", error: bedrockError });
|
|
@@ -1230,7 +1247,14 @@ var BedrockChatLanguageModel = class {
|
|
|
1230
1247
|
if (contentBlock.type === "reasoning") {
|
|
1231
1248
|
controller.enqueue({
|
|
1232
1249
|
type: "reasoning-end",
|
|
1233
|
-
id: String(blockIndex)
|
|
1250
|
+
id: String(blockIndex),
|
|
1251
|
+
...contentBlock.redactedContent != null ? {
|
|
1252
|
+
providerMetadata: {
|
|
1253
|
+
bedrock: {
|
|
1254
|
+
redactedContent: contentBlock.redactedContent
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
} : {}
|
|
1234
1258
|
});
|
|
1235
1259
|
} else if (contentBlock.type === "text") {
|
|
1236
1260
|
controller.enqueue({
|
|
@@ -1321,10 +1345,22 @@ var BedrockChatLanguageModel = class {
|
|
|
1321
1345
|
}
|
|
1322
1346
|
}
|
|
1323
1347
|
});
|
|
1348
|
+
} else if ("redactedContent" in reasoningContent && reasoningContent.redactedContent) {
|
|
1349
|
+
if (contentBlocks[blockIndex] == null) {
|
|
1350
|
+
contentBlocks[blockIndex] = { type: "reasoning" };
|
|
1351
|
+
controller.enqueue({
|
|
1352
|
+
type: "reasoning-start",
|
|
1353
|
+
id: String(blockIndex)
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
const contentBlock = contentBlocks[blockIndex];
|
|
1357
|
+
if (contentBlock.type === "reasoning") {
|
|
1358
|
+
contentBlock.redactedContent = ((_s = contentBlock.redactedContent) != null ? _s : "") + reasoningContent.redactedContent;
|
|
1359
|
+
}
|
|
1324
1360
|
}
|
|
1325
1361
|
}
|
|
1326
1362
|
const contentBlockStart = value.contentBlockStart;
|
|
1327
|
-
if (((
|
|
1363
|
+
if (((_t = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _t.toolUse) != null) {
|
|
1328
1364
|
const toolUse = contentBlockStart.start.toolUse;
|
|
1329
1365
|
const blockIndex = contentBlockStart.contentBlockIndex;
|
|
1330
1366
|
const isJsonResponseTool = usesJsonResponseTool && toolUse.name === "json";
|
|
@@ -1348,7 +1384,7 @@ var BedrockChatLanguageModel = class {
|
|
|
1348
1384
|
const blockIndex = contentBlockDelta.contentBlockIndex;
|
|
1349
1385
|
const contentBlock = contentBlocks[blockIndex];
|
|
1350
1386
|
if ((contentBlock == null ? void 0 : contentBlock.type) === "tool-call") {
|
|
1351
|
-
const delta = (
|
|
1387
|
+
const delta = (_u = contentBlockDelta.delta.toolUse.input) != null ? _u : "";
|
|
1352
1388
|
if (!contentBlock.isJsonResponseTool) {
|
|
1353
1389
|
controller.enqueue({
|
|
1354
1390
|
type: "tool-input-delta",
|
|
@@ -1439,6 +1475,13 @@ var BedrockResponseSchema = import_v44.z.object({
|
|
|
1439
1475
|
}),
|
|
1440
1476
|
import_v44.z.object({
|
|
1441
1477
|
redactedReasoning: BedrockRedactedReasoningSchema
|
|
1478
|
+
}),
|
|
1479
|
+
// `redactedContent` is a member of the documented
|
|
1480
|
+
// ReasoningContentBlock union. OpenAI models on Bedrock
|
|
1481
|
+
// (e.g. `us.openai.gpt-5.6-luna`) return their encrypted
|
|
1482
|
+
// reasoning in this shape.
|
|
1483
|
+
import_v44.z.object({
|
|
1484
|
+
redactedContent: import_v44.z.string()
|
|
1442
1485
|
})
|
|
1443
1486
|
]).nullish()
|
|
1444
1487
|
})
|
|
@@ -1473,6 +1516,12 @@ var BedrockStreamSchema = import_v44.z.object({
|
|
|
1473
1516
|
}),
|
|
1474
1517
|
import_v44.z.object({
|
|
1475
1518
|
reasoningContent: import_v44.z.object({ data: import_v44.z.string() })
|
|
1519
|
+
}),
|
|
1520
|
+
// `redactedContent` is a member of the documented
|
|
1521
|
+
// ReasoningContentBlockDelta union. OpenAI models on Bedrock stream
|
|
1522
|
+
// their encrypted reasoning in this shape.
|
|
1523
|
+
import_v44.z.object({
|
|
1524
|
+
reasoningContent: import_v44.z.object({ redactedContent: import_v44.z.string() })
|
|
1476
1525
|
})
|
|
1477
1526
|
]).nullish()
|
|
1478
1527
|
}).nullish(),
|