@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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/amazon-bedrock
2
2
 
3
+ ## 4.0.91
4
+
5
+ ### Patch Changes
6
+
7
+ - ac80bc7: fix(amazon-bedrock): preserve empty text blocks when reasoning content is present
8
+
9
+ ## 4.0.90
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [6247886]
14
+ - @ai-sdk/provider-utils@4.0.23
15
+ - @ai-sdk/anthropic@3.0.67
16
+
3
17
  ## 4.0.89
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.89" : "0.0.0-test";
38
+ var VERSION = true ? "4.0.91" : "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.89" : "0.0.0-test";
27
+ var VERSION = true ? "4.0.91" : "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
@@ -574,12 +574,15 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
574
574
  const message = block.messages[j];
575
575
  const isLastMessage = j === block.messages.length - 1;
576
576
  const { content } = message;
577
+ const hasReasoningBlocks = content.some(
578
+ (part) => part.type === "reasoning"
579
+ );
577
580
  for (let k = 0; k < content.length; k++) {
578
581
  const part = content[k];
579
582
  const isLastContentPart = k === content.length - 1;
580
583
  switch (part.type) {
581
584
  case "text": {
582
- if (!part.text.trim()) {
585
+ if (!part.text.trim() && !hasReasoningBlocks) {
583
586
  break;
584
587
  }
585
588
  bedrockContent.push({
@@ -1066,7 +1069,7 @@ var BedrockChatLanguageModel = class {
1066
1069
  const content = [];
1067
1070
  let isJsonResponseFromTool = false;
1068
1071
  for (const part of response.output.message.content) {
1069
- if (part.text) {
1072
+ if (part.text != null) {
1070
1073
  content.push({ type: "text", text: part.text });
1071
1074
  }
1072
1075
  if (part.reasoningContent) {
@@ -1968,7 +1971,7 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1968
1971
  var import_aws4fetch = require("aws4fetch");
1969
1972
 
1970
1973
  // src/version.ts
1971
- var VERSION = true ? "4.0.89" : "0.0.0-test";
1974
+ var VERSION = true ? "4.0.91" : "0.0.0-test";
1972
1975
 
1973
1976
  // src/bedrock-sigv4-fetch.ts
1974
1977
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {