@ai-sdk/amazon-bedrock 4.0.33 → 4.0.34

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/dist/index.d.mts CHANGED
@@ -45,67 +45,67 @@ type BedrockRerankingOptions = {
45
45
 
46
46
  interface AmazonBedrockProviderSettings {
47
47
  /**
48
- The AWS region to use for the Bedrock provider. Defaults to the value of the
49
- `AWS_REGION` environment variable.
48
+ * The AWS region to use for the Bedrock provider. Defaults to the value of the
49
+ * `AWS_REGION` environment variable.
50
50
  */
51
51
  region?: string;
52
52
  /**
53
- API key for authenticating requests using Bearer token authentication.
54
- When provided, this will be used instead of AWS SigV4 authentication.
55
- Defaults to the value of the `AWS_BEARER_TOKEN_BEDROCK` environment variable.
56
-
57
- @example
58
- ```typescript
59
- // Using API key directly
60
- const bedrock = createAmazonBedrock({
61
- apiKey: 'your-api-key-here',
62
- region: 'us-east-1'
63
- });
64
-
65
- // Using environment variable AWS_BEARER_TOKEN_BEDROCK
66
- const bedrock = createAmazonBedrock({
67
- region: 'us-east-1'
68
- });
69
- ```
70
-
71
- Note: When `apiKey` is provided, it takes precedence over AWS SigV4 authentication.
72
- If neither `apiKey` nor `AWS_BEARER_TOKEN_BEDROCK` environment variable is set,
73
- the provider will fall back to AWS SigV4 authentication using AWS credentials.
53
+ * API key for authenticating requests using Bearer token authentication.
54
+ * When provided, this will be used instead of AWS SigV4 authentication.
55
+ * Defaults to the value of the `AWS_BEARER_TOKEN_BEDROCK` environment variable.
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Using API key directly
60
+ * const bedrock = createAmazonBedrock({
61
+ * apiKey: 'your-api-key-here',
62
+ * region: 'us-east-1'
63
+ * });
64
+ *
65
+ * // Using environment variable AWS_BEARER_TOKEN_BEDROCK
66
+ * const bedrock = createAmazonBedrock({
67
+ * region: 'us-east-1'
68
+ * });
69
+ * ```
70
+ *
71
+ * Note: When `apiKey` is provided, it takes precedence over AWS SigV4 authentication.
72
+ * If neither `apiKey` nor `AWS_BEARER_TOKEN_BEDROCK` environment variable is set,
73
+ * the provider will fall back to AWS SigV4 authentication using AWS credentials.
74
74
  */
75
75
  apiKey?: string;
76
76
  /**
77
- The AWS access key ID to use for the Bedrock provider. Defaults to the value of the
78
- `AWS_ACCESS_KEY_ID` environment variable.
77
+ * The AWS access key ID to use for the Bedrock provider. Defaults to the value of the
78
+ * `AWS_ACCESS_KEY_ID` environment variable.
79
79
  */
80
80
  accessKeyId?: string;
81
81
  /**
82
- The AWS secret access key to use for the Bedrock provider. Defaults to the value of the
83
- `AWS_SECRET_ACCESS_KEY` environment variable.
82
+ * The AWS secret access key to use for the Bedrock provider. Defaults to the value of the
83
+ * `AWS_SECRET_ACCESS_KEY` environment variable.
84
84
  */
85
85
  secretAccessKey?: string;
86
86
  /**
87
- The AWS session token to use for the Bedrock provider. Defaults to the value of the
88
- `AWS_SESSION_TOKEN` environment variable.
87
+ * The AWS session token to use for the Bedrock provider. Defaults to the value of the
88
+ * `AWS_SESSION_TOKEN` environment variable.
89
89
  */
90
90
  sessionToken?: string;
91
91
  /**
92
- Base URL for the Bedrock API calls.
92
+ * Base URL for the Bedrock API calls.
93
93
  */
94
94
  baseURL?: string;
95
95
  /**
96
- Custom headers to include in the requests.
96
+ * Custom headers to include in the requests.
97
97
  */
98
98
  headers?: Record<string, string>;
99
99
  /**
100
- Custom fetch implementation. You can use it as a middleware to intercept requests,
101
- or to provide a custom fetch implementation for e.g. testing.
102
- */
100
+ * Custom fetch implementation. You can use it as a middleware to intercept requests,
101
+ * or to provide a custom fetch implementation for e.g. testing.
102
+ */
103
103
  fetch?: FetchFunction;
104
104
  /**
105
- The AWS credential provider to use for the Bedrock provider to get dynamic
106
- credentials similar to the AWS SDK. Setting a provider here will cause its
107
- credential values to be used instead of the `accessKeyId`, `secretAccessKey`,
108
- and `sessionToken` settings.
105
+ * The AWS credential provider to use for the Bedrock provider to get dynamic
106
+ * credentials similar to the AWS SDK. Setting a provider here will cause its
107
+ * credential values to be used instead of the `accessKeyId`, `secretAccessKey`,
108
+ * and `sessionToken` settings.
109
109
  */
110
110
  credentialProvider?: () => PromiseLike<Omit<BedrockCredentials, 'region'>>;
111
111
  generateId?: () => string;
@@ -130,11 +130,11 @@ interface AmazonBedrockProvider extends ProviderV3 {
130
130
  */
131
131
  textEmbeddingModel(modelId: BedrockEmbeddingModelId): EmbeddingModelV3;
132
132
  /**
133
- Creates a model for image generation.
133
+ * Creates a model for image generation.
134
134
  */
135
135
  image(modelId: BedrockImageModelId): ImageModelV3;
136
136
  /**
137
- Creates a model for image generation.
137
+ * Creates a model for image generation.
138
138
  */
139
139
  imageModel(modelId: BedrockImageModelId): ImageModelV3;
140
140
  /**
@@ -146,16 +146,16 @@ interface AmazonBedrockProvider extends ProviderV3 {
146
146
  */
147
147
  rerankingModel(modelId: BedrockRerankingModelId): RerankingModelV3;
148
148
  /**
149
- Anthropic-specific tools that can be used with Anthropic models on Bedrock.
149
+ * Anthropic-specific tools that can be used with Anthropic models on Bedrock.
150
150
  */
151
151
  tools: typeof anthropicTools;
152
152
  }
153
153
  /**
154
- Create an Amazon Bedrock provider instance.
154
+ * Create an Amazon Bedrock provider instance.
155
155
  */
156
156
  declare function createAmazonBedrock(options?: AmazonBedrockProviderSettings): AmazonBedrockProvider;
157
157
  /**
158
- Default Bedrock provider instance.
158
+ * Default Bedrock provider instance.
159
159
  */
160
160
  declare const bedrock: AmazonBedrockProvider;
161
161
 
package/dist/index.d.ts CHANGED
@@ -45,67 +45,67 @@ type BedrockRerankingOptions = {
45
45
 
46
46
  interface AmazonBedrockProviderSettings {
47
47
  /**
48
- The AWS region to use for the Bedrock provider. Defaults to the value of the
49
- `AWS_REGION` environment variable.
48
+ * The AWS region to use for the Bedrock provider. Defaults to the value of the
49
+ * `AWS_REGION` environment variable.
50
50
  */
51
51
  region?: string;
52
52
  /**
53
- API key for authenticating requests using Bearer token authentication.
54
- When provided, this will be used instead of AWS SigV4 authentication.
55
- Defaults to the value of the `AWS_BEARER_TOKEN_BEDROCK` environment variable.
56
-
57
- @example
58
- ```typescript
59
- // Using API key directly
60
- const bedrock = createAmazonBedrock({
61
- apiKey: 'your-api-key-here',
62
- region: 'us-east-1'
63
- });
64
-
65
- // Using environment variable AWS_BEARER_TOKEN_BEDROCK
66
- const bedrock = createAmazonBedrock({
67
- region: 'us-east-1'
68
- });
69
- ```
70
-
71
- Note: When `apiKey` is provided, it takes precedence over AWS SigV4 authentication.
72
- If neither `apiKey` nor `AWS_BEARER_TOKEN_BEDROCK` environment variable is set,
73
- the provider will fall back to AWS SigV4 authentication using AWS credentials.
53
+ * API key for authenticating requests using Bearer token authentication.
54
+ * When provided, this will be used instead of AWS SigV4 authentication.
55
+ * Defaults to the value of the `AWS_BEARER_TOKEN_BEDROCK` environment variable.
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Using API key directly
60
+ * const bedrock = createAmazonBedrock({
61
+ * apiKey: 'your-api-key-here',
62
+ * region: 'us-east-1'
63
+ * });
64
+ *
65
+ * // Using environment variable AWS_BEARER_TOKEN_BEDROCK
66
+ * const bedrock = createAmazonBedrock({
67
+ * region: 'us-east-1'
68
+ * });
69
+ * ```
70
+ *
71
+ * Note: When `apiKey` is provided, it takes precedence over AWS SigV4 authentication.
72
+ * If neither `apiKey` nor `AWS_BEARER_TOKEN_BEDROCK` environment variable is set,
73
+ * the provider will fall back to AWS SigV4 authentication using AWS credentials.
74
74
  */
75
75
  apiKey?: string;
76
76
  /**
77
- The AWS access key ID to use for the Bedrock provider. Defaults to the value of the
78
- `AWS_ACCESS_KEY_ID` environment variable.
77
+ * The AWS access key ID to use for the Bedrock provider. Defaults to the value of the
78
+ * `AWS_ACCESS_KEY_ID` environment variable.
79
79
  */
80
80
  accessKeyId?: string;
81
81
  /**
82
- The AWS secret access key to use for the Bedrock provider. Defaults to the value of the
83
- `AWS_SECRET_ACCESS_KEY` environment variable.
82
+ * The AWS secret access key to use for the Bedrock provider. Defaults to the value of the
83
+ * `AWS_SECRET_ACCESS_KEY` environment variable.
84
84
  */
85
85
  secretAccessKey?: string;
86
86
  /**
87
- The AWS session token to use for the Bedrock provider. Defaults to the value of the
88
- `AWS_SESSION_TOKEN` environment variable.
87
+ * The AWS session token to use for the Bedrock provider. Defaults to the value of the
88
+ * `AWS_SESSION_TOKEN` environment variable.
89
89
  */
90
90
  sessionToken?: string;
91
91
  /**
92
- Base URL for the Bedrock API calls.
92
+ * Base URL for the Bedrock API calls.
93
93
  */
94
94
  baseURL?: string;
95
95
  /**
96
- Custom headers to include in the requests.
96
+ * Custom headers to include in the requests.
97
97
  */
98
98
  headers?: Record<string, string>;
99
99
  /**
100
- Custom fetch implementation. You can use it as a middleware to intercept requests,
101
- or to provide a custom fetch implementation for e.g. testing.
102
- */
100
+ * Custom fetch implementation. You can use it as a middleware to intercept requests,
101
+ * or to provide a custom fetch implementation for e.g. testing.
102
+ */
103
103
  fetch?: FetchFunction;
104
104
  /**
105
- The AWS credential provider to use for the Bedrock provider to get dynamic
106
- credentials similar to the AWS SDK. Setting a provider here will cause its
107
- credential values to be used instead of the `accessKeyId`, `secretAccessKey`,
108
- and `sessionToken` settings.
105
+ * The AWS credential provider to use for the Bedrock provider to get dynamic
106
+ * credentials similar to the AWS SDK. Setting a provider here will cause its
107
+ * credential values to be used instead of the `accessKeyId`, `secretAccessKey`,
108
+ * and `sessionToken` settings.
109
109
  */
110
110
  credentialProvider?: () => PromiseLike<Omit<BedrockCredentials, 'region'>>;
111
111
  generateId?: () => string;
@@ -130,11 +130,11 @@ interface AmazonBedrockProvider extends ProviderV3 {
130
130
  */
131
131
  textEmbeddingModel(modelId: BedrockEmbeddingModelId): EmbeddingModelV3;
132
132
  /**
133
- Creates a model for image generation.
133
+ * Creates a model for image generation.
134
134
  */
135
135
  image(modelId: BedrockImageModelId): ImageModelV3;
136
136
  /**
137
- Creates a model for image generation.
137
+ * Creates a model for image generation.
138
138
  */
139
139
  imageModel(modelId: BedrockImageModelId): ImageModelV3;
140
140
  /**
@@ -146,16 +146,16 @@ interface AmazonBedrockProvider extends ProviderV3 {
146
146
  */
147
147
  rerankingModel(modelId: BedrockRerankingModelId): RerankingModelV3;
148
148
  /**
149
- Anthropic-specific tools that can be used with Anthropic models on Bedrock.
149
+ * Anthropic-specific tools that can be used with Anthropic models on Bedrock.
150
150
  */
151
151
  tools: typeof anthropicTools;
152
152
  }
153
153
  /**
154
- Create an Amazon Bedrock provider instance.
154
+ * Create an Amazon Bedrock provider instance.
155
155
  */
156
156
  declare function createAmazonBedrock(options?: AmazonBedrockProviderSettings): AmazonBedrockProvider;
157
157
  /**
158
- Default Bedrock provider instance.
158
+ * Default Bedrock provider instance.
159
159
  */
160
160
  declare const bedrock: AmazonBedrockProvider;
161
161
 
package/dist/index.js CHANGED
@@ -1489,24 +1489,24 @@ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1489
1489
  var import_v44 = require("zod/v4");
1490
1490
  var bedrockEmbeddingProviderOptions = import_v44.z.object({
1491
1491
  /**
1492
- The number of dimensions the resulting output embeddings should have (defaults to 1024).
1493
- Only supported in amazon.titan-embed-text-v2:0.
1494
- */
1492
+ * The number of dimensions the resulting output embeddings should have (defaults to 1024).
1493
+ * Only supported in amazon.titan-embed-text-v2:0.
1494
+ */
1495
1495
  dimensions: import_v44.z.union([import_v44.z.literal(1024), import_v44.z.literal(512), import_v44.z.literal(256)]).optional(),
1496
1496
  /**
1497
- Flag indicating whether or not to normalize the output embeddings. Defaults to true
1498
- Only supported in amazon.titan-embed-text-v2:0.
1497
+ * Flag indicating whether or not to normalize the output embeddings. Defaults to true
1498
+ * Only supported in amazon.titan-embed-text-v2:0.
1499
1499
  */
1500
1500
  normalize: import_v44.z.boolean().optional(),
1501
1501
  /**
1502
- The number of dimensions for Nova embedding models (defaults to 1024).
1503
- Supported values: 256, 384, 1024, 3072.
1504
- Only supported in amazon.nova-* embedding models.
1502
+ * The number of dimensions for Nova embedding models (defaults to 1024).
1503
+ * Supported values: 256, 384, 1024, 3072.
1504
+ * Only supported in amazon.nova-* embedding models.
1505
1505
  */
1506
1506
  embeddingDimension: import_v44.z.union([import_v44.z.literal(256), import_v44.z.literal(384), import_v44.z.literal(1024), import_v44.z.literal(3072)]).optional(),
1507
1507
  /**
1508
- The purpose of the embedding. Defaults to 'GENERIC_INDEX'.
1509
- Only supported in amazon.nova-* embedding models.
1508
+ * The purpose of the embedding. Defaults to 'GENERIC_INDEX'.
1509
+ * Only supported in amazon.nova-* embedding models.
1510
1510
  */
1511
1511
  embeddingPurpose: import_v44.z.enum([
1512
1512
  "GENERIC_INDEX",
@@ -1520,15 +1520,15 @@ var bedrockEmbeddingProviderOptions = import_v44.z.object({
1520
1520
  "CLUSTERING"
1521
1521
  ]).optional(),
1522
1522
  /**
1523
- Input type for Cohere embedding models on Bedrock.
1524
- Common values: `search_document`, `search_query`, `classification`, `clustering`.
1525
- If not set, the provider defaults to `search_query`.
1526
- */
1523
+ * Input type for Cohere embedding models on Bedrock.
1524
+ * Common values: `search_document`, `search_query`, `classification`, `clustering`.
1525
+ * If not set, the provider defaults to `search_query`.
1526
+ */
1527
1527
  inputType: import_v44.z.enum(["search_document", "search_query", "classification", "clustering"]).optional(),
1528
1528
  /**
1529
- Truncation behavior when input exceeds the model's context length.
1530
- Supported in Cohere and Nova embedding models. Defaults to 'END' for Nova models.
1531
- */
1529
+ * Truncation behavior when input exceeds the model's context length.
1530
+ * Supported in Cohere and Nova embedding models. Defaults to 'END' for Nova models.
1531
+ */
1532
1532
  truncate: import_v44.z.enum(["NONE", "START", "END"]).optional()
1533
1533
  });
1534
1534
 
@@ -1868,7 +1868,7 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1868
1868
  var import_aws4fetch = require("aws4fetch");
1869
1869
 
1870
1870
  // src/version.ts
1871
- var VERSION = true ? "4.0.33" : "0.0.0-test";
1871
+ var VERSION = true ? "4.0.34" : "0.0.0-test";
1872
1872
 
1873
1873
  // src/bedrock-sigv4-fetch.ts
1874
1874
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {