@ai-sdk/google 2.0.0-beta.6 → 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,9 @@ 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,
822
+ usageMetadata: usageMetadata != null ? usageMetadata : null
741
823
  }
742
824
  },
743
825
  request: { body },
@@ -773,7 +855,7 @@ var GoogleGenerativeAILanguageModel = class {
773
855
  totalTokens: void 0
774
856
  };
775
857
  let providerMetadata = void 0;
776
- const generateId2 = this.config.generateId;
858
+ const generateId3 = this.config.generateId;
777
859
  let hasToolCalls = false;
778
860
  let currentTextBlockId = null;
779
861
  let currentReasoningBlockId = null;
@@ -785,7 +867,7 @@ var GoogleGenerativeAILanguageModel = class {
785
867
  controller.enqueue({ type: "stream-start", warnings });
786
868
  },
787
869
  transform(chunk, controller) {
788
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
870
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
789
871
  if (options.includeRawChunks) {
790
872
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
791
873
  }
@@ -866,7 +948,7 @@ var GoogleGenerativeAILanguageModel = class {
866
948
  }
867
949
  const toolCallDeltas = getToolCallsFromParts({
868
950
  parts: content.parts,
869
- generateId: generateId2
951
+ generateId: generateId3
870
952
  });
871
953
  if (toolCallDeltas != null) {
872
954
  for (const toolCall of toolCallDeltas) {
@@ -901,7 +983,7 @@ var GoogleGenerativeAILanguageModel = class {
901
983
  });
902
984
  const sources = (_h = extractSources({
903
985
  groundingMetadata: candidate.groundingMetadata,
904
- generateId: generateId2
986
+ generateId: generateId3
905
987
  })) != null ? _h : [];
906
988
  for (const source of sources) {
907
989
  controller.enqueue(source);
@@ -909,9 +991,13 @@ var GoogleGenerativeAILanguageModel = class {
909
991
  providerMetadata = {
910
992
  google: {
911
993
  groundingMetadata: (_i = candidate.groundingMetadata) != null ? _i : null,
912
- safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null
994
+ urlContextMetadata: (_j = candidate.urlContextMetadata) != null ? _j : null,
995
+ safetyRatings: (_k = candidate.safetyRatings) != null ? _k : null
913
996
  }
914
997
  };
998
+ if (usageMetadata != null) {
999
+ providerMetadata.google.usageMetadata = usageMetadata;
1000
+ }
915
1001
  }
916
1002
  },
917
1003
  flush(controller) {
@@ -943,14 +1029,14 @@ var GoogleGenerativeAILanguageModel = class {
943
1029
  };
944
1030
  function getToolCallsFromParts({
945
1031
  parts,
946
- generateId: generateId2
1032
+ generateId: generateId3
947
1033
  }) {
948
1034
  const functionCallParts = parts == null ? void 0 : parts.filter(
949
1035
  (part) => "functionCall" in part
950
1036
  );
951
1037
  return functionCallParts == null || functionCallParts.length === 0 ? void 0 : functionCallParts.map((part) => ({
952
1038
  type: "tool-call",
953
- toolCallId: generateId2(),
1039
+ toolCallId: generateId3(),
954
1040
  toolName: part.functionCall.name,
955
1041
  args: JSON.stringify(part.functionCall.args)
956
1042
  }));
@@ -962,7 +1048,7 @@ function getInlineDataParts(parts) {
962
1048
  }
963
1049
  function extractSources({
964
1050
  groundingMetadata,
965
- generateId: generateId2
1051
+ generateId: generateId3
966
1052
  }) {
967
1053
  var _a;
968
1054
  return (_a = groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks) == null ? void 0 : _a.filter(
@@ -970,102 +1056,88 @@ function extractSources({
970
1056
  ).map((chunk) => ({
971
1057
  type: "source",
972
1058
  sourceType: "url",
973
- id: generateId2(),
1059
+ id: generateId3(),
974
1060
  url: chunk.web.uri,
975
1061
  title: chunk.web.title
976
1062
  }));
977
1063
  }
978
- var contentSchema = z5.object({
979
- parts: z5.array(
980
- z5.union([
1064
+ var contentSchema = z7.object({
1065
+ parts: z7.array(
1066
+ z7.union([
981
1067
  // note: order matters since text can be fully empty
982
- z5.object({
983
- functionCall: z5.object({
984
- name: z5.string(),
985
- args: z5.unknown()
1068
+ z7.object({
1069
+ functionCall: z7.object({
1070
+ name: z7.string(),
1071
+ args: z7.unknown()
986
1072
  })
987
1073
  }),
988
- z5.object({
989
- inlineData: z5.object({
990
- mimeType: z5.string(),
991
- data: z5.string()
1074
+ z7.object({
1075
+ inlineData: z7.object({
1076
+ mimeType: z7.string(),
1077
+ data: z7.string()
992
1078
  })
993
1079
  }),
994
- z5.object({
995
- text: z5.string().nullish(),
996
- thought: z5.boolean().nullish()
1080
+ z7.object({
1081
+ text: z7.string().nullish(),
1082
+ thought: z7.boolean().nullish()
997
1083
  })
998
1084
  ])
999
1085
  ).nullish()
1000
1086
  });
1001
- var groundingChunkSchema = z5.object({
1002
- web: z5.object({ uri: z5.string(), title: z5.string() }).nullish(),
1003
- retrievedContext: z5.object({ uri: z5.string(), title: z5.string() }).nullish()
1004
- });
1005
- var groundingMetadataSchema = z5.object({
1006
- webSearchQueries: z5.array(z5.string()).nullish(),
1007
- retrievalQueries: z5.array(z5.string()).nullish(),
1008
- searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
1009
- groundingChunks: z5.array(groundingChunkSchema).nullish(),
1010
- groundingSupports: z5.array(
1011
- z5.object({
1012
- segment: z5.object({
1013
- startIndex: z5.number().nullish(),
1014
- endIndex: z5.number().nullish(),
1015
- text: z5.string().nullish()
1016
- }),
1017
- segment_text: z5.string().nullish(),
1018
- groundingChunkIndices: z5.array(z5.number()).nullish(),
1019
- supportChunkIndices: z5.array(z5.number()).nullish(),
1020
- confidenceScores: z5.array(z5.number()).nullish(),
1021
- confidenceScore: z5.array(z5.number()).nullish()
1022
- })
1023
- ).nullish(),
1024
- retrievalMetadata: z5.union([
1025
- z5.object({
1026
- webDynamicRetrievalScore: z5.number()
1027
- }),
1028
- z5.object({})
1029
- ]).nullish()
1030
- });
1031
- var safetyRatingSchema = z5.object({
1032
- category: z5.string().nullish(),
1033
- probability: z5.string().nullish(),
1034
- probabilityScore: z5.number().nullish(),
1035
- severity: z5.string().nullish(),
1036
- severityScore: z5.number().nullish(),
1037
- blocked: z5.boolean().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()
1038
1094
  });
1039
- var usageSchema = z5.object({
1040
- cachedContentTokenCount: z5.number().nullish(),
1041
- thoughtsTokenCount: z5.number().nullish(),
1042
- promptTokenCount: z5.number().nullish(),
1043
- candidatesTokenCount: z5.number().nullish(),
1044
- totalTokenCount: z5.number().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()
1045
1101
  });
1046
- var responseSchema = z5.object({
1047
- candidates: z5.array(
1048
- z5.object({
1049
- content: contentSchema.nullish().or(z5.object({}).strict()),
1050
- finishReason: z5.string().nullish(),
1051
- safetyRatings: z5.array(safetyRatingSchema).nullish(),
1052
- 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()
1053
1110
  })
1054
1111
  ),
1055
1112
  usageMetadata: usageSchema.nullish()
1056
1113
  });
1057
- var chunkSchema = z5.object({
1058
- candidates: z5.array(
1059
- z5.object({
1114
+ var chunkSchema = z7.object({
1115
+ candidates: z7.array(
1116
+ z7.object({
1060
1117
  content: contentSchema.nullish(),
1061
- finishReason: z5.string().nullish(),
1062
- safetyRatings: z5.array(safetyRatingSchema).nullish(),
1063
- groundingMetadata: groundingMetadataSchema.nullish()
1118
+ finishReason: z7.string().nullish(),
1119
+ safetyRatings: z7.array(safetyRatingSchema).nullish(),
1120
+ groundingMetadata: groundingMetadataSchema.nullish(),
1121
+ urlContextMetadata: urlContextMetadataSchema.nullish()
1064
1122
  })
1065
1123
  ).nullish(),
1066
1124
  usageMetadata: usageSchema.nullish()
1067
1125
  });
1068
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
+
1069
1141
  // src/google-provider.ts
1070
1142
  function createGoogleGenerativeAI(options = {}) {
1071
1143
  var _a;
@@ -1084,7 +1156,7 @@ function createGoogleGenerativeAI(options = {}) {
1084
1156
  provider: "google.generative-ai",
1085
1157
  baseURL,
1086
1158
  headers: getHeaders,
1087
- generateId: (_a2 = options.generateId) != null ? _a2 : generateId,
1159
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
1088
1160
  supportedUrls: () => ({
1089
1161
  "*": [
1090
1162
  // Only allow requests to the Google Generative Language "files" endpoint
@@ -1118,6 +1190,7 @@ function createGoogleGenerativeAI(options = {}) {
1118
1190
  provider.imageModel = (modelId) => {
1119
1191
  throw new NoSuchModelError({ modelId, modelType: "imageModel" });
1120
1192
  };
1193
+ provider.tools = googleTools;
1121
1194
  return provider;
1122
1195
  }
1123
1196
  var google = createGoogleGenerativeAI();