@ai-sdk/amazon-bedrock 3.0.140 → 3.0.141

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.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "3.0.140" : "0.0.0-test";
10
+ var VERSION = true ? "3.0.141" : "0.0.0-test";
11
11
 
12
12
  // src/bedrock-provider.ts
13
13
  import { anthropicTools as anthropicTools2 } from "@ai-sdk/anthropic/internal";
@@ -18,6 +18,8 @@ import {
18
18
  sanitizeJsonSchema
19
19
  } from "@ai-sdk/anthropic/internal";
20
20
  import {
21
+ lazySchema as lazySchema4,
22
+ zodSchema as zodSchema4,
21
23
  combineHeaders,
22
24
  createJsonErrorResponseHandler as createJsonErrorResponseHandler2,
23
25
  createJsonResponseHandler,
@@ -63,19 +65,27 @@ var BEDROCK_DOCUMENT_MIME_TYPES = {
63
65
  };
64
66
 
65
67
  // src/bedrock-chat-options.ts
68
+ import {
69
+ lazySchema,
70
+ zodSchema
71
+ } from "@ai-sdk/provider-utils";
66
72
  import { z } from "zod/v4";
67
- var bedrockFilePartProviderOptions = z.object({
68
- /**
69
- * Citation configuration for this document.
70
- * When enabled, this document will generate citations in the response.
71
- */
72
- citations: z.object({
73
- /**
74
- * Enable citations for this document
75
- */
76
- enabled: z.boolean()
77
- }).optional()
78
- });
73
+ var bedrockFilePartProviderOptions = lazySchema(
74
+ () => zodSchema(
75
+ z.object({
76
+ /**
77
+ * Citation configuration for this document.
78
+ * When enabled, this document will generate citations in the response.
79
+ */
80
+ citations: z.object({
81
+ /**
82
+ * Enable citations for this document
83
+ */
84
+ enabled: z.boolean()
85
+ }).optional()
86
+ })
87
+ )
88
+ );
79
89
  var bedrockProviderOptions = z.object({
80
90
  /**
81
91
  * Determines how structured outputs are generated for Anthropic models.
@@ -127,12 +137,20 @@ function isAnthropicModel({
127
137
  }
128
138
 
129
139
  // src/bedrock-error.ts
130
- import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
140
+ import {
141
+ lazySchema as lazySchema2,
142
+ zodSchema as zodSchema2,
143
+ createJsonErrorResponseHandler
144
+ } from "@ai-sdk/provider-utils";
131
145
  import { z as z2 } from "zod/v4";
132
- var BedrockErrorSchema = z2.object({
133
- message: z2.string(),
134
- type: z2.string().nullish()
135
- });
146
+ var BedrockErrorSchema = lazySchema2(
147
+ () => zodSchema2(
148
+ z2.object({
149
+ message: z2.string(),
150
+ type: z2.string().nullish()
151
+ })
152
+ )
153
+ );
136
154
  var bedrockFailedResponseHandler = createJsonErrorResponseHandler({
137
155
  errorSchema: BedrockErrorSchema,
138
156
  errorToMessage: (error) => error.type == null ? error.message : `${error.type}: ${error.message}`
@@ -404,12 +422,20 @@ import {
404
422
  import { convertToBase64, parseProviderOptions } from "@ai-sdk/provider-utils";
405
423
 
406
424
  // src/bedrock-reasoning-metadata.ts
425
+ import {
426
+ lazySchema as lazySchema3,
427
+ zodSchema as zodSchema3
428
+ } from "@ai-sdk/provider-utils";
407
429
  import { z as z3 } from "zod/v4";
408
- var bedrockReasoningMetadataSchema = z3.object({
409
- signature: z3.string().optional(),
410
- redactedData: z3.string().optional(),
411
- redactedContent: z3.string().optional()
412
- });
430
+ var bedrockReasoningMetadataSchema = lazySchema3(
431
+ () => zodSchema3(
432
+ z3.object({
433
+ signature: z3.string().optional(),
434
+ redactedData: z3.string().optional(),
435
+ redactedContent: z3.string().optional()
436
+ })
437
+ )
438
+ );
413
439
 
414
440
  // src/convert-to-bedrock-chat-messages.ts
415
441
  function getCachePoint(providerMetadata) {
@@ -787,10 +813,14 @@ function mapBedrockFinishReason(finishReason, isJsonResponseFromTool) {
787
813
  }
788
814
 
789
815
  // src/bedrock-chat-language-model.ts
790
- var anthropicProviderOptions = z4.object({
791
- disableParallelToolUse: z4.boolean().optional(),
792
- structuredOutputMode: z4.enum(["outputFormat", "jsonTool", "auto"]).optional()
793
- });
816
+ var anthropicProviderOptions = lazySchema4(
817
+ () => zodSchema4(
818
+ z4.object({
819
+ disableParallelToolUse: z4.boolean().optional(),
820
+ structuredOutputMode: z4.enum(["outputFormat", "jsonTool", "auto"]).optional()
821
+ })
822
+ )
823
+ );
794
824
  var BedrockChatLanguageModel = class {
795
825
  constructor(modelId, config) {
796
826
  this.modelId = modelId;
@@ -1580,62 +1610,66 @@ var BedrockToolUseSchema = z4.object({
1580
1610
  name: z4.string(),
1581
1611
  input: z4.unknown()
1582
1612
  });
1583
- var BedrockCitationsContentSchema = z4.object({
1613
+ var BedrockCitationsContentSchema = () => z4.object({
1584
1614
  content: z4.array(
1585
1615
  z4.object({
1586
1616
  text: z4.string().nullish()
1587
1617
  })
1588
1618
  ).nullish()
1589
1619
  });
1590
- var BedrockReasoningTextSchema = z4.object({
1620
+ var BedrockReasoningTextSchema = () => z4.object({
1591
1621
  signature: z4.string().nullish(),
1592
1622
  text: z4.string()
1593
1623
  });
1594
- var BedrockRedactedReasoningSchema = z4.object({
1624
+ var BedrockRedactedReasoningSchema = () => z4.object({
1595
1625
  data: z4.string()
1596
1626
  });
1597
- var BedrockResponseSchema = z4.object({
1598
- metrics: z4.object({
1599
- latencyMs: z4.number()
1600
- }).nullish(),
1601
- output: z4.object({
1602
- message: z4.object({
1603
- content: z4.array(
1604
- z4.object({
1605
- text: z4.string().nullish(),
1606
- citationsContent: BedrockCitationsContentSchema.nullish(),
1607
- toolUse: BedrockToolUseSchema.nullish(),
1608
- reasoningContent: z4.union([
1609
- z4.object({
1610
- reasoningText: BedrockReasoningTextSchema
1611
- }),
1612
- z4.object({
1613
- redactedReasoning: BedrockRedactedReasoningSchema
1614
- }),
1615
- // `redactedContent` is a member of the documented
1616
- // ReasoningContentBlock union. OpenAI models on Bedrock
1617
- // (e.g. `us.openai.gpt-5.6-luna`) return their encrypted
1618
- // reasoning in this shape.
1627
+ var BedrockResponseSchema = lazySchema4(
1628
+ () => zodSchema4(
1629
+ z4.object({
1630
+ metrics: z4.object({
1631
+ latencyMs: z4.number()
1632
+ }).nullish(),
1633
+ output: z4.object({
1634
+ message: z4.object({
1635
+ content: z4.array(
1619
1636
  z4.object({
1620
- redactedContent: z4.string()
1637
+ text: z4.string().nullish(),
1638
+ citationsContent: BedrockCitationsContentSchema().nullish(),
1639
+ toolUse: BedrockToolUseSchema.nullish(),
1640
+ reasoningContent: z4.union([
1641
+ z4.object({
1642
+ reasoningText: BedrockReasoningTextSchema()
1643
+ }),
1644
+ z4.object({
1645
+ redactedReasoning: BedrockRedactedReasoningSchema()
1646
+ }),
1647
+ // `redactedContent` is a member of the documented
1648
+ // ReasoningContentBlock union. OpenAI models on Bedrock
1649
+ // (e.g. `us.openai.gpt-5.6-luna`) return their encrypted
1650
+ // reasoning in this shape.
1651
+ z4.object({
1652
+ redactedContent: z4.string()
1653
+ })
1654
+ ]).nullish()
1621
1655
  })
1622
- ]).nullish()
1656
+ ),
1657
+ role: z4.string()
1623
1658
  })
1624
- ),
1625
- role: z4.string()
1659
+ }),
1660
+ stopReason: BedrockStopReasonSchema,
1661
+ additionalModelResponseFields: BedrockAdditionalModelResponseFieldsSchema.nullish(),
1662
+ trace: z4.unknown().nullish(),
1663
+ usage: z4.object({
1664
+ inputTokens: z4.number(),
1665
+ outputTokens: z4.number(),
1666
+ totalTokens: z4.number(),
1667
+ cacheReadInputTokens: z4.number().nullish(),
1668
+ cacheWriteInputTokens: z4.number().nullish()
1669
+ })
1626
1670
  })
1627
- }),
1628
- stopReason: BedrockStopReasonSchema,
1629
- additionalModelResponseFields: BedrockAdditionalModelResponseFieldsSchema.nullish(),
1630
- trace: z4.unknown().nullish(),
1631
- usage: z4.object({
1632
- inputTokens: z4.number(),
1633
- outputTokens: z4.number(),
1634
- totalTokens: z4.number(),
1635
- cacheReadInputTokens: z4.number().nullish(),
1636
- cacheWriteInputTokens: z4.number().nullish()
1637
- })
1638
- });
1671
+ )
1672
+ );
1639
1673
  var BedrockStreamSchema = z4.object({
1640
1674
  contentBlockDelta: z4.object({
1641
1675
  contentBlockIndex: z4.number(),
@@ -1698,6 +1732,8 @@ import {
1698
1732
  TooManyEmbeddingValuesForCallError
1699
1733
  } from "@ai-sdk/provider";
1700
1734
  import {
1735
+ lazySchema as lazySchema6,
1736
+ zodSchema as zodSchema6,
1701
1737
  combineHeaders as combineHeaders2,
1702
1738
  createJsonResponseHandler as createJsonResponseHandler2,
1703
1739
  parseProviderOptions as parseProviderOptions3,
@@ -1706,19 +1742,24 @@ import {
1706
1742
  } from "@ai-sdk/provider-utils";
1707
1743
 
1708
1744
  // src/bedrock-embedding-options.ts
1745
+ import { lazySchema as lazySchema5, zodSchema as zodSchema5 } from "@ai-sdk/provider-utils";
1709
1746
  import { z as z5 } from "zod/v4";
1710
- var bedrockEmbeddingProviderOptions = z5.object({
1711
- /**
1712
- The number of dimensions the resulting output embeddings should have (defaults to 1024).
1713
- Only supported in amazon.titan-embed-text-v2:0.
1714
- */
1715
- dimensions: z5.union([z5.literal(1024), z5.literal(512), z5.literal(256)]).optional(),
1716
- /**
1717
- Flag indicating whether or not to normalize the output embeddings. Defaults to true
1718
- Only supported in amazon.titan-embed-text-v2:0.
1719
- */
1720
- normalize: z5.boolean().optional()
1721
- });
1747
+ var bedrockEmbeddingProviderOptions = lazySchema5(
1748
+ () => zodSchema5(
1749
+ z5.object({
1750
+ /**
1751
+ The number of dimensions the resulting output embeddings should have (defaults to 1024).
1752
+ Only supported in amazon.titan-embed-text-v2:0.
1753
+ */
1754
+ dimensions: z5.union([z5.literal(1024), z5.literal(512), z5.literal(256)]).optional(),
1755
+ /**
1756
+ Flag indicating whether or not to normalize the output embeddings. Defaults to true
1757
+ Only supported in amazon.titan-embed-text-v2:0.
1758
+ */
1759
+ normalize: z5.boolean().optional()
1760
+ })
1761
+ )
1762
+ );
1722
1763
 
1723
1764
  // src/bedrock-embedding-model.ts
1724
1765
  import { z as z6 } from "zod/v4";
@@ -1780,13 +1821,19 @@ var BedrockEmbeddingModel = class {
1780
1821
  };
1781
1822
  }
1782
1823
  };
1783
- var BedrockEmbeddingResponseSchema = z6.object({
1784
- embedding: z6.array(z6.number()),
1785
- inputTextTokenCount: z6.number()
1786
- });
1824
+ var BedrockEmbeddingResponseSchema = lazySchema6(
1825
+ () => zodSchema6(
1826
+ z6.object({
1827
+ embedding: z6.array(z6.number()),
1828
+ inputTextTokenCount: z6.number()
1829
+ })
1830
+ )
1831
+ );
1787
1832
 
1788
1833
  // src/bedrock-image-model.ts
1789
1834
  import {
1835
+ lazySchema as lazySchema7,
1836
+ zodSchema as zodSchema7,
1790
1837
  combineHeaders as combineHeaders3,
1791
1838
  createJsonResponseHandler as createJsonResponseHandler3,
1792
1839
  postJsonToApi as postJsonToApi3,
@@ -1880,9 +1927,13 @@ var BedrockImageModel = class {
1880
1927
  };
1881
1928
  }
1882
1929
  };
1883
- var bedrockImageResponseSchema = z7.object({
1884
- images: z7.array(z7.string())
1885
- });
1930
+ var bedrockImageResponseSchema = lazySchema7(
1931
+ () => zodSchema7(
1932
+ z7.object({
1933
+ images: z7.array(z7.string())
1934
+ })
1935
+ )
1936
+ );
1886
1937
 
1887
1938
  // src/bedrock-sigv4-fetch.ts
1888
1939
  import {