@ai-sdk/amazon-bedrock 5.0.0-beta.44 → 5.0.0-beta.45

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.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  WORKFLOW_DESERIALIZE
25
25
  } from "@ai-sdk/provider-utils";
26
26
  import { getModelCapabilities } from "@ai-sdk/anthropic/internal";
27
- import { z as z3 } from "zod/v4";
27
+ import { z as z4 } from "zod/v4";
28
28
 
29
29
  // src/bedrock-api-types.ts
30
30
  var BEDROCK_STOP_REASONS = [
@@ -384,11 +384,20 @@ import {
384
384
  } from "@ai-sdk/provider";
385
385
  import {
386
386
  convertToBase64,
387
- isProviderReference,
387
+ getTopLevelMediaType,
388
+ isFullMediaType,
388
389
  parseProviderOptions,
390
+ resolveFullMediaType,
389
391
  stripFileExtension
390
392
  } from "@ai-sdk/provider-utils";
391
393
 
394
+ // src/bedrock-reasoning-metadata.ts
395
+ import { z as z3 } from "zod/v4";
396
+ var bedrockReasoningMetadataSchema = z3.object({
397
+ signature: z3.string().optional(),
398
+ redactedData: z3.string().optional()
399
+ });
400
+
392
401
  // src/normalize-tool-call-id.ts
393
402
  function isMistralModel(modelId) {
394
403
  return modelId.includes("mistral.");
@@ -462,43 +471,68 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
462
471
  break;
463
472
  }
464
473
  case "file": {
465
- if (isProviderReference(part.data)) {
466
- throw new UnsupportedFunctionalityError2({
467
- functionality: "file parts with provider references"
468
- });
469
- }
470
- if (part.data instanceof URL) {
471
- throw new UnsupportedFunctionalityError2({
472
- functionality: "File URL data"
473
- });
474
- }
475
- if (part.mediaType.startsWith("image/")) {
476
- bedrockContent.push({
477
- image: {
478
- format: getBedrockImageFormat(part.mediaType),
479
- source: { bytes: convertToBase64(part.data) }
480
- }
481
- });
482
- } else {
483
- if (!part.mediaType) {
474
+ switch (part.data.type) {
475
+ case "reference": {
484
476
  throw new UnsupportedFunctionalityError2({
485
- functionality: "file without mime type",
486
- message: "File mime type is required in user message part content"
477
+ functionality: "file parts with provider references"
487
478
  });
488
479
  }
489
- const enableCitations = await shouldEnableCitations(
490
- part.providerOptions
491
- );
492
- bedrockContent.push({
493
- document: {
494
- format: getBedrockDocumentFormat(part.mediaType),
495
- name: part.filename ? stripFileExtension(part.filename) : generateDocumentName(),
496
- source: { bytes: convertToBase64(part.data) },
497
- ...enableCitations && {
498
- citations: { enabled: true }
480
+ case "url": {
481
+ throw new UnsupportedFunctionalityError2({
482
+ functionality: "File URL data"
483
+ });
484
+ }
485
+ case "text": {
486
+ const textMediaType = isFullMediaType(part.mediaType) ? part.mediaType : "text/plain";
487
+ const enableCitations = await shouldEnableCitations(
488
+ part.providerOptions
489
+ );
490
+ bedrockContent.push({
491
+ document: {
492
+ format: getBedrockDocumentFormat(textMediaType),
493
+ name: part.filename ? stripFileExtension(part.filename) : generateDocumentName(),
494
+ source: {
495
+ bytes: convertToBase64(
496
+ new TextEncoder().encode(part.data.text)
497
+ )
498
+ },
499
+ ...enableCitations && {
500
+ citations: { enabled: true }
501
+ }
499
502
  }
503
+ });
504
+ break;
505
+ }
506
+ case "data": {
507
+ const fullMediaType = resolveFullMediaType({ part });
508
+ if (getTopLevelMediaType(fullMediaType) === "image") {
509
+ bedrockContent.push({
510
+ image: {
511
+ format: getBedrockImageFormat(fullMediaType),
512
+ source: {
513
+ bytes: convertToBase64(part.data.data)
514
+ }
515
+ }
516
+ });
517
+ } else {
518
+ const enableCitations = await shouldEnableCitations(
519
+ part.providerOptions
520
+ );
521
+ bedrockContent.push({
522
+ document: {
523
+ format: getBedrockDocumentFormat(fullMediaType),
524
+ name: part.filename ? stripFileExtension(part.filename) : generateDocumentName(),
525
+ source: {
526
+ bytes: convertToBase64(part.data.data)
527
+ },
528
+ ...enableCitations && {
529
+ citations: { enabled: true }
530
+ }
531
+ }
532
+ });
500
533
  }
501
- });
534
+ break;
535
+ }
502
536
  }
503
537
  break;
504
538
  }
@@ -682,12 +716,6 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
682
716
  return { system, messages };
683
717
  }
684
718
  function getBedrockImageFormat(mimeType) {
685
- if (!mimeType) {
686
- throw new UnsupportedFunctionalityError2({
687
- functionality: "image without mime type",
688
- message: "Image mime type is required in user message part content"
689
- });
690
- }
691
719
  const format = BEDROCK_IMAGE_MIME_TYPES[mimeType];
692
720
  if (!format) {
693
721
  throw new UnsupportedFunctionalityError2({
@@ -1517,116 +1545,112 @@ var BedrockChatLanguageModel = class _BedrockChatLanguageModel {
1517
1545
  return `${this.config.baseUrl()}/model/${encodedModelId}`;
1518
1546
  }
1519
1547
  };
1520
- var BedrockStopReasonSchema = z3.union([
1521
- z3.enum(BEDROCK_STOP_REASONS),
1522
- z3.string()
1548
+ var BedrockStopReasonSchema = z4.union([
1549
+ z4.enum(BEDROCK_STOP_REASONS),
1550
+ z4.string()
1523
1551
  ]);
1524
- var BedrockAdditionalModelResponseFieldsSchema = z3.object({
1525
- delta: z3.object({
1526
- stop_sequence: z3.string().nullish()
1552
+ var BedrockAdditionalModelResponseFieldsSchema = z4.object({
1553
+ delta: z4.object({
1554
+ stop_sequence: z4.string().nullish()
1527
1555
  }).nullish()
1528
- }).catchall(z3.unknown());
1529
- var BedrockToolUseSchema = z3.object({
1530
- toolUseId: z3.string(),
1531
- name: z3.string(),
1532
- input: z3.unknown()
1556
+ }).catchall(z4.unknown());
1557
+ var BedrockToolUseSchema = z4.object({
1558
+ toolUseId: z4.string(),
1559
+ name: z4.string(),
1560
+ input: z4.unknown()
1533
1561
  });
1534
- var BedrockReasoningTextSchema = z3.object({
1535
- signature: z3.string().nullish(),
1536
- text: z3.string()
1562
+ var BedrockReasoningTextSchema = z4.object({
1563
+ signature: z4.string().nullish(),
1564
+ text: z4.string()
1537
1565
  });
1538
- var BedrockRedactedReasoningSchema = z3.object({
1539
- data: z3.string()
1566
+ var BedrockRedactedReasoningSchema = z4.object({
1567
+ data: z4.string()
1540
1568
  });
1541
- var BedrockResponseSchema = z3.object({
1542
- metrics: z3.object({
1543
- latencyMs: z3.number()
1569
+ var BedrockResponseSchema = z4.object({
1570
+ metrics: z4.object({
1571
+ latencyMs: z4.number()
1544
1572
  }).nullish(),
1545
- output: z3.object({
1546
- message: z3.object({
1547
- content: z3.array(
1548
- z3.object({
1549
- text: z3.string().nullish(),
1573
+ output: z4.object({
1574
+ message: z4.object({
1575
+ content: z4.array(
1576
+ z4.object({
1577
+ text: z4.string().nullish(),
1550
1578
  toolUse: BedrockToolUseSchema.nullish(),
1551
- reasoningContent: z3.union([
1552
- z3.object({
1579
+ reasoningContent: z4.union([
1580
+ z4.object({
1553
1581
  reasoningText: BedrockReasoningTextSchema
1554
1582
  }),
1555
- z3.object({
1583
+ z4.object({
1556
1584
  redactedReasoning: BedrockRedactedReasoningSchema
1557
1585
  })
1558
1586
  ]).nullish()
1559
1587
  })
1560
1588
  ),
1561
- role: z3.string()
1589
+ role: z4.string()
1562
1590
  })
1563
1591
  }),
1564
1592
  stopReason: BedrockStopReasonSchema,
1565
1593
  additionalModelResponseFields: BedrockAdditionalModelResponseFieldsSchema.nullish(),
1566
- trace: z3.unknown().nullish(),
1567
- performanceConfig: z3.object({ latency: z3.string() }).nullish(),
1568
- serviceTier: z3.object({ type: z3.string() }).nullish(),
1569
- usage: z3.object({
1570
- inputTokens: z3.number(),
1571
- outputTokens: z3.number(),
1572
- totalTokens: z3.number(),
1573
- cacheReadInputTokens: z3.number().nullish(),
1574
- cacheWriteInputTokens: z3.number().nullish(),
1575
- cacheDetails: z3.array(z3.object({ inputTokens: z3.number(), ttl: z3.string() })).nullish()
1594
+ trace: z4.unknown().nullish(),
1595
+ performanceConfig: z4.object({ latency: z4.string() }).nullish(),
1596
+ serviceTier: z4.object({ type: z4.string() }).nullish(),
1597
+ usage: z4.object({
1598
+ inputTokens: z4.number(),
1599
+ outputTokens: z4.number(),
1600
+ totalTokens: z4.number(),
1601
+ cacheReadInputTokens: z4.number().nullish(),
1602
+ cacheWriteInputTokens: z4.number().nullish(),
1603
+ cacheDetails: z4.array(z4.object({ inputTokens: z4.number(), ttl: z4.string() })).nullish()
1576
1604
  })
1577
1605
  });
1578
- var BedrockStreamSchema = z3.object({
1579
- contentBlockDelta: z3.object({
1580
- contentBlockIndex: z3.number(),
1581
- delta: z3.union([
1582
- z3.object({ text: z3.string() }),
1583
- z3.object({ toolUse: z3.object({ input: z3.string() }) }),
1584
- z3.object({
1585
- reasoningContent: z3.object({ text: z3.string() })
1606
+ var BedrockStreamSchema = z4.object({
1607
+ contentBlockDelta: z4.object({
1608
+ contentBlockIndex: z4.number(),
1609
+ delta: z4.union([
1610
+ z4.object({ text: z4.string() }),
1611
+ z4.object({ toolUse: z4.object({ input: z4.string() }) }),
1612
+ z4.object({
1613
+ reasoningContent: z4.object({ text: z4.string() })
1586
1614
  }),
1587
- z3.object({
1588
- reasoningContent: z3.object({
1589
- signature: z3.string()
1615
+ z4.object({
1616
+ reasoningContent: z4.object({
1617
+ signature: z4.string()
1590
1618
  })
1591
1619
  }),
1592
- z3.object({
1593
- reasoningContent: z3.object({ data: z3.string() })
1620
+ z4.object({
1621
+ reasoningContent: z4.object({ data: z4.string() })
1594
1622
  })
1595
1623
  ]).nullish()
1596
1624
  }).nullish(),
1597
- contentBlockStart: z3.object({
1598
- contentBlockIndex: z3.number(),
1599
- start: z3.object({
1625
+ contentBlockStart: z4.object({
1626
+ contentBlockIndex: z4.number(),
1627
+ start: z4.object({
1600
1628
  toolUse: BedrockToolUseSchema.nullish()
1601
1629
  }).nullish()
1602
1630
  }).nullish(),
1603
- contentBlockStop: z3.object({
1604
- contentBlockIndex: z3.number()
1631
+ contentBlockStop: z4.object({
1632
+ contentBlockIndex: z4.number()
1605
1633
  }).nullish(),
1606
- internalServerException: z3.record(z3.string(), z3.unknown()).nullish(),
1607
- messageStop: z3.object({
1634
+ internalServerException: z4.record(z4.string(), z4.unknown()).nullish(),
1635
+ messageStop: z4.object({
1608
1636
  additionalModelResponseFields: BedrockAdditionalModelResponseFieldsSchema.nullish(),
1609
1637
  stopReason: BedrockStopReasonSchema
1610
1638
  }).nullish(),
1611
- metadata: z3.object({
1612
- trace: z3.unknown().nullish(),
1613
- performanceConfig: z3.object({ latency: z3.string() }).nullish(),
1614
- serviceTier: z3.object({ type: z3.string() }).nullish(),
1615
- usage: z3.object({
1616
- cacheReadInputTokens: z3.number().nullish(),
1617
- cacheWriteInputTokens: z3.number().nullish(),
1618
- cacheDetails: z3.array(z3.object({ inputTokens: z3.number(), ttl: z3.string() })).nullish(),
1619
- inputTokens: z3.number(),
1620
- outputTokens: z3.number()
1639
+ metadata: z4.object({
1640
+ trace: z4.unknown().nullish(),
1641
+ performanceConfig: z4.object({ latency: z4.string() }).nullish(),
1642
+ serviceTier: z4.object({ type: z4.string() }).nullish(),
1643
+ usage: z4.object({
1644
+ cacheReadInputTokens: z4.number().nullish(),
1645
+ cacheWriteInputTokens: z4.number().nullish(),
1646
+ cacheDetails: z4.array(z4.object({ inputTokens: z4.number(), ttl: z4.string() })).nullish(),
1647
+ inputTokens: z4.number(),
1648
+ outputTokens: z4.number()
1621
1649
  }).nullish()
1622
1650
  }).nullish(),
1623
- modelStreamErrorException: z3.record(z3.string(), z3.unknown()).nullish(),
1624
- throttlingException: z3.record(z3.string(), z3.unknown()).nullish(),
1625
- validationException: z3.record(z3.string(), z3.unknown()).nullish()
1626
- });
1627
- var bedrockReasoningMetadataSchema = z3.object({
1628
- signature: z3.string().optional(),
1629
- redactedData: z3.string().optional()
1651
+ modelStreamErrorException: z4.record(z4.string(), z4.unknown()).nullish(),
1652
+ throttlingException: z4.record(z4.string(), z4.unknown()).nullish(),
1653
+ validationException: z4.record(z4.string(), z4.unknown()).nullish()
1630
1654
  });
1631
1655
  var bedrockReasoningEffortMap = {
1632
1656
  minimal: "low",
@@ -1712,29 +1736,29 @@ import {
1712
1736
  } from "@ai-sdk/provider-utils";
1713
1737
 
1714
1738
  // src/bedrock-embedding-options.ts
1715
- import { z as z4 } from "zod/v4";
1716
- var amazonBedrockEmbeddingModelOptionsSchema = z4.object({
1739
+ import { z as z5 } from "zod/v4";
1740
+ var amazonBedrockEmbeddingModelOptionsSchema = z5.object({
1717
1741
  /**
1718
1742
  * The number of dimensions the resulting output embeddings should have (defaults to 1024).
1719
1743
  * Only supported in amazon.titan-embed-text-v2:0.
1720
1744
  */
1721
- dimensions: z4.union([z4.literal(1024), z4.literal(512), z4.literal(256)]).optional(),
1745
+ dimensions: z5.union([z5.literal(1024), z5.literal(512), z5.literal(256)]).optional(),
1722
1746
  /**
1723
1747
  * Flag indicating whether or not to normalize the output embeddings. Defaults to true.
1724
1748
  * Only supported in amazon.titan-embed-text-v2:0.
1725
1749
  */
1726
- normalize: z4.boolean().optional(),
1750
+ normalize: z5.boolean().optional(),
1727
1751
  /**
1728
1752
  * The number of dimensions for Nova embedding models (defaults to 1024).
1729
1753
  * Supported values: 256, 384, 1024, 3072.
1730
1754
  * Only supported in amazon.nova-* embedding models.
1731
1755
  */
1732
- embeddingDimension: z4.union([z4.literal(256), z4.literal(384), z4.literal(1024), z4.literal(3072)]).optional(),
1756
+ embeddingDimension: z5.union([z5.literal(256), z5.literal(384), z5.literal(1024), z5.literal(3072)]).optional(),
1733
1757
  /**
1734
1758
  * The purpose of the embedding. Defaults to 'GENERIC_INDEX'.
1735
1759
  * Only supported in amazon.nova-* embedding models.
1736
1760
  */
1737
- embeddingPurpose: z4.enum([
1761
+ embeddingPurpose: z5.enum([
1738
1762
  "GENERIC_INDEX",
1739
1763
  "TEXT_RETRIEVAL",
1740
1764
  "IMAGE_RETRIEVAL",
@@ -1750,21 +1774,21 @@ var amazonBedrockEmbeddingModelOptionsSchema = z4.object({
1750
1774
  * Common values: `search_document`, `search_query`, `classification`, `clustering`.
1751
1775
  * If not set, the provider defaults to `search_query`.
1752
1776
  */
1753
- inputType: z4.enum(["search_document", "search_query", "classification", "clustering"]).optional(),
1777
+ inputType: z5.enum(["search_document", "search_query", "classification", "clustering"]).optional(),
1754
1778
  /**
1755
1779
  * Truncation behavior when input exceeds the model's context length.
1756
1780
  * Supported in Cohere and Nova embedding models. Defaults to 'END' for Nova models.
1757
1781
  */
1758
- truncate: z4.enum(["NONE", "START", "END"]).optional(),
1782
+ truncate: z5.enum(["NONE", "START", "END"]).optional(),
1759
1783
  /**
1760
1784
  * The number of dimensions the resulting output embeddings should have (defaults to 1536).
1761
1785
  * Only supported in cohere.embed-v4:0 and newer Cohere embedding models.
1762
1786
  */
1763
- outputDimension: z4.union([z4.literal(256), z4.literal(512), z4.literal(1024), z4.literal(1536)]).optional()
1787
+ outputDimension: z5.union([z5.literal(256), z5.literal(512), z5.literal(1024), z5.literal(1536)]).optional()
1764
1788
  });
1765
1789
 
1766
1790
  // src/bedrock-embedding-model.ts
1767
- import { z as z5 } from "zod/v4";
1791
+ import { z as z6 } from "zod/v4";
1768
1792
  var BedrockEmbeddingModel = class _BedrockEmbeddingModel {
1769
1793
  constructor(modelId, config) {
1770
1794
  this.modelId = modelId;
@@ -1872,30 +1896,30 @@ var BedrockEmbeddingModel = class _BedrockEmbeddingModel {
1872
1896
  };
1873
1897
  }
1874
1898
  };
1875
- var BedrockEmbeddingResponseSchema = z5.union([
1899
+ var BedrockEmbeddingResponseSchema = z6.union([
1876
1900
  // Titan-style response
1877
- z5.object({
1878
- embedding: z5.array(z5.number()),
1879
- inputTextTokenCount: z5.number()
1901
+ z6.object({
1902
+ embedding: z6.array(z6.number()),
1903
+ inputTextTokenCount: z6.number()
1880
1904
  }),
1881
1905
  // Nova-style response
1882
- z5.object({
1883
- embeddings: z5.array(
1884
- z5.object({
1885
- embeddingType: z5.string(),
1886
- embedding: z5.array(z5.number())
1906
+ z6.object({
1907
+ embeddings: z6.array(
1908
+ z6.object({
1909
+ embeddingType: z6.string(),
1910
+ embedding: z6.array(z6.number())
1887
1911
  })
1888
1912
  ),
1889
- inputTokenCount: z5.number().optional()
1913
+ inputTokenCount: z6.number().optional()
1890
1914
  }),
1891
1915
  // Cohere v3-style response
1892
- z5.object({
1893
- embeddings: z5.array(z5.array(z5.number()))
1916
+ z6.object({
1917
+ embeddings: z6.array(z6.array(z6.number()))
1894
1918
  }),
1895
1919
  // Cohere v4-style response
1896
- z5.object({
1897
- embeddings: z5.object({
1898
- float: z5.array(z5.array(z5.number()))
1920
+ z6.object({
1921
+ embeddings: z6.object({
1922
+ float: z6.array(z6.array(z6.number()))
1899
1923
  })
1900
1924
  })
1901
1925
  ]);
@@ -1919,7 +1943,7 @@ var modelMaxImagesPerCall = {
1919
1943
  };
1920
1944
 
1921
1945
  // src/bedrock-image-model.ts
1922
- import { z as z6 } from "zod/v4";
1946
+ import { z as z7 } from "zod/v4";
1923
1947
  var BedrockImageModel = class _BedrockImageModel {
1924
1948
  constructor(modelId, config) {
1925
1949
  this.modelId = modelId;
@@ -2117,16 +2141,16 @@ function getBase64Data(file) {
2117
2141
  }
2118
2142
  return file.data;
2119
2143
  }
2120
- var bedrockImageResponseSchema = z6.object({
2144
+ var bedrockImageResponseSchema = z7.object({
2121
2145
  // Normal successful response
2122
- images: z6.array(z6.string()).optional(),
2146
+ images: z7.array(z7.string()).optional(),
2123
2147
  // Moderation response fields
2124
- id: z6.string().optional(),
2125
- status: z6.string().optional(),
2126
- result: z6.unknown().optional(),
2127
- progress: z6.unknown().optional(),
2128
- details: z6.record(z6.string(), z6.unknown()).optional(),
2129
- preview: z6.unknown().optional()
2148
+ id: z7.string().optional(),
2149
+ status: z7.string().optional(),
2150
+ result: z7.unknown().optional(),
2151
+ progress: z7.unknown().optional(),
2152
+ details: z7.record(z7.string(), z7.unknown()).optional(),
2153
+ preview: z7.unknown().optional()
2130
2154
  });
2131
2155
 
2132
2156
  // src/bedrock-sigv4-fetch.ts
@@ -2139,7 +2163,7 @@ import {
2139
2163
  import { AwsV4Signer } from "aws4fetch";
2140
2164
 
2141
2165
  // src/version.ts
2142
- var VERSION = true ? "5.0.0-beta.44" : "0.0.0-test";
2166
+ var VERSION = true ? "5.0.0-beta.45" : "0.0.0-test";
2143
2167
 
2144
2168
  // src/bedrock-sigv4-fetch.ts
2145
2169
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
@@ -2234,35 +2258,35 @@ import {
2234
2258
 
2235
2259
  // src/reranking/bedrock-reranking-api.ts
2236
2260
  import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
2237
- import { z as z7 } from "zod/v4";
2261
+ import { z as z8 } from "zod/v4";
2238
2262
  var bedrockRerankingResponseSchema = lazySchema(
2239
2263
  () => zodSchema(
2240
- z7.object({
2241
- results: z7.array(
2242
- z7.object({
2243
- index: z7.number(),
2244
- relevanceScore: z7.number()
2264
+ z8.object({
2265
+ results: z8.array(
2266
+ z8.object({
2267
+ index: z8.number(),
2268
+ relevanceScore: z8.number()
2245
2269
  })
2246
2270
  ),
2247
- nextToken: z7.string().optional()
2271
+ nextToken: z8.string().optional()
2248
2272
  })
2249
2273
  )
2250
2274
  );
2251
2275
 
2252
2276
  // src/reranking/bedrock-reranking-options.ts
2253
2277
  import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
2254
- import { z as z8 } from "zod/v4";
2278
+ import { z as z9 } from "zod/v4";
2255
2279
  var amazonBedrockRerankingModelOptionsSchema = lazySchema2(
2256
2280
  () => zodSchema2(
2257
- z8.object({
2281
+ z9.object({
2258
2282
  /**
2259
2283
  * 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.
2260
2284
  */
2261
- nextToken: z8.string().optional(),
2285
+ nextToken: z9.string().optional(),
2262
2286
  /**
2263
2287
  * Additional model request fields to pass to the model.
2264
2288
  */
2265
- additionalModelRequestFields: z8.record(z8.string(), z8.any()).optional()
2289
+ additionalModelRequestFields: z9.record(z9.string(), z9.any()).optional()
2266
2290
  })
2267
2291
  )
2268
2292
  );
@@ -2388,7 +2412,7 @@ function createAmazonBedrock(options = {}) {
2388
2412
  environmentVariableName: "AWS_SECRET_ACCESS_KEY",
2389
2413
  description: "AWS secret access key"
2390
2414
  }),
2391
- sessionToken: loadOptionalSetting({
2415
+ sessionToken: options.accessKeyId != null && options.secretAccessKey != null ? options.sessionToken : loadOptionalSetting({
2392
2416
  settingValue: options.sessionToken,
2393
2417
  environmentVariableName: "AWS_SESSION_TOKEN"
2394
2418
  })