@ai-sdk/amazon-bedrock 4.0.89 → 4.0.91
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 +14 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/bedrock-chat-language-model.ts +1 -1
- package/src/convert-to-bedrock-chat-messages.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/amazon-bedrock",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.91",
|
|
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.
|
|
42
|
-
"@ai-sdk/provider": "
|
|
43
|
-
"@ai-sdk/provider
|
|
41
|
+
"@ai-sdk/anthropic": "3.0.67",
|
|
42
|
+
"@ai-sdk/provider-utils": "4.0.23",
|
|
43
|
+
"@ai-sdk/provider": "3.0.8"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "20.17.24",
|
|
@@ -447,7 +447,7 @@ export class BedrockChatLanguageModel implements LanguageModelV3 {
|
|
|
447
447
|
// map response content to content array
|
|
448
448
|
for (const part of response.output.message.content) {
|
|
449
449
|
// text
|
|
450
|
-
if (part.text) {
|
|
450
|
+
if (part.text != null) {
|
|
451
451
|
content.push({ type: 'text', text: part.text });
|
|
452
452
|
}
|
|
453
453
|
|
|
@@ -253,6 +253,9 @@ export async function convertToBedrockChatMessages(
|
|
|
253
253
|
const message = block.messages[j];
|
|
254
254
|
const isLastMessage = j === block.messages.length - 1;
|
|
255
255
|
const { content } = message;
|
|
256
|
+
const hasReasoningBlocks = content.some(
|
|
257
|
+
part => part.type === 'reasoning',
|
|
258
|
+
);
|
|
256
259
|
|
|
257
260
|
for (let k = 0; k < content.length; k++) {
|
|
258
261
|
const part = content[k];
|
|
@@ -260,8 +263,8 @@ export async function convertToBedrockChatMessages(
|
|
|
260
263
|
|
|
261
264
|
switch (part.type) {
|
|
262
265
|
case 'text': {
|
|
263
|
-
// Skip empty text blocks
|
|
264
|
-
if (!part.text.trim()) {
|
|
266
|
+
// Skip empty text blocks unless reasoning blocks are present
|
|
267
|
+
if (!part.text.trim() && !hasReasoningBlocks) {
|
|
265
268
|
break;
|
|
266
269
|
}
|
|
267
270
|
|