@ai-sdk/google 2.0.0-beta.7 → 2.0.0-beta.8

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.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  NoSuchModelError
4
4
  } from "@ai-sdk/provider";
5
5
  import {
6
- generateId,
6
+ generateId as generateId2,
7
7
  loadApiKey,
8
8
  withoutTrailingSlash
9
9
  } from "@ai-sdk/provider-utils";
@@ -141,11 +141,12 @@ import {
141
141
  combineHeaders as combineHeaders2,
142
142
  createEventSourceResponseHandler,
143
143
  createJsonResponseHandler as createJsonResponseHandler2,
144
+ generateId,
144
145
  parseProviderOptions as parseProviderOptions2,
145
146
  postJsonToApi as postJsonToApi2,
146
147
  resolve as resolve2
147
148
  } from "@ai-sdk/provider-utils";
148
- import { z as z5 } from "zod/v4";
149
+ import { z as z7 } from "zod/v4";
149
150
 
150
151
  // src/convert-json-schema-to-openapi-schema.ts
151
152
  function convertJSONSchemaToOpenAPISchema(jsonSchema) {
@@ -372,17 +373,6 @@ function getModelPath(modelId) {
372
373
 
373
374
  // src/google-generative-ai-options.ts
374
375
  import { z as z4 } from "zod/v4";
375
- var dynamicRetrievalConfig = z4.object({
376
- /**
377
- * The mode of the predictor to be used in dynamic retrieval.
378
- */
379
- mode: z4.enum(["MODE_UNSPECIFIED", "MODE_DYNAMIC"]).optional(),
380
- /**
381
- * The threshold to be used in dynamic retrieval. If not set, a system default
382
- * value is used.
383
- */
384
- dynamicThreshold: z4.number().optional()
385
- });
386
376
  var googleGenerativeAIProviderOptions = z4.object({
387
377
  responseModalities: z4.array(z4.enum(["TEXT", "IMAGE"])).optional(),
388
378
  thinkingConfig: z4.object({
@@ -440,21 +430,7 @@ var googleGenerativeAIProviderOptions = z4.object({
440
430
  *
441
431
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
442
432
  */
443
- audioTimestamp: z4.boolean().optional(),
444
- /**
445
- Optional. When enabled, the model will use Google search to ground the response.
446
-
447
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/overview
448
- */
449
- useSearchGrounding: z4.boolean().optional(),
450
- /**
451
- Optional. Specifies the dynamic retrieval configuration.
452
-
453
- @note Dynamic retrieval is only compatible with Gemini 1.5 Flash.
454
-
455
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/ground-with-google-search#dynamic-retrieval
456
- */
457
- dynamicRetrievalConfig: dynamicRetrievalConfig.optional()
433
+ audioTimestamp: z4.boolean().optional()
458
434
  });
459
435
 
460
436
  // src/google-prepare-tools.ts
@@ -464,8 +440,6 @@ import {
464
440
  function prepareTools({
465
441
  tools,
466
442
  toolChoice,
467
- useSearchGrounding,
468
- dynamicRetrievalConfig: dynamicRetrievalConfig2,
469
443
  modelId
470
444
  }) {
471
445
  var _a;
@@ -473,28 +447,76 @@ function prepareTools({
473
447
  const toolWarnings = [];
474
448
  const isGemini2 = modelId.includes("gemini-2");
475
449
  const supportsDynamicRetrieval = modelId.includes("gemini-1.5-flash") && !modelId.includes("-8b");
476
- if (useSearchGrounding) {
450
+ if (tools == null) {
451
+ return { tools: void 0, toolConfig: void 0, toolWarnings };
452
+ }
453
+ const hasFunctionTools = tools.some((tool) => tool.type === "function");
454
+ const hasProviderDefinedTools = tools.some(
455
+ (tool) => tool.type === "provider-defined"
456
+ );
457
+ if (hasFunctionTools && hasProviderDefinedTools) {
458
+ toolWarnings.push({
459
+ type: "unsupported-tool",
460
+ tool: tools.find((tool) => tool.type === "function"),
461
+ details: "Cannot mix function tools with provider-defined tools in the same request. Please use either function tools or provider-defined tools, but not both."
462
+ });
463
+ }
464
+ if (hasProviderDefinedTools) {
465
+ const googleTools2 = {};
466
+ const providerDefinedTools = tools.filter(
467
+ (tool) => tool.type === "provider-defined"
468
+ );
469
+ providerDefinedTools.forEach((tool) => {
470
+ switch (tool.id) {
471
+ case "google.google_search":
472
+ if (isGemini2) {
473
+ googleTools2.googleSearch = {};
474
+ } else if (supportsDynamicRetrieval) {
475
+ googleTools2.googleSearchRetrieval = {
476
+ dynamicRetrievalConfig: {
477
+ mode: tool.args.mode,
478
+ dynamicThreshold: tool.args.dynamicThreshold
479
+ }
480
+ };
481
+ } else {
482
+ googleTools2.googleSearchRetrieval = {};
483
+ }
484
+ break;
485
+ case "google.url_context":
486
+ if (isGemini2) {
487
+ googleTools2.urlContext = {};
488
+ } else {
489
+ toolWarnings.push({
490
+ type: "unsupported-tool",
491
+ tool,
492
+ details: "The URL context tool is not supported with other Gemini models than Gemini 2."
493
+ });
494
+ }
495
+ break;
496
+ default:
497
+ toolWarnings.push({ type: "unsupported-tool", tool });
498
+ break;
499
+ }
500
+ });
477
501
  return {
478
- tools: isGemini2 ? { googleSearch: {} } : {
479
- googleSearchRetrieval: !supportsDynamicRetrieval || !dynamicRetrievalConfig2 ? {} : { dynamicRetrievalConfig: dynamicRetrievalConfig2 }
480
- },
502
+ tools: Object.keys(googleTools2).length > 0 ? googleTools2 : void 0,
481
503
  toolConfig: void 0,
482
504
  toolWarnings
483
505
  };
484
506
  }
485
- if (tools == null) {
486
- return { tools: void 0, toolConfig: void 0, toolWarnings };
487
- }
488
507
  const functionDeclarations = [];
489
508
  for (const tool of tools) {
490
- if (tool.type === "provider-defined") {
491
- toolWarnings.push({ type: "unsupported-tool", tool });
492
- } else {
493
- functionDeclarations.push({
494
- name: tool.name,
495
- description: (_a = tool.description) != null ? _a : "",
496
- parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
497
- });
509
+ switch (tool.type) {
510
+ case "function":
511
+ functionDeclarations.push({
512
+ name: tool.name,
513
+ description: (_a = tool.description) != null ? _a : "",
514
+ parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
515
+ });
516
+ break;
517
+ default:
518
+ toolWarnings.push({ type: "unsupported-tool", tool });
519
+ break;
498
520
  }
499
521
  }
500
522
  if (toolChoice == null) {
@@ -571,12 +593,72 @@ function mapGoogleGenerativeAIFinishReason({
571
593
  }
572
594
  }
573
595
 
596
+ // src/tool/google-search.ts
597
+ import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
598
+ import { z as z5 } from "zod/v4";
599
+ var groundingChunkSchema = z5.object({
600
+ web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
601
+ retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
602
+ });
603
+ var groundingMetadataSchema = z5.object({
604
+ webSearchQueries: z5.array(z5.string()).nullish(),
605
+ retrievalQueries: z5.array(z5.string()).nullish(),
606
+ searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
607
+ groundingChunks: z5.array(groundingChunkSchema).nullish(),
608
+ groundingSupports: z5.array(
609
+ z5.object({
610
+ segment: z5.object({
611
+ startIndex: z5.number().nullish(),
612
+ endIndex: z5.number().nullish(),
613
+ text: z5.string().nullish()
614
+ }),
615
+ segment_text: z5.string().nullish(),
616
+ groundingChunkIndices: z5.array(z5.number()).nullish(),
617
+ supportChunkIndices: z5.array(z5.number()).nullish(),
618
+ confidenceScores: z5.array(z5.number()).nullish(),
619
+ confidenceScore: z5.array(z5.number()).nullish()
620
+ })
621
+ ).nullish(),
622
+ retrievalMetadata: z5.union([
623
+ z5.object({
624
+ webDynamicRetrievalScore: z5.number()
625
+ }),
626
+ z5.object({})
627
+ ]).nullish()
628
+ });
629
+ var googleSearch = createProviderDefinedToolFactory({
630
+ id: "google.google_search",
631
+ name: "google_search",
632
+ inputSchema: z5.object({
633
+ mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
634
+ dynamicThreshold: z5.number().default(1)
635
+ })
636
+ });
637
+
638
+ // src/tool/url-context.ts
639
+ import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
640
+ import { z as z6 } from "zod/v4";
641
+ var urlMetadataSchema = z6.object({
642
+ retrievedUrl: z6.string(),
643
+ urlRetrievalStatus: z6.string()
644
+ });
645
+ var urlContextMetadataSchema = z6.object({
646
+ urlMetadata: z6.array(urlMetadataSchema)
647
+ });
648
+ var urlContext = createProviderDefinedToolFactory2({
649
+ id: "google.url_context",
650
+ name: "url_context",
651
+ inputSchema: z6.object({})
652
+ });
653
+
574
654
  // src/google-generative-ai-language-model.ts
575
655
  var GoogleGenerativeAILanguageModel = class {
576
656
  constructor(modelId, config) {
577
657
  this.specificationVersion = "v2";
658
+ var _a;
578
659
  this.modelId = modelId;
579
660
  this.config = config;
661
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
580
662
  }
581
663
  get provider() {
582
664
  return this.config.provider;
@@ -600,7 +682,7 @@ var GoogleGenerativeAILanguageModel = class {
600
682
  toolChoice,
601
683
  providerOptions
602
684
  }) {
603
- var _a, _b, _c;
685
+ var _a, _b;
604
686
  const warnings = [];
605
687
  const googleOptions = await parseProviderOptions2({
606
688
  provider: "google",
@@ -619,14 +701,12 @@ var GoogleGenerativeAILanguageModel = class {
619
701
  { isGemmaModel }
620
702
  );
621
703
  const {
622
- tools: googleTools,
704
+ tools: googleTools2,
623
705
  toolConfig: googleToolConfig,
624
706
  toolWarnings
625
707
  } = prepareTools({
626
708
  tools,
627
709
  toolChoice,
628
- useSearchGrounding: (_b = googleOptions == null ? void 0 : googleOptions.useSearchGrounding) != null ? _b : false,
629
- dynamicRetrievalConfig: googleOptions == null ? void 0 : googleOptions.dynamicRetrievalConfig,
630
710
  modelId: this.modelId
631
711
  });
632
712
  return {
@@ -646,7 +726,7 @@ var GoogleGenerativeAILanguageModel = class {
646
726
  responseSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google GenAI does not support all OpenAPI Schema features,
647
727
  // so this is needed as an escape hatch:
648
728
  // TODO convert into provider option
649
- ((_c = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _c : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
729
+ ((_b = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _b : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
650
730
  ...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
651
731
  audioTimestamp: googleOptions.audioTimestamp
652
732
  },
@@ -657,7 +737,7 @@ var GoogleGenerativeAILanguageModel = class {
657
737
  contents,
658
738
  systemInstruction: isGemmaModel ? void 0 : systemInstruction,
659
739
  safetySettings: googleOptions == null ? void 0 : googleOptions.safetySettings,
660
- tools: googleTools,
740
+ tools: googleTools2,
661
741
  toolConfig: googleToolConfig,
662
742
  cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent
663
743
  },
@@ -665,7 +745,7 @@ var GoogleGenerativeAILanguageModel = class {
665
745
  };
666
746
  }
667
747
  async doGenerate(options) {
668
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
748
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
669
749
  const { args, warnings } = await this.getArgs(options);
670
750
  const body = JSON.stringify(args);
671
751
  const mergedHeaders = combineHeaders2(
@@ -737,7 +817,8 @@ var GoogleGenerativeAILanguageModel = class {
737
817
  providerMetadata: {
738
818
  google: {
739
819
  groundingMetadata: (_h = candidate.groundingMetadata) != null ? _h : null,
740
- safetyRatings: (_i = candidate.safetyRatings) != null ? _i : null,
820
+ urlContextMetadata: (_i = candidate.urlContextMetadata) != null ? _i : null,
821
+ safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
741
822
  usageMetadata: usageMetadata != null ? usageMetadata : null
742
823
  }
743
824
  },
@@ -774,7 +855,7 @@ var GoogleGenerativeAILanguageModel = class {
774
855
  totalTokens: void 0
775
856
  };
776
857
  let providerMetadata = void 0;
777
- const generateId2 = this.config.generateId;
858
+ const generateId3 = this.config.generateId;
778
859
  let hasToolCalls = false;
779
860
  let currentTextBlockId = null;
780
861
  let currentReasoningBlockId = null;
@@ -786,7 +867,7 @@ var GoogleGenerativeAILanguageModel = class {
786
867
  controller.enqueue({ type: "stream-start", warnings });
787
868
  },
788
869
  transform(chunk, controller) {
789
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
870
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
790
871
  if (options.includeRawChunks) {
791
872
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
792
873
  }
@@ -867,7 +948,7 @@ var GoogleGenerativeAILanguageModel = class {
867
948
  }
868
949
  const toolCallDeltas = getToolCallsFromParts({
869
950
  parts: content.parts,
870
- generateId: generateId2
951
+ generateId: generateId3
871
952
  });
872
953
  if (toolCallDeltas != null) {
873
954
  for (const toolCall of toolCallDeltas) {
@@ -902,7 +983,7 @@ var GoogleGenerativeAILanguageModel = class {
902
983
  });
903
984
  const sources = (_h = extractSources({
904
985
  groundingMetadata: candidate.groundingMetadata,
905
- generateId: generateId2
986
+ generateId: generateId3
906
987
  })) != null ? _h : [];
907
988
  for (const source of sources) {
908
989
  controller.enqueue(source);
@@ -910,7 +991,8 @@ var GoogleGenerativeAILanguageModel = class {
910
991
  providerMetadata = {
911
992
  google: {
912
993
  groundingMetadata: (_i = candidate.groundingMetadata) != null ? _i : null,
913
- safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null
994
+ urlContextMetadata: (_j = candidate.urlContextMetadata) != null ? _j : null,
995
+ safetyRatings: (_k = candidate.safetyRatings) != null ? _k : null
914
996
  }
915
997
  };
916
998
  if (usageMetadata != null) {
@@ -947,14 +1029,14 @@ var GoogleGenerativeAILanguageModel = class {
947
1029
  };
948
1030
  function getToolCallsFromParts({
949
1031
  parts,
950
- generateId: generateId2
1032
+ generateId: generateId3
951
1033
  }) {
952
1034
  const functionCallParts = parts == null ? void 0 : parts.filter(
953
1035
  (part) => "functionCall" in part
954
1036
  );
955
1037
  return functionCallParts == null || functionCallParts.length === 0 ? void 0 : functionCallParts.map((part) => ({
956
1038
  type: "tool-call",
957
- toolCallId: generateId2(),
1039
+ toolCallId: generateId3(),
958
1040
  toolName: part.functionCall.name,
959
1041
  args: JSON.stringify(part.functionCall.args)
960
1042
  }));
@@ -966,7 +1048,7 @@ function getInlineDataParts(parts) {
966
1048
  }
967
1049
  function extractSources({
968
1050
  groundingMetadata,
969
- generateId: generateId2
1051
+ generateId: generateId3
970
1052
  }) {
971
1053
  var _a;
972
1054
  return (_a = groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks) == null ? void 0 : _a.filter(
@@ -974,102 +1056,88 @@ function extractSources({
974
1056
  ).map((chunk) => ({
975
1057
  type: "source",
976
1058
  sourceType: "url",
977
- id: generateId2(),
1059
+ id: generateId3(),
978
1060
  url: chunk.web.uri,
979
1061
  title: chunk.web.title
980
1062
  }));
981
1063
  }
982
- var contentSchema = z5.object({
983
- parts: z5.array(
984
- z5.union([
1064
+ var contentSchema = z7.object({
1065
+ parts: z7.array(
1066
+ z7.union([
985
1067
  // note: order matters since text can be fully empty
986
- z5.object({
987
- functionCall: z5.object({
988
- name: z5.string(),
989
- args: z5.unknown()
1068
+ z7.object({
1069
+ functionCall: z7.object({
1070
+ name: z7.string(),
1071
+ args: z7.unknown()
990
1072
  })
991
1073
  }),
992
- z5.object({
993
- inlineData: z5.object({
994
- mimeType: z5.string(),
995
- data: z5.string()
1074
+ z7.object({
1075
+ inlineData: z7.object({
1076
+ mimeType: z7.string(),
1077
+ data: z7.string()
996
1078
  })
997
1079
  }),
998
- z5.object({
999
- text: z5.string().nullish(),
1000
- thought: z5.boolean().nullish()
1080
+ z7.object({
1081
+ text: z7.string().nullish(),
1082
+ thought: z7.boolean().nullish()
1001
1083
  })
1002
1084
  ])
1003
1085
  ).nullish()
1004
1086
  });
1005
- var groundingChunkSchema = z5.object({
1006
- web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
1007
- retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
1087
+ var safetyRatingSchema = z7.object({
1088
+ category: z7.string().nullish(),
1089
+ probability: z7.string().nullish(),
1090
+ probabilityScore: z7.number().nullish(),
1091
+ severity: z7.string().nullish(),
1092
+ severityScore: z7.number().nullish(),
1093
+ blocked: z7.boolean().nullish()
1008
1094
  });
1009
- var groundingMetadataSchema = z5.object({
1010
- webSearchQueries: z5.array(z5.string()).nullish(),
1011
- retrievalQueries: z5.array(z5.string()).nullish(),
1012
- searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
1013
- groundingChunks: z5.array(groundingChunkSchema).nullish(),
1014
- groundingSupports: z5.array(
1015
- z5.object({
1016
- segment: z5.object({
1017
- startIndex: z5.number().nullish(),
1018
- endIndex: z5.number().nullish(),
1019
- text: z5.string().nullish()
1020
- }),
1021
- segment_text: z5.string().nullish(),
1022
- groundingChunkIndices: z5.array(z5.number()).nullish(),
1023
- supportChunkIndices: z5.array(z5.number()).nullish(),
1024
- confidenceScores: z5.array(z5.number()).nullish(),
1025
- confidenceScore: z5.array(z5.number()).nullish()
1026
- })
1027
- ).nullish(),
1028
- retrievalMetadata: z5.union([
1029
- z5.object({
1030
- webDynamicRetrievalScore: z5.number()
1031
- }),
1032
- z5.object({})
1033
- ]).nullish()
1034
- });
1035
- var safetyRatingSchema = z5.object({
1036
- category: z5.string().nullish(),
1037
- probability: z5.string().nullish(),
1038
- probabilityScore: z5.number().nullish(),
1039
- severity: z5.string().nullish(),
1040
- severityScore: z5.number().nullish(),
1041
- blocked: z5.boolean().nullish()
1095
+ var usageSchema = z7.object({
1096
+ cachedContentTokenCount: z7.number().nullish(),
1097
+ thoughtsTokenCount: z7.number().nullish(),
1098
+ promptTokenCount: z7.number().nullish(),
1099
+ candidatesTokenCount: z7.number().nullish(),
1100
+ totalTokenCount: z7.number().nullish()
1042
1101
  });
1043
- var usageSchema = z5.object({
1044
- cachedContentTokenCount: z5.number().nullish(),
1045
- thoughtsTokenCount: z5.number().nullish(),
1046
- promptTokenCount: z5.number().nullish(),
1047
- candidatesTokenCount: z5.number().nullish(),
1048
- totalTokenCount: z5.number().nullish()
1049
- });
1050
- var responseSchema = z5.object({
1051
- candidates: z5.array(
1052
- z5.object({
1053
- content: contentSchema.nullish().or(z5.object({}).strict()),
1054
- finishReason: z5.string().nullish(),
1055
- safetyRatings: z5.array(safetyRatingSchema).nullish(),
1056
- groundingMetadata: groundingMetadataSchema.nullish()
1102
+ var responseSchema = z7.object({
1103
+ candidates: z7.array(
1104
+ z7.object({
1105
+ content: contentSchema.nullish().or(z7.object({}).strict()),
1106
+ finishReason: z7.string().nullish(),
1107
+ safetyRatings: z7.array(safetyRatingSchema).nullish(),
1108
+ groundingMetadata: groundingMetadataSchema.nullish(),
1109
+ urlContextMetadata: urlContextMetadataSchema.nullish()
1057
1110
  })
1058
1111
  ),
1059
1112
  usageMetadata: usageSchema.nullish()
1060
1113
  });
1061
- var chunkSchema = z5.object({
1062
- candidates: z5.array(
1063
- z5.object({
1114
+ var chunkSchema = z7.object({
1115
+ candidates: z7.array(
1116
+ z7.object({
1064
1117
  content: contentSchema.nullish(),
1065
- finishReason: z5.string().nullish(),
1066
- safetyRatings: z5.array(safetyRatingSchema).nullish(),
1067
- groundingMetadata: groundingMetadataSchema.nullish()
1118
+ finishReason: z7.string().nullish(),
1119
+ safetyRatings: z7.array(safetyRatingSchema).nullish(),
1120
+ groundingMetadata: groundingMetadataSchema.nullish(),
1121
+ urlContextMetadata: urlContextMetadataSchema.nullish()
1068
1122
  })
1069
1123
  ).nullish(),
1070
1124
  usageMetadata: usageSchema.nullish()
1071
1125
  });
1072
1126
 
1127
+ // src/google-tools.ts
1128
+ var googleTools = {
1129
+ /**
1130
+ * Creates a Google search tool that gives Google direct access to real-time web content.
1131
+ * Must have name "google_search".
1132
+ */
1133
+ googleSearch,
1134
+ /**
1135
+ * Creates a URL context tool that gives Google direct access to real-time web content.
1136
+ * Must have name "url_context".
1137
+ */
1138
+ urlContext
1139
+ };
1140
+
1073
1141
  // src/google-provider.ts
1074
1142
  function createGoogleGenerativeAI(options = {}) {
1075
1143
  var _a;
@@ -1088,7 +1156,7 @@ function createGoogleGenerativeAI(options = {}) {
1088
1156
  provider: "google.generative-ai",
1089
1157
  baseURL,
1090
1158
  headers: getHeaders,
1091
- generateId: (_a2 = options.generateId) != null ? _a2 : generateId,
1159
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
1092
1160
  supportedUrls: () => ({
1093
1161
  "*": [
1094
1162
  // Only allow requests to the Google Generative Language "files" endpoint
@@ -1122,6 +1190,7 @@ function createGoogleGenerativeAI(options = {}) {
1122
1190
  provider.imageModel = (modelId) => {
1123
1191
  throw new NoSuchModelError({ modelId, modelType: "imageModel" });
1124
1192
  };
1193
+ provider.tools = googleTools;
1125
1194
  return provider;
1126
1195
  }
1127
1196
  var google = createGoogleGenerativeAI();