@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 3.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ed329cb: feat: `Provider-V3`
|
|
8
|
+
- 522f6b8: feat: `ImageModelV3`
|
|
9
|
+
- Updated dependencies [ed329cb]
|
|
10
|
+
- Updated dependencies [522f6b8]
|
|
11
|
+
- @ai-sdk/anthropic@2.1.0-beta.3
|
|
12
|
+
- @ai-sdk/provider@2.1.0-beta.2
|
|
13
|
+
- @ai-sdk/provider-utils@3.1.0-beta.3
|
|
14
|
+
|
|
15
|
+
## 3.1.0-beta.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 0c4822d: feat: `EmbeddingModelV3`
|
|
20
|
+
- 1cad0ab: feat: add provider version to user-agent header
|
|
21
|
+
- Updated dependencies [0c4822d]
|
|
22
|
+
- Updated dependencies [1cad0ab]
|
|
23
|
+
- @ai-sdk/provider@2.1.0-beta.1
|
|
24
|
+
- @ai-sdk/anthropic@2.1.0-beta.2
|
|
25
|
+
- @ai-sdk/provider-utils@3.1.0-beta.2
|
|
26
|
+
|
|
3
27
|
## 3.1.0-beta.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderV3, LanguageModelV2, EmbeddingModelV3, ImageModelV3 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { anthropicTools } from '@ai-sdk/anthropic/internal';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
@@ -91,18 +91,18 @@ interface AmazonBedrockProviderSettings {
|
|
|
91
91
|
credentialProvider?: () => PromiseLike<Omit<BedrockCredentials, 'region'>>;
|
|
92
92
|
generateId?: () => string;
|
|
93
93
|
}
|
|
94
|
-
interface AmazonBedrockProvider extends
|
|
94
|
+
interface AmazonBedrockProvider extends ProviderV3 {
|
|
95
95
|
(modelId: BedrockChatModelId): LanguageModelV2;
|
|
96
96
|
languageModel(modelId: BedrockChatModelId): LanguageModelV2;
|
|
97
|
-
embedding(modelId: BedrockEmbeddingModelId):
|
|
97
|
+
embedding(modelId: BedrockEmbeddingModelId): EmbeddingModelV3<string>;
|
|
98
98
|
/**
|
|
99
99
|
Creates a model for image generation.
|
|
100
100
|
*/
|
|
101
|
-
image(modelId: BedrockImageModelId):
|
|
101
|
+
image(modelId: BedrockImageModelId): ImageModelV3;
|
|
102
102
|
/**
|
|
103
103
|
Creates a model for image generation.
|
|
104
104
|
*/
|
|
105
|
-
imageModel(modelId: BedrockImageModelId):
|
|
105
|
+
imageModel(modelId: BedrockImageModelId): ImageModelV3;
|
|
106
106
|
/**
|
|
107
107
|
Anthropic-specific tools that can be used with Anthropic models on Bedrock.
|
|
108
108
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderV3, LanguageModelV2, EmbeddingModelV3, ImageModelV3 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { anthropicTools } from '@ai-sdk/anthropic/internal';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
@@ -91,18 +91,18 @@ interface AmazonBedrockProviderSettings {
|
|
|
91
91
|
credentialProvider?: () => PromiseLike<Omit<BedrockCredentials, 'region'>>;
|
|
92
92
|
generateId?: () => string;
|
|
93
93
|
}
|
|
94
|
-
interface AmazonBedrockProvider extends
|
|
94
|
+
interface AmazonBedrockProvider extends ProviderV3 {
|
|
95
95
|
(modelId: BedrockChatModelId): LanguageModelV2;
|
|
96
96
|
languageModel(modelId: BedrockChatModelId): LanguageModelV2;
|
|
97
|
-
embedding(modelId: BedrockEmbeddingModelId):
|
|
97
|
+
embedding(modelId: BedrockEmbeddingModelId): EmbeddingModelV3<string>;
|
|
98
98
|
/**
|
|
99
99
|
Creates a model for image generation.
|
|
100
100
|
*/
|
|
101
|
-
image(modelId: BedrockImageModelId):
|
|
101
|
+
image(modelId: BedrockImageModelId): ImageModelV3;
|
|
102
102
|
/**
|
|
103
103
|
Creates a model for image generation.
|
|
104
104
|
*/
|
|
105
|
-
imageModel(modelId: BedrockImageModelId):
|
|
105
|
+
imageModel(modelId: BedrockImageModelId): ImageModelV3;
|
|
106
106
|
/**
|
|
107
107
|
Anthropic-specific tools that can be used with Anthropic models on Bedrock.
|
|
108
108
|
*/
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/bedrock-provider.ts
|
|
30
30
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
31
|
+
|
|
32
|
+
// src/version.ts
|
|
33
|
+
var VERSION = true ? "3.1.0-beta.3" : "0.0.0-test";
|
|
34
|
+
|
|
35
|
+
// src/bedrock-provider.ts
|
|
31
36
|
var import_internal2 = require("@ai-sdk/anthropic/internal");
|
|
32
37
|
|
|
33
38
|
// src/bedrock-chat-language-model.ts
|
|
@@ -1304,7 +1309,7 @@ var BedrockEmbeddingModel = class {
|
|
|
1304
1309
|
constructor(modelId, config) {
|
|
1305
1310
|
this.modelId = modelId;
|
|
1306
1311
|
this.config = config;
|
|
1307
|
-
this.specificationVersion = "
|
|
1312
|
+
this.specificationVersion = "v3";
|
|
1308
1313
|
this.provider = "amazon-bedrock";
|
|
1309
1314
|
this.maxEmbeddingsPerCall = 1;
|
|
1310
1315
|
this.supportsParallelCalls = true;
|
|
@@ -1380,7 +1385,7 @@ var BedrockImageModel = class {
|
|
|
1380
1385
|
constructor(modelId, config) {
|
|
1381
1386
|
this.modelId = modelId;
|
|
1382
1387
|
this.config = config;
|
|
1383
|
-
this.specificationVersion = "
|
|
1388
|
+
this.specificationVersion = "v3";
|
|
1384
1389
|
this.provider = "amazon-bedrock";
|
|
1385
1390
|
}
|
|
1386
1391
|
get maxImagesPerCall() {
|
|
@@ -1488,11 +1493,6 @@ function convertHeadersToRecord(headers) {
|
|
|
1488
1493
|
// src/bedrock-sigv4-fetch.ts
|
|
1489
1494
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1490
1495
|
var import_aws4fetch = require("aws4fetch");
|
|
1491
|
-
|
|
1492
|
-
// src/version.ts
|
|
1493
|
-
var VERSION = true ? "3.1.0-beta.1" : "0.0.0-test";
|
|
1494
|
-
|
|
1495
|
-
// src/bedrock-sigv4-fetch.ts
|
|
1496
1496
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
1497
1497
|
return async (input, init) => {
|
|
1498
1498
|
var _a;
|
|
@@ -1640,15 +1640,17 @@ Original error: ${errorMessage}`
|
|
|
1640
1640
|
})}.amazonaws.com`
|
|
1641
1641
|
)) != null ? _b : `https://bedrock-runtime.us-east-1.amazonaws.com`;
|
|
1642
1642
|
};
|
|
1643
|
-
const
|
|
1643
|
+
const getHeaders = () => {
|
|
1644
1644
|
var _a;
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
headers: (_a = options.headers) != null ? _a : {},
|
|
1648
|
-
fetch: fetchFunction,
|
|
1649
|
-
generateId: import_provider_utils8.generateId
|
|
1650
|
-
});
|
|
1645
|
+
const baseHeaders = (_a = options.headers) != null ? _a : {};
|
|
1646
|
+
return (0, import_provider_utils8.withUserAgentSuffix)(baseHeaders, `ai-sdk/amazon-bedrock/${VERSION}`);
|
|
1651
1647
|
};
|
|
1648
|
+
const createChatModel = (modelId) => new BedrockChatLanguageModel(modelId, {
|
|
1649
|
+
baseUrl: getBaseUrl,
|
|
1650
|
+
headers: getHeaders,
|
|
1651
|
+
fetch: fetchFunction,
|
|
1652
|
+
generateId: import_provider_utils8.generateId
|
|
1653
|
+
});
|
|
1652
1654
|
const provider = function(modelId) {
|
|
1653
1655
|
if (new.target) {
|
|
1654
1656
|
throw new Error(
|
|
@@ -1657,22 +1659,16 @@ Original error: ${errorMessage}`
|
|
|
1657
1659
|
}
|
|
1658
1660
|
return createChatModel(modelId);
|
|
1659
1661
|
};
|
|
1660
|
-
const createEmbeddingModel = (modelId) => {
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
return new BedrockImageModel(modelId, {
|
|
1671
|
-
baseUrl: getBaseUrl,
|
|
1672
|
-
headers: (_a = options.headers) != null ? _a : {},
|
|
1673
|
-
fetch: fetchFunction
|
|
1674
|
-
});
|
|
1675
|
-
};
|
|
1662
|
+
const createEmbeddingModel = (modelId) => new BedrockEmbeddingModel(modelId, {
|
|
1663
|
+
baseUrl: getBaseUrl,
|
|
1664
|
+
headers: getHeaders,
|
|
1665
|
+
fetch: fetchFunction
|
|
1666
|
+
});
|
|
1667
|
+
const createImageModel = (modelId) => new BedrockImageModel(modelId, {
|
|
1668
|
+
baseUrl: getBaseUrl,
|
|
1669
|
+
headers: getHeaders,
|
|
1670
|
+
fetch: fetchFunction
|
|
1671
|
+
});
|
|
1676
1672
|
provider.languageModel = createChatModel;
|
|
1677
1673
|
provider.embedding = createEmbeddingModel;
|
|
1678
1674
|
provider.textEmbedding = createEmbeddingModel;
|