@ai-sdk/amazon-bedrock 3.0.46 → 3.0.48
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/index.js +5 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
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.0.
|
|
11
|
+
var VERSION = true ? "3.0.48" : "0.0.0-test";
|
|
12
12
|
|
|
13
13
|
// src/bedrock-provider.ts
|
|
14
14
|
import { anthropicTools as anthropicTools2 } from "@ai-sdk/anthropic/internal";
|
|
@@ -1511,31 +1511,10 @@ var bedrockImageResponseSchema = z6.object({
|
|
|
1511
1511
|
images: z6.array(z6.string())
|
|
1512
1512
|
});
|
|
1513
1513
|
|
|
1514
|
-
// src/headers-utils.ts
|
|
1515
|
-
function extractHeaders(headers) {
|
|
1516
|
-
let originalHeaders = {};
|
|
1517
|
-
if (headers) {
|
|
1518
|
-
if (headers instanceof Headers) {
|
|
1519
|
-
originalHeaders = convertHeadersToRecord(headers);
|
|
1520
|
-
} else if (Array.isArray(headers)) {
|
|
1521
|
-
for (const [k, v] of headers) {
|
|
1522
|
-
originalHeaders[k.toLowerCase()] = v;
|
|
1523
|
-
}
|
|
1524
|
-
} else {
|
|
1525
|
-
originalHeaders = Object.fromEntries(
|
|
1526
|
-
Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v])
|
|
1527
|
-
);
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
return originalHeaders;
|
|
1531
|
-
}
|
|
1532
|
-
function convertHeadersToRecord(headers) {
|
|
1533
|
-
return Object.fromEntries([...headers]);
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
1514
|
// src/bedrock-sigv4-fetch.ts
|
|
1537
1515
|
import {
|
|
1538
1516
|
combineHeaders as combineHeaders4,
|
|
1517
|
+
normalizeHeaders,
|
|
1539
1518
|
withUserAgentSuffix,
|
|
1540
1519
|
getRuntimeEnvironmentUserAgent
|
|
1541
1520
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1545,8 +1524,8 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
|
1545
1524
|
var _a, _b;
|
|
1546
1525
|
const request = input instanceof Request ? input : void 0;
|
|
1547
1526
|
const originalHeaders = combineHeaders4(
|
|
1548
|
-
|
|
1549
|
-
|
|
1527
|
+
normalizeHeaders(request == null ? void 0 : request.headers),
|
|
1528
|
+
normalizeHeaders(init == null ? void 0 : init.headers)
|
|
1550
1529
|
);
|
|
1551
1530
|
const headersWithUserAgent = withUserAgentSuffix(
|
|
1552
1531
|
originalHeaders,
|
|
@@ -1582,7 +1561,7 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
|
1582
1561
|
service: "bedrock"
|
|
1583
1562
|
});
|
|
1584
1563
|
const signingResult = await signer.sign();
|
|
1585
|
-
const signedHeaders =
|
|
1564
|
+
const signedHeaders = normalizeHeaders(signingResult.headers);
|
|
1586
1565
|
const combinedHeaders = combineHeaders4(headersWithUserAgent, signedHeaders);
|
|
1587
1566
|
return fetch(input, {
|
|
1588
1567
|
...init,
|
|
@@ -1604,7 +1583,7 @@ function prepareBodyString(body) {
|
|
|
1604
1583
|
}
|
|
1605
1584
|
function createApiKeyFetchFunction(apiKey, fetch = globalThis.fetch) {
|
|
1606
1585
|
return async (input, init) => {
|
|
1607
|
-
const originalHeaders =
|
|
1586
|
+
const originalHeaders = normalizeHeaders(init == null ? void 0 : init.headers);
|
|
1608
1587
|
const headersWithUserAgent = withUserAgentSuffix(
|
|
1609
1588
|
originalHeaders,
|
|
1610
1589
|
`ai-sdk/amazon-bedrock/${VERSION}`,
|