@ai-sdk/google 2.0.0-beta.1 → 2.0.0-beta.3

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.
@@ -1,8 +1,8 @@
1
1
  import { LanguageModelV2 } from '@ai-sdk/provider';
2
2
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
3
- import { z } from 'zod';
3
+ import { z } from 'zod/v4';
4
4
 
5
- type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-27b-it' | 'learnlm-1.5-pro-experimental' | (string & {});
5
+ type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
6
6
 
7
7
  type GoogleGenerativeAIConfig = {
8
8
  provider: string;
@@ -27,167 +27,37 @@ declare class GoogleGenerativeAILanguageModel implements LanguageModelV2 {
27
27
  doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
28
28
  }
29
29
  declare const groundingMetadataSchema: z.ZodObject<{
30
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
31
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
30
+ webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
31
+ retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
32
32
  searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
33
33
  renderedContent: z.ZodString;
34
- }, "strip", z.ZodTypeAny, {
35
- renderedContent: string;
36
- }, {
37
- renderedContent: string;
38
- }>>>;
34
+ }, z.core.$strip>>>;
39
35
  groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
40
36
  web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
41
37
  uri: z.ZodString;
42
38
  title: z.ZodString;
43
- }, "strip", z.ZodTypeAny, {
44
- uri: string;
45
- title: string;
46
- }, {
47
- uri: string;
48
- title: string;
49
- }>>>;
39
+ }, z.core.$strip>>>;
50
40
  retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
51
41
  uri: z.ZodString;
52
42
  title: z.ZodString;
53
- }, "strip", z.ZodTypeAny, {
54
- uri: string;
55
- title: string;
56
- }, {
57
- uri: string;
58
- title: string;
59
- }>>>;
60
- }, "strip", z.ZodTypeAny, {
61
- web?: {
62
- uri: string;
63
- title: string;
64
- } | null | undefined;
65
- retrievedContext?: {
66
- uri: string;
67
- title: string;
68
- } | null | undefined;
69
- }, {
70
- web?: {
71
- uri: string;
72
- title: string;
73
- } | null | undefined;
74
- retrievedContext?: {
75
- uri: string;
76
- title: string;
77
- } | null | undefined;
78
- }>, "many">>>;
43
+ }, z.core.$strip>>>;
44
+ }, z.core.$strip>>>>;
79
45
  groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
80
46
  segment: z.ZodObject<{
81
47
  startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
82
48
  endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
83
49
  text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
- }, "strip", z.ZodTypeAny, {
85
- startIndex?: number | null | undefined;
86
- endIndex?: number | null | undefined;
87
- text?: string | null | undefined;
88
- }, {
89
- startIndex?: number | null | undefined;
90
- endIndex?: number | null | undefined;
91
- text?: string | null | undefined;
92
- }>;
50
+ }, z.core.$strip>;
93
51
  segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
95
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
96
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
97
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
98
- }, "strip", z.ZodTypeAny, {
99
- segment: {
100
- startIndex?: number | null | undefined;
101
- endIndex?: number | null | undefined;
102
- text?: string | null | undefined;
103
- };
104
- segment_text?: string | null | undefined;
105
- groundingChunkIndices?: number[] | null | undefined;
106
- supportChunkIndices?: number[] | null | undefined;
107
- confidenceScores?: number[] | null | undefined;
108
- confidenceScore?: number[] | null | undefined;
109
- }, {
110
- segment: {
111
- startIndex?: number | null | undefined;
112
- endIndex?: number | null | undefined;
113
- text?: string | null | undefined;
114
- };
115
- segment_text?: string | null | undefined;
116
- groundingChunkIndices?: number[] | null | undefined;
117
- supportChunkIndices?: number[] | null | undefined;
118
- confidenceScores?: number[] | null | undefined;
119
- confidenceScore?: number[] | null | undefined;
120
- }>, "many">>>;
121
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
52
+ groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
53
+ supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
54
+ confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
55
+ confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
56
+ }, z.core.$strip>>>>;
57
+ retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
122
58
  webDynamicRetrievalScore: z.ZodNumber;
123
- }, "strip", z.ZodTypeAny, {
124
- webDynamicRetrievalScore: number;
125
- }, {
126
- webDynamicRetrievalScore: number;
127
- }>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
128
- }, "strip", z.ZodTypeAny, {
129
- webSearchQueries?: string[] | null | undefined;
130
- retrievalQueries?: string[] | null | undefined;
131
- searchEntryPoint?: {
132
- renderedContent: string;
133
- } | null | undefined;
134
- groundingChunks?: {
135
- web?: {
136
- uri: string;
137
- title: string;
138
- } | null | undefined;
139
- retrievedContext?: {
140
- uri: string;
141
- title: string;
142
- } | null | undefined;
143
- }[] | null | undefined;
144
- groundingSupports?: {
145
- segment: {
146
- startIndex?: number | null | undefined;
147
- endIndex?: number | null | undefined;
148
- text?: string | null | undefined;
149
- };
150
- segment_text?: string | null | undefined;
151
- groundingChunkIndices?: number[] | null | undefined;
152
- supportChunkIndices?: number[] | null | undefined;
153
- confidenceScores?: number[] | null | undefined;
154
- confidenceScore?: number[] | null | undefined;
155
- }[] | null | undefined;
156
- retrievalMetadata?: {
157
- webDynamicRetrievalScore: number;
158
- } | {} | null | undefined;
159
- }, {
160
- webSearchQueries?: string[] | null | undefined;
161
- retrievalQueries?: string[] | null | undefined;
162
- searchEntryPoint?: {
163
- renderedContent: string;
164
- } | null | undefined;
165
- groundingChunks?: {
166
- web?: {
167
- uri: string;
168
- title: string;
169
- } | null | undefined;
170
- retrievedContext?: {
171
- uri: string;
172
- title: string;
173
- } | null | undefined;
174
- }[] | null | undefined;
175
- groundingSupports?: {
176
- segment: {
177
- startIndex?: number | null | undefined;
178
- endIndex?: number | null | undefined;
179
- text?: string | null | undefined;
180
- };
181
- segment_text?: string | null | undefined;
182
- groundingChunkIndices?: number[] | null | undefined;
183
- supportChunkIndices?: number[] | null | undefined;
184
- confidenceScores?: number[] | null | undefined;
185
- confidenceScore?: number[] | null | undefined;
186
- }[] | null | undefined;
187
- retrievalMetadata?: {
188
- webDynamicRetrievalScore: number;
189
- } | {} | null | undefined;
190
- }>;
59
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
60
+ }, z.core.$strip>;
191
61
  declare const safetyRatingSchema: z.ZodObject<{
192
62
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
63
  probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -195,20 +65,6 @@ declare const safetyRatingSchema: z.ZodObject<{
195
65
  severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
66
  severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
197
67
  blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
198
- }, "strip", z.ZodTypeAny, {
199
- category?: string | null | undefined;
200
- probability?: string | null | undefined;
201
- probabilityScore?: number | null | undefined;
202
- severity?: string | null | undefined;
203
- severityScore?: number | null | undefined;
204
- blocked?: boolean | null | undefined;
205
- }, {
206
- category?: string | null | undefined;
207
- probability?: string | null | undefined;
208
- probabilityScore?: number | null | undefined;
209
- severity?: string | null | undefined;
210
- severityScore?: number | null | undefined;
211
- blocked?: boolean | null | undefined;
212
- }>;
68
+ }, z.core.$strip>;
213
69
 
214
70
  export { GoogleGenerativeAILanguageModel, groundingMetadataSchema, safetyRatingSchema };
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(internal_exports);
28
28
 
29
29
  // src/google-generative-ai-language-model.ts
30
30
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
31
- var import_zod3 = require("zod");
31
+ var import_v43 = require("zod/v4");
32
32
 
33
33
  // src/convert-json-schema-to-openapi-schema.ts
34
34
  function convertJSONSchemaToOpenAPISchema(jsonSchema) {
@@ -247,12 +247,12 @@ function getModelPath(modelId) {
247
247
 
248
248
  // src/google-error.ts
249
249
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
250
- var import_zod = require("zod");
251
- var googleErrorDataSchema = import_zod.z.object({
252
- error: import_zod.z.object({
253
- code: import_zod.z.number().nullable(),
254
- message: import_zod.z.string(),
255
- status: import_zod.z.string()
250
+ var import_v4 = require("zod/v4");
251
+ var googleErrorDataSchema = import_v4.z.object({
252
+ error: import_v4.z.object({
253
+ code: import_v4.z.number().nullable(),
254
+ message: import_v4.z.string(),
255
+ status: import_v4.z.string()
256
256
  })
257
257
  });
258
258
  var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
@@ -261,30 +261,30 @@ var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResp
261
261
  });
262
262
 
263
263
  // src/google-generative-ai-options.ts
264
- var import_zod2 = require("zod");
265
- var dynamicRetrievalConfig = import_zod2.z.object({
264
+ var import_v42 = require("zod/v4");
265
+ var dynamicRetrievalConfig = import_v42.z.object({
266
266
  /**
267
267
  * The mode of the predictor to be used in dynamic retrieval.
268
268
  */
269
- mode: import_zod2.z.enum(["MODE_UNSPECIFIED", "MODE_DYNAMIC"]).optional(),
269
+ mode: import_v42.z.enum(["MODE_UNSPECIFIED", "MODE_DYNAMIC"]).optional(),
270
270
  /**
271
271
  * The threshold to be used in dynamic retrieval. If not set, a system default
272
272
  * value is used.
273
273
  */
274
- dynamicThreshold: import_zod2.z.number().optional()
274
+ dynamicThreshold: import_v42.z.number().optional()
275
275
  });
276
- var googleGenerativeAIProviderOptions = import_zod2.z.object({
277
- responseModalities: import_zod2.z.array(import_zod2.z.enum(["TEXT", "IMAGE"])).optional(),
278
- thinkingConfig: import_zod2.z.object({
279
- thinkingBudget: import_zod2.z.number().optional(),
280
- includeThoughts: import_zod2.z.boolean().optional()
276
+ var googleGenerativeAIProviderOptions = import_v42.z.object({
277
+ responseModalities: import_v42.z.array(import_v42.z.enum(["TEXT", "IMAGE"])).optional(),
278
+ thinkingConfig: import_v42.z.object({
279
+ thinkingBudget: import_v42.z.number().optional(),
280
+ includeThoughts: import_v42.z.boolean().optional()
281
281
  }).optional(),
282
282
  /**
283
283
  Optional.
284
284
  The name of the cached content used as context to serve the prediction.
285
285
  Format: cachedContents/{cachedContent}
286
286
  */
287
- cachedContent: import_zod2.z.string().optional(),
287
+ cachedContent: import_v42.z.string().optional(),
288
288
  /**
289
289
  * Optional. Enable structured output. Default is true.
290
290
  *
@@ -293,13 +293,13 @@ var googleGenerativeAIProviderOptions = import_zod2.z.object({
293
293
  * Google Generative AI uses. You can use this to disable
294
294
  * structured outputs if you need to.
295
295
  */
296
- structuredOutputs: import_zod2.z.boolean().optional(),
296
+ structuredOutputs: import_v42.z.boolean().optional(),
297
297
  /**
298
298
  Optional. A list of unique safety settings for blocking unsafe content.
299
299
  */
300
- safetySettings: import_zod2.z.array(
301
- import_zod2.z.object({
302
- category: import_zod2.z.enum([
300
+ safetySettings: import_v42.z.array(
301
+ import_v42.z.object({
302
+ category: import_v42.z.enum([
303
303
  "HARM_CATEGORY_UNSPECIFIED",
304
304
  "HARM_CATEGORY_HATE_SPEECH",
305
305
  "HARM_CATEGORY_DANGEROUS_CONTENT",
@@ -307,7 +307,7 @@ var googleGenerativeAIProviderOptions = import_zod2.z.object({
307
307
  "HARM_CATEGORY_SEXUALLY_EXPLICIT",
308
308
  "HARM_CATEGORY_CIVIC_INTEGRITY"
309
309
  ]),
310
- threshold: import_zod2.z.enum([
310
+ threshold: import_v42.z.enum([
311
311
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
312
312
  "BLOCK_LOW_AND_ABOVE",
313
313
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -317,7 +317,7 @@ var googleGenerativeAIProviderOptions = import_zod2.z.object({
317
317
  ])
318
318
  })
319
319
  ).optional(),
320
- threshold: import_zod2.z.enum([
320
+ threshold: import_v42.z.enum([
321
321
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
322
322
  "BLOCK_LOW_AND_ABOVE",
323
323
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -330,13 +330,13 @@ var googleGenerativeAIProviderOptions = import_zod2.z.object({
330
330
  *
331
331
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
332
332
  */
333
- audioTimestamp: import_zod2.z.boolean().optional(),
333
+ audioTimestamp: import_v42.z.boolean().optional(),
334
334
  /**
335
335
  Optional. When enabled, the model will use Google search to ground the response.
336
336
 
337
337
  @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/overview
338
338
  */
339
- useSearchGrounding: import_zod2.z.boolean().optional(),
339
+ useSearchGrounding: import_v42.z.boolean().optional(),
340
340
  /**
341
341
  Optional. Specifies the dynamic retrieval configuration.
342
342
 
@@ -502,6 +502,13 @@ var GoogleGenerativeAILanguageModel = class {
502
502
  });
503
503
  }
504
504
  const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(prompt);
505
+ const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
506
+ if (isGemmaModel && systemInstruction && systemInstruction.parts.length > 0) {
507
+ warnings.push({
508
+ type: "other",
509
+ message: `GEMMA models do not support system instructions. System messages will be ignored. Consider including instructions in the first user message instead.`
510
+ });
511
+ }
505
512
  const {
506
513
  tools: googleTools,
507
514
  toolConfig: googleToolConfig,
@@ -539,7 +546,7 @@ var GoogleGenerativeAILanguageModel = class {
539
546
  thinkingConfig: googleOptions == null ? void 0 : googleOptions.thinkingConfig
540
547
  },
541
548
  contents,
542
- systemInstruction,
549
+ systemInstruction: isGemmaModel ? void 0 : systemInstruction,
543
550
  safetySettings: googleOptions == null ? void 0 : googleOptions.safetySettings,
544
551
  tools: googleTools,
545
552
  toolConfig: googleToolConfig,
@@ -859,91 +866,91 @@ function extractSources({
859
866
  title: chunk.web.title
860
867
  }));
861
868
  }
862
- var contentSchema = import_zod3.z.object({
863
- parts: import_zod3.z.array(
864
- import_zod3.z.union([
869
+ var contentSchema = import_v43.z.object({
870
+ parts: import_v43.z.array(
871
+ import_v43.z.union([
865
872
  // note: order matters since text can be fully empty
866
- import_zod3.z.object({
867
- functionCall: import_zod3.z.object({
868
- name: import_zod3.z.string(),
869
- args: import_zod3.z.unknown()
873
+ import_v43.z.object({
874
+ functionCall: import_v43.z.object({
875
+ name: import_v43.z.string(),
876
+ args: import_v43.z.unknown()
870
877
  })
871
878
  }),
872
- import_zod3.z.object({
873
- inlineData: import_zod3.z.object({
874
- mimeType: import_zod3.z.string(),
875
- data: import_zod3.z.string()
879
+ import_v43.z.object({
880
+ inlineData: import_v43.z.object({
881
+ mimeType: import_v43.z.string(),
882
+ data: import_v43.z.string()
876
883
  })
877
884
  }),
878
- import_zod3.z.object({
879
- text: import_zod3.z.string().nullish(),
880
- thought: import_zod3.z.boolean().nullish()
885
+ import_v43.z.object({
886
+ text: import_v43.z.string().nullish(),
887
+ thought: import_v43.z.boolean().nullish()
881
888
  })
882
889
  ])
883
890
  ).nullish()
884
891
  });
885
- var groundingChunkSchema = import_zod3.z.object({
886
- web: import_zod3.z.object({ uri: import_zod3.z.string(), title: import_zod3.z.string() }).nullish(),
887
- retrievedContext: import_zod3.z.object({ uri: import_zod3.z.string(), title: import_zod3.z.string() }).nullish()
892
+ var groundingChunkSchema = import_v43.z.object({
893
+ web: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish(),
894
+ retrievedContext: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish()
888
895
  });
889
- var groundingMetadataSchema = import_zod3.z.object({
890
- webSearchQueries: import_zod3.z.array(import_zod3.z.string()).nullish(),
891
- retrievalQueries: import_zod3.z.array(import_zod3.z.string()).nullish(),
892
- searchEntryPoint: import_zod3.z.object({ renderedContent: import_zod3.z.string() }).nullish(),
893
- groundingChunks: import_zod3.z.array(groundingChunkSchema).nullish(),
894
- groundingSupports: import_zod3.z.array(
895
- import_zod3.z.object({
896
- segment: import_zod3.z.object({
897
- startIndex: import_zod3.z.number().nullish(),
898
- endIndex: import_zod3.z.number().nullish(),
899
- text: import_zod3.z.string().nullish()
896
+ var groundingMetadataSchema = import_v43.z.object({
897
+ webSearchQueries: import_v43.z.array(import_v43.z.string()).nullish(),
898
+ retrievalQueries: import_v43.z.array(import_v43.z.string()).nullish(),
899
+ searchEntryPoint: import_v43.z.object({ renderedContent: import_v43.z.string() }).nullish(),
900
+ groundingChunks: import_v43.z.array(groundingChunkSchema).nullish(),
901
+ groundingSupports: import_v43.z.array(
902
+ import_v43.z.object({
903
+ segment: import_v43.z.object({
904
+ startIndex: import_v43.z.number().nullish(),
905
+ endIndex: import_v43.z.number().nullish(),
906
+ text: import_v43.z.string().nullish()
900
907
  }),
901
- segment_text: import_zod3.z.string().nullish(),
902
- groundingChunkIndices: import_zod3.z.array(import_zod3.z.number()).nullish(),
903
- supportChunkIndices: import_zod3.z.array(import_zod3.z.number()).nullish(),
904
- confidenceScores: import_zod3.z.array(import_zod3.z.number()).nullish(),
905
- confidenceScore: import_zod3.z.array(import_zod3.z.number()).nullish()
908
+ segment_text: import_v43.z.string().nullish(),
909
+ groundingChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
910
+ supportChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
911
+ confidenceScores: import_v43.z.array(import_v43.z.number()).nullish(),
912
+ confidenceScore: import_v43.z.array(import_v43.z.number()).nullish()
906
913
  })
907
914
  ).nullish(),
908
- retrievalMetadata: import_zod3.z.union([
909
- import_zod3.z.object({
910
- webDynamicRetrievalScore: import_zod3.z.number()
915
+ retrievalMetadata: import_v43.z.union([
916
+ import_v43.z.object({
917
+ webDynamicRetrievalScore: import_v43.z.number()
911
918
  }),
912
- import_zod3.z.object({})
919
+ import_v43.z.object({})
913
920
  ]).nullish()
914
921
  });
915
- var safetyRatingSchema = import_zod3.z.object({
916
- category: import_zod3.z.string().nullish(),
917
- probability: import_zod3.z.string().nullish(),
918
- probabilityScore: import_zod3.z.number().nullish(),
919
- severity: import_zod3.z.string().nullish(),
920
- severityScore: import_zod3.z.number().nullish(),
921
- blocked: import_zod3.z.boolean().nullish()
922
+ var safetyRatingSchema = import_v43.z.object({
923
+ category: import_v43.z.string().nullish(),
924
+ probability: import_v43.z.string().nullish(),
925
+ probabilityScore: import_v43.z.number().nullish(),
926
+ severity: import_v43.z.string().nullish(),
927
+ severityScore: import_v43.z.number().nullish(),
928
+ blocked: import_v43.z.boolean().nullish()
922
929
  });
923
- var usageSchema = import_zod3.z.object({
924
- cachedContentTokenCount: import_zod3.z.number().nullish(),
925
- thoughtsTokenCount: import_zod3.z.number().nullish(),
926
- promptTokenCount: import_zod3.z.number().nullish(),
927
- candidatesTokenCount: import_zod3.z.number().nullish(),
928
- totalTokenCount: import_zod3.z.number().nullish()
930
+ var usageSchema = import_v43.z.object({
931
+ cachedContentTokenCount: import_v43.z.number().nullish(),
932
+ thoughtsTokenCount: import_v43.z.number().nullish(),
933
+ promptTokenCount: import_v43.z.number().nullish(),
934
+ candidatesTokenCount: import_v43.z.number().nullish(),
935
+ totalTokenCount: import_v43.z.number().nullish()
929
936
  });
930
- var responseSchema = import_zod3.z.object({
931
- candidates: import_zod3.z.array(
932
- import_zod3.z.object({
933
- content: contentSchema.nullish().or(import_zod3.z.object({}).strict()),
934
- finishReason: import_zod3.z.string().nullish(),
935
- safetyRatings: import_zod3.z.array(safetyRatingSchema).nullish(),
937
+ var responseSchema = import_v43.z.object({
938
+ candidates: import_v43.z.array(
939
+ import_v43.z.object({
940
+ content: contentSchema.nullish().or(import_v43.z.object({}).strict()),
941
+ finishReason: import_v43.z.string().nullish(),
942
+ safetyRatings: import_v43.z.array(safetyRatingSchema).nullish(),
936
943
  groundingMetadata: groundingMetadataSchema.nullish()
937
944
  })
938
945
  ),
939
946
  usageMetadata: usageSchema.nullish()
940
947
  });
941
- var chunkSchema = import_zod3.z.object({
942
- candidates: import_zod3.z.array(
943
- import_zod3.z.object({
948
+ var chunkSchema = import_v43.z.object({
949
+ candidates: import_v43.z.array(
950
+ import_v43.z.object({
944
951
  content: contentSchema.nullish(),
945
- finishReason: import_zod3.z.string().nullish(),
946
- safetyRatings: import_zod3.z.array(safetyRatingSchema).nullish(),
952
+ finishReason: import_v43.z.string().nullish(),
953
+ safetyRatings: import_v43.z.array(safetyRatingSchema).nullish(),
947
954
  groundingMetadata: groundingMetadataSchema.nullish()
948
955
  })
949
956
  ).nullish(),