@ai-sdk/amazon-bedrock 5.0.100 → 5.0.102
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 +20 -0
- package/dist/anthropic/index.d.ts +79 -76
- package/dist/anthropic/index.d.ts.map +1 -0
- package/dist/anthropic/index.js +429 -521
- package/dist/anthropic/index.js.map +1 -1
- package/dist/index.d.ts +218 -211
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2547 -3233
- package/dist/index.js.map +1 -1
- package/dist/mantle/index.cjs +181 -235
- package/dist/mantle/index.cjs.map +1 -1
- package/dist/mantle/index.d.cts +85 -82
- package/dist/mantle/index.d.cts.map +1 -0
- package/dist/mantle/index.d.ts +85 -82
- package/dist/mantle/index.d.ts.map +1 -0
- package/dist/mantle/index.js +178 -221
- package/dist/mantle/index.js.map +1 -1
- package/docs/08-amazon-bedrock.mdx +2 -2
- package/package.json +10 -10
package/dist/mantle/index.d.cts
CHANGED
|
@@ -1,99 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FetchFunction } from
|
|
3
|
-
|
|
1
|
+
import { LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
|
|
2
|
+
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
3
|
+
//#region src/amazon-bedrock-sigv4-fetch.d.ts
|
|
4
4
|
interface AmazonBedrockCredentials {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
region: string;
|
|
6
|
+
accessKeyId: string;
|
|
7
|
+
secretAccessKey: string;
|
|
8
|
+
sessionToken?: string;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/mantle/bedrock-mantle-options.d.ts
|
|
11
12
|
type BedrockMantleChatModelId = 'openai.gpt-oss-20b' | 'openai.gpt-oss-120b' | 'openai.gpt-oss-safeguard-20b' | 'openai.gpt-oss-safeguard-120b' | (string & {});
|
|
12
13
|
type BedrockMantleResponsesModelId = 'openai.gpt-oss-20b' | 'openai.gpt-oss-120b' | (string & {});
|
|
13
14
|
type BedrockMantleModelId = BedrockMantleChatModelId | BedrockMantleResponsesModelId;
|
|
14
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/mantle/bedrock-mantle-provider.d.ts
|
|
15
17
|
interface BedrockMantleProvider extends ProviderV4 {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Creates a model for text generation using the Chat Completions API.
|
|
20
|
+
* Chat Completions has the broadest model support on Mantle.
|
|
21
|
+
*/
|
|
22
|
+
(modelId: BedrockMantleChatModelId): LanguageModelV4;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a model for text generation using the Chat Completions API.
|
|
25
|
+
*/
|
|
26
|
+
languageModel(modelId: BedrockMantleChatModelId): LanguageModelV4;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a model for text generation using the Chat Completions API.
|
|
29
|
+
*/
|
|
30
|
+
chat(modelId: BedrockMantleChatModelId): LanguageModelV4;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a model for text generation using the Responses API.
|
|
33
|
+
* Not all Mantle models support this API. Notably, gpt-oss-safeguard models
|
|
34
|
+
* are Chat-only.
|
|
35
|
+
*/
|
|
36
|
+
responses(modelId: BedrockMantleResponsesModelId): LanguageModelV4;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Mantle does not support embedding models.
|
|
39
|
+
*/
|
|
40
|
+
textEmbeddingModel(modelId: string): never;
|
|
39
41
|
}
|
|
40
42
|
interface BedrockMantleProviderSettings {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The AWS region to use for the Bedrock Mantle endpoint. Defaults to the value of the
|
|
45
|
+
* `AWS_REGION` environment variable.
|
|
46
|
+
*/
|
|
47
|
+
region?: string;
|
|
48
|
+
/**
|
|
49
|
+
* API key for authenticating requests using Bearer token authentication.
|
|
50
|
+
* When provided, this will be used instead of AWS SigV4 authentication.
|
|
51
|
+
* Defaults to the value of the `AWS_BEARER_TOKEN_BEDROCK` environment variable.
|
|
52
|
+
*/
|
|
53
|
+
apiKey?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The AWS access key ID to use for SigV4 authentication. Defaults to the value of the
|
|
56
|
+
* `AWS_ACCESS_KEY_ID` environment variable.
|
|
57
|
+
*/
|
|
58
|
+
accessKeyId?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The AWS secret access key to use for SigV4 authentication. Defaults to the value of the
|
|
61
|
+
* `AWS_SECRET_ACCESS_KEY` environment variable.
|
|
62
|
+
*/
|
|
63
|
+
secretAccessKey?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The AWS session token to use for SigV4 authentication. Defaults to the value of the
|
|
66
|
+
* `AWS_SESSION_TOKEN` environment variable.
|
|
67
|
+
*/
|
|
68
|
+
sessionToken?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Base URL for the Bedrock Mantle API calls.
|
|
71
|
+
*/
|
|
72
|
+
baseURL?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Custom headers to include in the requests.
|
|
75
|
+
*/
|
|
76
|
+
headers?: Record<string, string | undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
79
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
80
|
+
*/
|
|
81
|
+
fetch?: FetchFunction;
|
|
82
|
+
/**
|
|
83
|
+
* The AWS credential provider to use for SigV4 authentication to get dynamic
|
|
84
|
+
* credentials similar to the AWS SDK. Setting a provider here will cause its
|
|
85
|
+
* credential values to be used instead of the `accessKeyId`, `secretAccessKey`,
|
|
86
|
+
* and `sessionToken` settings.
|
|
87
|
+
*/
|
|
88
|
+
credentialProvider?: () => PromiseLike<Omit<AmazonBedrockCredentials, 'region'>>;
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
91
|
* Create an Amazon Bedrock Mantle provider instance.
|
|
90
92
|
* This provider uses the OpenAI-compatible Mantle API for models that are
|
|
91
93
|
* only available through the Mantle endpoint (e.g. openai.gpt-oss-20b).
|
|
92
94
|
*/
|
|
93
|
-
declare function createBedrockMantle(options?: BedrockMantleProviderSettings): BedrockMantleProvider;
|
|
95
|
+
export declare function createBedrockMantle(options?: BedrockMantleProviderSettings): BedrockMantleProvider;
|
|
94
96
|
/**
|
|
95
97
|
* Default Bedrock Mantle provider instance.
|
|
96
98
|
*/
|
|
97
|
-
declare const bedrockMantle: BedrockMantleProvider;
|
|
98
|
-
|
|
99
|
-
export {
|
|
99
|
+
export declare const bedrockMantle: BedrockMantleProvider;
|
|
100
|
+
//#endregion
|
|
101
|
+
export type { BedrockMantleModelId, BedrockMantleProvider, BedrockMantleProviderSettings };
|
|
102
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/amazon-bedrock-sigv4-fetch.ts","../../src/mantle/bedrock-mantle-options.ts","../../src/mantle/bedrock-mantle-provider.ts"],"mappings":";;;UAUiB;EACf;EACA;EACA;EACA;;;;KCdU;KAOA;KAKA,uBACR,2BACA;;;UCaa,8BAA8B;;;;;GAK5C,SAAS,2BAA2B;;;;EAKrC,cAAc,SAAS,2BAA2B;;;;EAKlD,KAAK,SAAS,2BAA2B;;;;;;EAOzC,UAAU,SAAS,gCAAgC;;;;EAKnD,mBAAmB;;UAGJ;;;;;EAKf;;;;;;EAOA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;EAKA;;;;EAKA,UAAU;;;;;EAMV,QAAQ;;;;;;;EAQR,2BAA2B,YACzB,KAAK;;;;;;;wBASO,oBACd,UAAS,gCACR;;;;qBAqKU,eAAa"}
|
package/dist/mantle/index.d.ts
CHANGED
|
@@ -1,99 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FetchFunction } from
|
|
3
|
-
|
|
1
|
+
import { LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
|
|
2
|
+
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
3
|
+
//#region src/amazon-bedrock-sigv4-fetch.d.ts
|
|
4
4
|
interface AmazonBedrockCredentials {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
region: string;
|
|
6
|
+
accessKeyId: string;
|
|
7
|
+
secretAccessKey: string;
|
|
8
|
+
sessionToken?: string;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/mantle/bedrock-mantle-options.d.ts
|
|
11
12
|
type BedrockMantleChatModelId = 'openai.gpt-oss-20b' | 'openai.gpt-oss-120b' | 'openai.gpt-oss-safeguard-20b' | 'openai.gpt-oss-safeguard-120b' | (string & {});
|
|
12
13
|
type BedrockMantleResponsesModelId = 'openai.gpt-oss-20b' | 'openai.gpt-oss-120b' | (string & {});
|
|
13
14
|
type BedrockMantleModelId = BedrockMantleChatModelId | BedrockMantleResponsesModelId;
|
|
14
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/mantle/bedrock-mantle-provider.d.ts
|
|
15
17
|
interface BedrockMantleProvider extends ProviderV4 {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Creates a model for text generation using the Chat Completions API.
|
|
20
|
+
* Chat Completions has the broadest model support on Mantle.
|
|
21
|
+
*/
|
|
22
|
+
(modelId: BedrockMantleChatModelId): LanguageModelV4;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a model for text generation using the Chat Completions API.
|
|
25
|
+
*/
|
|
26
|
+
languageModel(modelId: BedrockMantleChatModelId): LanguageModelV4;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a model for text generation using the Chat Completions API.
|
|
29
|
+
*/
|
|
30
|
+
chat(modelId: BedrockMantleChatModelId): LanguageModelV4;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a model for text generation using the Responses API.
|
|
33
|
+
* Not all Mantle models support this API. Notably, gpt-oss-safeguard models
|
|
34
|
+
* are Chat-only.
|
|
35
|
+
*/
|
|
36
|
+
responses(modelId: BedrockMantleResponsesModelId): LanguageModelV4;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Mantle does not support embedding models.
|
|
39
|
+
*/
|
|
40
|
+
textEmbeddingModel(modelId: string): never;
|
|
39
41
|
}
|
|
40
42
|
interface BedrockMantleProviderSettings {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The AWS region to use for the Bedrock Mantle endpoint. Defaults to the value of the
|
|
45
|
+
* `AWS_REGION` environment variable.
|
|
46
|
+
*/
|
|
47
|
+
region?: string;
|
|
48
|
+
/**
|
|
49
|
+
* API key for authenticating requests using Bearer token authentication.
|
|
50
|
+
* When provided, this will be used instead of AWS SigV4 authentication.
|
|
51
|
+
* Defaults to the value of the `AWS_BEARER_TOKEN_BEDROCK` environment variable.
|
|
52
|
+
*/
|
|
53
|
+
apiKey?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The AWS access key ID to use for SigV4 authentication. Defaults to the value of the
|
|
56
|
+
* `AWS_ACCESS_KEY_ID` environment variable.
|
|
57
|
+
*/
|
|
58
|
+
accessKeyId?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The AWS secret access key to use for SigV4 authentication. Defaults to the value of the
|
|
61
|
+
* `AWS_SECRET_ACCESS_KEY` environment variable.
|
|
62
|
+
*/
|
|
63
|
+
secretAccessKey?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The AWS session token to use for SigV4 authentication. Defaults to the value of the
|
|
66
|
+
* `AWS_SESSION_TOKEN` environment variable.
|
|
67
|
+
*/
|
|
68
|
+
sessionToken?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Base URL for the Bedrock Mantle API calls.
|
|
71
|
+
*/
|
|
72
|
+
baseURL?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Custom headers to include in the requests.
|
|
75
|
+
*/
|
|
76
|
+
headers?: Record<string, string | undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
79
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
80
|
+
*/
|
|
81
|
+
fetch?: FetchFunction;
|
|
82
|
+
/**
|
|
83
|
+
* The AWS credential provider to use for SigV4 authentication to get dynamic
|
|
84
|
+
* credentials similar to the AWS SDK. Setting a provider here will cause its
|
|
85
|
+
* credential values to be used instead of the `accessKeyId`, `secretAccessKey`,
|
|
86
|
+
* and `sessionToken` settings.
|
|
87
|
+
*/
|
|
88
|
+
credentialProvider?: () => PromiseLike<Omit<AmazonBedrockCredentials, 'region'>>;
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
91
|
* Create an Amazon Bedrock Mantle provider instance.
|
|
90
92
|
* This provider uses the OpenAI-compatible Mantle API for models that are
|
|
91
93
|
* only available through the Mantle endpoint (e.g. openai.gpt-oss-20b).
|
|
92
94
|
*/
|
|
93
|
-
declare function createBedrockMantle(options?: BedrockMantleProviderSettings): BedrockMantleProvider;
|
|
95
|
+
export declare function createBedrockMantle(options?: BedrockMantleProviderSettings): BedrockMantleProvider;
|
|
94
96
|
/**
|
|
95
97
|
* Default Bedrock Mantle provider instance.
|
|
96
98
|
*/
|
|
97
|
-
declare const bedrockMantle: BedrockMantleProvider;
|
|
98
|
-
|
|
99
|
-
export {
|
|
99
|
+
export declare const bedrockMantle: BedrockMantleProvider;
|
|
100
|
+
//#endregion
|
|
101
|
+
export type { BedrockMantleModelId, BedrockMantleProvider, BedrockMantleProviderSettings };
|
|
102
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/amazon-bedrock-sigv4-fetch.ts","../../src/mantle/bedrock-mantle-options.ts","../../src/mantle/bedrock-mantle-provider.ts"],"mappings":";;;UAUiB;EACf;EACA;EACA;EACA;;;;KCdU;KAOA;KAKA,uBACR,2BACA;;;UCaa,8BAA8B;;;;;GAK5C,SAAS,2BAA2B;;;;EAKrC,cAAc,SAAS,2BAA2B;;;;EAKlD,KAAK,SAAS,2BAA2B;;;;;;EAOzC,UAAU,SAAS,gCAAgC;;;;EAKnD,mBAAmB;;UAGJ;;;;;EAKf;;;;;;EAOA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;EAKA;;;;EAKA,UAAU;;;;;EAMV,QAAQ;;;;;;;EAQR,2BAA2B,YACzB,KAAK;;;;;;;wBASO,oBACd,UAAS,gCACR;;;;qBAqKU,eAAa"}
|