@ai-sdk/amazon-bedrock 4.0.0-beta.46 → 4.0.0-beta.47

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @ai-sdk/amazon-bedrock
2
2
 
3
+ ## 4.0.0-beta.47
4
+
5
+ ### Patch Changes
6
+
7
+ - d1bdadb: Added support for reranking models
8
+ - Updated dependencies [d1bdadb]
9
+ - @ai-sdk/provider@3.0.0-beta.12
10
+ - @ai-sdk/anthropic@3.0.0-beta.43
11
+ - @ai-sdk/provider-utils@4.0.0-beta.26
12
+
3
13
  ## 4.0.0-beta.46
4
14
 
5
15
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3 } from '@ai-sdk/provider';
2
- import { FetchFunction } from '@ai-sdk/provider-utils';
3
- import { anthropicTools } from '@ai-sdk/anthropic/internal';
4
1
  import { z } from 'zod/v4';
2
+ import { anthropicTools } from '@ai-sdk/anthropic/internal';
3
+ import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, RerankingModelV3 } from '@ai-sdk/provider';
4
+ import { FetchFunction } from '@ai-sdk/provider-utils';
5
5
 
6
6
  type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-haiku-4-5-20251001-v1:0' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-sonnet-4-5-20250929-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
7
7
  declare const bedrockProviderOptions: z.ZodObject<{
@@ -24,6 +24,18 @@ interface BedrockCredentials {
24
24
  sessionToken?: string;
25
25
  }
26
26
 
27
+ type BedrockRerankingModelId = 'amazon.rerank-v1:0' | 'cohere.rerank-v3-5:0' | (string & {});
28
+ type BedrockRerankingOptions = {
29
+ /**
30
+ * If the total number of results was greater than could fit in a response, a token is returned in the nextToken field. You can enter that token in this field to return the next batch of results.
31
+ */
32
+ nextToken?: string;
33
+ /**
34
+ * Additional model request fields to pass to the model.
35
+ */
36
+ additionalModelRequestFields?: Record<string, unknown>;
37
+ };
38
+
27
39
  interface AmazonBedrockProviderSettings {
28
40
  /**
29
41
  The AWS region to use for the Bedrock provider. Defaults to the value of the
@@ -104,6 +116,10 @@ interface AmazonBedrockProvider extends ProviderV3 {
104
116
  */
105
117
  imageModel(modelId: BedrockImageModelId): ImageModelV3;
106
118
  /**
119
+ Creates a model for reranking documents.
120
+ */
121
+ rerankingModel(modelId: BedrockRerankingModelId): RerankingModelV3;
122
+ /**
107
123
  Anthropic-specific tools that can be used with Anthropic models on Bedrock.
108
124
  */
109
125
  tools: typeof anthropicTools;
@@ -119,4 +135,4 @@ declare const bedrock: AmazonBedrockProvider;
119
135
 
120
136
  declare const VERSION: string;
121
137
 
122
- export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type BedrockProviderOptions, VERSION, bedrock, createAmazonBedrock };
138
+ export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type BedrockProviderOptions, type BedrockRerankingOptions, VERSION, bedrock, createAmazonBedrock };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3 } from '@ai-sdk/provider';
2
- import { FetchFunction } from '@ai-sdk/provider-utils';
3
- import { anthropicTools } from '@ai-sdk/anthropic/internal';
4
1
  import { z } from 'zod/v4';
2
+ import { anthropicTools } from '@ai-sdk/anthropic/internal';
3
+ import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, RerankingModelV3 } from '@ai-sdk/provider';
4
+ import { FetchFunction } from '@ai-sdk/provider-utils';
5
5
 
6
6
  type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-haiku-4-5-20251001-v1:0' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-sonnet-4-5-20250929-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
7
7
  declare const bedrockProviderOptions: z.ZodObject<{
@@ -24,6 +24,18 @@ interface BedrockCredentials {
24
24
  sessionToken?: string;
25
25
  }
26
26
 
27
+ type BedrockRerankingModelId = 'amazon.rerank-v1:0' | 'cohere.rerank-v3-5:0' | (string & {});
28
+ type BedrockRerankingOptions = {
29
+ /**
30
+ * If the total number of results was greater than could fit in a response, a token is returned in the nextToken field. You can enter that token in this field to return the next batch of results.
31
+ */
32
+ nextToken?: string;
33
+ /**
34
+ * Additional model request fields to pass to the model.
35
+ */
36
+ additionalModelRequestFields?: Record<string, unknown>;
37
+ };
38
+
27
39
  interface AmazonBedrockProviderSettings {
28
40
  /**
29
41
  The AWS region to use for the Bedrock provider. Defaults to the value of the
@@ -104,6 +116,10 @@ interface AmazonBedrockProvider extends ProviderV3 {
104
116
  */
105
117
  imageModel(modelId: BedrockImageModelId): ImageModelV3;
106
118
  /**
119
+ Creates a model for reranking documents.
120
+ */
121
+ rerankingModel(modelId: BedrockRerankingModelId): RerankingModelV3;
122
+ /**
107
123
  Anthropic-specific tools that can be used with Anthropic models on Bedrock.
108
124
  */
109
125
  tools: typeof anthropicTools;
@@ -119,4 +135,4 @@ declare const bedrock: AmazonBedrockProvider;
119
135
 
120
136
  declare const VERSION: string;
121
137
 
122
- export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type BedrockProviderOptions, VERSION, bedrock, createAmazonBedrock };
138
+ export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type BedrockProviderOptions, type BedrockRerankingOptions, VERSION, bedrock, createAmazonBedrock };
package/dist/index.js CHANGED
@@ -26,14 +26,9 @@ __export(src_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(src_exports);
28
28
 
29
- // src/bedrock-provider.ts
30
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
31
-
32
- // src/version.ts
33
- var VERSION = true ? "4.0.0-beta.46" : "0.0.0-test";
34
-
35
29
  // src/bedrock-provider.ts
36
30
  var import_internal2 = require("@ai-sdk/anthropic/internal");
31
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
37
32
 
38
33
  // src/bedrock-chat-language-model.ts
39
34
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
@@ -1513,6 +1508,11 @@ var bedrockImageResponseSchema = import_v46.z.object({
1513
1508
  // src/bedrock-sigv4-fetch.ts
1514
1509
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1515
1510
  var import_aws4fetch = require("aws4fetch");
1511
+
1512
+ // src/version.ts
1513
+ var VERSION = true ? "4.0.0-beta.47" : "0.0.0-test";
1514
+
1515
+ // src/bedrock-sigv4-fetch.ts
1516
1516
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
1517
1517
  return async (input, init) => {
1518
1518
  var _a, _b;
@@ -1593,15 +1593,132 @@ function createApiKeyFetchFunction(apiKey, fetch = globalThis.fetch) {
1593
1593
  };
1594
1594
  }
1595
1595
 
1596
+ // src/reranking/bedrock-reranking-model.ts
1597
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1598
+
1599
+ // src/reranking/bedrock-reranking-api.ts
1600
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
1601
+ var import_v47 = require("zod/v4");
1602
+ var bedrockRerankingResponseSchema = (0, import_provider_utils8.lazySchema)(
1603
+ () => (0, import_provider_utils8.zodSchema)(
1604
+ import_v47.z.object({
1605
+ results: import_v47.z.array(
1606
+ import_v47.z.object({
1607
+ index: import_v47.z.number(),
1608
+ relevanceScore: import_v47.z.number()
1609
+ })
1610
+ ),
1611
+ nextToken: import_v47.z.string().optional()
1612
+ })
1613
+ )
1614
+ );
1615
+
1616
+ // src/reranking/bedrock-reranking-options.ts
1617
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1618
+ var import_v48 = require("zod/v4");
1619
+ var bedrockRerankingOptionsSchema = (0, import_provider_utils9.lazySchema)(
1620
+ () => (0, import_provider_utils9.zodSchema)(
1621
+ import_v48.z.object({
1622
+ /**
1623
+ * If the total number of results was greater than could fit in a response, a token is returned in the nextToken field. You can enter that token in this field to return the next batch of results.
1624
+ */
1625
+ nextToken: import_v48.z.string().optional(),
1626
+ /**
1627
+ * Additional model request fields to pass to the model.
1628
+ */
1629
+ additionalModelRequestFields: import_v48.z.record(import_v48.z.string(), import_v48.z.any()).optional()
1630
+ })
1631
+ )
1632
+ );
1633
+
1634
+ // src/reranking/bedrock-reranking-model.ts
1635
+ var BedrockRerankingModel = class {
1636
+ constructor(modelId, config) {
1637
+ this.modelId = modelId;
1638
+ this.config = config;
1639
+ this.specificationVersion = "v3";
1640
+ this.provider = "amazon-bedrock";
1641
+ }
1642
+ async doRerank({
1643
+ documents,
1644
+ headers,
1645
+ query,
1646
+ topN,
1647
+ abortSignal,
1648
+ providerOptions
1649
+ }) {
1650
+ const bedrockOptions = await (0, import_provider_utils10.parseProviderOptions)({
1651
+ provider: "bedrock",
1652
+ providerOptions,
1653
+ schema: bedrockRerankingOptionsSchema
1654
+ });
1655
+ const {
1656
+ value: response,
1657
+ responseHeaders,
1658
+ rawValue
1659
+ } = await (0, import_provider_utils10.postJsonToApi)({
1660
+ url: `${this.config.baseUrl()}/rerank`,
1661
+ headers: await (0, import_provider_utils10.resolve)(
1662
+ (0, import_provider_utils10.combineHeaders)(await (0, import_provider_utils10.resolve)(this.config.headers), headers)
1663
+ ),
1664
+ body: {
1665
+ nextToken: bedrockOptions == null ? void 0 : bedrockOptions.nextToken,
1666
+ queries: [
1667
+ {
1668
+ textQuery: { text: query },
1669
+ type: "TEXT"
1670
+ }
1671
+ ],
1672
+ rerankingConfiguration: {
1673
+ bedrockRerankingConfiguration: {
1674
+ modelConfiguration: {
1675
+ modelArn: `arn:aws:bedrock:${this.config.region}::foundation-model/${this.modelId}`,
1676
+ additionalModelRequestFields: bedrockOptions == null ? void 0 : bedrockOptions.additionalModelRequestFields
1677
+ },
1678
+ numberOfResults: topN
1679
+ },
1680
+ type: "BEDROCK_RERANKING_MODEL"
1681
+ },
1682
+ sources: documents.values.map((value) => ({
1683
+ type: "INLINE",
1684
+ inlineDocumentSource: documents.type === "text" ? {
1685
+ type: "TEXT",
1686
+ textDocument: { text: value }
1687
+ } : {
1688
+ type: "JSON",
1689
+ jsonDocument: value
1690
+ }
1691
+ }))
1692
+ },
1693
+ failedResponseHandler: (0, import_provider_utils10.createJsonErrorResponseHandler)({
1694
+ errorSchema: BedrockErrorSchema,
1695
+ errorToMessage: (error) => `${error.type}: ${error.message}`
1696
+ }),
1697
+ successfulResponseHandler: (0, import_provider_utils10.createJsonResponseHandler)(
1698
+ bedrockRerankingResponseSchema
1699
+ ),
1700
+ fetch: this.config.fetch,
1701
+ abortSignal
1702
+ });
1703
+ return {
1704
+ ranking: response.results,
1705
+ response: {
1706
+ headers: responseHeaders,
1707
+ body: rawValue
1708
+ }
1709
+ };
1710
+ }
1711
+ };
1712
+
1596
1713
  // src/bedrock-provider.ts
1597
1714
  function createAmazonBedrock(options = {}) {
1598
- const rawApiKey = (0, import_provider_utils8.loadOptionalSetting)({
1715
+ const rawApiKey = (0, import_provider_utils11.loadOptionalSetting)({
1599
1716
  settingValue: options.apiKey,
1600
1717
  environmentVariableName: "AWS_BEARER_TOKEN_BEDROCK"
1601
1718
  });
1602
1719
  const apiKey = rawApiKey && rawApiKey.trim().length > 0 ? rawApiKey.trim() : void 0;
1603
1720
  const fetchFunction = apiKey ? createApiKeyFetchFunction(apiKey, options.fetch) : createSigV4FetchFunction(async () => {
1604
- const region = (0, import_provider_utils8.loadSetting)({
1721
+ const region = (0, import_provider_utils11.loadSetting)({
1605
1722
  settingValue: options.region,
1606
1723
  settingName: "region",
1607
1724
  environmentVariableName: "AWS_REGION",
@@ -1623,19 +1740,19 @@ function createAmazonBedrock(options = {}) {
1623
1740
  try {
1624
1741
  return {
1625
1742
  region,
1626
- accessKeyId: (0, import_provider_utils8.loadSetting)({
1743
+ accessKeyId: (0, import_provider_utils11.loadSetting)({
1627
1744
  settingValue: options.accessKeyId,
1628
1745
  settingName: "accessKeyId",
1629
1746
  environmentVariableName: "AWS_ACCESS_KEY_ID",
1630
1747
  description: "AWS access key ID"
1631
1748
  }),
1632
- secretAccessKey: (0, import_provider_utils8.loadSetting)({
1749
+ secretAccessKey: (0, import_provider_utils11.loadSetting)({
1633
1750
  settingValue: options.secretAccessKey,
1634
1751
  settingName: "secretAccessKey",
1635
1752
  environmentVariableName: "AWS_SECRET_ACCESS_KEY",
1636
1753
  description: "AWS secret access key"
1637
1754
  }),
1638
- sessionToken: (0, import_provider_utils8.loadOptionalSetting)({
1755
+ sessionToken: (0, import_provider_utils11.loadOptionalSetting)({
1639
1756
  settingValue: options.sessionToken,
1640
1757
  environmentVariableName: "AWS_SESSION_TOKEN"
1641
1758
  })
@@ -1661,10 +1778,15 @@ Original error: ${errorMessage}`
1661
1778
  throw error;
1662
1779
  }
1663
1780
  }, options.fetch);
1664
- const getBaseUrl = () => {
1781
+ const getHeaders = () => {
1782
+ var _a;
1783
+ const baseHeaders = (_a = options.headers) != null ? _a : {};
1784
+ return (0, import_provider_utils11.withUserAgentSuffix)(baseHeaders, `ai-sdk/amazon-bedrock/${VERSION}`);
1785
+ };
1786
+ const getBedrockRuntimeBaseUrl = () => {
1665
1787
  var _a, _b;
1666
- return (_b = (0, import_provider_utils8.withoutTrailingSlash)(
1667
- (_a = options.baseURL) != null ? _a : `https://bedrock-runtime.${(0, import_provider_utils8.loadSetting)({
1788
+ return (_b = (0, import_provider_utils11.withoutTrailingSlash)(
1789
+ (_a = options.baseURL) != null ? _a : `https://bedrock-runtime.${(0, import_provider_utils11.loadSetting)({
1668
1790
  settingValue: options.region,
1669
1791
  settingName: "region",
1670
1792
  environmentVariableName: "AWS_REGION",
@@ -1672,16 +1794,22 @@ Original error: ${errorMessage}`
1672
1794
  })}.amazonaws.com`
1673
1795
  )) != null ? _b : `https://bedrock-runtime.us-east-1.amazonaws.com`;
1674
1796
  };
1675
- const getHeaders = () => {
1676
- var _a;
1677
- const baseHeaders = (_a = options.headers) != null ? _a : {};
1678
- return (0, import_provider_utils8.withUserAgentSuffix)(baseHeaders, `ai-sdk/amazon-bedrock/${VERSION}`);
1797
+ const getBedrockAgentRuntimeBaseUrl = () => {
1798
+ var _a, _b;
1799
+ return (_b = (0, import_provider_utils11.withoutTrailingSlash)(
1800
+ (_a = options.baseURL) != null ? _a : `https://bedrock-agent-runtime.${(0, import_provider_utils11.loadSetting)({
1801
+ settingValue: options.region,
1802
+ settingName: "region",
1803
+ environmentVariableName: "AWS_REGION",
1804
+ description: "AWS region"
1805
+ })}.amazonaws.com`
1806
+ )) != null ? _b : `https://bedrock-agent-runtime.us-west-2.amazonaws.com`;
1679
1807
  };
1680
1808
  const createChatModel = (modelId) => new BedrockChatLanguageModel(modelId, {
1681
- baseUrl: getBaseUrl,
1809
+ baseUrl: getBedrockRuntimeBaseUrl,
1682
1810
  headers: getHeaders,
1683
1811
  fetch: fetchFunction,
1684
- generateId: import_provider_utils8.generateId
1812
+ generateId: import_provider_utils11.generateId
1685
1813
  });
1686
1814
  const provider = function(modelId) {
1687
1815
  if (new.target) {
@@ -1692,12 +1820,23 @@ Original error: ${errorMessage}`
1692
1820
  return createChatModel(modelId);
1693
1821
  };
1694
1822
  const createEmbeddingModel = (modelId) => new BedrockEmbeddingModel(modelId, {
1695
- baseUrl: getBaseUrl,
1823
+ baseUrl: getBedrockRuntimeBaseUrl,
1696
1824
  headers: getHeaders,
1697
1825
  fetch: fetchFunction
1698
1826
  });
1699
1827
  const createImageModel = (modelId) => new BedrockImageModel(modelId, {
1700
- baseUrl: getBaseUrl,
1828
+ baseUrl: getBedrockRuntimeBaseUrl,
1829
+ headers: getHeaders,
1830
+ fetch: fetchFunction
1831
+ });
1832
+ const createRerankingModel = (modelId) => new BedrockRerankingModel(modelId, {
1833
+ baseUrl: getBedrockAgentRuntimeBaseUrl,
1834
+ region: (0, import_provider_utils11.loadSetting)({
1835
+ settingValue: options.region,
1836
+ settingName: "region",
1837
+ environmentVariableName: "AWS_REGION",
1838
+ description: "AWS region"
1839
+ }),
1701
1840
  headers: getHeaders,
1702
1841
  fetch: fetchFunction
1703
1842
  });
@@ -1708,6 +1847,7 @@ Original error: ${errorMessage}`
1708
1847
  provider.textEmbeddingModel = createEmbeddingModel;
1709
1848
  provider.image = createImageModel;
1710
1849
  provider.imageModel = createImageModel;
1850
+ provider.rerankingModel = createRerankingModel;
1711
1851
  provider.tools = import_internal2.anthropicTools;
1712
1852
  return provider;
1713
1853
  }