@ai-sdk/amazon-bedrock 5.0.104 → 5.0.106

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.
@@ -4,7 +4,7 @@ let _ai_sdk_provider = require("@ai-sdk/provider");
4
4
  let _ai_sdk_provider_utils = require("@ai-sdk/provider-utils");
5
5
  let aws4fetch = require("aws4fetch");
6
6
  //#region src/version.ts
7
- const VERSION = "5.0.104";
7
+ const VERSION = "5.0.106";
8
8
  //#endregion
9
9
  //#region src/amazon-bedrock-sigv4-fetch.ts
10
10
  /**
@@ -3,7 +3,7 @@ import { InvalidArgumentError, NoSuchModelError } from "@ai-sdk/provider";
3
3
  import { combineHeaders, getRuntimeEnvironmentUserAgent, isValidHostnamePart, loadOptionalSetting, loadSetting, normalizeHeaders, withUserAgentSuffix, withoutTrailingSlash } from "@ai-sdk/provider-utils";
4
4
  import { AwsV4Signer } from "aws4fetch";
5
5
  //#region src/version.ts
6
- const VERSION = "5.0.104";
6
+ const VERSION = "5.0.106";
7
7
  //#endregion
8
8
  //#region src/amazon-bedrock-sigv4-fetch.ts
9
9
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/amazon-bedrock",
3
- "version": "5.0.104",
3
+ "version": "5.0.106",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -41,10 +41,10 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@ai-sdk/anthropic": "4.0.71",
45
- "@ai-sdk/openai": "4.0.83",
46
- "@ai-sdk/provider": "4.0.21",
47
- "@ai-sdk/provider-utils": "5.0.53",
44
+ "@ai-sdk/anthropic": "4.0.72",
45
+ "@ai-sdk/openai": "4.0.84",
46
+ "@ai-sdk/provider": "4.0.22",
47
+ "@ai-sdk/provider-utils": "5.0.54",
48
48
  "@smithy/eventstream-codec": "^4.3.3",
49
49
  "@smithy/util-utf8": "^4.3.3",
50
50
  "aws4fetch": "^1.0.20"
@@ -13,6 +13,7 @@ export interface AmazonBedrockConverseInput {
13
13
  };
14
14
  additionalModelRequestFields?: Record<string, unknown>;
15
15
  additionalModelResponseFieldPaths?: string[];
16
+ requestMetadata?: Record<string, string>;
16
17
  serviceTier?: {
17
18
  type: string;
18
19
  };
@@ -197,6 +197,15 @@ export const amazonBedrockLanguageModelChatOptions = z.object({
197
197
  * - 'flex': Lower-cost tier for flexible latency workloads
198
198
  */
199
199
  serviceTier: z.enum(['reserved', 'priority', 'default', 'flex']).optional(),
200
+ /**
201
+ * Key-value pairs to attach to the request for invocation log filtering and
202
+ * cost attribution.
203
+ * @see https://docs.aws.amazon.com/bedrock/latest/userguide/cost-mgmt-request-metadata.html
204
+ *
205
+ * - Maximum 16 entries per request.
206
+ * - Keys and values: maximum 256 characters each.
207
+ */
208
+ requestMetadata: z.record(z.string(), z.string()).optional(),
200
209
  });
201
210
 
202
211
  export type AmazonBedrockLanguageModelChatOptions = z.infer<
@@ -632,9 +632,12 @@ export class AmazonBedrockChatLanguageModel implements LanguageModelV4 {
632
632
  additionalModelRequestFields: __,
633
633
  serviceTier: ___,
634
634
  structuredOutputMode: ____,
635
+ requestMetadata: _____,
635
636
  ...filteredAmazonBedrockOptions
636
637
  } = providerOptions?.amazonBedrock ?? providerOptions?.bedrock ?? {};
637
638
 
639
+ const resolvedRequestMetadata = amazonBedrockOptions.requestMetadata;
640
+
638
641
  const additionalModelResponseFieldPaths = isAnthropicModel
639
642
  ? ['/delta/stop_sequence']
640
643
  : undefined;
@@ -656,6 +659,9 @@ export class AmazonBedrockChatLanguageModel implements LanguageModelV4 {
656
659
  type: amazonBedrockOptions.serviceTier,
657
660
  },
658
661
  }),
662
+ ...(resolvedRequestMetadata != null && {
663
+ requestMetadata: resolvedRequestMetadata,
664
+ }),
659
665
  ...filteredAmazonBedrockOptions,
660
666
  ...(toolConfig.tools !== undefined && toolConfig.tools.length > 0
661
667
  ? { toolConfig }