@ai-sdk/amazon-bedrock 4.0.154 → 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.
- package/CHANGELOG.md +6 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mantle/index.js +1 -1
- package/dist/mantle/index.mjs +1 -1
- package/package.json +1 -1
- package/src/convert-to-bedrock-chat-messages.ts +9 -1
package/dist/mantle/index.js
CHANGED
|
@@ -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.
|
|
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") {
|
package/dist/mantle/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { AwsV4Signer } from "aws4fetch";
|
|
24
24
|
|
|
25
25
|
// src/version.ts
|
|
26
|
-
var VERSION = true ? "4.0.
|
|
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,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
|
|
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,
|