@ai-sdk/amazon-bedrock 4.0.69 → 4.0.71
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 +16 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/docs/08-amazon-bedrock.mdx +6 -13
- package/package.json +3 -3
- package/src/convert-to-bedrock-chat-messages.ts +8 -2
package/dist/index.mjs
CHANGED
|
@@ -363,7 +363,11 @@ function convertBedrockUsage(usage) {
|
|
|
363
363
|
import {
|
|
364
364
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
365
365
|
} from "@ai-sdk/provider";
|
|
366
|
-
import {
|
|
366
|
+
import {
|
|
367
|
+
convertToBase64,
|
|
368
|
+
parseProviderOptions,
|
|
369
|
+
stripFileExtension
|
|
370
|
+
} from "@ai-sdk/provider-utils";
|
|
367
371
|
|
|
368
372
|
// src/normalize-tool-call-id.ts
|
|
369
373
|
function isMistralModel(modelId) {
|
|
@@ -396,7 +400,7 @@ async function shouldEnableCitations(providerMetadata) {
|
|
|
396
400
|
return (_b = (_a = bedrockOptions == null ? void 0 : bedrockOptions.citations) == null ? void 0 : _a.enabled) != null ? _b : false;
|
|
397
401
|
}
|
|
398
402
|
async function convertToBedrockChatMessages(prompt, isMistral = false) {
|
|
399
|
-
var _a
|
|
403
|
+
var _a;
|
|
400
404
|
const blocks = groupIntoBlocks(prompt);
|
|
401
405
|
let system = [];
|
|
402
406
|
const messages = [];
|
|
@@ -463,7 +467,7 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
|
|
|
463
467
|
bedrockContent.push({
|
|
464
468
|
document: {
|
|
465
469
|
format: getBedrockDocumentFormat(part.mediaType),
|
|
466
|
-
name:
|
|
470
|
+
name: part.filename ? stripFileExtension(part.filename) : generateDocumentName(),
|
|
467
471
|
source: { bytes: convertToBase64(part.data) },
|
|
468
472
|
...enableCitations && {
|
|
469
473
|
citations: { enabled: true }
|
|
@@ -520,7 +524,7 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
|
|
|
520
524
|
break;
|
|
521
525
|
case "execution-denied":
|
|
522
526
|
toolResultContent = [
|
|
523
|
-
{ text: (
|
|
527
|
+
{ text: (_a = output.reason) != null ? _a : "Tool execution denied." }
|
|
524
528
|
];
|
|
525
529
|
break;
|
|
526
530
|
case "json":
|
|
@@ -1965,7 +1969,7 @@ import {
|
|
|
1965
1969
|
import { AwsV4Signer } from "aws4fetch";
|
|
1966
1970
|
|
|
1967
1971
|
// src/version.ts
|
|
1968
|
-
var VERSION = true ? "4.0.
|
|
1972
|
+
var VERSION = true ? "4.0.71" : "0.0.0-test";
|
|
1969
1973
|
|
|
1970
1974
|
// src/bedrock-sigv4-fetch.ts
|
|
1971
1975
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|