@ai-sdk/amazon-bedrock 3.1.0-beta.1 → 3.1.0-beta.3
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 +24 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +26 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,14 @@ import {
|
|
|
3
3
|
generateId,
|
|
4
4
|
loadOptionalSetting,
|
|
5
5
|
loadSetting,
|
|
6
|
-
withoutTrailingSlash
|
|
6
|
+
withoutTrailingSlash,
|
|
7
|
+
withUserAgentSuffix as withUserAgentSuffix2
|
|
7
8
|
} from "@ai-sdk/provider-utils";
|
|
9
|
+
|
|
10
|
+
// src/version.ts
|
|
11
|
+
var VERSION = true ? "3.1.0-beta.3" : "0.0.0-test";
|
|
12
|
+
|
|
13
|
+
// src/bedrock-provider.ts
|
|
8
14
|
import { anthropicTools as anthropicTools2 } from "@ai-sdk/anthropic/internal";
|
|
9
15
|
|
|
10
16
|
// src/bedrock-chat-language-model.ts
|
|
@@ -1308,7 +1314,7 @@ var BedrockEmbeddingModel = class {
|
|
|
1308
1314
|
constructor(modelId, config) {
|
|
1309
1315
|
this.modelId = modelId;
|
|
1310
1316
|
this.config = config;
|
|
1311
|
-
this.specificationVersion = "
|
|
1317
|
+
this.specificationVersion = "v3";
|
|
1312
1318
|
this.provider = "amazon-bedrock";
|
|
1313
1319
|
this.maxEmbeddingsPerCall = 1;
|
|
1314
1320
|
this.supportsParallelCalls = true;
|
|
@@ -1390,7 +1396,7 @@ var BedrockImageModel = class {
|
|
|
1390
1396
|
constructor(modelId, config) {
|
|
1391
1397
|
this.modelId = modelId;
|
|
1392
1398
|
this.config = config;
|
|
1393
|
-
this.specificationVersion = "
|
|
1399
|
+
this.specificationVersion = "v3";
|
|
1394
1400
|
this.provider = "amazon-bedrock";
|
|
1395
1401
|
}
|
|
1396
1402
|
get maxImagesPerCall() {
|
|
@@ -1502,11 +1508,6 @@ import {
|
|
|
1502
1508
|
getRuntimeEnvironmentUserAgent
|
|
1503
1509
|
} from "@ai-sdk/provider-utils";
|
|
1504
1510
|
import { AwsV4Signer } from "aws4fetch";
|
|
1505
|
-
|
|
1506
|
-
// src/version.ts
|
|
1507
|
-
var VERSION = true ? "3.1.0-beta.1" : "0.0.0-test";
|
|
1508
|
-
|
|
1509
|
-
// src/bedrock-sigv4-fetch.ts
|
|
1510
1511
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
1511
1512
|
return async (input, init) => {
|
|
1512
1513
|
var _a;
|
|
@@ -1654,15 +1655,17 @@ Original error: ${errorMessage}`
|
|
|
1654
1655
|
})}.amazonaws.com`
|
|
1655
1656
|
)) != null ? _b : `https://bedrock-runtime.us-east-1.amazonaws.com`;
|
|
1656
1657
|
};
|
|
1657
|
-
const
|
|
1658
|
+
const getHeaders = () => {
|
|
1658
1659
|
var _a;
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
headers: (_a = options.headers) != null ? _a : {},
|
|
1662
|
-
fetch: fetchFunction,
|
|
1663
|
-
generateId
|
|
1664
|
-
});
|
|
1660
|
+
const baseHeaders = (_a = options.headers) != null ? _a : {};
|
|
1661
|
+
return withUserAgentSuffix2(baseHeaders, `ai-sdk/amazon-bedrock/${VERSION}`);
|
|
1665
1662
|
};
|
|
1663
|
+
const createChatModel = (modelId) => new BedrockChatLanguageModel(modelId, {
|
|
1664
|
+
baseUrl: getBaseUrl,
|
|
1665
|
+
headers: getHeaders,
|
|
1666
|
+
fetch: fetchFunction,
|
|
1667
|
+
generateId
|
|
1668
|
+
});
|
|
1666
1669
|
const provider = function(modelId) {
|
|
1667
1670
|
if (new.target) {
|
|
1668
1671
|
throw new Error(
|
|
@@ -1671,22 +1674,16 @@ Original error: ${errorMessage}`
|
|
|
1671
1674
|
}
|
|
1672
1675
|
return createChatModel(modelId);
|
|
1673
1676
|
};
|
|
1674
|
-
const createEmbeddingModel = (modelId) => {
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
return new BedrockImageModel(modelId, {
|
|
1685
|
-
baseUrl: getBaseUrl,
|
|
1686
|
-
headers: (_a = options.headers) != null ? _a : {},
|
|
1687
|
-
fetch: fetchFunction
|
|
1688
|
-
});
|
|
1689
|
-
};
|
|
1677
|
+
const createEmbeddingModel = (modelId) => new BedrockEmbeddingModel(modelId, {
|
|
1678
|
+
baseUrl: getBaseUrl,
|
|
1679
|
+
headers: getHeaders,
|
|
1680
|
+
fetch: fetchFunction
|
|
1681
|
+
});
|
|
1682
|
+
const createImageModel = (modelId) => new BedrockImageModel(modelId, {
|
|
1683
|
+
baseUrl: getBaseUrl,
|
|
1684
|
+
headers: getHeaders,
|
|
1685
|
+
fetch: fetchFunction
|
|
1686
|
+
});
|
|
1690
1687
|
provider.languageModel = createChatModel;
|
|
1691
1688
|
provider.embedding = createEmbeddingModel;
|
|
1692
1689
|
provider.textEmbedding = createEmbeddingModel;
|