@ai-sdk/amazon-bedrock 4.0.98 → 4.0.100
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 +14 -0
- package/dist/anthropic/index.js +8 -6
- package/dist/anthropic/index.js.map +1 -1
- package/dist/anthropic/index.mjs +8 -6
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/bedrock-sigv4-fetch.ts +9 -5
- package/src/convert-to-bedrock-chat-messages.ts +14 -3
package/dist/index.mjs
CHANGED
|
@@ -631,7 +631,9 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
|
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
633
|
});
|
|
634
|
-
} else
|
|
634
|
+
} else if (part.providerOptions == null || Object.keys(part.providerOptions).every(
|
|
635
|
+
(k2) => k2 === "bedrock" || k2 === "amazonBedrock"
|
|
636
|
+
)) {
|
|
635
637
|
bedrockContent.push({
|
|
636
638
|
reasoningContent: {
|
|
637
639
|
reasoningText: {
|
|
@@ -2012,12 +2014,13 @@ import {
|
|
|
2012
2014
|
import { AwsV4Signer } from "aws4fetch";
|
|
2013
2015
|
|
|
2014
2016
|
// src/version.ts
|
|
2015
|
-
var VERSION = true ? "4.0.
|
|
2017
|
+
var VERSION = true ? "4.0.100" : "0.0.0-test";
|
|
2016
2018
|
|
|
2017
2019
|
// src/bedrock-sigv4-fetch.ts
|
|
2018
|
-
function createSigV4FetchFunction(getCredentials, fetch
|
|
2020
|
+
function createSigV4FetchFunction(getCredentials, fetch) {
|
|
2019
2021
|
return async (input, init) => {
|
|
2020
2022
|
var _a, _b;
|
|
2023
|
+
const effectiveFetch = fetch != null ? fetch : globalThis.fetch;
|
|
2021
2024
|
const request = input instanceof Request ? input : void 0;
|
|
2022
2025
|
const originalHeaders = combineHeaders4(
|
|
2023
2026
|
normalizeHeaders(request == null ? void 0 : request.headers),
|
|
@@ -2037,7 +2040,7 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
|
2037
2040
|
}
|
|
2038
2041
|
const effectiveMethod = (_b = init == null ? void 0 : init.method) != null ? _b : request == null ? void 0 : request.method;
|
|
2039
2042
|
if ((effectiveMethod == null ? void 0 : effectiveMethod.toUpperCase()) !== "POST" || !effectiveBody) {
|
|
2040
|
-
return
|
|
2043
|
+
return effectiveFetch(input, {
|
|
2041
2044
|
...init,
|
|
2042
2045
|
headers: headersWithUserAgent
|
|
2043
2046
|
});
|
|
@@ -2059,7 +2062,7 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
|
2059
2062
|
const signingResult = await signer.sign();
|
|
2060
2063
|
const signedHeaders = normalizeHeaders(signingResult.headers);
|
|
2061
2064
|
const combinedHeaders = combineHeaders4(headersWithUserAgent, signedHeaders);
|
|
2062
|
-
return
|
|
2065
|
+
return effectiveFetch(input, {
|
|
2063
2066
|
...init,
|
|
2064
2067
|
body,
|
|
2065
2068
|
headers: combinedHeaders
|
|
@@ -2077,8 +2080,9 @@ function prepareBodyString(body) {
|
|
|
2077
2080
|
return JSON.stringify(body);
|
|
2078
2081
|
}
|
|
2079
2082
|
}
|
|
2080
|
-
function createApiKeyFetchFunction(apiKey, fetch
|
|
2083
|
+
function createApiKeyFetchFunction(apiKey, fetch) {
|
|
2081
2084
|
return async (input, init) => {
|
|
2085
|
+
const effectiveFetch = fetch != null ? fetch : globalThis.fetch;
|
|
2082
2086
|
const originalHeaders = normalizeHeaders(init == null ? void 0 : init.headers);
|
|
2083
2087
|
const headersWithUserAgent = withUserAgentSuffix(
|
|
2084
2088
|
originalHeaders,
|
|
@@ -2088,7 +2092,7 @@ function createApiKeyFetchFunction(apiKey, fetch = globalThis.fetch) {
|
|
|
2088
2092
|
const finalHeaders = combineHeaders4(headersWithUserAgent, {
|
|
2089
2093
|
Authorization: `Bearer ${apiKey}`
|
|
2090
2094
|
});
|
|
2091
|
-
return
|
|
2095
|
+
return effectiveFetch(input, {
|
|
2092
2096
|
...init,
|
|
2093
2097
|
headers: finalHeaders
|
|
2094
2098
|
});
|