@ai-sdk/amazon-bedrock 3.1.0-beta.8 → 3.1.0-beta.9
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/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "3.1.0-beta.
|
|
33
|
+
var VERSION = true ? "3.1.0-beta.9" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/bedrock-provider.ts
|
|
36
36
|
var import_internal2 = require("@ai-sdk/anthropic/internal");
|
|
@@ -1495,21 +1495,33 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
|
1495
1495
|
var import_aws4fetch = require("aws4fetch");
|
|
1496
1496
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
1497
1497
|
return async (input, init) => {
|
|
1498
|
-
var _a;
|
|
1499
|
-
const
|
|
1498
|
+
var _a, _b;
|
|
1499
|
+
const request = input instanceof Request ? input : void 0;
|
|
1500
|
+
const originalHeaders = (0, import_provider_utils7.combineHeaders)(
|
|
1501
|
+
extractHeaders(request == null ? void 0 : request.headers),
|
|
1502
|
+
extractHeaders(init == null ? void 0 : init.headers)
|
|
1503
|
+
);
|
|
1500
1504
|
const headersWithUserAgent = (0, import_provider_utils7.withUserAgentSuffix)(
|
|
1501
1505
|
originalHeaders,
|
|
1502
1506
|
`ai-sdk/amazon-bedrock/${VERSION}`,
|
|
1503
1507
|
(0, import_provider_utils7.getRuntimeEnvironmentUserAgent)()
|
|
1504
1508
|
);
|
|
1505
|
-
|
|
1509
|
+
let effectiveBody = (_a = init == null ? void 0 : init.body) != null ? _a : void 0;
|
|
1510
|
+
if (effectiveBody === void 0 && request && request.body !== null) {
|
|
1511
|
+
try {
|
|
1512
|
+
effectiveBody = await request.clone().text();
|
|
1513
|
+
} catch (e) {
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
const effectiveMethod = (_b = init == null ? void 0 : init.method) != null ? _b : request == null ? void 0 : request.method;
|
|
1517
|
+
if ((effectiveMethod == null ? void 0 : effectiveMethod.toUpperCase()) !== "POST" || !effectiveBody) {
|
|
1506
1518
|
return fetch(input, {
|
|
1507
1519
|
...init,
|
|
1508
1520
|
headers: headersWithUserAgent
|
|
1509
1521
|
});
|
|
1510
1522
|
}
|
|
1511
1523
|
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
1512
|
-
const body = prepareBodyString(
|
|
1524
|
+
const body = prepareBodyString(effectiveBody);
|
|
1513
1525
|
const credentials = await getCredentials();
|
|
1514
1526
|
const signer = new import_aws4fetch.AwsV4Signer({
|
|
1515
1527
|
url,
|