@ai-sdk/google 2.0.18 → 2.0.20

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,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,28 +15,21 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
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
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/internal/index.ts
31
21
  var internal_exports = {};
32
22
  __export(internal_exports, {
33
23
  GoogleGenerativeAILanguageModel: () => GoogleGenerativeAILanguageModel,
34
- googleTools: () => googleTools,
35
- safetyRatingSchema: () => safetyRatingSchema
24
+ getGroundingMetadataSchema: () => getGroundingMetadataSchema,
25
+ getUrlContextMetadataSchema: () => getUrlContextMetadataSchema,
26
+ googleTools: () => googleTools
36
27
  });
37
28
  module.exports = __toCommonJS(internal_exports);
38
29
 
39
30
  // src/google-generative-ai-language-model.ts
40
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
41
- var z5 = __toESM(require("zod/v4"));
31
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
32
+ var import_v43 = require("zod/v4");
42
33
 
43
34
  // src/convert-json-schema-to-openapi-schema.ts
44
35
  function convertJSONSchemaToOpenAPISchema(jsonSchema) {
@@ -311,86 +302,106 @@ function getModelPath(modelId) {
311
302
 
312
303
  // src/google-error.ts
313
304
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
314
- var z = __toESM(require("zod/v4"));
315
- var googleErrorDataSchema = z.object({
316
- error: z.object({
317
- code: z.number().nullable(),
318
- message: z.string(),
319
- status: z.string()
320
- })
321
- });
305
+ var import_v4 = require("zod/v4");
306
+ var googleErrorDataSchema = (0, import_provider_utils2.lazySchema)(
307
+ () => (0, import_provider_utils2.zodSchema)(
308
+ 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
+ )
316
+ );
322
317
  var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
323
318
  errorSchema: googleErrorDataSchema,
324
319
  errorToMessage: (data) => data.error.message
325
320
  });
326
321
 
327
322
  // src/google-generative-ai-options.ts
328
- var z2 = __toESM(require("zod/v4"));
329
- var googleGenerativeAIProviderOptions = z2.object({
330
- responseModalities: z2.array(z2.enum(["TEXT", "IMAGE"])).optional(),
331
- thinkingConfig: z2.object({
332
- thinkingBudget: z2.number().optional(),
333
- includeThoughts: z2.boolean().optional()
334
- }).optional(),
335
- /**
336
- Optional.
337
- The name of the cached content used as context to serve the prediction.
338
- Format: cachedContents/{cachedContent}
339
- */
340
- cachedContent: z2.string().optional(),
341
- /**
342
- * Optional. Enable structured output. Default is true.
343
- *
344
- * This is useful when the JSON Schema contains elements that are
345
- * not supported by the OpenAPI schema version that
346
- * Google Generative AI uses. You can use this to disable
347
- * structured outputs if you need to.
348
- */
349
- structuredOutputs: z2.boolean().optional(),
350
- /**
351
- Optional. A list of unique safety settings for blocking unsafe content.
352
- */
353
- safetySettings: z2.array(
354
- z2.object({
355
- category: z2.enum([
356
- "HARM_CATEGORY_UNSPECIFIED",
357
- "HARM_CATEGORY_HATE_SPEECH",
358
- "HARM_CATEGORY_DANGEROUS_CONTENT",
359
- "HARM_CATEGORY_HARASSMENT",
360
- "HARM_CATEGORY_SEXUALLY_EXPLICIT",
361
- "HARM_CATEGORY_CIVIC_INTEGRITY"
362
- ]),
363
- threshold: z2.enum([
323
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
324
+ var import_v42 = require("zod/v4");
325
+ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
326
+ () => (0, import_provider_utils3.zodSchema)(
327
+ import_v42.z.object({
328
+ responseModalities: import_v42.z.array(import_v42.z.enum(["TEXT", "IMAGE"])).optional(),
329
+ thinkingConfig: import_v42.z.object({
330
+ thinkingBudget: import_v42.z.number().optional(),
331
+ includeThoughts: import_v42.z.boolean().optional()
332
+ }).optional(),
333
+ /**
334
+ * Optional.
335
+ * The name of the cached content used as context to serve the prediction.
336
+ * Format: cachedContents/{cachedContent}
337
+ */
338
+ cachedContent: import_v42.z.string().optional(),
339
+ /**
340
+ * Optional. Enable structured output. Default is true.
341
+ *
342
+ * This is useful when the JSON Schema contains elements that are
343
+ * not supported by the OpenAPI schema version that
344
+ * Google Generative AI uses. You can use this to disable
345
+ * structured outputs if you need to.
346
+ */
347
+ structuredOutputs: import_v42.z.boolean().optional(),
348
+ /**
349
+ * Optional. A list of unique safety settings for blocking unsafe content.
350
+ */
351
+ safetySettings: import_v42.z.array(
352
+ import_v42.z.object({
353
+ category: import_v42.z.enum([
354
+ "HARM_CATEGORY_UNSPECIFIED",
355
+ "HARM_CATEGORY_HATE_SPEECH",
356
+ "HARM_CATEGORY_DANGEROUS_CONTENT",
357
+ "HARM_CATEGORY_HARASSMENT",
358
+ "HARM_CATEGORY_SEXUALLY_EXPLICIT",
359
+ "HARM_CATEGORY_CIVIC_INTEGRITY"
360
+ ]),
361
+ threshold: import_v42.z.enum([
362
+ "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
363
+ "BLOCK_LOW_AND_ABOVE",
364
+ "BLOCK_MEDIUM_AND_ABOVE",
365
+ "BLOCK_ONLY_HIGH",
366
+ "BLOCK_NONE",
367
+ "OFF"
368
+ ])
369
+ })
370
+ ).optional(),
371
+ threshold: import_v42.z.enum([
364
372
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
365
373
  "BLOCK_LOW_AND_ABOVE",
366
374
  "BLOCK_MEDIUM_AND_ABOVE",
367
375
  "BLOCK_ONLY_HIGH",
368
376
  "BLOCK_NONE",
369
377
  "OFF"
370
- ])
378
+ ]).optional(),
379
+ /**
380
+ * Optional. Enables timestamp understanding for audio-only files.
381
+ *
382
+ * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
383
+ */
384
+ audioTimestamp: import_v42.z.boolean().optional(),
385
+ /**
386
+ * Optional. Defines labels used in billing reports. Available on Vertex AI only.
387
+ *
388
+ * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
389
+ */
390
+ labels: import_v42.z.record(import_v42.z.string(), import_v42.z.string()).optional(),
391
+ /**
392
+ * Optional. If specified, the media resolution specified will be used.
393
+ *
394
+ * https://ai.google.dev/api/generate-content#MediaResolution
395
+ */
396
+ mediaResolution: import_v42.z.enum([
397
+ "MEDIA_RESOLUTION_UNSPECIFIED",
398
+ "MEDIA_RESOLUTION_LOW",
399
+ "MEDIA_RESOLUTION_MEDIUM",
400
+ "MEDIA_RESOLUTION_HIGH"
401
+ ]).optional()
371
402
  })
372
- ).optional(),
373
- threshold: z2.enum([
374
- "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
375
- "BLOCK_LOW_AND_ABOVE",
376
- "BLOCK_MEDIUM_AND_ABOVE",
377
- "BLOCK_ONLY_HIGH",
378
- "BLOCK_NONE",
379
- "OFF"
380
- ]).optional(),
381
- /**
382
- * Optional. Enables timestamp understanding for audio-only files.
383
- *
384
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
385
- */
386
- audioTimestamp: z2.boolean().optional(),
387
- /**
388
- * Optional. Defines labels used in billing reports. Available on Vertex AI only.
389
- *
390
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
391
- */
392
- labels: z2.record(z2.string(), z2.string()).optional()
393
- });
403
+ )
404
+ );
394
405
 
395
406
  // src/google-prepare-tools.ts
396
407
  var import_provider2 = require("@ai-sdk/provider");
@@ -561,64 +572,6 @@ function mapGoogleGenerativeAIFinishReason({
561
572
  }
562
573
  }
563
574
 
564
- // src/tool/google-search.ts
565
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
566
- var z3 = __toESM(require("zod/v4"));
567
- var groundingChunkSchema = z3.object({
568
- web: z3.object({ uri: z3.string(), title: z3.string() }).nullish(),
569
- retrievedContext: z3.object({ uri: z3.string(), title: z3.string() }).nullish()
570
- });
571
- var groundingMetadataSchema = z3.object({
572
- webSearchQueries: z3.array(z3.string()).nullish(),
573
- retrievalQueries: z3.array(z3.string()).nullish(),
574
- searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
575
- groundingChunks: z3.array(groundingChunkSchema).nullish(),
576
- groundingSupports: z3.array(
577
- z3.object({
578
- segment: z3.object({
579
- startIndex: z3.number().nullish(),
580
- endIndex: z3.number().nullish(),
581
- text: z3.string().nullish()
582
- }),
583
- segment_text: z3.string().nullish(),
584
- groundingChunkIndices: z3.array(z3.number()).nullish(),
585
- supportChunkIndices: z3.array(z3.number()).nullish(),
586
- confidenceScores: z3.array(z3.number()).nullish(),
587
- confidenceScore: z3.array(z3.number()).nullish()
588
- })
589
- ).nullish(),
590
- retrievalMetadata: z3.union([
591
- z3.object({
592
- webDynamicRetrievalScore: z3.number()
593
- }),
594
- z3.object({})
595
- ]).nullish()
596
- });
597
- var googleSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
598
- id: "google.google_search",
599
- name: "google_search",
600
- inputSchema: z3.object({
601
- mode: z3.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
602
- dynamicThreshold: z3.number().default(1)
603
- })
604
- });
605
-
606
- // src/tool/url-context.ts
607
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
608
- var z4 = __toESM(require("zod/v4"));
609
- var urlMetadataSchema = z4.object({
610
- retrievedUrl: z4.string(),
611
- urlRetrievalStatus: z4.string()
612
- });
613
- var urlContextMetadataSchema = z4.object({
614
- urlMetadata: z4.array(urlMetadataSchema)
615
- });
616
- var urlContext = (0, import_provider_utils4.createProviderDefinedToolFactory)({
617
- id: "google.url_context",
618
- name: "url_context",
619
- inputSchema: z4.object({})
620
- });
621
-
622
575
  // src/google-generative-ai-language-model.ts
623
576
  var GoogleGenerativeAILanguageModel = class {
624
577
  constructor(modelId, config) {
@@ -626,7 +579,7 @@ var GoogleGenerativeAILanguageModel = class {
626
579
  var _a;
627
580
  this.modelId = modelId;
628
581
  this.config = config;
629
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils5.generateId;
582
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils4.generateId;
630
583
  }
631
584
  get provider() {
632
585
  return this.config.provider;
@@ -652,7 +605,7 @@ var GoogleGenerativeAILanguageModel = class {
652
605
  }) {
653
606
  var _a, _b;
654
607
  const warnings = [];
655
- const googleOptions = await (0, import_provider_utils5.parseProviderOptions)({
608
+ const googleOptions = await (0, import_provider_utils4.parseProviderOptions)({
656
609
  provider: "google",
657
610
  providerOptions,
658
611
  schema: googleGenerativeAIProviderOptions
@@ -717,22 +670,22 @@ var GoogleGenerativeAILanguageModel = class {
717
670
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
718
671
  const { args, warnings } = await this.getArgs(options);
719
672
  const body = JSON.stringify(args);
720
- const mergedHeaders = (0, import_provider_utils5.combineHeaders)(
721
- await (0, import_provider_utils5.resolve)(this.config.headers),
673
+ const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
674
+ await (0, import_provider_utils4.resolve)(this.config.headers),
722
675
  options.headers
723
676
  );
724
677
  const {
725
678
  responseHeaders,
726
679
  value: response,
727
680
  rawValue: rawResponse
728
- } = await (0, import_provider_utils5.postJsonToApi)({
681
+ } = await (0, import_provider_utils4.postJsonToApi)({
729
682
  url: `${this.config.baseURL}/${getModelPath(
730
683
  this.modelId
731
684
  )}:generateContent`,
732
685
  headers: mergedHeaders,
733
686
  body: args,
734
687
  failedResponseHandler: googleFailedResponseHandler,
735
- successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(responseSchema),
688
+ successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(responseSchema),
736
689
  abortSignal: options.abortSignal,
737
690
  fetch: this.config.fetch
738
691
  });
@@ -828,18 +781,18 @@ var GoogleGenerativeAILanguageModel = class {
828
781
  async doStream(options) {
829
782
  const { args, warnings } = await this.getArgs(options);
830
783
  const body = JSON.stringify(args);
831
- const headers = (0, import_provider_utils5.combineHeaders)(
832
- await (0, import_provider_utils5.resolve)(this.config.headers),
784
+ const headers = (0, import_provider_utils4.combineHeaders)(
785
+ await (0, import_provider_utils4.resolve)(this.config.headers),
833
786
  options.headers
834
787
  );
835
- const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({
788
+ const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
836
789
  url: `${this.config.baseURL}/${getModelPath(
837
790
  this.modelId
838
791
  )}:streamGenerateContent?alt=sse`,
839
792
  headers,
840
793
  body: args,
841
794
  failedResponseHandler: googleFailedResponseHandler,
842
- successfulResponseHandler: (0, import_provider_utils5.createEventSourceResponseHandler)(chunkSchema),
795
+ successfulResponseHandler: (0, import_provider_utils4.createEventSourceResponseHandler)(chunkSchema),
843
796
  abortSignal: options.abortSignal,
844
797
  fetch: this.config.fetch
845
798
  });
@@ -1111,103 +1064,175 @@ function extractSources({
1111
1064
  title: chunk.web.title
1112
1065
  }));
1113
1066
  }
1114
- var contentSchema = z5.object({
1115
- parts: z5.array(
1116
- z5.union([
1067
+ var getGroundingMetadataSchema = () => import_v43.z.object({
1068
+ webSearchQueries: import_v43.z.array(import_v43.z.string()).nullish(),
1069
+ retrievalQueries: import_v43.z.array(import_v43.z.string()).nullish(),
1070
+ searchEntryPoint: import_v43.z.object({ renderedContent: import_v43.z.string() }).nullish(),
1071
+ groundingChunks: import_v43.z.array(
1072
+ import_v43.z.object({
1073
+ web: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish(),
1074
+ retrievedContext: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish()
1075
+ })
1076
+ ).nullish(),
1077
+ groundingSupports: import_v43.z.array(
1078
+ import_v43.z.object({
1079
+ segment: import_v43.z.object({
1080
+ startIndex: import_v43.z.number().nullish(),
1081
+ endIndex: import_v43.z.number().nullish(),
1082
+ text: import_v43.z.string().nullish()
1083
+ }),
1084
+ segment_text: import_v43.z.string().nullish(),
1085
+ groundingChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
1086
+ supportChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
1087
+ confidenceScores: import_v43.z.array(import_v43.z.number()).nullish(),
1088
+ confidenceScore: import_v43.z.array(import_v43.z.number()).nullish()
1089
+ })
1090
+ ).nullish(),
1091
+ retrievalMetadata: import_v43.z.union([
1092
+ import_v43.z.object({
1093
+ webDynamicRetrievalScore: import_v43.z.number()
1094
+ }),
1095
+ import_v43.z.object({})
1096
+ ]).nullish()
1097
+ });
1098
+ var getContentSchema = () => import_v43.z.object({
1099
+ parts: import_v43.z.array(
1100
+ import_v43.z.union([
1117
1101
  // note: order matters since text can be fully empty
1118
- z5.object({
1119
- functionCall: z5.object({
1120
- name: z5.string(),
1121
- args: z5.unknown()
1102
+ import_v43.z.object({
1103
+ functionCall: import_v43.z.object({
1104
+ name: import_v43.z.string(),
1105
+ args: import_v43.z.unknown()
1122
1106
  }),
1123
- thoughtSignature: z5.string().nullish()
1107
+ thoughtSignature: import_v43.z.string().nullish()
1124
1108
  }),
1125
- z5.object({
1126
- inlineData: z5.object({
1127
- mimeType: z5.string(),
1128
- data: z5.string()
1109
+ import_v43.z.object({
1110
+ inlineData: import_v43.z.object({
1111
+ mimeType: import_v43.z.string(),
1112
+ data: import_v43.z.string()
1129
1113
  })
1130
1114
  }),
1131
- z5.object({
1132
- executableCode: z5.object({
1133
- language: z5.string(),
1134
- code: z5.string()
1115
+ import_v43.z.object({
1116
+ executableCode: import_v43.z.object({
1117
+ language: import_v43.z.string(),
1118
+ code: import_v43.z.string()
1135
1119
  }).nullish(),
1136
- codeExecutionResult: z5.object({
1137
- outcome: z5.string(),
1138
- output: z5.string()
1120
+ codeExecutionResult: import_v43.z.object({
1121
+ outcome: import_v43.z.string(),
1122
+ output: import_v43.z.string()
1139
1123
  }).nullish(),
1140
- text: z5.string().nullish(),
1141
- thought: z5.boolean().nullish(),
1142
- thoughtSignature: z5.string().nullish()
1124
+ text: import_v43.z.string().nullish(),
1125
+ thought: import_v43.z.boolean().nullish(),
1126
+ thoughtSignature: import_v43.z.string().nullish()
1143
1127
  })
1144
1128
  ])
1145
1129
  ).nullish()
1146
1130
  });
1147
- var safetyRatingSchema = z5.object({
1148
- category: z5.string().nullish(),
1149
- probability: z5.string().nullish(),
1150
- probabilityScore: z5.number().nullish(),
1151
- severity: z5.string().nullish(),
1152
- severityScore: z5.number().nullish(),
1153
- blocked: z5.boolean().nullish()
1131
+ var getSafetyRatingSchema = () => import_v43.z.object({
1132
+ category: import_v43.z.string().nullish(),
1133
+ probability: import_v43.z.string().nullish(),
1134
+ probabilityScore: import_v43.z.number().nullish(),
1135
+ severity: import_v43.z.string().nullish(),
1136
+ severityScore: import_v43.z.number().nullish(),
1137
+ blocked: import_v43.z.boolean().nullish()
1154
1138
  });
1155
- var usageSchema = z5.object({
1156
- cachedContentTokenCount: z5.number().nullish(),
1157
- thoughtsTokenCount: z5.number().nullish(),
1158
- promptTokenCount: z5.number().nullish(),
1159
- candidatesTokenCount: z5.number().nullish(),
1160
- totalTokenCount: z5.number().nullish()
1139
+ var usageSchema = import_v43.z.object({
1140
+ cachedContentTokenCount: import_v43.z.number().nullish(),
1141
+ thoughtsTokenCount: import_v43.z.number().nullish(),
1142
+ promptTokenCount: import_v43.z.number().nullish(),
1143
+ candidatesTokenCount: import_v43.z.number().nullish(),
1144
+ totalTokenCount: import_v43.z.number().nullish()
1161
1145
  });
1162
- var responseSchema = z5.object({
1163
- candidates: z5.array(
1164
- z5.object({
1165
- content: contentSchema.nullish().or(z5.object({}).strict()),
1166
- finishReason: z5.string().nullish(),
1167
- safetyRatings: z5.array(safetyRatingSchema).nullish(),
1168
- groundingMetadata: groundingMetadataSchema.nullish(),
1169
- urlContextMetadata: urlContextMetadataSchema.nullish()
1146
+ var getUrlContextMetadataSchema = () => import_v43.z.object({
1147
+ urlMetadata: import_v43.z.array(
1148
+ import_v43.z.object({
1149
+ retrievedUrl: import_v43.z.string(),
1150
+ urlRetrievalStatus: import_v43.z.string()
1170
1151
  })
1171
- ),
1172
- usageMetadata: usageSchema.nullish(),
1173
- promptFeedback: z5.object({
1174
- blockReason: z5.string().nullish(),
1175
- safetyRatings: z5.array(safetyRatingSchema).nullish()
1176
- }).nullish()
1152
+ )
1177
1153
  });
1178
- var chunkSchema = z5.object({
1179
- candidates: z5.array(
1180
- z5.object({
1181
- content: contentSchema.nullish(),
1182
- finishReason: z5.string().nullish(),
1183
- safetyRatings: z5.array(safetyRatingSchema).nullish(),
1184
- groundingMetadata: groundingMetadataSchema.nullish(),
1185
- urlContextMetadata: urlContextMetadataSchema.nullish()
1154
+ var responseSchema = (0, import_provider_utils4.lazySchema)(
1155
+ () => (0, import_provider_utils4.zodSchema)(
1156
+ import_v43.z.object({
1157
+ candidates: import_v43.z.array(
1158
+ import_v43.z.object({
1159
+ content: getContentSchema().nullish().or(import_v43.z.object({}).strict()),
1160
+ finishReason: import_v43.z.string().nullish(),
1161
+ safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish(),
1162
+ groundingMetadata: getGroundingMetadataSchema().nullish(),
1163
+ urlContextMetadata: getUrlContextMetadataSchema().nullish()
1164
+ })
1165
+ ),
1166
+ usageMetadata: usageSchema.nullish(),
1167
+ promptFeedback: import_v43.z.object({
1168
+ blockReason: import_v43.z.string().nullish(),
1169
+ safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish()
1170
+ }).nullish()
1186
1171
  })
1187
- ).nullish(),
1188
- usageMetadata: usageSchema.nullish(),
1189
- promptFeedback: z5.object({
1190
- blockReason: z5.string().nullish(),
1191
- safetyRatings: z5.array(safetyRatingSchema).nullish()
1192
- }).nullish()
1193
- });
1172
+ )
1173
+ );
1174
+ var chunkSchema = (0, import_provider_utils4.lazySchema)(
1175
+ () => (0, import_provider_utils4.zodSchema)(
1176
+ import_v43.z.object({
1177
+ candidates: import_v43.z.array(
1178
+ import_v43.z.object({
1179
+ content: getContentSchema().nullish(),
1180
+ finishReason: import_v43.z.string().nullish(),
1181
+ safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish(),
1182
+ groundingMetadata: getGroundingMetadataSchema().nullish(),
1183
+ urlContextMetadata: getUrlContextMetadataSchema().nullish()
1184
+ })
1185
+ ).nullish(),
1186
+ usageMetadata: usageSchema.nullish(),
1187
+ promptFeedback: import_v43.z.object({
1188
+ blockReason: import_v43.z.string().nullish(),
1189
+ safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish()
1190
+ }).nullish()
1191
+ })
1192
+ )
1193
+ );
1194
1194
 
1195
1195
  // src/tool/code-execution.ts
1196
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
1197
- var z6 = __toESM(require("zod/v4"));
1198
- var codeExecution = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
1196
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1197
+ var import_v44 = require("zod/v4");
1198
+ var codeExecution = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1199
1199
  id: "google.code_execution",
1200
1200
  name: "code_execution",
1201
- inputSchema: z6.object({
1202
- language: z6.string().describe("The programming language of the code."),
1203
- code: z6.string().describe("The code to be executed.")
1201
+ inputSchema: import_v44.z.object({
1202
+ language: import_v44.z.string().describe("The programming language of the code."),
1203
+ code: import_v44.z.string().describe("The code to be executed.")
1204
1204
  }),
1205
- outputSchema: z6.object({
1206
- outcome: z6.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
1207
- output: z6.string().describe("The output from the code execution.")
1205
+ outputSchema: import_v44.z.object({
1206
+ outcome: import_v44.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
1207
+ output: import_v44.z.string().describe("The output from the code execution.")
1208
1208
  })
1209
1209
  });
1210
1210
 
1211
+ // src/tool/google-search.ts
1212
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1213
+ var import_v45 = require("zod/v4");
1214
+ var googleSearch = (0, import_provider_utils6.createProviderDefinedToolFactory)({
1215
+ id: "google.google_search",
1216
+ name: "google_search",
1217
+ inputSchema: (0, import_provider_utils6.lazySchema)(
1218
+ () => (0, import_provider_utils6.zodSchema)(
1219
+ import_v45.z.object({
1220
+ mode: import_v45.z.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
1221
+ dynamicThreshold: import_v45.z.number().default(1)
1222
+ })
1223
+ )
1224
+ )
1225
+ });
1226
+
1227
+ // src/tool/url-context.ts
1228
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1229
+ var import_v46 = require("zod/v4");
1230
+ var urlContext = (0, import_provider_utils7.createProviderDefinedToolFactory)({
1231
+ id: "google.url_context",
1232
+ name: "url_context",
1233
+ inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(import_v46.z.object({})))
1234
+ });
1235
+
1211
1236
  // src/google-tools.ts
1212
1237
  var googleTools = {
1213
1238
  /**
@@ -1235,7 +1260,8 @@ var googleTools = {
1235
1260
  // Annotate the CommonJS export names for ESM import in node:
1236
1261
  0 && (module.exports = {
1237
1262
  GoogleGenerativeAILanguageModel,
1238
- googleTools,
1239
- safetyRatingSchema
1263
+ getGroundingMetadataSchema,
1264
+ getUrlContextMetadataSchema,
1265
+ googleTools
1240
1266
  });
1241
1267
  //# sourceMappingURL=index.js.map