@ai-sdk/amazon-bedrock 4.0.153 → 4.0.155

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.
@@ -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.153" : "0.0.0-test";
38
+ var VERSION = true ? "4.0.155" : "0.0.0-test";
39
39
 
40
40
  // src/bedrock-sigv4-fetch.ts
41
41
  function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
@@ -23,7 +23,7 @@ import {
23
23
  import { AwsV4Signer } from "aws4fetch";
24
24
 
25
25
  // src/version.ts
26
- var VERSION = true ? "4.0.153" : "0.0.0-test";
26
+ var VERSION = true ? "4.0.155" : "0.0.0-test";
27
27
 
28
28
  // src/bedrock-sigv4-fetch.ts
29
29
  function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/amazon-bedrock",
3
- "version": "4.0.153",
3
+ "version": "4.0.155",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -44,10 +44,10 @@
44
44
  "@smithy/eventstream-codec": "^4.0.1",
45
45
  "@smithy/util-utf8": "^4.0.0",
46
46
  "aws4fetch": "^1.0.20",
47
- "@ai-sdk/anthropic": "3.0.110",
48
- "@ai-sdk/openai": "3.0.96",
47
+ "@ai-sdk/anthropic": "3.0.111",
48
+ "@ai-sdk/openai": "3.0.97",
49
49
  "@ai-sdk/provider": "3.0.15",
50
- "@ai-sdk/provider-utils": "4.0.45"
50
+ "@ai-sdk/provider-utils": "4.0.46"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "20.17.24",
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  UnsupportedFunctionalityError,
3
3
  type JSONObject,
4
+ type JSONValue,
4
5
  type LanguageModelV3FilePart,
5
6
  type LanguageModelV3Message,
6
7
  type LanguageModelV3Prompt,
@@ -415,7 +416,7 @@ export async function convertToBedrockChatMessages(
415
416
  toolUse: {
416
417
  toolUseId: normalizeToolCallId(part.toolCallId, isMistral),
417
418
  name: sanitizeToolName(part.toolName),
418
- input: part.input as JSONObject,
419
+ input: toBedrockToolInput(part.input),
419
420
  },
420
421
  });
421
422
  break;
@@ -442,6 +443,13 @@ export async function convertToBedrockChatMessages(
442
443
  return { system, messages };
443
444
  }
444
445
 
446
+ // wrap invalid tool call input because Bedrock requires it to be an object
447
+ function toBedrockToolInput(input: unknown): JSONObject {
448
+ return typeof input === 'object' && input !== null && !Array.isArray(input)
449
+ ? (input as JSONObject)
450
+ : { rawInvalidInput: input as JSONValue };
451
+ }
452
+
445
453
  function isBedrockImageFormat(format: string): format is BedrockImageFormat {
446
454
  return Object.values(BEDROCK_IMAGE_MIME_TYPES).includes(
447
455
  format as BedrockImageFormat,