@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/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "@ai-sdk/provider-utils";
|
|
9
9
|
|
|
10
10
|
// src/version.ts
|
|
11
|
-
var VERSION = true ? "3.1.0-beta.
|
|
11
|
+
var VERSION = true ? "3.1.0-beta.9" : "0.0.0-test";
|
|
12
12
|
|
|
13
13
|
// src/bedrock-provider.ts
|
|
14
14
|
import { anthropicTools as anthropicTools2 } from "@ai-sdk/anthropic/internal";
|
|
@@ -1510,21 +1510,33 @@ import {
|
|
|
1510
1510
|
import { AwsV4Signer } from "aws4fetch";
|
|
1511
1511
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
1512
1512
|
return async (input, init) => {
|
|
1513
|
-
var _a;
|
|
1514
|
-
const
|
|
1513
|
+
var _a, _b;
|
|
1514
|
+
const request = input instanceof Request ? input : void 0;
|
|
1515
|
+
const originalHeaders = combineHeaders4(
|
|
1516
|
+
extractHeaders(request == null ? void 0 : request.headers),
|
|
1517
|
+
extractHeaders(init == null ? void 0 : init.headers)
|
|
1518
|
+
);
|
|
1515
1519
|
const headersWithUserAgent = withUserAgentSuffix(
|
|
1516
1520
|
originalHeaders,
|
|
1517
1521
|
`ai-sdk/amazon-bedrock/${VERSION}`,
|
|
1518
1522
|
getRuntimeEnvironmentUserAgent()
|
|
1519
1523
|
);
|
|
1520
|
-
|
|
1524
|
+
let effectiveBody = (_a = init == null ? void 0 : init.body) != null ? _a : void 0;
|
|
1525
|
+
if (effectiveBody === void 0 && request && request.body !== null) {
|
|
1526
|
+
try {
|
|
1527
|
+
effectiveBody = await request.clone().text();
|
|
1528
|
+
} catch (e) {
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
const effectiveMethod = (_b = init == null ? void 0 : init.method) != null ? _b : request == null ? void 0 : request.method;
|
|
1532
|
+
if ((effectiveMethod == null ? void 0 : effectiveMethod.toUpperCase()) !== "POST" || !effectiveBody) {
|
|
1521
1533
|
return fetch(input, {
|
|
1522
1534
|
...init,
|
|
1523
1535
|
headers: headersWithUserAgent
|
|
1524
1536
|
});
|
|
1525
1537
|
}
|
|
1526
1538
|
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
1527
|
-
const body = prepareBodyString(
|
|
1539
|
+
const body = prepareBodyString(effectiveBody);
|
|
1528
1540
|
const credentials = await getCredentials();
|
|
1529
1541
|
const signer = new AwsV4Signer({
|
|
1530
1542
|
url,
|