@ai-sdk/google 2.0.17 → 2.0.19

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) {
@@ -53,12 +64,9 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
53
64
  enum: enumValues
54
65
  } = jsonSchema;
55
66
  const result = {};
56
- if (description)
57
- result.description = description;
58
- if (required)
59
- result.required = required;
60
- if (format)
61
- result.format = format;
67
+ if (description) result.description = description;
68
+ if (required) result.required = required;
69
+ if (format) result.format = format;
62
70
  if (constValue !== void 0) {
63
71
  result.enum = [constValue];
64
72
  }
@@ -304,86 +312,106 @@ function getModelPath(modelId) {
304
312
 
305
313
  // src/google-error.ts
306
314
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
307
- var import_v4 = require("zod/v4");
308
- var googleErrorDataSchema = import_v4.z.object({
309
- error: import_v4.z.object({
310
- code: import_v4.z.number().nullable(),
311
- message: import_v4.z.string(),
312
- status: import_v4.z.string()
313
- })
314
- });
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
+ );
315
327
  var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
316
328
  errorSchema: googleErrorDataSchema,
317
329
  errorToMessage: (data) => data.error.message
318
330
  });
319
331
 
320
332
  // src/google-generative-ai-options.ts
321
- var import_v42 = require("zod/v4");
322
- var googleGenerativeAIProviderOptions = import_v42.z.object({
323
- responseModalities: import_v42.z.array(import_v42.z.enum(["TEXT", "IMAGE"])).optional(),
324
- thinkingConfig: import_v42.z.object({
325
- thinkingBudget: import_v42.z.number().optional(),
326
- includeThoughts: import_v42.z.boolean().optional()
327
- }).optional(),
328
- /**
329
- Optional.
330
- The name of the cached content used as context to serve the prediction.
331
- Format: cachedContents/{cachedContent}
332
- */
333
- cachedContent: import_v42.z.string().optional(),
334
- /**
335
- * Optional. Enable structured output. Default is true.
336
- *
337
- * This is useful when the JSON Schema contains elements that are
338
- * not supported by the OpenAPI schema version that
339
- * Google Generative AI uses. You can use this to disable
340
- * structured outputs if you need to.
341
- */
342
- structuredOutputs: import_v42.z.boolean().optional(),
343
- /**
344
- Optional. A list of unique safety settings for blocking unsafe content.
345
- */
346
- safetySettings: import_v42.z.array(
347
- import_v42.z.object({
348
- category: import_v42.z.enum([
349
- "HARM_CATEGORY_UNSPECIFIED",
350
- "HARM_CATEGORY_HATE_SPEECH",
351
- "HARM_CATEGORY_DANGEROUS_CONTENT",
352
- "HARM_CATEGORY_HARASSMENT",
353
- "HARM_CATEGORY_SEXUALLY_EXPLICIT",
354
- "HARM_CATEGORY_CIVIC_INTEGRITY"
355
- ]),
356
- 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([
357
382
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
358
383
  "BLOCK_LOW_AND_ABOVE",
359
384
  "BLOCK_MEDIUM_AND_ABOVE",
360
385
  "BLOCK_ONLY_HIGH",
361
386
  "BLOCK_NONE",
362
387
  "OFF"
363
- ])
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()
364
412
  })
365
- ).optional(),
366
- threshold: import_v42.z.enum([
367
- "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
368
- "BLOCK_LOW_AND_ABOVE",
369
- "BLOCK_MEDIUM_AND_ABOVE",
370
- "BLOCK_ONLY_HIGH",
371
- "BLOCK_NONE",
372
- "OFF"
373
- ]).optional(),
374
- /**
375
- * Optional. Enables timestamp understanding for audio-only files.
376
- *
377
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
378
- */
379
- audioTimestamp: import_v42.z.boolean().optional(),
380
- /**
381
- * Optional. Defines labels used in billing reports. Available on Vertex AI only.
382
- *
383
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
384
- */
385
- labels: import_v42.z.record(import_v42.z.string(), import_v42.z.string()).optional()
386
- });
413
+ )
414
+ );
387
415
 
388
416
  // src/google-prepare-tools.ts
389
417
  var import_provider2 = require("@ai-sdk/provider");
@@ -554,64 +582,6 @@ function mapGoogleGenerativeAIFinishReason({
554
582
  }
555
583
  }
556
584
 
557
- // src/tool/google-search.ts
558
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
559
- var import_v43 = require("zod/v4");
560
- var groundingChunkSchema = import_v43.z.object({
561
- web: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish(),
562
- retrievedContext: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish()
563
- });
564
- var groundingMetadataSchema = import_v43.z.object({
565
- webSearchQueries: import_v43.z.array(import_v43.z.string()).nullish(),
566
- retrievalQueries: import_v43.z.array(import_v43.z.string()).nullish(),
567
- searchEntryPoint: import_v43.z.object({ renderedContent: import_v43.z.string() }).nullish(),
568
- groundingChunks: import_v43.z.array(groundingChunkSchema).nullish(),
569
- groundingSupports: import_v43.z.array(
570
- import_v43.z.object({
571
- segment: import_v43.z.object({
572
- startIndex: import_v43.z.number().nullish(),
573
- endIndex: import_v43.z.number().nullish(),
574
- text: import_v43.z.string().nullish()
575
- }),
576
- segment_text: import_v43.z.string().nullish(),
577
- groundingChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
578
- supportChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
579
- confidenceScores: import_v43.z.array(import_v43.z.number()).nullish(),
580
- confidenceScore: import_v43.z.array(import_v43.z.number()).nullish()
581
- })
582
- ).nullish(),
583
- retrievalMetadata: import_v43.z.union([
584
- import_v43.z.object({
585
- webDynamicRetrievalScore: import_v43.z.number()
586
- }),
587
- import_v43.z.object({})
588
- ]).nullish()
589
- });
590
- var googleSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
591
- id: "google.google_search",
592
- name: "google_search",
593
- inputSchema: import_v43.z.object({
594
- mode: import_v43.z.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
595
- dynamicThreshold: import_v43.z.number().default(1)
596
- })
597
- });
598
-
599
- // src/tool/url-context.ts
600
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
601
- var import_v44 = require("zod/v4");
602
- var urlMetadataSchema = import_v44.z.object({
603
- retrievedUrl: import_v44.z.string(),
604
- urlRetrievalStatus: import_v44.z.string()
605
- });
606
- var urlContextMetadataSchema = import_v44.z.object({
607
- urlMetadata: import_v44.z.array(urlMetadataSchema)
608
- });
609
- var urlContext = (0, import_provider_utils4.createProviderDefinedToolFactory)({
610
- id: "google.url_context",
611
- name: "url_context",
612
- inputSchema: import_v44.z.object({})
613
- });
614
-
615
585
  // src/google-generative-ai-language-model.ts
616
586
  var GoogleGenerativeAILanguageModel = class {
617
587
  constructor(modelId, config) {
@@ -619,7 +589,7 @@ var GoogleGenerativeAILanguageModel = class {
619
589
  var _a;
620
590
  this.modelId = modelId;
621
591
  this.config = config;
622
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils5.generateId;
592
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils4.generateId;
623
593
  }
624
594
  get provider() {
625
595
  return this.config.provider;
@@ -645,7 +615,7 @@ var GoogleGenerativeAILanguageModel = class {
645
615
  }) {
646
616
  var _a, _b;
647
617
  const warnings = [];
648
- const googleOptions = await (0, import_provider_utils5.parseProviderOptions)({
618
+ const googleOptions = await (0, import_provider_utils4.parseProviderOptions)({
649
619
  provider: "google",
650
620
  providerOptions,
651
621
  schema: googleGenerativeAIProviderOptions
@@ -710,22 +680,22 @@ var GoogleGenerativeAILanguageModel = class {
710
680
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
711
681
  const { args, warnings } = await this.getArgs(options);
712
682
  const body = JSON.stringify(args);
713
- const mergedHeaders = (0, import_provider_utils5.combineHeaders)(
714
- await (0, import_provider_utils5.resolve)(this.config.headers),
683
+ const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
684
+ await (0, import_provider_utils4.resolve)(this.config.headers),
715
685
  options.headers
716
686
  );
717
687
  const {
718
688
  responseHeaders,
719
689
  value: response,
720
690
  rawValue: rawResponse
721
- } = await (0, import_provider_utils5.postJsonToApi)({
691
+ } = await (0, import_provider_utils4.postJsonToApi)({
722
692
  url: `${this.config.baseURL}/${getModelPath(
723
693
  this.modelId
724
694
  )}:generateContent`,
725
695
  headers: mergedHeaders,
726
696
  body: args,
727
697
  failedResponseHandler: googleFailedResponseHandler,
728
- successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(responseSchema),
698
+ successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(responseSchema),
729
699
  abortSignal: options.abortSignal,
730
700
  fetch: this.config.fetch
731
701
  });
@@ -821,18 +791,18 @@ var GoogleGenerativeAILanguageModel = class {
821
791
  async doStream(options) {
822
792
  const { args, warnings } = await this.getArgs(options);
823
793
  const body = JSON.stringify(args);
824
- const headers = (0, import_provider_utils5.combineHeaders)(
825
- await (0, import_provider_utils5.resolve)(this.config.headers),
794
+ const headers = (0, import_provider_utils4.combineHeaders)(
795
+ await (0, import_provider_utils4.resolve)(this.config.headers),
826
796
  options.headers
827
797
  );
828
- const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({
798
+ const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
829
799
  url: `${this.config.baseURL}/${getModelPath(
830
800
  this.modelId
831
801
  )}:streamGenerateContent?alt=sse`,
832
802
  headers,
833
803
  body: args,
834
804
  failedResponseHandler: googleFailedResponseHandler,
835
- successfulResponseHandler: (0, import_provider_utils5.createEventSourceResponseHandler)(chunkSchema),
805
+ successfulResponseHandler: (0, import_provider_utils4.createEventSourceResponseHandler)(chunkSchema),
836
806
  abortSignal: options.abortSignal,
837
807
  fetch: this.config.fetch
838
808
  });
@@ -1104,103 +1074,175 @@ function extractSources({
1104
1074
  title: chunk.web.title
1105
1075
  }));
1106
1076
  }
1107
- var contentSchema = import_v45.z.object({
1108
- parts: import_v45.z.array(
1109
- import_v45.z.union([
1077
+ var getGroundingMetadataSchema = () => z3.object({
1078
+ webSearchQueries: z3.array(z3.string()).nullish(),
1079
+ retrievalQueries: z3.array(z3.string()).nullish(),
1080
+ searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
1081
+ groundingChunks: z3.array(
1082
+ z3.object({
1083
+ web: z3.object({ uri: z3.string(), title: z3.string() }).nullish(),
1084
+ retrievedContext: z3.object({ uri: z3.string(), title: z3.string() }).nullish()
1085
+ })
1086
+ ).nullish(),
1087
+ groundingSupports: z3.array(
1088
+ z3.object({
1089
+ segment: z3.object({
1090
+ startIndex: z3.number().nullish(),
1091
+ endIndex: z3.number().nullish(),
1092
+ text: z3.string().nullish()
1093
+ }),
1094
+ segment_text: z3.string().nullish(),
1095
+ groundingChunkIndices: z3.array(z3.number()).nullish(),
1096
+ supportChunkIndices: z3.array(z3.number()).nullish(),
1097
+ confidenceScores: z3.array(z3.number()).nullish(),
1098
+ confidenceScore: z3.array(z3.number()).nullish()
1099
+ })
1100
+ ).nullish(),
1101
+ retrievalMetadata: z3.union([
1102
+ z3.object({
1103
+ webDynamicRetrievalScore: z3.number()
1104
+ }),
1105
+ z3.object({})
1106
+ ]).nullish()
1107
+ });
1108
+ var getContentSchema = () => z3.object({
1109
+ parts: z3.array(
1110
+ z3.union([
1110
1111
  // note: order matters since text can be fully empty
1111
- import_v45.z.object({
1112
- functionCall: import_v45.z.object({
1113
- name: import_v45.z.string(),
1114
- args: import_v45.z.unknown()
1112
+ z3.object({
1113
+ functionCall: z3.object({
1114
+ name: z3.string(),
1115
+ args: z3.unknown()
1115
1116
  }),
1116
- thoughtSignature: import_v45.z.string().nullish()
1117
+ thoughtSignature: z3.string().nullish()
1117
1118
  }),
1118
- import_v45.z.object({
1119
- inlineData: import_v45.z.object({
1120
- mimeType: import_v45.z.string(),
1121
- data: import_v45.z.string()
1119
+ z3.object({
1120
+ inlineData: z3.object({
1121
+ mimeType: z3.string(),
1122
+ data: z3.string()
1122
1123
  })
1123
1124
  }),
1124
- import_v45.z.object({
1125
- executableCode: import_v45.z.object({
1126
- language: import_v45.z.string(),
1127
- code: import_v45.z.string()
1125
+ z3.object({
1126
+ executableCode: z3.object({
1127
+ language: z3.string(),
1128
+ code: z3.string()
1128
1129
  }).nullish(),
1129
- codeExecutionResult: import_v45.z.object({
1130
- outcome: import_v45.z.string(),
1131
- output: import_v45.z.string()
1130
+ codeExecutionResult: z3.object({
1131
+ outcome: z3.string(),
1132
+ output: z3.string()
1132
1133
  }).nullish(),
1133
- text: import_v45.z.string().nullish(),
1134
- thought: import_v45.z.boolean().nullish(),
1135
- thoughtSignature: import_v45.z.string().nullish()
1134
+ text: z3.string().nullish(),
1135
+ thought: z3.boolean().nullish(),
1136
+ thoughtSignature: z3.string().nullish()
1136
1137
  })
1137
1138
  ])
1138
1139
  ).nullish()
1139
1140
  });
1140
- var safetyRatingSchema = import_v45.z.object({
1141
- category: import_v45.z.string().nullish(),
1142
- probability: import_v45.z.string().nullish(),
1143
- probabilityScore: import_v45.z.number().nullish(),
1144
- severity: import_v45.z.string().nullish(),
1145
- severityScore: import_v45.z.number().nullish(),
1146
- blocked: import_v45.z.boolean().nullish()
1141
+ var getSafetyRatingSchema = () => z3.object({
1142
+ category: z3.string().nullish(),
1143
+ probability: z3.string().nullish(),
1144
+ probabilityScore: z3.number().nullish(),
1145
+ severity: z3.string().nullish(),
1146
+ severityScore: z3.number().nullish(),
1147
+ blocked: z3.boolean().nullish()
1147
1148
  });
1148
- var usageSchema = import_v45.z.object({
1149
- cachedContentTokenCount: import_v45.z.number().nullish(),
1150
- thoughtsTokenCount: import_v45.z.number().nullish(),
1151
- promptTokenCount: import_v45.z.number().nullish(),
1152
- candidatesTokenCount: import_v45.z.number().nullish(),
1153
- totalTokenCount: import_v45.z.number().nullish()
1149
+ var usageSchema = z3.object({
1150
+ cachedContentTokenCount: z3.number().nullish(),
1151
+ thoughtsTokenCount: z3.number().nullish(),
1152
+ promptTokenCount: z3.number().nullish(),
1153
+ candidatesTokenCount: z3.number().nullish(),
1154
+ totalTokenCount: z3.number().nullish()
1154
1155
  });
1155
- var responseSchema = import_v45.z.object({
1156
- candidates: import_v45.z.array(
1157
- import_v45.z.object({
1158
- content: contentSchema.nullish().or(import_v45.z.object({}).strict()),
1159
- finishReason: import_v45.z.string().nullish(),
1160
- safetyRatings: import_v45.z.array(safetyRatingSchema).nullish(),
1161
- groundingMetadata: groundingMetadataSchema.nullish(),
1162
- urlContextMetadata: urlContextMetadataSchema.nullish()
1156
+ var getUrlContextMetadataSchema = () => z3.object({
1157
+ urlMetadata: z3.array(
1158
+ z3.object({
1159
+ retrievedUrl: z3.string(),
1160
+ urlRetrievalStatus: z3.string()
1163
1161
  })
1164
- ),
1165
- usageMetadata: usageSchema.nullish(),
1166
- promptFeedback: import_v45.z.object({
1167
- blockReason: import_v45.z.string().nullish(),
1168
- safetyRatings: import_v45.z.array(safetyRatingSchema).nullish()
1169
- }).nullish()
1162
+ )
1170
1163
  });
1171
- var chunkSchema = import_v45.z.object({
1172
- candidates: import_v45.z.array(
1173
- import_v45.z.object({
1174
- content: contentSchema.nullish(),
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 responseSchema = (0, import_provider_utils4.lazySchema)(
1165
+ () => (0, import_provider_utils4.zodSchema)(
1166
+ z3.object({
1167
+ candidates: z3.array(
1168
+ z3.object({
1169
+ content: getContentSchema().nullish().or(z3.object({}).strict()),
1170
+ finishReason: z3.string().nullish(),
1171
+ safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
1172
+ groundingMetadata: getGroundingMetadataSchema().nullish(),
1173
+ urlContextMetadata: getUrlContextMetadataSchema().nullish()
1174
+ })
1175
+ ),
1176
+ usageMetadata: usageSchema.nullish(),
1177
+ promptFeedback: z3.object({
1178
+ blockReason: z3.string().nullish(),
1179
+ safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
1180
+ }).nullish()
1179
1181
  })
1180
- ).nullish(),
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()
1186
- });
1182
+ )
1183
+ );
1184
+ var chunkSchema = (0, import_provider_utils4.lazySchema)(
1185
+ () => (0, import_provider_utils4.zodSchema)(
1186
+ z3.object({
1187
+ candidates: z3.array(
1188
+ z3.object({
1189
+ content: getContentSchema().nullish(),
1190
+ finishReason: z3.string().nullish(),
1191
+ safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
1192
+ groundingMetadata: getGroundingMetadataSchema().nullish(),
1193
+ urlContextMetadata: getUrlContextMetadataSchema().nullish()
1194
+ })
1195
+ ).nullish(),
1196
+ usageMetadata: usageSchema.nullish(),
1197
+ promptFeedback: z3.object({
1198
+ blockReason: z3.string().nullish(),
1199
+ safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
1200
+ }).nullish()
1201
+ })
1202
+ )
1203
+ );
1187
1204
 
1188
1205
  // src/tool/code-execution.ts
1189
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1190
- var import_v46 = require("zod/v4");
1191
- var codeExecution = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
1206
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1207
+ var z4 = __toESM(require("zod/v4"));
1208
+ var codeExecution = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1192
1209
  id: "google.code_execution",
1193
1210
  name: "code_execution",
1194
- inputSchema: import_v46.z.object({
1195
- language: import_v46.z.string().describe("The programming language of the code."),
1196
- code: import_v46.z.string().describe("The code to be executed.")
1211
+ inputSchema: z4.object({
1212
+ language: z4.string().describe("The programming language of the code."),
1213
+ code: z4.string().describe("The code to be executed.")
1197
1214
  }),
1198
- outputSchema: import_v46.z.object({
1199
- outcome: import_v46.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
1200
- output: import_v46.z.string().describe("The output from the code execution.")
1215
+ outputSchema: z4.object({
1216
+ outcome: z4.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
1217
+ output: z4.string().describe("The output from the code execution.")
1201
1218
  })
1202
1219
  });
1203
1220
 
1221
+ // src/tool/google-search.ts
1222
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1223
+ var z5 = __toESM(require("zod/v4"));
1224
+ var googleSearch = (0, import_provider_utils6.createProviderDefinedToolFactory)({
1225
+ id: "google.google_search",
1226
+ name: "google_search",
1227
+ inputSchema: (0, import_provider_utils6.lazySchema)(
1228
+ () => (0, import_provider_utils6.zodSchema)(
1229
+ z5.object({
1230
+ mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1231
+ dynamicThreshold: z5.number().default(1)
1232
+ })
1233
+ )
1234
+ )
1235
+ });
1236
+
1237
+ // src/tool/url-context.ts
1238
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1239
+ var z6 = __toESM(require("zod/v4"));
1240
+ var urlContext = (0, import_provider_utils7.createProviderDefinedToolFactory)({
1241
+ id: "google.url_context",
1242
+ name: "url_context",
1243
+ inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(z6.object({})))
1244
+ });
1245
+
1204
1246
  // src/google-tools.ts
1205
1247
  var googleTools = {
1206
1248
  /**
@@ -1228,7 +1270,8 @@ var googleTools = {
1228
1270
  // Annotate the CommonJS export names for ESM import in node:
1229
1271
  0 && (module.exports = {
1230
1272
  GoogleGenerativeAILanguageModel,
1231
- googleTools,
1232
- safetyRatingSchema
1273
+ getGroundingMetadataSchema,
1274
+ getUrlContextMetadataSchema,
1275
+ googleTools
1233
1276
  });
1234
1277
  //# sourceMappingURL=index.js.map