@ai-sdk/amazon-bedrock 5.0.120 → 5.0.121

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,6 +4,8 @@ import type {
4
4
  SharedV4Warning,
5
5
  } from '@ai-sdk/provider';
6
6
  import {
7
+ lazySchema,
8
+ zodSchema,
7
9
  combineHeaders,
8
10
  convertUint8ArrayToBase64,
9
11
  createJsonResponseHandler,
@@ -323,15 +325,19 @@ function getBase64Data(file: ImageModelV4File): string {
323
325
 
324
326
  // minimal version of the schema, focussed on what is needed for the implementation
325
327
  // this approach limits breakages when the API changes and increases efficiency
326
- const amazonBedrockImageResponseSchema = z.object({
327
- // Normal successful response
328
- images: z.array(z.string()).optional(),
329
-
330
- // Moderation response fields
331
- id: z.string().optional(),
332
- status: z.string().optional(),
333
- result: z.unknown().optional(),
334
- progress: z.unknown().optional(),
335
- details: z.record(z.string(), z.unknown()).optional(),
336
- preview: z.unknown().optional(),
337
- });
328
+ const amazonBedrockImageResponseSchema = lazySchema(() =>
329
+ zodSchema(
330
+ z.object({
331
+ // Normal successful response
332
+ images: z.array(z.string()).optional(),
333
+
334
+ // Moderation response fields
335
+ id: z.string().optional(),
336
+ status: z.string().optional(),
337
+ result: z.unknown().optional(),
338
+ progress: z.unknown().optional(),
339
+ details: z.record(z.string(), z.unknown()).optional(),
340
+ preview: z.unknown().optional(),
341
+ }),
342
+ ),
343
+ );
@@ -1,11 +1,20 @@
1
+ import {
2
+ lazySchema,
3
+ zodSchema,
4
+ type InferSchema,
5
+ } from '@ai-sdk/provider-utils';
1
6
  import { z } from 'zod/v4';
2
7
 
3
- export const amazonBedrockReasoningMetadataSchema = z.object({
4
- signature: z.string().optional(),
5
- redactedData: z.string().optional(),
6
- redactedContent: z.string().optional(),
7
- });
8
+ export const amazonBedrockReasoningMetadataSchema = lazySchema(() =>
9
+ zodSchema(
10
+ z.object({
11
+ signature: z.string().optional(),
12
+ redactedData: z.string().optional(),
13
+ redactedContent: z.string().optional(),
14
+ }),
15
+ ),
16
+ );
8
17
 
9
- export type AmazonBedrockReasoningMetadata = z.infer<
18
+ export type AmazonBedrockReasoningMetadata = InferSchema<
10
19
  typeof amazonBedrockReasoningMetadataSchema
11
20
  >;
@@ -1,4 +1,6 @@
1
1
  import {
2
+ lazySchema,
3
+ zodSchema,
2
4
  convertBase64ToUint8Array,
3
5
  safeParseJSON,
4
6
  type FetchFunction,
@@ -7,9 +9,13 @@ import { z } from 'zod/v4';
7
9
  import { createAmazonBedrockEventStreamDecoder } from '../amazon-bedrock-event-stream-decoder';
8
10
  import { getAmazonBedrockStreamErrorMetadata } from '../amazon-bedrock-stream-error';
9
11
 
10
- const amazonBedrockErrorSchema = z.looseObject({
11
- message: z.string().optional(),
12
- });
12
+ const amazonBedrockErrorSchema = lazySchema(() =>
13
+ zodSchema(
14
+ z.looseObject({
15
+ message: z.string().optional(),
16
+ }),
17
+ ),
18
+ );
13
19
 
14
20
  export function createAmazonBedrockAnthropicFetch(
15
21
  baseFetch: FetchFunction,