@ai-sdk/amazon-bedrock 4.0.83 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/amazon-bedrock",
3
- "version": "4.0.83",
3
+ "version": "4.0.85",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -38,8 +38,8 @@
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/provider": "3.0.8",
42
41
  "@ai-sdk/anthropic": "3.0.64",
42
+ "@ai-sdk/provider": "3.0.8",
43
43
  "@ai-sdk/provider-utils": "4.0.21"
44
44
  },
45
45
  "devDependencies": {
@@ -47,6 +47,10 @@ const BEDROCK_TOOL_BETA_MAP: Record<string, string> = {
47
47
  text_editor_20250728: 'computer-use-2025-01-24',
48
48
  computer_20250124: 'computer-use-2025-01-24',
49
49
  computer_20241022: 'computer-use-2024-10-22',
50
+ tool_search_tool_regex_20251119: 'tool-search-tool-2025-10-19',
51
+ // BM25 is not currently supported on Bedrock, but including the beta flag
52
+ // so that Bedrock returns a more useful error message if it's used.
53
+ tool_search_tool_bm25_20251119: 'tool-search-tool-2025-10-19',
50
54
  };
51
55
 
52
56
  export interface BedrockAnthropicProvider extends ProviderV3 {
@@ -287,33 +287,41 @@ export async function convertToBedrockChatMessages(
287
287
  schema: bedrockReasoningMetadataSchema,
288
288
  });
289
289
 
290
- if (reasoningMetadata != null) {
291
- if (reasoningMetadata.signature != null) {
292
- bedrockContent.push({
293
- reasoningContent: {
294
- reasoningText: {
295
- // trim the last text part if it's the last message in the block
296
- // because Bedrock does not allow trailing whitespace
297
- // in pre-filled assistant responses
298
- text: trimIfLast(
299
- isLastBlock,
300
- isLastMessage,
301
- isLastContentPart,
302
- part.text,
303
- ),
304
- signature: reasoningMetadata.signature,
305
- },
290
+ if (reasoningMetadata?.signature != null) {
291
+ // do not trim reasoning text when a signature is present:
292
+ // the signature validates the exact original bytes
293
+ bedrockContent.push({
294
+ reasoningContent: {
295
+ reasoningText: {
296
+ text: part.text,
297
+ signature: reasoningMetadata.signature,
306
298
  },
307
- });
308
- } else if (reasoningMetadata.redactedData != null) {
309
- bedrockContent.push({
310
- reasoningContent: {
311
- redactedReasoning: {
312
- data: reasoningMetadata.redactedData,
313
- },
299
+ },
300
+ });
301
+ } else if (reasoningMetadata?.redactedData != null) {
302
+ bedrockContent.push({
303
+ reasoningContent: {
304
+ redactedReasoning: {
305
+ data: reasoningMetadata.redactedData,
314
306
  },
315
- });
316
- }
307
+ },
308
+ });
309
+ } else {
310
+ // trim the last text part if it's the last message in the block
311
+ // because Bedrock does not allow trailing whitespace
312
+ // in pre-filled assistant responses
313
+ bedrockContent.push({
314
+ reasoningContent: {
315
+ reasoningText: {
316
+ text: trimIfLast(
317
+ isLastBlock,
318
+ isLastMessage,
319
+ isLastContentPart,
320
+ part.text,
321
+ ),
322
+ },
323
+ },
324
+ });
317
325
  }
318
326
 
319
327
  break;