@ai-sdk/google 3.0.0-beta.14 → 3.0.0-beta.16

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,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,20 +17,29 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/internal/index.ts
21
31
  var internal_exports = {};
22
32
  __export(internal_exports, {
23
33
  GoogleGenerativeAILanguageModel: () => GoogleGenerativeAILanguageModel,
24
- googleTools: () => googleTools,
25
- safetyRatingSchema: () => safetyRatingSchema
34
+ getGroundingMetadataSchema: () => getGroundingMetadataSchema,
35
+ getUrlContextMetadataSchema: () => getUrlContextMetadataSchema,
36
+ googleTools: () => googleTools
26
37
  });
27
38
  module.exports = __toCommonJS(internal_exports);
28
39
 
29
40
  // src/google-generative-ai-language-model.ts
30
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
31
- var import_v45 = require("zod/v4");
41
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
42
+ var z3 = __toESM(require("zod/v4"));
32
43
 
33
44
  // src/convert-json-schema-to-openapi-schema.ts
34
45
  function convertJSONSchemaToOpenAPISchema(jsonSchema) {
@@ -301,97 +312,106 @@ function getModelPath(modelId) {
301
312
 
302
313
  // src/google-error.ts
303
314
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
304
- var import_v4 = require("zod/v4");
305
- var googleErrorDataSchema = import_v4.z.object({
306
- error: import_v4.z.object({
307
- code: import_v4.z.number().nullable(),
308
- message: import_v4.z.string(),
309
- status: import_v4.z.string()
310
- })
311
- });
315
+ var z = __toESM(require("zod/v4"));
316
+ var googleErrorDataSchema = (0, import_provider_utils2.lazySchema)(
317
+ () => (0, import_provider_utils2.zodSchema)(
318
+ z.object({
319
+ error: z.object({
320
+ code: z.number().nullable(),
321
+ message: z.string(),
322
+ status: z.string()
323
+ })
324
+ })
325
+ )
326
+ );
312
327
  var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
313
328
  errorSchema: googleErrorDataSchema,
314
329
  errorToMessage: (data) => data.error.message
315
330
  });
316
331
 
317
332
  // src/google-generative-ai-options.ts
318
- var import_v42 = require("zod/v4");
319
- var googleGenerativeAIProviderOptions = import_v42.z.object({
320
- responseModalities: import_v42.z.array(import_v42.z.enum(["TEXT", "IMAGE"])).optional(),
321
- thinkingConfig: import_v42.z.object({
322
- thinkingBudget: import_v42.z.number().optional(),
323
- includeThoughts: import_v42.z.boolean().optional()
324
- }).optional(),
325
- /**
326
- Optional.
327
- The name of the cached content used as context to serve the prediction.
328
- Format: cachedContents/{cachedContent}
329
- */
330
- cachedContent: import_v42.z.string().optional(),
331
- /**
332
- * Optional. Enable structured output. Default is true.
333
- *
334
- * This is useful when the JSON Schema contains elements that are
335
- * not supported by the OpenAPI schema version that
336
- * Google Generative AI uses. You can use this to disable
337
- * structured outputs if you need to.
338
- */
339
- structuredOutputs: import_v42.z.boolean().optional(),
340
- /**
341
- Optional. A list of unique safety settings for blocking unsafe content.
342
- */
343
- safetySettings: import_v42.z.array(
344
- import_v42.z.object({
345
- category: import_v42.z.enum([
346
- "HARM_CATEGORY_UNSPECIFIED",
347
- "HARM_CATEGORY_HATE_SPEECH",
348
- "HARM_CATEGORY_DANGEROUS_CONTENT",
349
- "HARM_CATEGORY_HARASSMENT",
350
- "HARM_CATEGORY_SEXUALLY_EXPLICIT",
351
- "HARM_CATEGORY_CIVIC_INTEGRITY"
352
- ]),
353
- threshold: import_v42.z.enum([
333
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
334
+ var z2 = __toESM(require("zod/v4"));
335
+ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
336
+ () => (0, import_provider_utils3.zodSchema)(
337
+ z2.object({
338
+ responseModalities: z2.array(z2.enum(["TEXT", "IMAGE"])).optional(),
339
+ thinkingConfig: z2.object({
340
+ thinkingBudget: z2.number().optional(),
341
+ includeThoughts: z2.boolean().optional()
342
+ }).optional(),
343
+ /**
344
+ * Optional.
345
+ * The name of the cached content used as context to serve the prediction.
346
+ * Format: cachedContents/{cachedContent}
347
+ */
348
+ cachedContent: z2.string().optional(),
349
+ /**
350
+ * Optional. Enable structured output. Default is true.
351
+ *
352
+ * This is useful when the JSON Schema contains elements that are
353
+ * not supported by the OpenAPI schema version that
354
+ * Google Generative AI uses. You can use this to disable
355
+ * structured outputs if you need to.
356
+ */
357
+ structuredOutputs: z2.boolean().optional(),
358
+ /**
359
+ * Optional. A list of unique safety settings for blocking unsafe content.
360
+ */
361
+ safetySettings: z2.array(
362
+ z2.object({
363
+ category: z2.enum([
364
+ "HARM_CATEGORY_UNSPECIFIED",
365
+ "HARM_CATEGORY_HATE_SPEECH",
366
+ "HARM_CATEGORY_DANGEROUS_CONTENT",
367
+ "HARM_CATEGORY_HARASSMENT",
368
+ "HARM_CATEGORY_SEXUALLY_EXPLICIT",
369
+ "HARM_CATEGORY_CIVIC_INTEGRITY"
370
+ ]),
371
+ threshold: z2.enum([
372
+ "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
373
+ "BLOCK_LOW_AND_ABOVE",
374
+ "BLOCK_MEDIUM_AND_ABOVE",
375
+ "BLOCK_ONLY_HIGH",
376
+ "BLOCK_NONE",
377
+ "OFF"
378
+ ])
379
+ })
380
+ ).optional(),
381
+ threshold: z2.enum([
354
382
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
355
383
  "BLOCK_LOW_AND_ABOVE",
356
384
  "BLOCK_MEDIUM_AND_ABOVE",
357
385
  "BLOCK_ONLY_HIGH",
358
386
  "BLOCK_NONE",
359
387
  "OFF"
360
- ])
388
+ ]).optional(),
389
+ /**
390
+ * Optional. Enables timestamp understanding for audio-only files.
391
+ *
392
+ * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
393
+ */
394
+ audioTimestamp: z2.boolean().optional(),
395
+ /**
396
+ * Optional. Defines labels used in billing reports. Available on Vertex AI only.
397
+ *
398
+ * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
399
+ */
400
+ labels: z2.record(z2.string(), z2.string()).optional(),
401
+ /**
402
+ * Optional. If specified, the media resolution specified will be used.
403
+ *
404
+ * https://ai.google.dev/api/generate-content#MediaResolution
405
+ */
406
+ mediaResolution: z2.enum([
407
+ "MEDIA_RESOLUTION_UNSPECIFIED",
408
+ "MEDIA_RESOLUTION_LOW",
409
+ "MEDIA_RESOLUTION_MEDIUM",
410
+ "MEDIA_RESOLUTION_HIGH"
411
+ ]).optional()
361
412
  })
362
- ).optional(),
363
- threshold: import_v42.z.enum([
364
- "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
365
- "BLOCK_LOW_AND_ABOVE",
366
- "BLOCK_MEDIUM_AND_ABOVE",
367
- "BLOCK_ONLY_HIGH",
368
- "BLOCK_NONE",
369
- "OFF"
370
- ]).optional(),
371
- /**
372
- * Optional. Enables timestamp understanding for audio-only files.
373
- *
374
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
375
- */
376
- audioTimestamp: import_v42.z.boolean().optional(),
377
- /**
378
- * Optional. Defines labels used in billing reports. Available on Vertex AI only.
379
- *
380
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
381
- */
382
- labels: import_v42.z.record(import_v42.z.string(), import_v42.z.string()).optional(),
383
- /**
384
- * Optional. If specified, the media resolution specified will be used.
385
- *
386
- * https://ai.google.dev/api/generate-content#MediaResolution
387
- */
388
- mediaResolution: import_v42.z.enum([
389
- "MEDIA_RESOLUTION_UNSPECIFIED",
390
- "MEDIA_RESOLUTION_LOW",
391
- "MEDIA_RESOLUTION_MEDIUM",
392
- "MEDIA_RESOLUTION_HIGH"
393
- ]).optional()
394
- });
413
+ )
414
+ );
395
415
 
396
416
  // src/google-prepare-tools.ts
397
417
  var import_provider2 = require("@ai-sdk/provider");
@@ -567,64 +587,6 @@ function mapGoogleGenerativeAIFinishReason({
567
587
  }
568
588
  }
569
589
 
570
- // src/tool/google-search.ts
571
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
572
- var import_v43 = require("zod/v4");
573
- var groundingChunkSchema = import_v43.z.object({
574
- web: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish(),
575
- retrievedContext: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish()
576
- });
577
- var groundingMetadataSchema = import_v43.z.object({
578
- webSearchQueries: import_v43.z.array(import_v43.z.string()).nullish(),
579
- retrievalQueries: import_v43.z.array(import_v43.z.string()).nullish(),
580
- searchEntryPoint: import_v43.z.object({ renderedContent: import_v43.z.string() }).nullish(),
581
- groundingChunks: import_v43.z.array(groundingChunkSchema).nullish(),
582
- groundingSupports: import_v43.z.array(
583
- import_v43.z.object({
584
- segment: import_v43.z.object({
585
- startIndex: import_v43.z.number().nullish(),
586
- endIndex: import_v43.z.number().nullish(),
587
- text: import_v43.z.string().nullish()
588
- }),
589
- segment_text: import_v43.z.string().nullish(),
590
- groundingChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
591
- supportChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
592
- confidenceScores: import_v43.z.array(import_v43.z.number()).nullish(),
593
- confidenceScore: import_v43.z.array(import_v43.z.number()).nullish()
594
- })
595
- ).nullish(),
596
- retrievalMetadata: import_v43.z.union([
597
- import_v43.z.object({
598
- webDynamicRetrievalScore: import_v43.z.number()
599
- }),
600
- import_v43.z.object({})
601
- ]).nullish()
602
- });
603
- var googleSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
604
- id: "google.google_search",
605
- name: "google_search",
606
- inputSchema: import_v43.z.object({
607
- mode: import_v43.z.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
608
- dynamicThreshold: import_v43.z.number().default(1)
609
- })
610
- });
611
-
612
- // src/tool/url-context.ts
613
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
614
- var import_v44 = require("zod/v4");
615
- var urlMetadataSchema = import_v44.z.object({
616
- retrievedUrl: import_v44.z.string(),
617
- urlRetrievalStatus: import_v44.z.string()
618
- });
619
- var urlContextMetadataSchema = import_v44.z.object({
620
- urlMetadata: import_v44.z.array(urlMetadataSchema)
621
- });
622
- var urlContext = (0, import_provider_utils4.createProviderDefinedToolFactory)({
623
- id: "google.url_context",
624
- name: "url_context",
625
- inputSchema: import_v44.z.object({})
626
- });
627
-
628
590
  // src/google-generative-ai-language-model.ts
629
591
  var GoogleGenerativeAILanguageModel = class {
630
592
  constructor(modelId, config) {
@@ -632,7 +594,7 @@ var GoogleGenerativeAILanguageModel = class {
632
594
  var _a;
633
595
  this.modelId = modelId;
634
596
  this.config = config;
635
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils5.generateId;
597
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils4.generateId;
636
598
  }
637
599
  get provider() {
638
600
  return this.config.provider;
@@ -658,7 +620,7 @@ var GoogleGenerativeAILanguageModel = class {
658
620
  }) {
659
621
  var _a, _b;
660
622
  const warnings = [];
661
- const googleOptions = await (0, import_provider_utils5.parseProviderOptions)({
623
+ const googleOptions = await (0, import_provider_utils4.parseProviderOptions)({
662
624
  provider: "google",
663
625
  providerOptions,
664
626
  schema: googleGenerativeAIProviderOptions
@@ -726,22 +688,22 @@ var GoogleGenerativeAILanguageModel = class {
726
688
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
727
689
  const { args, warnings } = await this.getArgs(options);
728
690
  const body = JSON.stringify(args);
729
- const mergedHeaders = (0, import_provider_utils5.combineHeaders)(
730
- await (0, import_provider_utils5.resolve)(this.config.headers),
691
+ const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
692
+ await (0, import_provider_utils4.resolve)(this.config.headers),
731
693
  options.headers
732
694
  );
733
695
  const {
734
696
  responseHeaders,
735
697
  value: response,
736
698
  rawValue: rawResponse
737
- } = await (0, import_provider_utils5.postJsonToApi)({
699
+ } = await (0, import_provider_utils4.postJsonToApi)({
738
700
  url: `${this.config.baseURL}/${getModelPath(
739
701
  this.modelId
740
702
  )}:generateContent`,
741
703
  headers: mergedHeaders,
742
704
  body: args,
743
705
  failedResponseHandler: googleFailedResponseHandler,
744
- successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(responseSchema),
706
+ successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(responseSchema),
745
707
  abortSignal: options.abortSignal,
746
708
  fetch: this.config.fetch
747
709
  });
@@ -837,18 +799,18 @@ var GoogleGenerativeAILanguageModel = class {
837
799
  async doStream(options) {
838
800
  const { args, warnings } = await this.getArgs(options);
839
801
  const body = JSON.stringify(args);
840
- const headers = (0, import_provider_utils5.combineHeaders)(
841
- await (0, import_provider_utils5.resolve)(this.config.headers),
802
+ const headers = (0, import_provider_utils4.combineHeaders)(
803
+ await (0, import_provider_utils4.resolve)(this.config.headers),
842
804
  options.headers
843
805
  );
844
- const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({
806
+ const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
845
807
  url: `${this.config.baseURL}/${getModelPath(
846
808
  this.modelId
847
809
  )}:streamGenerateContent?alt=sse`,
848
810
  headers,
849
811
  body: args,
850
812
  failedResponseHandler: googleFailedResponseHandler,
851
- successfulResponseHandler: (0, import_provider_utils5.createEventSourceResponseHandler)(chunkSchema),
813
+ successfulResponseHandler: (0, import_provider_utils4.createEventSourceResponseHandler)(chunkSchema),
852
814
  abortSignal: options.abortSignal,
853
815
  fetch: this.config.fetch
854
816
  });
@@ -1120,103 +1082,175 @@ function extractSources({
1120
1082
  title: chunk.web.title
1121
1083
  }));
1122
1084
  }
1123
- var contentSchema = import_v45.z.object({
1124
- parts: import_v45.z.array(
1125
- import_v45.z.union([
1085
+ var getGroundingMetadataSchema = () => z3.object({
1086
+ webSearchQueries: z3.array(z3.string()).nullish(),
1087
+ retrievalQueries: z3.array(z3.string()).nullish(),
1088
+ searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
1089
+ groundingChunks: z3.array(
1090
+ z3.object({
1091
+ web: z3.object({ uri: z3.string(), title: z3.string() }).nullish(),
1092
+ retrievedContext: z3.object({ uri: z3.string(), title: z3.string() }).nullish()
1093
+ })
1094
+ ).nullish(),
1095
+ groundingSupports: z3.array(
1096
+ z3.object({
1097
+ segment: z3.object({
1098
+ startIndex: z3.number().nullish(),
1099
+ endIndex: z3.number().nullish(),
1100
+ text: z3.string().nullish()
1101
+ }),
1102
+ segment_text: z3.string().nullish(),
1103
+ groundingChunkIndices: z3.array(z3.number()).nullish(),
1104
+ supportChunkIndices: z3.array(z3.number()).nullish(),
1105
+ confidenceScores: z3.array(z3.number()).nullish(),
1106
+ confidenceScore: z3.array(z3.number()).nullish()
1107
+ })
1108
+ ).nullish(),
1109
+ retrievalMetadata: z3.union([
1110
+ z3.object({
1111
+ webDynamicRetrievalScore: z3.number()
1112
+ }),
1113
+ z3.object({})
1114
+ ]).nullish()
1115
+ });
1116
+ var getContentSchema = () => z3.object({
1117
+ parts: z3.array(
1118
+ z3.union([
1126
1119
  // note: order matters since text can be fully empty
1127
- import_v45.z.object({
1128
- functionCall: import_v45.z.object({
1129
- name: import_v45.z.string(),
1130
- args: import_v45.z.unknown()
1120
+ z3.object({
1121
+ functionCall: z3.object({
1122
+ name: z3.string(),
1123
+ args: z3.unknown()
1131
1124
  }),
1132
- thoughtSignature: import_v45.z.string().nullish()
1125
+ thoughtSignature: z3.string().nullish()
1133
1126
  }),
1134
- import_v45.z.object({
1135
- inlineData: import_v45.z.object({
1136
- mimeType: import_v45.z.string(),
1137
- data: import_v45.z.string()
1127
+ z3.object({
1128
+ inlineData: z3.object({
1129
+ mimeType: z3.string(),
1130
+ data: z3.string()
1138
1131
  })
1139
1132
  }),
1140
- import_v45.z.object({
1141
- executableCode: import_v45.z.object({
1142
- language: import_v45.z.string(),
1143
- code: import_v45.z.string()
1133
+ z3.object({
1134
+ executableCode: z3.object({
1135
+ language: z3.string(),
1136
+ code: z3.string()
1144
1137
  }).nullish(),
1145
- codeExecutionResult: import_v45.z.object({
1146
- outcome: import_v45.z.string(),
1147
- output: import_v45.z.string()
1138
+ codeExecutionResult: z3.object({
1139
+ outcome: z3.string(),
1140
+ output: z3.string()
1148
1141
  }).nullish(),
1149
- text: import_v45.z.string().nullish(),
1150
- thought: import_v45.z.boolean().nullish(),
1151
- thoughtSignature: import_v45.z.string().nullish()
1142
+ text: z3.string().nullish(),
1143
+ thought: z3.boolean().nullish(),
1144
+ thoughtSignature: z3.string().nullish()
1152
1145
  })
1153
1146
  ])
1154
1147
  ).nullish()
1155
1148
  });
1156
- var safetyRatingSchema = import_v45.z.object({
1157
- category: import_v45.z.string().nullish(),
1158
- probability: import_v45.z.string().nullish(),
1159
- probabilityScore: import_v45.z.number().nullish(),
1160
- severity: import_v45.z.string().nullish(),
1161
- severityScore: import_v45.z.number().nullish(),
1162
- blocked: import_v45.z.boolean().nullish()
1149
+ var getSafetyRatingSchema = () => z3.object({
1150
+ category: z3.string().nullish(),
1151
+ probability: z3.string().nullish(),
1152
+ probabilityScore: z3.number().nullish(),
1153
+ severity: z3.string().nullish(),
1154
+ severityScore: z3.number().nullish(),
1155
+ blocked: z3.boolean().nullish()
1163
1156
  });
1164
- var usageSchema = import_v45.z.object({
1165
- cachedContentTokenCount: import_v45.z.number().nullish(),
1166
- thoughtsTokenCount: import_v45.z.number().nullish(),
1167
- promptTokenCount: import_v45.z.number().nullish(),
1168
- candidatesTokenCount: import_v45.z.number().nullish(),
1169
- totalTokenCount: import_v45.z.number().nullish()
1157
+ var usageSchema = z3.object({
1158
+ cachedContentTokenCount: z3.number().nullish(),
1159
+ thoughtsTokenCount: z3.number().nullish(),
1160
+ promptTokenCount: z3.number().nullish(),
1161
+ candidatesTokenCount: z3.number().nullish(),
1162
+ totalTokenCount: z3.number().nullish()
1170
1163
  });
1171
- var responseSchema = import_v45.z.object({
1172
- candidates: import_v45.z.array(
1173
- import_v45.z.object({
1174
- content: contentSchema.nullish().or(import_v45.z.object({}).strict()),
1175
- finishReason: import_v45.z.string().nullish(),
1176
- safetyRatings: import_v45.z.array(safetyRatingSchema).nullish(),
1177
- groundingMetadata: groundingMetadataSchema.nullish(),
1178
- urlContextMetadata: urlContextMetadataSchema.nullish()
1164
+ var getUrlContextMetadataSchema = () => z3.object({
1165
+ urlMetadata: z3.array(
1166
+ z3.object({
1167
+ retrievedUrl: z3.string(),
1168
+ urlRetrievalStatus: z3.string()
1179
1169
  })
1180
- ),
1181
- usageMetadata: usageSchema.nullish(),
1182
- promptFeedback: import_v45.z.object({
1183
- blockReason: import_v45.z.string().nullish(),
1184
- safetyRatings: import_v45.z.array(safetyRatingSchema).nullish()
1185
- }).nullish()
1170
+ )
1186
1171
  });
1187
- var chunkSchema = import_v45.z.object({
1188
- candidates: import_v45.z.array(
1189
- import_v45.z.object({
1190
- content: contentSchema.nullish(),
1191
- finishReason: import_v45.z.string().nullish(),
1192
- safetyRatings: import_v45.z.array(safetyRatingSchema).nullish(),
1193
- groundingMetadata: groundingMetadataSchema.nullish(),
1194
- urlContextMetadata: urlContextMetadataSchema.nullish()
1172
+ var responseSchema = (0, import_provider_utils4.lazySchema)(
1173
+ () => (0, import_provider_utils4.zodSchema)(
1174
+ z3.object({
1175
+ candidates: z3.array(
1176
+ z3.object({
1177
+ content: getContentSchema().nullish().or(z3.object({}).strict()),
1178
+ finishReason: z3.string().nullish(),
1179
+ safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
1180
+ groundingMetadata: getGroundingMetadataSchema().nullish(),
1181
+ urlContextMetadata: getUrlContextMetadataSchema().nullish()
1182
+ })
1183
+ ),
1184
+ usageMetadata: usageSchema.nullish(),
1185
+ promptFeedback: z3.object({
1186
+ blockReason: z3.string().nullish(),
1187
+ safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
1188
+ }).nullish()
1195
1189
  })
1196
- ).nullish(),
1197
- usageMetadata: usageSchema.nullish(),
1198
- promptFeedback: import_v45.z.object({
1199
- blockReason: import_v45.z.string().nullish(),
1200
- safetyRatings: import_v45.z.array(safetyRatingSchema).nullish()
1201
- }).nullish()
1202
- });
1190
+ )
1191
+ );
1192
+ var chunkSchema = (0, import_provider_utils4.lazySchema)(
1193
+ () => (0, import_provider_utils4.zodSchema)(
1194
+ z3.object({
1195
+ candidates: z3.array(
1196
+ z3.object({
1197
+ content: getContentSchema().nullish(),
1198
+ finishReason: z3.string().nullish(),
1199
+ safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
1200
+ groundingMetadata: getGroundingMetadataSchema().nullish(),
1201
+ urlContextMetadata: getUrlContextMetadataSchema().nullish()
1202
+ })
1203
+ ).nullish(),
1204
+ usageMetadata: usageSchema.nullish(),
1205
+ promptFeedback: z3.object({
1206
+ blockReason: z3.string().nullish(),
1207
+ safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
1208
+ }).nullish()
1209
+ })
1210
+ )
1211
+ );
1203
1212
 
1204
1213
  // src/tool/code-execution.ts
1205
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1206
- var import_v46 = require("zod/v4");
1207
- var codeExecution = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
1214
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1215
+ var z4 = __toESM(require("zod/v4"));
1216
+ var codeExecution = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1208
1217
  id: "google.code_execution",
1209
1218
  name: "code_execution",
1210
- inputSchema: import_v46.z.object({
1211
- language: import_v46.z.string().describe("The programming language of the code."),
1212
- code: import_v46.z.string().describe("The code to be executed.")
1219
+ inputSchema: z4.object({
1220
+ language: z4.string().describe("The programming language of the code."),
1221
+ code: z4.string().describe("The code to be executed.")
1213
1222
  }),
1214
- outputSchema: import_v46.z.object({
1215
- outcome: import_v46.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
1216
- output: import_v46.z.string().describe("The output from the code execution.")
1223
+ outputSchema: z4.object({
1224
+ outcome: z4.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
1225
+ output: z4.string().describe("The output from the code execution.")
1217
1226
  })
1218
1227
  });
1219
1228
 
1229
+ // src/tool/google-search.ts
1230
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1231
+ var z5 = __toESM(require("zod/v4"));
1232
+ var googleSearch = (0, import_provider_utils6.createProviderDefinedToolFactory)({
1233
+ id: "google.google_search",
1234
+ name: "google_search",
1235
+ inputSchema: (0, import_provider_utils6.lazySchema)(
1236
+ () => (0, import_provider_utils6.zodSchema)(
1237
+ z5.object({
1238
+ mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1239
+ dynamicThreshold: z5.number().default(1)
1240
+ })
1241
+ )
1242
+ )
1243
+ });
1244
+
1245
+ // src/tool/url-context.ts
1246
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1247
+ var z6 = __toESM(require("zod/v4"));
1248
+ var urlContext = (0, import_provider_utils7.createProviderDefinedToolFactory)({
1249
+ id: "google.url_context",
1250
+ name: "url_context",
1251
+ inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(z6.object({})))
1252
+ });
1253
+
1220
1254
  // src/google-tools.ts
1221
1255
  var googleTools = {
1222
1256
  /**
@@ -1244,7 +1278,8 @@ var googleTools = {
1244
1278
  // Annotate the CommonJS export names for ESM import in node:
1245
1279
  0 && (module.exports = {
1246
1280
  GoogleGenerativeAILanguageModel,
1247
- googleTools,
1248
- safetyRatingSchema
1281
+ getGroundingMetadataSchema,
1282
+ getUrlContextMetadataSchema,
1283
+ googleTools
1249
1284
  });
1250
1285
  //# sourceMappingURL=index.js.map