@ai-sdk/google 3.0.24 → 3.0.26

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.26
4
+
5
+ ### Patch Changes
6
+
7
+ - 4c27179: feat(google): allow using Gemini image models with `generateImage`
8
+
9
+ ## 3.0.25
10
+
11
+ ### Patch Changes
12
+
13
+ - 99fbed8: feat: normalize provider specific model options type names and ensure they are exported
14
+
3
15
  ## 3.0.24
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -12,7 +12,7 @@ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
12
12
  type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;
13
13
 
14
14
  type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
15
- declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySchema<{
15
+ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
16
16
  responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
17
17
  thinkingConfig?: {
18
18
  thinkingBudget?: number | undefined;
@@ -40,7 +40,7 @@ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySche
40
40
  } | undefined;
41
41
  } | undefined;
42
42
  }>;
43
- type GoogleGenerativeAIProviderOptions = InferSchema<typeof googleGenerativeAIProviderOptions>;
43
+ type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
44
44
 
45
45
  declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
46
46
  candidates: {
@@ -160,7 +160,7 @@ interface GoogleGenerativeAIProviderMetadata {
160
160
  safetyRatings: GoogleGenerativeAISafetyRating[] | null;
161
161
  }
162
162
 
163
- type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | (string & {});
163
+ type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | (string & {});
164
164
  interface GoogleGenerativeAIImageSettings {
165
165
  /**
166
166
  * Override the maximum number of images per call (default 4)
@@ -168,22 +168,22 @@ interface GoogleGenerativeAIImageSettings {
168
168
  maxImagesPerCall?: number;
169
169
  }
170
170
 
171
- declare const googleImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
171
+ declare const googleImageModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
172
172
  personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
173
173
  aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
174
174
  }>;
175
- type GoogleGenerativeAIImageProviderOptions = InferSchema<typeof googleImageProviderOptionsSchema>;
175
+ type GoogleImageModelOptions = InferSchema<typeof googleImageModelOptionsSchema>;
176
176
 
177
177
  type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
178
- declare const googleGenerativeAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
178
+ declare const googleEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
179
179
  outputDimensionality?: number | undefined;
180
180
  taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
181
181
  }>;
182
- type GoogleGenerativeAIEmbeddingProviderOptions = InferSchema<typeof googleGenerativeAIEmbeddingProviderOptions>;
182
+ type GoogleEmbeddingModelOptions = InferSchema<typeof googleEmbeddingModelOptions>;
183
183
 
184
184
  type GoogleGenerativeAIVideoModelId = 'veo-3.1-fast-generate-preview' | 'veo-3.1-generate-preview' | 'veo-3.1-generate' | 'veo-2.0-generate-001' | (string & {});
185
185
 
186
- type GoogleGenerativeAIVideoProviderOptions = {
186
+ type GoogleVideoModelOptions = {
187
187
  pollIntervalMs?: number | null;
188
188
  pollTimeoutMs?: number | null;
189
189
  personGeneration?: 'dont_allow' | 'allow_adult' | 'allow_all' | null;
@@ -350,4 +350,4 @@ declare const google: GoogleGenerativeAIProvider;
350
350
 
351
351
  declare const VERSION: string;
352
352
 
353
- export { type GoogleErrorData, type GoogleGenerativeAIEmbeddingProviderOptions, type GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, type GoogleGenerativeAIVideoModelId, type GoogleGenerativeAIVideoProviderOptions, VERSION, createGoogleGenerativeAI, google };
353
+ export { type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, type GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleLanguageModelOptions, type GoogleVideoModelOptions, VERSION, createGoogleGenerativeAI, google };
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
12
12
  type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;
13
13
 
14
14
  type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
15
- declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySchema<{
15
+ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
16
16
  responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
17
17
  thinkingConfig?: {
18
18
  thinkingBudget?: number | undefined;
@@ -40,7 +40,7 @@ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySche
40
40
  } | undefined;
41
41
  } | undefined;
42
42
  }>;
43
- type GoogleGenerativeAIProviderOptions = InferSchema<typeof googleGenerativeAIProviderOptions>;
43
+ type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
44
44
 
45
45
  declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
46
46
  candidates: {
@@ -160,7 +160,7 @@ interface GoogleGenerativeAIProviderMetadata {
160
160
  safetyRatings: GoogleGenerativeAISafetyRating[] | null;
161
161
  }
162
162
 
163
- type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | (string & {});
163
+ type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | (string & {});
164
164
  interface GoogleGenerativeAIImageSettings {
165
165
  /**
166
166
  * Override the maximum number of images per call (default 4)
@@ -168,22 +168,22 @@ interface GoogleGenerativeAIImageSettings {
168
168
  maxImagesPerCall?: number;
169
169
  }
170
170
 
171
- declare const googleImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
171
+ declare const googleImageModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
172
172
  personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
173
173
  aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
174
174
  }>;
175
- type GoogleGenerativeAIImageProviderOptions = InferSchema<typeof googleImageProviderOptionsSchema>;
175
+ type GoogleImageModelOptions = InferSchema<typeof googleImageModelOptionsSchema>;
176
176
 
177
177
  type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
178
- declare const googleGenerativeAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
178
+ declare const googleEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
179
179
  outputDimensionality?: number | undefined;
180
180
  taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
181
181
  }>;
182
- type GoogleGenerativeAIEmbeddingProviderOptions = InferSchema<typeof googleGenerativeAIEmbeddingProviderOptions>;
182
+ type GoogleEmbeddingModelOptions = InferSchema<typeof googleEmbeddingModelOptions>;
183
183
 
184
184
  type GoogleGenerativeAIVideoModelId = 'veo-3.1-fast-generate-preview' | 'veo-3.1-generate-preview' | 'veo-3.1-generate' | 'veo-2.0-generate-001' | (string & {});
185
185
 
186
- type GoogleGenerativeAIVideoProviderOptions = {
186
+ type GoogleVideoModelOptions = {
187
187
  pollIntervalMs?: number | null;
188
188
  pollTimeoutMs?: number | null;
189
189
  personGeneration?: 'dont_allow' | 'allow_adult' | 'allow_all' | null;
@@ -350,4 +350,4 @@ declare const google: GoogleGenerativeAIProvider;
350
350
 
351
351
  declare const VERSION: string;
352
352
 
353
- export { type GoogleErrorData, type GoogleGenerativeAIEmbeddingProviderOptions, type GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, type GoogleGenerativeAIVideoModelId, type GoogleGenerativeAIVideoProviderOptions, VERSION, createGoogleGenerativeAI, google };
353
+ export { type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, type GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleLanguageModelOptions, type GoogleVideoModelOptions, VERSION, createGoogleGenerativeAI, google };
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
30
30
  var import_provider_utils16 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.24" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.26" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -59,7 +59,7 @@ var googleFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
59
59
  // src/google-generative-ai-embedding-options.ts
60
60
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
61
61
  var import_v42 = require("zod/v4");
62
- var googleGenerativeAIEmbeddingProviderOptions = (0, import_provider_utils2.lazySchema)(
62
+ var googleEmbeddingModelOptions = (0, import_provider_utils2.lazySchema)(
63
63
  () => (0, import_provider_utils2.zodSchema)(
64
64
  import_v42.z.object({
65
65
  /**
@@ -114,7 +114,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
114
114
  const googleOptions = await (0, import_provider_utils3.parseProviderOptions)({
115
115
  provider: "google",
116
116
  providerOptions,
117
- schema: googleGenerativeAIEmbeddingProviderOptions
117
+ schema: googleEmbeddingModelOptions
118
118
  });
119
119
  if (values.length > this.maxEmbeddingsPerCall) {
120
120
  throw new import_provider.TooManyEmbeddingValuesForCallError({
@@ -542,7 +542,7 @@ function getModelPath(modelId) {
542
542
  // src/google-generative-ai-options.ts
543
543
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
544
544
  var import_v44 = require("zod/v4");
545
- var googleGenerativeAIProviderOptions = (0, import_provider_utils5.lazySchema)(
545
+ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
546
546
  () => (0, import_provider_utils5.zodSchema)(
547
547
  import_v44.z.object({
548
548
  responseModalities: import_v44.z.array(import_v44.z.enum(["TEXT", "IMAGE"])).optional(),
@@ -924,13 +924,13 @@ var GoogleGenerativeAILanguageModel = class {
924
924
  let googleOptions = await (0, import_provider_utils6.parseProviderOptions)({
925
925
  provider: providerOptionsName,
926
926
  providerOptions,
927
- schema: googleGenerativeAIProviderOptions
927
+ schema: googleLanguageModelOptions
928
928
  });
929
929
  if (googleOptions == null && providerOptionsName !== "google") {
930
930
  googleOptions = await (0, import_provider_utils6.parseProviderOptions)({
931
931
  provider: "google",
932
932
  providerOptions,
933
- schema: googleGenerativeAIProviderOptions
933
+ schema: googleLanguageModelOptions
934
934
  });
935
935
  }
936
936
  if ((tools == null ? void 0 : tools.some(
@@ -1786,13 +1786,24 @@ var GoogleGenerativeAIImageModel = class {
1786
1786
  this.specificationVersion = "v3";
1787
1787
  }
1788
1788
  get maxImagesPerCall() {
1789
- var _a;
1790
- return (_a = this.settings.maxImagesPerCall) != null ? _a : 4;
1789
+ if (this.settings.maxImagesPerCall != null) {
1790
+ return this.settings.maxImagesPerCall;
1791
+ }
1792
+ if (isGeminiModel(this.modelId)) {
1793
+ return 10;
1794
+ }
1795
+ return 4;
1791
1796
  }
1792
1797
  get provider() {
1793
1798
  return this.config.provider;
1794
1799
  }
1795
1800
  async doGenerate(options) {
1801
+ if (isGeminiModel(this.modelId)) {
1802
+ return this.doGenerateGemini(options);
1803
+ }
1804
+ return this.doGenerateImagen(options);
1805
+ }
1806
+ async doGenerateImagen(options) {
1796
1807
  var _a, _b, _c;
1797
1808
  const {
1798
1809
  prompt,
@@ -1809,7 +1820,7 @@ var GoogleGenerativeAIImageModel = class {
1809
1820
  const warnings = [];
1810
1821
  if (files != null && files.length > 0) {
1811
1822
  throw new Error(
1812
- "Google Generative AI does not support image editing. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities."
1823
+ "Google Generative AI does not support image editing with Imagen models. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities."
1813
1824
  );
1814
1825
  }
1815
1826
  if (mask != null) {
@@ -1834,7 +1845,7 @@ var GoogleGenerativeAIImageModel = class {
1834
1845
  const googleOptions = await (0, import_provider_utils14.parseProviderOptions)({
1835
1846
  provider: "google",
1836
1847
  providerOptions,
1837
- schema: googleImageProviderOptionsSchema
1848
+ schema: googleImageModelOptionsSchema
1838
1849
  });
1839
1850
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1840
1851
  const parameters = {
@@ -1865,10 +1876,10 @@ var GoogleGenerativeAIImageModel = class {
1865
1876
  images: response.predictions.map(
1866
1877
  (p) => p.bytesBase64Encoded
1867
1878
  ),
1868
- warnings: warnings != null ? warnings : [],
1879
+ warnings,
1869
1880
  providerMetadata: {
1870
1881
  google: {
1871
- images: response.predictions.map((prediction) => ({
1882
+ images: response.predictions.map(() => ({
1872
1883
  // Add any prediction-specific metadata here
1873
1884
  }))
1874
1885
  }
@@ -1880,7 +1891,113 @@ var GoogleGenerativeAIImageModel = class {
1880
1891
  }
1881
1892
  };
1882
1893
  }
1894
+ async doGenerateGemini(options) {
1895
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1896
+ const {
1897
+ prompt,
1898
+ n,
1899
+ size,
1900
+ aspectRatio,
1901
+ seed,
1902
+ providerOptions,
1903
+ headers,
1904
+ abortSignal,
1905
+ files,
1906
+ mask
1907
+ } = options;
1908
+ const warnings = [];
1909
+ if (mask != null) {
1910
+ throw new Error(
1911
+ "Gemini image models do not support mask-based image editing."
1912
+ );
1913
+ }
1914
+ if (n != null && n > 1) {
1915
+ throw new Error(
1916
+ "Gemini image models do not support generating a set number of images per call. Use n=1 or omit the n parameter."
1917
+ );
1918
+ }
1919
+ if (size != null) {
1920
+ warnings.push({
1921
+ type: "unsupported",
1922
+ feature: "size",
1923
+ details: "This model does not support the `size` option. Use `aspectRatio` instead."
1924
+ });
1925
+ }
1926
+ const userContent = [];
1927
+ if (prompt != null) {
1928
+ userContent.push({ type: "text", text: prompt });
1929
+ }
1930
+ if (files != null && files.length > 0) {
1931
+ for (const file of files) {
1932
+ if (file.type === "url") {
1933
+ userContent.push({
1934
+ type: "file",
1935
+ data: new URL(file.url),
1936
+ mediaType: "image/*"
1937
+ });
1938
+ } else {
1939
+ userContent.push({
1940
+ type: "file",
1941
+ data: typeof file.data === "string" ? file.data : new Uint8Array(file.data),
1942
+ mediaType: file.mediaType
1943
+ });
1944
+ }
1945
+ }
1946
+ }
1947
+ const languageModelPrompt = [
1948
+ { role: "user", content: userContent }
1949
+ ];
1950
+ const languageModel = new GoogleGenerativeAILanguageModel(this.modelId, {
1951
+ provider: this.config.provider,
1952
+ baseURL: this.config.baseURL,
1953
+ headers: (_a = this.config.headers) != null ? _a : {},
1954
+ fetch: this.config.fetch,
1955
+ generateId: (_b = this.config.generateId) != null ? _b : import_provider_utils14.generateId
1956
+ });
1957
+ const result = await languageModel.doGenerate({
1958
+ prompt: languageModelPrompt,
1959
+ seed,
1960
+ providerOptions: {
1961
+ google: {
1962
+ responseModalities: ["IMAGE"],
1963
+ imageConfig: aspectRatio ? { aspectRatio } : void 0,
1964
+ ...(_c = providerOptions == null ? void 0 : providerOptions.google) != null ? _c : {}
1965
+ }
1966
+ },
1967
+ headers,
1968
+ abortSignal
1969
+ });
1970
+ const currentDate = (_f = (_e = (_d = this.config._internal) == null ? void 0 : _d.currentDate) == null ? void 0 : _e.call(_d)) != null ? _f : /* @__PURE__ */ new Date();
1971
+ const images = [];
1972
+ for (const part of result.content) {
1973
+ if (part.type === "file" && part.mediaType.startsWith("image/")) {
1974
+ images.push((0, import_provider_utils14.convertToBase64)(part.data));
1975
+ }
1976
+ }
1977
+ return {
1978
+ images,
1979
+ warnings,
1980
+ providerMetadata: {
1981
+ google: {
1982
+ images: images.map(() => ({}))
1983
+ }
1984
+ },
1985
+ response: {
1986
+ timestamp: currentDate,
1987
+ modelId: this.modelId,
1988
+ headers: (_g = result.response) == null ? void 0 : _g.headers
1989
+ },
1990
+ usage: result.usage ? {
1991
+ inputTokens: result.usage.inputTokens.total,
1992
+ outputTokens: result.usage.outputTokens.total,
1993
+ totalTokens: ((_h = result.usage.inputTokens.total) != null ? _h : 0) + ((_i = result.usage.outputTokens.total) != null ? _i : 0)
1994
+ } : void 0
1995
+ };
1996
+ }
1883
1997
  };
1998
+ function isGeminiModel(modelId) {
1999
+ return modelId.startsWith("gemini-");
2000
+ }
1884
2001
  var googleImageResponseSchema = (0, import_provider_utils14.lazySchema)(
1885
2002
  () => (0, import_provider_utils14.zodSchema)(
1886
2003
  import_v413.z.object({
@@ -1888,7 +2005,7 @@ var googleImageResponseSchema = (0, import_provider_utils14.lazySchema)(
1888
2005
  })
1889
2006
  )
1890
2007
  );
1891
- var googleImageProviderOptionsSchema = (0, import_provider_utils14.lazySchema)(
2008
+ var googleImageModelOptionsSchema = (0, import_provider_utils14.lazySchema)(
1892
2009
  () => (0, import_provider_utils14.zodSchema)(
1893
2010
  import_v413.z.object({
1894
2011
  personGeneration: import_v413.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
@@ -1920,7 +2037,7 @@ var GoogleGenerativeAIVideoModel = class {
1920
2037
  const googleOptions = await (0, import_provider_utils15.parseProviderOptions)({
1921
2038
  provider: "google",
1922
2039
  providerOptions: options.providerOptions,
1923
- schema: googleVideoProviderOptionsSchema
2040
+ schema: googleVideoModelOptionsSchema
1924
2041
  });
1925
2042
  const instances = [{}];
1926
2043
  const instance = instances[0];
@@ -2132,7 +2249,7 @@ var googleOperationSchema = import_v414.z.object({
2132
2249
  }).nullish()
2133
2250
  }).nullish()
2134
2251
  });
2135
- var googleVideoProviderOptionsSchema = (0, import_provider_utils15.lazySchema)(
2252
+ var googleVideoModelOptionsSchema = (0, import_provider_utils15.lazySchema)(
2136
2253
  () => (0, import_provider_utils15.zodSchema)(
2137
2254
  import_v414.z.object({
2138
2255
  pollIntervalMs: import_v414.z.number().positive().nullish(),