@ai-sdk/amazon-bedrock 4.0.84 → 4.0.85

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,11 @@
1
1
  # @ai-sdk/amazon-bedrock
2
2
 
3
+ ## 4.0.85
4
+
5
+ ### Patch Changes
6
+
7
+ - 4918dda: fix(amazon-bedrock): preserve reasoning text when signature is present
8
+
3
9
  ## 4.0.84
4
10
 
5
11
  ### 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.84" : "0.0.0-test";
38
+ var VERSION = true ? "4.0.85" : "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.84" : "0.0.0-test";
27
+ var VERSION = true ? "4.0.85" : "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
@@ -593,33 +593,36 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
593
593
  providerOptions: part.providerOptions,
594
594
  schema: bedrockReasoningMetadataSchema
595
595
  });
596
- if (reasoningMetadata != null) {
597
- if (reasoningMetadata.signature != null) {
598
- bedrockContent.push({
599
- reasoningContent: {
600
- reasoningText: {
601
- // trim the last text part if it's the last message in the block
602
- // because Bedrock does not allow trailing whitespace
603
- // in pre-filled assistant responses
604
- text: trimIfLast(
605
- isLastBlock,
606
- isLastMessage,
607
- isLastContentPart,
608
- part.text
609
- ),
610
- signature: reasoningMetadata.signature
611
- }
596
+ if ((reasoningMetadata == null ? void 0 : reasoningMetadata.signature) != null) {
597
+ bedrockContent.push({
598
+ reasoningContent: {
599
+ reasoningText: {
600
+ text: part.text,
601
+ signature: reasoningMetadata.signature
612
602
  }
613
- });
614
- } else if (reasoningMetadata.redactedData != null) {
615
- bedrockContent.push({
616
- reasoningContent: {
617
- redactedReasoning: {
618
- data: reasoningMetadata.redactedData
619
- }
603
+ }
604
+ });
605
+ } else if ((reasoningMetadata == null ? void 0 : reasoningMetadata.redactedData) != null) {
606
+ bedrockContent.push({
607
+ reasoningContent: {
608
+ redactedReasoning: {
609
+ data: reasoningMetadata.redactedData
620
610
  }
621
- });
622
- }
611
+ }
612
+ });
613
+ } else {
614
+ bedrockContent.push({
615
+ reasoningContent: {
616
+ reasoningText: {
617
+ text: trimIfLast(
618
+ isLastBlock,
619
+ isLastMessage,
620
+ isLastContentPart,
621
+ part.text
622
+ )
623
+ }
624
+ }
625
+ });
623
626
  }
624
627
  break;
625
628
  }
@@ -1949,7 +1952,7 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1949
1952
  var import_aws4fetch = require("aws4fetch");
1950
1953
 
1951
1954
  // src/version.ts
1952
- var VERSION = true ? "4.0.84" : "0.0.0-test";
1955
+ var VERSION = true ? "4.0.85" : "0.0.0-test";
1953
1956
 
1954
1957
  // src/bedrock-sigv4-fetch.ts
1955
1958
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {