@ai-sdk/google 4.0.0-beta.36 → 4.0.0-beta.37

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.js CHANGED
@@ -1,81 +1,75 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- VERSION: () => VERSION,
24
- createGoogleGenerativeAI: () => createGoogleGenerativeAI,
25
- google: () => google
26
- });
27
- module.exports = __toCommonJS(index_exports);
28
-
29
1
  // src/google-provider.ts
30
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
2
+ import {
3
+ generateId as generateId2,
4
+ loadApiKey,
5
+ withoutTrailingSlash,
6
+ withUserAgentSuffix
7
+ } from "@ai-sdk/provider-utils";
31
8
 
32
9
  // src/version.ts
33
- var VERSION = true ? "4.0.0-beta.36" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.0-beta.37" : "0.0.0-test";
34
11
 
35
12
  // src/google-generative-ai-embedding-model.ts
36
- var import_provider = require("@ai-sdk/provider");
37
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
38
- var import_v43 = require("zod/v4");
13
+ import {
14
+ TooManyEmbeddingValuesForCallError
15
+ } from "@ai-sdk/provider";
16
+ import {
17
+ combineHeaders,
18
+ createJsonResponseHandler,
19
+ lazySchema as lazySchema3,
20
+ parseProviderOptions,
21
+ postJsonToApi,
22
+ resolve,
23
+ zodSchema as zodSchema3
24
+ } from "@ai-sdk/provider-utils";
25
+ import { z as z3 } from "zod/v4";
39
26
 
40
27
  // src/google-error.ts
41
- var import_provider_utils = require("@ai-sdk/provider-utils");
42
- var import_v4 = require("zod/v4");
43
- var googleErrorDataSchema = (0, import_provider_utils.lazySchema)(
44
- () => (0, import_provider_utils.zodSchema)(
45
- import_v4.z.object({
46
- error: import_v4.z.object({
47
- code: import_v4.z.number().nullable(),
48
- message: import_v4.z.string(),
49
- status: import_v4.z.string()
28
+ import {
29
+ createJsonErrorResponseHandler,
30
+ lazySchema,
31
+ zodSchema
32
+ } from "@ai-sdk/provider-utils";
33
+ import { z } from "zod/v4";
34
+ var googleErrorDataSchema = lazySchema(
35
+ () => zodSchema(
36
+ z.object({
37
+ error: z.object({
38
+ code: z.number().nullable(),
39
+ message: z.string(),
40
+ status: z.string()
50
41
  })
51
42
  })
52
43
  )
53
44
  );
54
- var googleFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
45
+ var googleFailedResponseHandler = createJsonErrorResponseHandler({
55
46
  errorSchema: googleErrorDataSchema,
56
47
  errorToMessage: (data) => data.error.message
57
48
  });
58
49
 
59
50
  // src/google-generative-ai-embedding-options.ts
60
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
61
- var import_v42 = require("zod/v4");
62
- var googleEmbeddingContentPartSchema = import_v42.z.union([
63
- import_v42.z.object({ text: import_v42.z.string() }),
64
- import_v42.z.object({
65
- inlineData: import_v42.z.object({
66
- mimeType: import_v42.z.string(),
67
- data: import_v42.z.string()
51
+ import {
52
+ lazySchema as lazySchema2,
53
+ zodSchema as zodSchema2
54
+ } from "@ai-sdk/provider-utils";
55
+ import { z as z2 } from "zod/v4";
56
+ var googleEmbeddingContentPartSchema = z2.union([
57
+ z2.object({ text: z2.string() }),
58
+ z2.object({
59
+ inlineData: z2.object({
60
+ mimeType: z2.string(),
61
+ data: z2.string()
68
62
  })
69
63
  })
70
64
  ]);
71
- var googleEmbeddingModelOptions = (0, import_provider_utils2.lazySchema)(
72
- () => (0, import_provider_utils2.zodSchema)(
73
- import_v42.z.object({
65
+ var googleEmbeddingModelOptions = lazySchema2(
66
+ () => zodSchema2(
67
+ z2.object({
74
68
  /**
75
69
  * Optional. Optional reduced dimension for the output embedding.
76
70
  * If set, excessive values in the output embedding are truncated from the end.
77
71
  */
78
- outputDimensionality: import_v42.z.number().optional(),
72
+ outputDimensionality: z2.number().optional(),
79
73
  /**
80
74
  * Optional. Specifies the task type for generating embeddings.
81
75
  * Supported task types:
@@ -88,7 +82,7 @@ var googleEmbeddingModelOptions = (0, import_provider_utils2.lazySchema)(
88
82
  * - FACT_VERIFICATION: Optimized for verifying factual information.
89
83
  * - CODE_RETRIEVAL_QUERY: Optimized for retrieving code blocks based on natural language queries.
90
84
  */
91
- taskType: import_v42.z.enum([
85
+ taskType: z2.enum([
92
86
  "SEMANTIC_SIMILARITY",
93
87
  "CLASSIFICATION",
94
88
  "CLUSTERING",
@@ -107,7 +101,7 @@ var googleEmbeddingModelOptions = (0, import_provider_utils2.lazySchema)(
107
101
  * The array length must match the number of values being embedded. In
108
102
  * the case of a single embedding, the array length must be 1.
109
103
  */
110
- content: import_v42.z.array(import_v42.z.array(googleEmbeddingContentPartSchema).min(1).nullable()).optional()
104
+ content: z2.array(z2.array(googleEmbeddingContentPartSchema).min(1).nullable()).optional()
111
105
  })
112
106
  )
113
107
  );
@@ -130,21 +124,21 @@ var GoogleGenerativeAIEmbeddingModel = class {
130
124
  abortSignal,
131
125
  providerOptions
132
126
  }) {
133
- const googleOptions = await (0, import_provider_utils3.parseProviderOptions)({
127
+ const googleOptions = await parseProviderOptions({
134
128
  provider: "google",
135
129
  providerOptions,
136
130
  schema: googleEmbeddingModelOptions
137
131
  });
138
132
  if (values.length > this.maxEmbeddingsPerCall) {
139
- throw new import_provider.TooManyEmbeddingValuesForCallError({
133
+ throw new TooManyEmbeddingValuesForCallError({
140
134
  provider: this.provider,
141
135
  modelId: this.modelId,
142
136
  maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
143
137
  values
144
138
  });
145
139
  }
146
- const mergedHeaders = (0, import_provider_utils3.combineHeaders)(
147
- await (0, import_provider_utils3.resolve)(this.config.headers),
140
+ const mergedHeaders = combineHeaders(
141
+ await resolve(this.config.headers),
148
142
  headers
149
143
  );
150
144
  const multimodalContent = googleOptions == null ? void 0 : googleOptions.content;
@@ -161,7 +155,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
161
155
  responseHeaders: responseHeaders2,
162
156
  value: response2,
163
157
  rawValue: rawValue2
164
- } = await (0, import_provider_utils3.postJsonToApi)({
158
+ } = await postJsonToApi({
165
159
  url: `${this.config.baseURL}/models/${this.modelId}:embedContent`,
166
160
  headers: mergedHeaders,
167
161
  body: {
@@ -173,7 +167,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
173
167
  taskType: googleOptions == null ? void 0 : googleOptions.taskType
174
168
  },
175
169
  failedResponseHandler: googleFailedResponseHandler,
176
- successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)(
170
+ successfulResponseHandler: createJsonResponseHandler(
177
171
  googleGenerativeAISingleEmbeddingResponseSchema
178
172
  ),
179
173
  abortSignal,
@@ -190,7 +184,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
190
184
  responseHeaders,
191
185
  value: response,
192
186
  rawValue
193
- } = await (0, import_provider_utils3.postJsonToApi)({
187
+ } = await postJsonToApi({
194
188
  url: `${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,
195
189
  headers: mergedHeaders,
196
190
  body: {
@@ -209,7 +203,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
209
203
  })
210
204
  },
211
205
  failedResponseHandler: googleFailedResponseHandler,
212
- successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)(
206
+ successfulResponseHandler: createJsonResponseHandler(
213
207
  googleGenerativeAITextEmbeddingResponseSchema
214
208
  ),
215
209
  abortSignal,
@@ -223,24 +217,37 @@ var GoogleGenerativeAIEmbeddingModel = class {
223
217
  };
224
218
  }
225
219
  };
226
- var googleGenerativeAITextEmbeddingResponseSchema = (0, import_provider_utils3.lazySchema)(
227
- () => (0, import_provider_utils3.zodSchema)(
228
- import_v43.z.object({
229
- embeddings: import_v43.z.array(import_v43.z.object({ values: import_v43.z.array(import_v43.z.number()) }))
220
+ var googleGenerativeAITextEmbeddingResponseSchema = lazySchema3(
221
+ () => zodSchema3(
222
+ z3.object({
223
+ embeddings: z3.array(z3.object({ values: z3.array(z3.number()) }))
230
224
  })
231
225
  )
232
226
  );
233
- var googleGenerativeAISingleEmbeddingResponseSchema = (0, import_provider_utils3.lazySchema)(
234
- () => (0, import_provider_utils3.zodSchema)(
235
- import_v43.z.object({
236
- embedding: import_v43.z.object({ values: import_v43.z.array(import_v43.z.number()) })
227
+ var googleGenerativeAISingleEmbeddingResponseSchema = lazySchema3(
228
+ () => zodSchema3(
229
+ z3.object({
230
+ embedding: z3.object({ values: z3.array(z3.number()) })
237
231
  })
238
232
  )
239
233
  );
240
234
 
241
235
  // src/google-generative-ai-language-model.ts
242
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
243
- var import_v45 = require("zod/v4");
236
+ import {
237
+ combineHeaders as combineHeaders2,
238
+ createEventSourceResponseHandler,
239
+ createJsonResponseHandler as createJsonResponseHandler2,
240
+ generateId,
241
+ isCustomReasoning,
242
+ lazySchema as lazySchema5,
243
+ mapReasoningToProviderBudget,
244
+ mapReasoningToProviderEffort,
245
+ parseProviderOptions as parseProviderOptions2,
246
+ postJsonToApi as postJsonToApi2,
247
+ resolve as resolve2,
248
+ zodSchema as zodSchema5
249
+ } from "@ai-sdk/provider-utils";
250
+ import { z as z5 } from "zod/v4";
244
251
 
245
252
  // src/convert-google-generative-ai-usage.ts
246
253
  function convertGoogleGenerativeAIUsage(usage) {
@@ -398,8 +405,14 @@ function isEmptyObjectSchema(jsonSchema) {
398
405
  }
399
406
 
400
407
  // src/convert-to-google-generative-ai-messages.ts
401
- var import_provider2 = require("@ai-sdk/provider");
402
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
408
+ import {
409
+ UnsupportedFunctionalityError
410
+ } from "@ai-sdk/provider";
411
+ import {
412
+ convertToBase64,
413
+ isProviderReference,
414
+ resolveProviderReference
415
+ } from "@ai-sdk/provider-utils";
403
416
  var dataUrlRegex = /^data:([^;,]+);base64,(.+)$/s;
404
417
  function parseBase64DataUrl(value) {
405
418
  const match = dataUrlRegex.exec(value);
@@ -516,7 +529,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
516
529
  switch (role) {
517
530
  case "system": {
518
531
  if (!systemMessagesAllowed) {
519
- throw new import_provider2.UnsupportedFunctionalityError({
532
+ throw new UnsupportedFunctionalityError({
520
533
  functionality: "system messages are only supported at the beginning of the conversation"
521
534
  });
522
535
  }
@@ -541,16 +554,16 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
541
554
  fileUri: part.data.toString()
542
555
  }
543
556
  });
544
- } else if ((0, import_provider_utils4.isProviderReference)(part.data)) {
557
+ } else if (isProviderReference(part.data)) {
545
558
  if (providerOptionsName === "vertex") {
546
- throw new import_provider2.UnsupportedFunctionalityError({
559
+ throw new UnsupportedFunctionalityError({
547
560
  functionality: "file parts with provider references"
548
561
  });
549
562
  }
550
563
  parts.push({
551
564
  fileData: {
552
565
  mimeType: mediaType,
553
- fileUri: (0, import_provider_utils4.resolveProviderReference)({
566
+ fileUri: resolveProviderReference({
554
567
  reference: part.data,
555
568
  provider: "google"
556
569
  })
@@ -560,7 +573,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
560
573
  parts.push({
561
574
  inlineData: {
562
575
  mimeType: mediaType,
563
- data: (0, import_provider_utils4.convertToBase64)(part.data)
576
+ data: convertToBase64(part.data)
564
577
  }
565
578
  });
566
579
  }
@@ -595,14 +608,14 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
595
608
  }
596
609
  case "reasoning-file": {
597
610
  if (part.data instanceof URL) {
598
- throw new import_provider2.UnsupportedFunctionalityError({
611
+ throw new UnsupportedFunctionalityError({
599
612
  functionality: "File data URLs in assistant messages are not supported"
600
613
  });
601
614
  }
602
615
  return {
603
616
  inlineData: {
604
617
  mimeType: part.mediaType,
605
- data: (0, import_provider_utils4.convertToBase64)(part.data)
618
+ data: convertToBase64(part.data)
606
619
  },
607
620
  thought: true,
608
621
  thoughtSignature
@@ -610,20 +623,20 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
610
623
  }
611
624
  case "file": {
612
625
  if (part.data instanceof URL) {
613
- throw new import_provider2.UnsupportedFunctionalityError({
626
+ throw new UnsupportedFunctionalityError({
614
627
  functionality: "File data URLs in assistant messages are not supported"
615
628
  });
616
629
  }
617
- if ((0, import_provider_utils4.isProviderReference)(part.data)) {
630
+ if (isProviderReference(part.data)) {
618
631
  if (providerOptionsName === "vertex") {
619
- throw new import_provider2.UnsupportedFunctionalityError({
632
+ throw new UnsupportedFunctionalityError({
620
633
  functionality: "file parts with provider references"
621
634
  });
622
635
  }
623
636
  return {
624
637
  fileData: {
625
638
  mimeType: part.mediaType,
626
- fileUri: (0, import_provider_utils4.resolveProviderReference)({
639
+ fileUri: resolveProviderReference({
627
640
  reference: part.data,
628
641
  provider: "google"
629
642
  })
@@ -635,7 +648,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
635
648
  return {
636
649
  inlineData: {
637
650
  mimeType: part.mediaType,
638
- data: (0, import_provider_utils4.convertToBase64)(part.data)
651
+ data: convertToBase64(part.data)
639
652
  },
640
653
  ...(providerOpts == null ? void 0 : providerOpts.thought) === true ? { thought: true } : {},
641
654
  thoughtSignature
@@ -752,24 +765,24 @@ function getModelPath(modelId) {
752
765
  }
753
766
 
754
767
  // src/google-generative-ai-options.ts
755
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
756
- var import_v44 = require("zod/v4");
757
- var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
758
- () => (0, import_provider_utils5.zodSchema)(
759
- import_v44.z.object({
760
- responseModalities: import_v44.z.array(import_v44.z.enum(["TEXT", "IMAGE"])).optional(),
761
- thinkingConfig: import_v44.z.object({
762
- thinkingBudget: import_v44.z.number().optional(),
763
- includeThoughts: import_v44.z.boolean().optional(),
768
+ import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
769
+ import { z as z4 } from "zod/v4";
770
+ var googleLanguageModelOptions = lazySchema4(
771
+ () => zodSchema4(
772
+ z4.object({
773
+ responseModalities: z4.array(z4.enum(["TEXT", "IMAGE"])).optional(),
774
+ thinkingConfig: z4.object({
775
+ thinkingBudget: z4.number().optional(),
776
+ includeThoughts: z4.boolean().optional(),
764
777
  // https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
765
- thinkingLevel: import_v44.z.enum(["minimal", "low", "medium", "high"]).optional()
778
+ thinkingLevel: z4.enum(["minimal", "low", "medium", "high"]).optional()
766
779
  }).optional(),
767
780
  /**
768
781
  * Optional.
769
782
  * The name of the cached content used as context to serve the prediction.
770
783
  * Format: cachedContents/{cachedContent}
771
784
  */
772
- cachedContent: import_v44.z.string().optional(),
785
+ cachedContent: z4.string().optional(),
773
786
  /**
774
787
  * Optional. Enable structured output. Default is true.
775
788
  *
@@ -778,13 +791,13 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
778
791
  * Google Generative AI uses. You can use this to disable
779
792
  * structured outputs if you need to.
780
793
  */
781
- structuredOutputs: import_v44.z.boolean().optional(),
794
+ structuredOutputs: z4.boolean().optional(),
782
795
  /**
783
796
  * Optional. A list of unique safety settings for blocking unsafe content.
784
797
  */
785
- safetySettings: import_v44.z.array(
786
- import_v44.z.object({
787
- category: import_v44.z.enum([
798
+ safetySettings: z4.array(
799
+ z4.object({
800
+ category: z4.enum([
788
801
  "HARM_CATEGORY_UNSPECIFIED",
789
802
  "HARM_CATEGORY_HATE_SPEECH",
790
803
  "HARM_CATEGORY_DANGEROUS_CONTENT",
@@ -792,7 +805,7 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
792
805
  "HARM_CATEGORY_SEXUALLY_EXPLICIT",
793
806
  "HARM_CATEGORY_CIVIC_INTEGRITY"
794
807
  ]),
795
- threshold: import_v44.z.enum([
808
+ threshold: z4.enum([
796
809
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
797
810
  "BLOCK_LOW_AND_ABOVE",
798
811
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -802,7 +815,7 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
802
815
  ])
803
816
  })
804
817
  ).optional(),
805
- threshold: import_v44.z.enum([
818
+ threshold: z4.enum([
806
819
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
807
820
  "BLOCK_LOW_AND_ABOVE",
808
821
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -815,19 +828,19 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
815
828
  *
816
829
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
817
830
  */
818
- audioTimestamp: import_v44.z.boolean().optional(),
831
+ audioTimestamp: z4.boolean().optional(),
819
832
  /**
820
833
  * Optional. Defines labels used in billing reports. Available on Vertex AI only.
821
834
  *
822
835
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
823
836
  */
824
- labels: import_v44.z.record(import_v44.z.string(), import_v44.z.string()).optional(),
837
+ labels: z4.record(z4.string(), z4.string()).optional(),
825
838
  /**
826
839
  * Optional. If specified, the media resolution specified will be used.
827
840
  *
828
841
  * https://ai.google.dev/api/generate-content#MediaResolution
829
842
  */
830
- mediaResolution: import_v44.z.enum([
843
+ mediaResolution: z4.enum([
831
844
  "MEDIA_RESOLUTION_UNSPECIFIED",
832
845
  "MEDIA_RESOLUTION_LOW",
833
846
  "MEDIA_RESOLUTION_MEDIUM",
@@ -838,8 +851,8 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
838
851
  *
839
852
  * https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
840
853
  */
841
- imageConfig: import_v44.z.object({
842
- aspectRatio: import_v44.z.enum([
854
+ imageConfig: z4.object({
855
+ aspectRatio: z4.enum([
843
856
  "1:1",
844
857
  "2:3",
845
858
  "3:2",
@@ -855,7 +868,7 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
855
868
  "1:4",
856
869
  "4:1"
857
870
  ]).optional(),
858
- imageSize: import_v44.z.enum(["1K", "2K", "4K", "512"]).optional()
871
+ imageSize: z4.enum(["1K", "2K", "4K", "512"]).optional()
859
872
  }).optional(),
860
873
  /**
861
874
  * Optional. Configuration for grounding retrieval.
@@ -863,10 +876,10 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
863
876
  *
864
877
  * https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
865
878
  */
866
- retrievalConfig: import_v44.z.object({
867
- latLng: import_v44.z.object({
868
- latitude: import_v44.z.number(),
869
- longitude: import_v44.z.number()
879
+ retrievalConfig: z4.object({
880
+ latLng: z4.object({
881
+ latitude: z4.number(),
882
+ longitude: z4.number()
870
883
  }).optional()
871
884
  }).optional(),
872
885
  /**
@@ -879,11 +892,11 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
879
892
  *
880
893
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
881
894
  */
882
- streamFunctionCallArguments: import_v44.z.boolean().optional(),
895
+ streamFunctionCallArguments: z4.boolean().optional(),
883
896
  /**
884
897
  * Optional. The service tier to use for the request.
885
898
  */
886
- serviceTier: import_v44.z.enum(["standard", "flex", "priority"]).optional()
899
+ serviceTier: z4.enum(["standard", "flex", "priority"]).optional()
887
900
  })
888
901
  )
889
902
  );
@@ -894,7 +907,9 @@ var VertexServiceTierMap = {
894
907
  };
895
908
 
896
909
  // src/google-prepare-tools.ts
897
- var import_provider3 = require("@ai-sdk/provider");
910
+ import {
911
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError2
912
+ } from "@ai-sdk/provider";
898
913
  function prepareTools({
899
914
  tools,
900
915
  toolChoice,
@@ -1136,7 +1151,7 @@ function prepareTools({
1136
1151
  };
1137
1152
  default: {
1138
1153
  const _exhaustiveCheck = type;
1139
- throw new import_provider3.UnsupportedFunctionalityError({
1154
+ throw new UnsupportedFunctionalityError2({
1140
1155
  functionality: `tool choice type: ${_exhaustiveCheck}`
1141
1156
  });
1142
1157
  }
@@ -1399,7 +1414,7 @@ var GoogleGenerativeAILanguageModel = class {
1399
1414
  var _a;
1400
1415
  this.modelId = modelId;
1401
1416
  this.config = config;
1402
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils6.generateId;
1417
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
1403
1418
  }
1404
1419
  get provider() {
1405
1420
  return this.config.provider;
@@ -1427,13 +1442,13 @@ var GoogleGenerativeAILanguageModel = class {
1427
1442
  var _a, _b;
1428
1443
  const warnings = [];
1429
1444
  const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
1430
- let googleOptions = await (0, import_provider_utils6.parseProviderOptions)({
1445
+ let googleOptions = await parseProviderOptions2({
1431
1446
  provider: providerOptionsName,
1432
1447
  providerOptions,
1433
1448
  schema: googleLanguageModelOptions
1434
1449
  });
1435
1450
  if (googleOptions == null && providerOptionsName !== "google") {
1436
- googleOptions = await (0, import_provider_utils6.parseProviderOptions)({
1451
+ googleOptions = await parseProviderOptions2({
1437
1452
  provider: "google",
1438
1453
  providerOptions,
1439
1454
  schema: googleLanguageModelOptions
@@ -1543,22 +1558,22 @@ var GoogleGenerativeAILanguageModel = class {
1543
1558
  async doGenerate(options) {
1544
1559
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1545
1560
  const { args, warnings, providerOptionsName } = await this.getArgs(options);
1546
- const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
1547
- await (0, import_provider_utils6.resolve)(this.config.headers),
1561
+ const mergedHeaders = combineHeaders2(
1562
+ await resolve2(this.config.headers),
1548
1563
  options.headers
1549
1564
  );
1550
1565
  const {
1551
1566
  responseHeaders,
1552
1567
  value: response,
1553
1568
  rawValue: rawResponse
1554
- } = await (0, import_provider_utils6.postJsonToApi)({
1569
+ } = await postJsonToApi2({
1555
1570
  url: `${this.config.baseURL}/${getModelPath(
1556
1571
  this.modelId
1557
1572
  )}:generateContent`,
1558
1573
  headers: mergedHeaders,
1559
1574
  body: args,
1560
1575
  failedResponseHandler: googleFailedResponseHandler,
1561
- successfulResponseHandler: (0, import_provider_utils6.createJsonResponseHandler)(responseSchema),
1576
+ successfulResponseHandler: createJsonResponseHandler2(responseSchema),
1562
1577
  abortSignal: options.abortSignal,
1563
1578
  fetch: this.config.fetch
1564
1579
  });
@@ -1725,18 +1740,18 @@ var GoogleGenerativeAILanguageModel = class {
1725
1740
  options,
1726
1741
  { isStreaming: true }
1727
1742
  );
1728
- const headers = (0, import_provider_utils6.combineHeaders)(
1729
- await (0, import_provider_utils6.resolve)(this.config.headers),
1743
+ const headers = combineHeaders2(
1744
+ await resolve2(this.config.headers),
1730
1745
  options.headers
1731
1746
  );
1732
- const { responseHeaders, value: response } = await (0, import_provider_utils6.postJsonToApi)({
1747
+ const { responseHeaders, value: response } = await postJsonToApi2({
1733
1748
  url: `${this.config.baseURL}/${getModelPath(
1734
1749
  this.modelId
1735
1750
  )}:streamGenerateContent?alt=sse`,
1736
1751
  headers,
1737
1752
  body: args,
1738
1753
  failedResponseHandler: googleFailedResponseHandler,
1739
- successfulResponseHandler: (0, import_provider_utils6.createEventSourceResponseHandler)(chunkSchema),
1754
+ successfulResponseHandler: createEventSourceResponseHandler(chunkSchema),
1740
1755
  abortSignal: options.abortSignal,
1741
1756
  fetch: this.config.fetch
1742
1757
  });
@@ -2132,7 +2147,7 @@ function resolveThinkingConfig({
2132
2147
  modelId,
2133
2148
  warnings
2134
2149
  }) {
2135
- if (!(0, import_provider_utils6.isCustomReasoning)(reasoning)) {
2150
+ if (!isCustomReasoning(reasoning)) {
2136
2151
  return void 0;
2137
2152
  }
2138
2153
  if (isGemini3Model(modelId) && !modelId.includes("gemini-3-pro-image")) {
@@ -2147,7 +2162,7 @@ function resolveGemini3ThinkingConfig({
2147
2162
  if (reasoning === "none") {
2148
2163
  return { thinkingLevel: "minimal" };
2149
2164
  }
2150
- const thinkingLevel = (0, import_provider_utils6.mapReasoningToProviderEffort)({
2165
+ const thinkingLevel = mapReasoningToProviderEffort({
2151
2166
  reasoning,
2152
2167
  effortMap: {
2153
2168
  minimal: "minimal",
@@ -2171,7 +2186,7 @@ function resolveGemini25ThinkingConfig({
2171
2186
  if (reasoning === "none") {
2172
2187
  return { thinkingBudget: 0 };
2173
2188
  }
2174
- const thinkingBudget = (0, import_provider_utils6.mapReasoningToProviderBudget)({
2189
+ const thinkingBudget = mapReasoningToProviderBudget({
2175
2190
  reasoning,
2176
2191
  maxOutputTokens: getMaxOutputTokensForGemini25Model(),
2177
2192
  maxReasoningBudget: getMaxThinkingTokensForGemini25Model(modelId),
@@ -2277,270 +2292,286 @@ function extractSources({
2277
2292
  }
2278
2293
  return sources.length > 0 ? sources : void 0;
2279
2294
  }
2280
- var getGroundingMetadataSchema = () => import_v45.z.object({
2281
- webSearchQueries: import_v45.z.array(import_v45.z.string()).nullish(),
2282
- imageSearchQueries: import_v45.z.array(import_v45.z.string()).nullish(),
2283
- retrievalQueries: import_v45.z.array(import_v45.z.string()).nullish(),
2284
- searchEntryPoint: import_v45.z.object({ renderedContent: import_v45.z.string() }).nullish(),
2285
- groundingChunks: import_v45.z.array(
2286
- import_v45.z.object({
2287
- web: import_v45.z.object({ uri: import_v45.z.string(), title: import_v45.z.string().nullish() }).nullish(),
2288
- image: import_v45.z.object({
2289
- sourceUri: import_v45.z.string(),
2290
- imageUri: import_v45.z.string(),
2291
- title: import_v45.z.string().nullish(),
2292
- domain: import_v45.z.string().nullish()
2295
+ var getGroundingMetadataSchema = () => z5.object({
2296
+ webSearchQueries: z5.array(z5.string()).nullish(),
2297
+ imageSearchQueries: z5.array(z5.string()).nullish(),
2298
+ retrievalQueries: z5.array(z5.string()).nullish(),
2299
+ searchEntryPoint: z5.object({ renderedContent: z5.string() }).nullish(),
2300
+ groundingChunks: z5.array(
2301
+ z5.object({
2302
+ web: z5.object({ uri: z5.string(), title: z5.string().nullish() }).nullish(),
2303
+ image: z5.object({
2304
+ sourceUri: z5.string(),
2305
+ imageUri: z5.string(),
2306
+ title: z5.string().nullish(),
2307
+ domain: z5.string().nullish()
2293
2308
  }).nullish(),
2294
- retrievedContext: import_v45.z.object({
2295
- uri: import_v45.z.string().nullish(),
2296
- title: import_v45.z.string().nullish(),
2297
- text: import_v45.z.string().nullish(),
2298
- fileSearchStore: import_v45.z.string().nullish()
2309
+ retrievedContext: z5.object({
2310
+ uri: z5.string().nullish(),
2311
+ title: z5.string().nullish(),
2312
+ text: z5.string().nullish(),
2313
+ fileSearchStore: z5.string().nullish()
2299
2314
  }).nullish(),
2300
- maps: import_v45.z.object({
2301
- uri: import_v45.z.string().nullish(),
2302
- title: import_v45.z.string().nullish(),
2303
- text: import_v45.z.string().nullish(),
2304
- placeId: import_v45.z.string().nullish()
2315
+ maps: z5.object({
2316
+ uri: z5.string().nullish(),
2317
+ title: z5.string().nullish(),
2318
+ text: z5.string().nullish(),
2319
+ placeId: z5.string().nullish()
2305
2320
  }).nullish()
2306
2321
  })
2307
2322
  ).nullish(),
2308
- groundingSupports: import_v45.z.array(
2309
- import_v45.z.object({
2310
- segment: import_v45.z.object({
2311
- startIndex: import_v45.z.number().nullish(),
2312
- endIndex: import_v45.z.number().nullish(),
2313
- text: import_v45.z.string().nullish()
2323
+ groundingSupports: z5.array(
2324
+ z5.object({
2325
+ segment: z5.object({
2326
+ startIndex: z5.number().nullish(),
2327
+ endIndex: z5.number().nullish(),
2328
+ text: z5.string().nullish()
2314
2329
  }).nullish(),
2315
- segment_text: import_v45.z.string().nullish(),
2316
- groundingChunkIndices: import_v45.z.array(import_v45.z.number()).nullish(),
2317
- supportChunkIndices: import_v45.z.array(import_v45.z.number()).nullish(),
2318
- confidenceScores: import_v45.z.array(import_v45.z.number()).nullish(),
2319
- confidenceScore: import_v45.z.array(import_v45.z.number()).nullish()
2330
+ segment_text: z5.string().nullish(),
2331
+ groundingChunkIndices: z5.array(z5.number()).nullish(),
2332
+ supportChunkIndices: z5.array(z5.number()).nullish(),
2333
+ confidenceScores: z5.array(z5.number()).nullish(),
2334
+ confidenceScore: z5.array(z5.number()).nullish()
2320
2335
  })
2321
2336
  ).nullish(),
2322
- retrievalMetadata: import_v45.z.union([
2323
- import_v45.z.object({
2324
- webDynamicRetrievalScore: import_v45.z.number()
2337
+ retrievalMetadata: z5.union([
2338
+ z5.object({
2339
+ webDynamicRetrievalScore: z5.number()
2325
2340
  }),
2326
- import_v45.z.object({})
2341
+ z5.object({})
2327
2342
  ]).nullish()
2328
2343
  });
2329
- var partialArgSchema = import_v45.z.object({
2330
- jsonPath: import_v45.z.string(),
2331
- stringValue: import_v45.z.string().nullish(),
2332
- numberValue: import_v45.z.number().nullish(),
2333
- boolValue: import_v45.z.boolean().nullish(),
2334
- nullValue: import_v45.z.unknown().nullish(),
2335
- willContinue: import_v45.z.boolean().nullish()
2344
+ var partialArgSchema = z5.object({
2345
+ jsonPath: z5.string(),
2346
+ stringValue: z5.string().nullish(),
2347
+ numberValue: z5.number().nullish(),
2348
+ boolValue: z5.boolean().nullish(),
2349
+ nullValue: z5.unknown().nullish(),
2350
+ willContinue: z5.boolean().nullish()
2336
2351
  });
2337
- var getContentSchema = () => import_v45.z.object({
2338
- parts: import_v45.z.array(
2339
- import_v45.z.union([
2352
+ var getContentSchema = () => z5.object({
2353
+ parts: z5.array(
2354
+ z5.union([
2340
2355
  // note: order matters since text can be fully empty
2341
- import_v45.z.object({
2342
- functionCall: import_v45.z.object({
2343
- name: import_v45.z.string().nullish(),
2344
- args: import_v45.z.unknown().nullish(),
2345
- partialArgs: import_v45.z.array(partialArgSchema).nullish(),
2346
- willContinue: import_v45.z.boolean().nullish()
2356
+ z5.object({
2357
+ functionCall: z5.object({
2358
+ name: z5.string().nullish(),
2359
+ args: z5.unknown().nullish(),
2360
+ partialArgs: z5.array(partialArgSchema).nullish(),
2361
+ willContinue: z5.boolean().nullish()
2347
2362
  }),
2348
- thoughtSignature: import_v45.z.string().nullish()
2363
+ thoughtSignature: z5.string().nullish()
2349
2364
  }),
2350
- import_v45.z.object({
2351
- inlineData: import_v45.z.object({
2352
- mimeType: import_v45.z.string(),
2353
- data: import_v45.z.string()
2365
+ z5.object({
2366
+ inlineData: z5.object({
2367
+ mimeType: z5.string(),
2368
+ data: z5.string()
2354
2369
  }),
2355
- thought: import_v45.z.boolean().nullish(),
2356
- thoughtSignature: import_v45.z.string().nullish()
2370
+ thought: z5.boolean().nullish(),
2371
+ thoughtSignature: z5.string().nullish()
2357
2372
  }),
2358
- import_v45.z.object({
2359
- toolCall: import_v45.z.object({
2360
- toolType: import_v45.z.string(),
2361
- args: import_v45.z.unknown().nullish(),
2362
- id: import_v45.z.string()
2373
+ z5.object({
2374
+ toolCall: z5.object({
2375
+ toolType: z5.string(),
2376
+ args: z5.unknown().nullish(),
2377
+ id: z5.string()
2363
2378
  }),
2364
- thoughtSignature: import_v45.z.string().nullish()
2379
+ thoughtSignature: z5.string().nullish()
2365
2380
  }),
2366
- import_v45.z.object({
2367
- toolResponse: import_v45.z.object({
2368
- toolType: import_v45.z.string(),
2369
- response: import_v45.z.unknown().nullish(),
2370
- id: import_v45.z.string()
2381
+ z5.object({
2382
+ toolResponse: z5.object({
2383
+ toolType: z5.string(),
2384
+ response: z5.unknown().nullish(),
2385
+ id: z5.string()
2371
2386
  }),
2372
- thoughtSignature: import_v45.z.string().nullish()
2387
+ thoughtSignature: z5.string().nullish()
2373
2388
  }),
2374
- import_v45.z.object({
2375
- executableCode: import_v45.z.object({
2376
- language: import_v45.z.string(),
2377
- code: import_v45.z.string()
2389
+ z5.object({
2390
+ executableCode: z5.object({
2391
+ language: z5.string(),
2392
+ code: z5.string()
2378
2393
  }).nullish(),
2379
- codeExecutionResult: import_v45.z.object({
2380
- outcome: import_v45.z.string(),
2381
- output: import_v45.z.string().nullish()
2394
+ codeExecutionResult: z5.object({
2395
+ outcome: z5.string(),
2396
+ output: z5.string().nullish()
2382
2397
  }).nullish(),
2383
- text: import_v45.z.string().nullish(),
2384
- thought: import_v45.z.boolean().nullish(),
2385
- thoughtSignature: import_v45.z.string().nullish()
2398
+ text: z5.string().nullish(),
2399
+ thought: z5.boolean().nullish(),
2400
+ thoughtSignature: z5.string().nullish()
2386
2401
  })
2387
2402
  ])
2388
2403
  ).nullish()
2389
2404
  });
2390
- var getSafetyRatingSchema = () => import_v45.z.object({
2391
- category: import_v45.z.string().nullish(),
2392
- probability: import_v45.z.string().nullish(),
2393
- probabilityScore: import_v45.z.number().nullish(),
2394
- severity: import_v45.z.string().nullish(),
2395
- severityScore: import_v45.z.number().nullish(),
2396
- blocked: import_v45.z.boolean().nullish()
2405
+ var getSafetyRatingSchema = () => z5.object({
2406
+ category: z5.string().nullish(),
2407
+ probability: z5.string().nullish(),
2408
+ probabilityScore: z5.number().nullish(),
2409
+ severity: z5.string().nullish(),
2410
+ severityScore: z5.number().nullish(),
2411
+ blocked: z5.boolean().nullish()
2397
2412
  });
2398
- var tokenDetailsSchema = import_v45.z.array(
2399
- import_v45.z.object({
2400
- modality: import_v45.z.string(),
2401
- tokenCount: import_v45.z.number()
2413
+ var tokenDetailsSchema = z5.array(
2414
+ z5.object({
2415
+ modality: z5.string(),
2416
+ tokenCount: z5.number()
2402
2417
  })
2403
2418
  ).nullish();
2404
- var usageSchema = import_v45.z.object({
2405
- cachedContentTokenCount: import_v45.z.number().nullish(),
2406
- thoughtsTokenCount: import_v45.z.number().nullish(),
2407
- promptTokenCount: import_v45.z.number().nullish(),
2408
- candidatesTokenCount: import_v45.z.number().nullish(),
2409
- totalTokenCount: import_v45.z.number().nullish(),
2419
+ var usageSchema = z5.object({
2420
+ cachedContentTokenCount: z5.number().nullish(),
2421
+ thoughtsTokenCount: z5.number().nullish(),
2422
+ promptTokenCount: z5.number().nullish(),
2423
+ candidatesTokenCount: z5.number().nullish(),
2424
+ totalTokenCount: z5.number().nullish(),
2410
2425
  // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
2411
- trafficType: import_v45.z.string().nullish(),
2426
+ trafficType: z5.string().nullish(),
2412
2427
  // https://ai.google.dev/api/generate-content#Modality
2413
2428
  promptTokensDetails: tokenDetailsSchema,
2414
2429
  candidatesTokensDetails: tokenDetailsSchema
2415
2430
  });
2416
- var getUrlContextMetadataSchema = () => import_v45.z.object({
2417
- urlMetadata: import_v45.z.array(
2418
- import_v45.z.object({
2419
- retrievedUrl: import_v45.z.string(),
2420
- urlRetrievalStatus: import_v45.z.string()
2431
+ var getUrlContextMetadataSchema = () => z5.object({
2432
+ urlMetadata: z5.array(
2433
+ z5.object({
2434
+ retrievedUrl: z5.string(),
2435
+ urlRetrievalStatus: z5.string()
2421
2436
  })
2422
2437
  ).nullish()
2423
2438
  });
2424
- var responseSchema = (0, import_provider_utils6.lazySchema)(
2425
- () => (0, import_provider_utils6.zodSchema)(
2426
- import_v45.z.object({
2427
- candidates: import_v45.z.array(
2428
- import_v45.z.object({
2429
- content: getContentSchema().nullish().or(import_v45.z.object({}).strict()),
2430
- finishReason: import_v45.z.string().nullish(),
2431
- finishMessage: import_v45.z.string().nullish(),
2432
- safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish(),
2439
+ var responseSchema = lazySchema5(
2440
+ () => zodSchema5(
2441
+ z5.object({
2442
+ candidates: z5.array(
2443
+ z5.object({
2444
+ content: getContentSchema().nullish().or(z5.object({}).strict()),
2445
+ finishReason: z5.string().nullish(),
2446
+ finishMessage: z5.string().nullish(),
2447
+ safetyRatings: z5.array(getSafetyRatingSchema()).nullish(),
2433
2448
  groundingMetadata: getGroundingMetadataSchema().nullish(),
2434
2449
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
2435
2450
  })
2436
2451
  ),
2437
2452
  usageMetadata: usageSchema.nullish(),
2438
- promptFeedback: import_v45.z.object({
2439
- blockReason: import_v45.z.string().nullish(),
2440
- safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
2453
+ promptFeedback: z5.object({
2454
+ blockReason: z5.string().nullish(),
2455
+ safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
2441
2456
  }).nullish(),
2442
- serviceTier: import_v45.z.string().nullish()
2457
+ serviceTier: z5.string().nullish()
2443
2458
  })
2444
2459
  )
2445
2460
  );
2446
- var chunkSchema = (0, import_provider_utils6.lazySchema)(
2447
- () => (0, import_provider_utils6.zodSchema)(
2448
- import_v45.z.object({
2449
- candidates: import_v45.z.array(
2450
- import_v45.z.object({
2461
+ var chunkSchema = lazySchema5(
2462
+ () => zodSchema5(
2463
+ z5.object({
2464
+ candidates: z5.array(
2465
+ z5.object({
2451
2466
  content: getContentSchema().nullish(),
2452
- finishReason: import_v45.z.string().nullish(),
2453
- finishMessage: import_v45.z.string().nullish(),
2454
- safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish(),
2467
+ finishReason: z5.string().nullish(),
2468
+ finishMessage: z5.string().nullish(),
2469
+ safetyRatings: z5.array(getSafetyRatingSchema()).nullish(),
2455
2470
  groundingMetadata: getGroundingMetadataSchema().nullish(),
2456
2471
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
2457
2472
  })
2458
2473
  ).nullish(),
2459
2474
  usageMetadata: usageSchema.nullish(),
2460
- promptFeedback: import_v45.z.object({
2461
- blockReason: import_v45.z.string().nullish(),
2462
- safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
2475
+ promptFeedback: z5.object({
2476
+ blockReason: z5.string().nullish(),
2477
+ safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
2463
2478
  }).nullish(),
2464
- serviceTier: import_v45.z.string().nullish()
2479
+ serviceTier: z5.string().nullish()
2465
2480
  })
2466
2481
  )
2467
2482
  );
2468
2483
 
2469
2484
  // src/tool/code-execution.ts
2470
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
2471
- var import_v46 = require("zod/v4");
2472
- var codeExecution = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
2485
+ import { createProviderToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
2486
+ import { z as z6 } from "zod/v4";
2487
+ var codeExecution = createProviderToolFactoryWithOutputSchema({
2473
2488
  id: "google.code_execution",
2474
- inputSchema: import_v46.z.object({
2475
- language: import_v46.z.string().describe("The programming language of the code."),
2476
- code: import_v46.z.string().describe("The code to be executed.")
2489
+ inputSchema: z6.object({
2490
+ language: z6.string().describe("The programming language of the code."),
2491
+ code: z6.string().describe("The code to be executed.")
2477
2492
  }),
2478
- outputSchema: import_v46.z.object({
2479
- outcome: import_v46.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
2480
- output: import_v46.z.string().describe("The output from the code execution.")
2493
+ outputSchema: z6.object({
2494
+ outcome: z6.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
2495
+ output: z6.string().describe("The output from the code execution.")
2481
2496
  })
2482
2497
  });
2483
2498
 
2484
2499
  // src/tool/enterprise-web-search.ts
2485
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
2486
- var import_v47 = require("zod/v4");
2487
- var enterpriseWebSearch = (0, import_provider_utils8.createProviderToolFactory)({
2500
+ import {
2501
+ createProviderToolFactory,
2502
+ lazySchema as lazySchema6,
2503
+ zodSchema as zodSchema6
2504
+ } from "@ai-sdk/provider-utils";
2505
+ import { z as z7 } from "zod/v4";
2506
+ var enterpriseWebSearch = createProviderToolFactory({
2488
2507
  id: "google.enterprise_web_search",
2489
- inputSchema: (0, import_provider_utils8.lazySchema)(() => (0, import_provider_utils8.zodSchema)(import_v47.z.object({})))
2508
+ inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
2490
2509
  });
2491
2510
 
2492
2511
  // src/tool/file-search.ts
2493
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
2494
- var import_v48 = require("zod/v4");
2495
- var fileSearchArgsBaseSchema = import_v48.z.object({
2512
+ import {
2513
+ createProviderToolFactory as createProviderToolFactory2,
2514
+ lazySchema as lazySchema7,
2515
+ zodSchema as zodSchema7
2516
+ } from "@ai-sdk/provider-utils";
2517
+ import { z as z8 } from "zod/v4";
2518
+ var fileSearchArgsBaseSchema = z8.object({
2496
2519
  /** The names of the file_search_stores to retrieve from.
2497
2520
  * Example: `fileSearchStores/my-file-search-store-123`
2498
2521
  */
2499
- fileSearchStoreNames: import_v48.z.array(import_v48.z.string()).describe(
2522
+ fileSearchStoreNames: z8.array(z8.string()).describe(
2500
2523
  "The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
2501
2524
  ),
2502
2525
  /** The number of file search retrieval chunks to retrieve. */
2503
- topK: import_v48.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
2526
+ topK: z8.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
2504
2527
  /** Metadata filter to apply to the file search retrieval documents.
2505
2528
  * See https://google.aip.dev/160 for the syntax of the filter expression.
2506
2529
  */
2507
- metadataFilter: import_v48.z.string().describe(
2530
+ metadataFilter: z8.string().describe(
2508
2531
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
2509
2532
  ).optional()
2510
2533
  }).passthrough();
2511
- var fileSearchArgsSchema = (0, import_provider_utils9.lazySchema)(
2512
- () => (0, import_provider_utils9.zodSchema)(fileSearchArgsBaseSchema)
2534
+ var fileSearchArgsSchema = lazySchema7(
2535
+ () => zodSchema7(fileSearchArgsBaseSchema)
2513
2536
  );
2514
- var fileSearch = (0, import_provider_utils9.createProviderToolFactory)({
2537
+ var fileSearch = createProviderToolFactory2({
2515
2538
  id: "google.file_search",
2516
2539
  inputSchema: fileSearchArgsSchema
2517
2540
  });
2518
2541
 
2519
2542
  // src/tool/google-maps.ts
2520
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
2521
- var import_v49 = require("zod/v4");
2522
- var googleMaps = (0, import_provider_utils10.createProviderToolFactory)({
2543
+ import {
2544
+ createProviderToolFactory as createProviderToolFactory3,
2545
+ lazySchema as lazySchema8,
2546
+ zodSchema as zodSchema8
2547
+ } from "@ai-sdk/provider-utils";
2548
+ import { z as z9 } from "zod/v4";
2549
+ var googleMaps = createProviderToolFactory3({
2523
2550
  id: "google.google_maps",
2524
- inputSchema: (0, import_provider_utils10.lazySchema)(() => (0, import_provider_utils10.zodSchema)(import_v49.z.object({})))
2551
+ inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
2525
2552
  });
2526
2553
 
2527
2554
  // src/tool/google-search.ts
2528
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
2529
- var import_v410 = require("zod/v4");
2530
- var googleSearchToolArgsBaseSchema = import_v410.z.object({
2531
- searchTypes: import_v410.z.object({
2532
- webSearch: import_v410.z.object({}).optional(),
2533
- imageSearch: import_v410.z.object({}).optional()
2555
+ import {
2556
+ createProviderToolFactory as createProviderToolFactory4,
2557
+ lazySchema as lazySchema9,
2558
+ zodSchema as zodSchema9
2559
+ } from "@ai-sdk/provider-utils";
2560
+ import { z as z10 } from "zod/v4";
2561
+ var googleSearchToolArgsBaseSchema = z10.object({
2562
+ searchTypes: z10.object({
2563
+ webSearch: z10.object({}).optional(),
2564
+ imageSearch: z10.object({}).optional()
2534
2565
  }).optional(),
2535
- timeRangeFilter: import_v410.z.object({
2536
- startTime: import_v410.z.string(),
2537
- endTime: import_v410.z.string()
2566
+ timeRangeFilter: z10.object({
2567
+ startTime: z10.string(),
2568
+ endTime: z10.string()
2538
2569
  }).optional()
2539
2570
  }).passthrough();
2540
- var googleSearchToolArgsSchema = (0, import_provider_utils11.lazySchema)(
2541
- () => (0, import_provider_utils11.zodSchema)(googleSearchToolArgsBaseSchema)
2571
+ var googleSearchToolArgsSchema = lazySchema9(
2572
+ () => zodSchema9(googleSearchToolArgsBaseSchema)
2542
2573
  );
2543
- var googleSearch = (0, import_provider_utils11.createProviderToolFactory)(
2574
+ var googleSearch = createProviderToolFactory4(
2544
2575
  {
2545
2576
  id: "google.google_search",
2546
2577
  inputSchema: googleSearchToolArgsSchema
@@ -2548,21 +2579,25 @@ var googleSearch = (0, import_provider_utils11.createProviderToolFactory)(
2548
2579
  );
2549
2580
 
2550
2581
  // src/tool/url-context.ts
2551
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
2552
- var import_v411 = require("zod/v4");
2553
- var urlContext = (0, import_provider_utils12.createProviderToolFactory)({
2582
+ import {
2583
+ createProviderToolFactory as createProviderToolFactory5,
2584
+ lazySchema as lazySchema10,
2585
+ zodSchema as zodSchema10
2586
+ } from "@ai-sdk/provider-utils";
2587
+ import { z as z11 } from "zod/v4";
2588
+ var urlContext = createProviderToolFactory5({
2554
2589
  id: "google.url_context",
2555
- inputSchema: (0, import_provider_utils12.lazySchema)(() => (0, import_provider_utils12.zodSchema)(import_v411.z.object({})))
2590
+ inputSchema: lazySchema10(() => zodSchema10(z11.object({})))
2556
2591
  });
2557
2592
 
2558
2593
  // src/tool/vertex-rag-store.ts
2559
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
2560
- var import_v412 = require("zod/v4");
2561
- var vertexRagStore = (0, import_provider_utils13.createProviderToolFactory)({
2594
+ import { createProviderToolFactory as createProviderToolFactory6 } from "@ai-sdk/provider-utils";
2595
+ import { z as z12 } from "zod/v4";
2596
+ var vertexRagStore = createProviderToolFactory6({
2562
2597
  id: "google.vertex_rag_store",
2563
- inputSchema: import_v412.z.object({
2564
- ragCorpus: import_v412.z.string(),
2565
- topK: import_v412.z.number().optional()
2598
+ inputSchema: z12.object({
2599
+ ragCorpus: z12.string(),
2600
+ topK: z12.number().optional()
2566
2601
  })
2567
2602
  });
2568
2603
 
@@ -2627,8 +2662,18 @@ var googleTools = {
2627
2662
  };
2628
2663
 
2629
2664
  // src/google-generative-ai-image-model.ts
2630
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2631
- var import_v413 = require("zod/v4");
2665
+ import {
2666
+ combineHeaders as combineHeaders3,
2667
+ convertToBase64 as convertToBase642,
2668
+ createJsonResponseHandler as createJsonResponseHandler3,
2669
+ generateId as defaultGenerateId,
2670
+ lazySchema as lazySchema11,
2671
+ parseProviderOptions as parseProviderOptions3,
2672
+ postJsonToApi as postJsonToApi3,
2673
+ resolve as resolve3,
2674
+ zodSchema as zodSchema11
2675
+ } from "@ai-sdk/provider-utils";
2676
+ import { z as z13 } from "zod/v4";
2632
2677
  var GoogleGenerativeAIImageModel = class {
2633
2678
  constructor(modelId, settings, config) {
2634
2679
  this.modelId = modelId;
@@ -2693,7 +2738,7 @@ var GoogleGenerativeAIImageModel = class {
2693
2738
  details: "This model does not support the `seed` option through this provider."
2694
2739
  });
2695
2740
  }
2696
- const googleOptions = await (0, import_provider_utils14.parseProviderOptions)({
2741
+ const googleOptions = await parseProviderOptions3({
2697
2742
  provider: "google",
2698
2743
  providerOptions,
2699
2744
  schema: googleImageModelOptionsSchema
@@ -2712,12 +2757,12 @@ var GoogleGenerativeAIImageModel = class {
2712
2757
  instances: [{ prompt }],
2713
2758
  parameters
2714
2759
  };
2715
- const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
2760
+ const { responseHeaders, value: response } = await postJsonToApi3({
2716
2761
  url: `${this.config.baseURL}/models/${this.modelId}:predict`,
2717
- headers: (0, import_provider_utils14.combineHeaders)(await (0, import_provider_utils14.resolve)(this.config.headers), headers),
2762
+ headers: combineHeaders3(await resolve3(this.config.headers), headers),
2718
2763
  body,
2719
2764
  failedResponseHandler: googleFailedResponseHandler,
2720
- successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
2765
+ successfulResponseHandler: createJsonResponseHandler3(
2721
2766
  googleImageResponseSchema
2722
2767
  ),
2723
2768
  abortSignal,
@@ -2803,7 +2848,7 @@ var GoogleGenerativeAIImageModel = class {
2803
2848
  baseURL: this.config.baseURL,
2804
2849
  headers: (_a = this.config.headers) != null ? _a : {},
2805
2850
  fetch: this.config.fetch,
2806
- generateId: (_b = this.config.generateId) != null ? _b : import_provider_utils14.generateId
2851
+ generateId: (_b = this.config.generateId) != null ? _b : defaultGenerateId
2807
2852
  });
2808
2853
  const result = await languageModel.doGenerate({
2809
2854
  prompt: languageModelPrompt,
@@ -2824,7 +2869,7 @@ var GoogleGenerativeAIImageModel = class {
2824
2869
  const images = [];
2825
2870
  for (const part of result.content) {
2826
2871
  if (part.type === "file" && part.mediaType.startsWith("image/")) {
2827
- images.push((0, import_provider_utils14.convertToBase64)(part.data));
2872
+ images.push(convertToBase642(part.data));
2828
2873
  }
2829
2874
  }
2830
2875
  return {
@@ -2851,26 +2896,36 @@ var GoogleGenerativeAIImageModel = class {
2851
2896
  function isGeminiModel(modelId) {
2852
2897
  return modelId.startsWith("gemini-");
2853
2898
  }
2854
- var googleImageResponseSchema = (0, import_provider_utils14.lazySchema)(
2855
- () => (0, import_provider_utils14.zodSchema)(
2856
- import_v413.z.object({
2857
- predictions: import_v413.z.array(import_v413.z.object({ bytesBase64Encoded: import_v413.z.string() })).default([])
2899
+ var googleImageResponseSchema = lazySchema11(
2900
+ () => zodSchema11(
2901
+ z13.object({
2902
+ predictions: z13.array(z13.object({ bytesBase64Encoded: z13.string() })).default([])
2858
2903
  })
2859
2904
  )
2860
2905
  );
2861
- var googleImageModelOptionsSchema = (0, import_provider_utils14.lazySchema)(
2862
- () => (0, import_provider_utils14.zodSchema)(
2863
- import_v413.z.object({
2864
- personGeneration: import_v413.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
2865
- aspectRatio: import_v413.z.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
2906
+ var googleImageModelOptionsSchema = lazySchema11(
2907
+ () => zodSchema11(
2908
+ z13.object({
2909
+ personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
2910
+ aspectRatio: z13.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish()
2866
2911
  })
2867
2912
  )
2868
2913
  );
2869
2914
 
2870
2915
  // src/google-generative-ai-files.ts
2871
- var import_provider4 = require("@ai-sdk/provider");
2872
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
2873
- var import_v414 = require("zod/v4");
2916
+ import {
2917
+ AISDKError
2918
+ } from "@ai-sdk/provider";
2919
+ import {
2920
+ combineHeaders as combineHeaders4,
2921
+ createJsonResponseHandler as createJsonResponseHandler4,
2922
+ delay,
2923
+ lazySchema as lazySchema12,
2924
+ parseProviderOptions as parseProviderOptions4,
2925
+ zodSchema as zodSchema12,
2926
+ getFromApi
2927
+ } from "@ai-sdk/provider-utils";
2928
+ import { z as z14 } from "zod/v4";
2874
2929
  var GoogleGenerativeAIFiles = class {
2875
2930
  constructor(config) {
2876
2931
  this.config = config;
@@ -2881,7 +2936,7 @@ var GoogleGenerativeAIFiles = class {
2881
2936
  }
2882
2937
  async uploadFile(options) {
2883
2938
  var _a, _b, _c, _d;
2884
- const googleOptions = await (0, import_provider_utils15.parseProviderOptions)({
2939
+ const googleOptions = await parseProviderOptions4({
2885
2940
  provider: "google",
2886
2941
  providerOptions: options.providerOptions,
2887
2942
  schema: googleFilesUploadOptionsSchema
@@ -2915,14 +2970,14 @@ var GoogleGenerativeAIFiles = class {
2915
2970
  });
2916
2971
  if (!initResponse.ok) {
2917
2972
  const errorBody = await initResponse.text();
2918
- throw new import_provider4.AISDKError({
2973
+ throw new AISDKError({
2919
2974
  name: "GOOGLE_FILES_UPLOAD_ERROR",
2920
2975
  message: `Failed to initiate resumable upload: ${initResponse.status} ${errorBody}`
2921
2976
  });
2922
2977
  }
2923
2978
  const uploadUrl = initResponse.headers.get("x-goog-upload-url");
2924
2979
  if (!uploadUrl) {
2925
- throw new import_provider4.AISDKError({
2980
+ throw new AISDKError({
2926
2981
  name: "GOOGLE_FILES_UPLOAD_ERROR",
2927
2982
  message: "No upload URL returned from initiation request"
2928
2983
  });
@@ -2938,7 +2993,7 @@ var GoogleGenerativeAIFiles = class {
2938
2993
  });
2939
2994
  if (!uploadResponse.ok) {
2940
2995
  const errorBody = await uploadResponse.text();
2941
- throw new import_provider4.AISDKError({
2996
+ throw new AISDKError({
2942
2997
  name: "GOOGLE_FILES_UPLOAD_ERROR",
2943
2998
  message: `Failed to upload file data: ${uploadResponse.status} ${errorBody}`
2944
2999
  });
@@ -2950,16 +3005,16 @@ var GoogleGenerativeAIFiles = class {
2950
3005
  const startTime = Date.now();
2951
3006
  while (file.state === "PROCESSING") {
2952
3007
  if (Date.now() - startTime > pollTimeoutMs) {
2953
- throw new import_provider4.AISDKError({
3008
+ throw new AISDKError({
2954
3009
  name: "GOOGLE_FILES_UPLOAD_TIMEOUT",
2955
3010
  message: `File processing timed out after ${pollTimeoutMs}ms`
2956
3011
  });
2957
3012
  }
2958
- await (0, import_provider_utils15.delay)(pollIntervalMs);
2959
- const { value: fileStatus } = await (0, import_provider_utils15.getFromApi)({
3013
+ await delay(pollIntervalMs);
3014
+ const { value: fileStatus } = await getFromApi({
2960
3015
  url: `${this.config.baseURL}/${file.name}`,
2961
- headers: (0, import_provider_utils15.combineHeaders)(resolvedHeaders),
2962
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3016
+ headers: combineHeaders4(resolvedHeaders),
3017
+ successfulResponseHandler: createJsonResponseHandler4(
2963
3018
  googleFileResponseSchema
2964
3019
  ),
2965
3020
  failedResponseHandler: googleFailedResponseHandler,
@@ -2968,7 +3023,7 @@ var GoogleGenerativeAIFiles = class {
2968
3023
  file = fileStatus;
2969
3024
  }
2970
3025
  if (file.state === "FAILED") {
2971
- throw new import_provider4.AISDKError({
3026
+ throw new AISDKError({
2972
3027
  name: "GOOGLE_FILES_UPLOAD_FAILED",
2973
3028
  message: `File processing failed for ${file.name}`
2974
3029
  });
@@ -2994,36 +3049,49 @@ var GoogleGenerativeAIFiles = class {
2994
3049
  };
2995
3050
  }
2996
3051
  };
2997
- var googleFileResponseSchema = (0, import_provider_utils15.lazySchema)(
2998
- () => (0, import_provider_utils15.zodSchema)(
2999
- import_v414.z.object({
3000
- name: import_v414.z.string(),
3001
- displayName: import_v414.z.string().nullish(),
3002
- mimeType: import_v414.z.string(),
3003
- sizeBytes: import_v414.z.string().nullish(),
3004
- createTime: import_v414.z.string().nullish(),
3005
- updateTime: import_v414.z.string().nullish(),
3006
- expirationTime: import_v414.z.string().nullish(),
3007
- sha256Hash: import_v414.z.string().nullish(),
3008
- uri: import_v414.z.string(),
3009
- state: import_v414.z.string()
3052
+ var googleFileResponseSchema = lazySchema12(
3053
+ () => zodSchema12(
3054
+ z14.object({
3055
+ name: z14.string(),
3056
+ displayName: z14.string().nullish(),
3057
+ mimeType: z14.string(),
3058
+ sizeBytes: z14.string().nullish(),
3059
+ createTime: z14.string().nullish(),
3060
+ updateTime: z14.string().nullish(),
3061
+ expirationTime: z14.string().nullish(),
3062
+ sha256Hash: z14.string().nullish(),
3063
+ uri: z14.string(),
3064
+ state: z14.string()
3010
3065
  })
3011
3066
  )
3012
3067
  );
3013
- var googleFilesUploadOptionsSchema = (0, import_provider_utils15.lazySchema)(
3014
- () => (0, import_provider_utils15.zodSchema)(
3015
- import_v414.z.object({
3016
- displayName: import_v414.z.string().nullish(),
3017
- pollIntervalMs: import_v414.z.number().positive().nullish(),
3018
- pollTimeoutMs: import_v414.z.number().positive().nullish()
3068
+ var googleFilesUploadOptionsSchema = lazySchema12(
3069
+ () => zodSchema12(
3070
+ z14.object({
3071
+ displayName: z14.string().nullish(),
3072
+ pollIntervalMs: z14.number().positive().nullish(),
3073
+ pollTimeoutMs: z14.number().positive().nullish()
3019
3074
  }).passthrough()
3020
3075
  )
3021
3076
  );
3022
3077
 
3023
3078
  // src/google-generative-ai-video-model.ts
3024
- var import_provider5 = require("@ai-sdk/provider");
3025
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
3026
- var import_v415 = require("zod/v4");
3079
+ import {
3080
+ AISDKError as AISDKError2
3081
+ } from "@ai-sdk/provider";
3082
+ import {
3083
+ combineHeaders as combineHeaders5,
3084
+ convertUint8ArrayToBase64,
3085
+ createJsonResponseHandler as createJsonResponseHandler5,
3086
+ delay as delay2,
3087
+ getFromApi as getFromApi2,
3088
+ lazySchema as lazySchema13,
3089
+ parseProviderOptions as parseProviderOptions5,
3090
+ postJsonToApi as postJsonToApi4,
3091
+ resolve as resolve4,
3092
+ zodSchema as zodSchema13
3093
+ } from "@ai-sdk/provider-utils";
3094
+ import { z as z15 } from "zod/v4";
3027
3095
  var GoogleGenerativeAIVideoModel = class {
3028
3096
  constructor(modelId, config) {
3029
3097
  this.modelId = modelId;
@@ -3040,7 +3108,7 @@ var GoogleGenerativeAIVideoModel = class {
3040
3108
  var _a, _b, _c, _d, _e, _f, _g, _h;
3041
3109
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
3042
3110
  const warnings = [];
3043
- const googleOptions = await (0, import_provider_utils16.parseProviderOptions)({
3111
+ const googleOptions = await parseProviderOptions5({
3044
3112
  provider: "google",
3045
3113
  providerOptions: options.providerOptions,
3046
3114
  schema: googleVideoModelOptionsSchema
@@ -3058,7 +3126,7 @@ var GoogleGenerativeAIVideoModel = class {
3058
3126
  details: "Google Generative AI video models require base64-encoded images. URL will be ignored."
3059
3127
  });
3060
3128
  } else {
3061
- const base64Data = typeof options.image.data === "string" ? options.image.data : (0, import_provider_utils16.convertUint8ArrayToBase64)(options.image.data);
3129
+ const base64Data = typeof options.image.data === "string" ? options.image.data : convertUint8ArrayToBase64(options.image.data);
3062
3130
  instance.image = {
3063
3131
  inlineData: {
3064
3132
  mimeType: options.image.mediaType || "image/png",
@@ -3124,17 +3192,17 @@ var GoogleGenerativeAIVideoModel = class {
3124
3192
  }
3125
3193
  }
3126
3194
  }
3127
- const { value: operation } = await (0, import_provider_utils16.postJsonToApi)({
3195
+ const { value: operation } = await postJsonToApi4({
3128
3196
  url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
3129
- headers: (0, import_provider_utils16.combineHeaders)(
3130
- await (0, import_provider_utils16.resolve)(this.config.headers),
3197
+ headers: combineHeaders5(
3198
+ await resolve4(this.config.headers),
3131
3199
  options.headers
3132
3200
  ),
3133
3201
  body: {
3134
3202
  instances,
3135
3203
  parameters
3136
3204
  },
3137
- successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3205
+ successfulResponseHandler: createJsonResponseHandler5(
3138
3206
  googleOperationSchema
3139
3207
  ),
3140
3208
  failedResponseHandler: googleFailedResponseHandler,
@@ -3143,7 +3211,7 @@ var GoogleGenerativeAIVideoModel = class {
3143
3211
  });
3144
3212
  const operationName = operation.name;
3145
3213
  if (!operationName) {
3146
- throw new import_provider5.AISDKError({
3214
+ throw new AISDKError2({
3147
3215
  name: "GOOGLE_VIDEO_GENERATION_ERROR",
3148
3216
  message: "No operation name returned from API"
3149
3217
  });
@@ -3155,25 +3223,25 @@ var GoogleGenerativeAIVideoModel = class {
3155
3223
  let responseHeaders;
3156
3224
  while (!finalOperation.done) {
3157
3225
  if (Date.now() - startTime > pollTimeoutMs) {
3158
- throw new import_provider5.AISDKError({
3226
+ throw new AISDKError2({
3159
3227
  name: "GOOGLE_VIDEO_GENERATION_TIMEOUT",
3160
3228
  message: `Video generation timed out after ${pollTimeoutMs}ms`
3161
3229
  });
3162
3230
  }
3163
- await (0, import_provider_utils16.delay)(pollIntervalMs);
3231
+ await delay2(pollIntervalMs);
3164
3232
  if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
3165
- throw new import_provider5.AISDKError({
3233
+ throw new AISDKError2({
3166
3234
  name: "GOOGLE_VIDEO_GENERATION_ABORTED",
3167
3235
  message: "Video generation request was aborted"
3168
3236
  });
3169
3237
  }
3170
- const { value: statusOperation, responseHeaders: pollHeaders } = await (0, import_provider_utils16.getFromApi)({
3238
+ const { value: statusOperation, responseHeaders: pollHeaders } = await getFromApi2({
3171
3239
  url: `${this.config.baseURL}/${operationName}`,
3172
- headers: (0, import_provider_utils16.combineHeaders)(
3173
- await (0, import_provider_utils16.resolve)(this.config.headers),
3240
+ headers: combineHeaders5(
3241
+ await resolve4(this.config.headers),
3174
3242
  options.headers
3175
3243
  ),
3176
- successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3244
+ successfulResponseHandler: createJsonResponseHandler5(
3177
3245
  googleOperationSchema
3178
3246
  ),
3179
3247
  failedResponseHandler: googleFailedResponseHandler,
@@ -3184,21 +3252,21 @@ var GoogleGenerativeAIVideoModel = class {
3184
3252
  responseHeaders = pollHeaders;
3185
3253
  }
3186
3254
  if (finalOperation.error) {
3187
- throw new import_provider5.AISDKError({
3255
+ throw new AISDKError2({
3188
3256
  name: "GOOGLE_VIDEO_GENERATION_FAILED",
3189
3257
  message: `Video generation failed: ${finalOperation.error.message}`
3190
3258
  });
3191
3259
  }
3192
3260
  const response = finalOperation.response;
3193
3261
  if (!((_g = response == null ? void 0 : response.generateVideoResponse) == null ? void 0 : _g.generatedSamples) || response.generateVideoResponse.generatedSamples.length === 0) {
3194
- throw new import_provider5.AISDKError({
3262
+ throw new AISDKError2({
3195
3263
  name: "GOOGLE_VIDEO_GENERATION_ERROR",
3196
3264
  message: `No videos in response. Response: ${JSON.stringify(finalOperation)}`
3197
3265
  });
3198
3266
  }
3199
3267
  const videos = [];
3200
3268
  const videoMetadata = [];
3201
- const resolvedHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
3269
+ const resolvedHeaders = await resolve4(this.config.headers);
3202
3270
  const apiKey = resolvedHeaders == null ? void 0 : resolvedHeaders["x-goog-api-key"];
3203
3271
  for (const generatedSample of response.generateVideoResponse.generatedSamples) {
3204
3272
  if ((_h = generatedSample.video) == null ? void 0 : _h.uri) {
@@ -3214,7 +3282,7 @@ var GoogleGenerativeAIVideoModel = class {
3214
3282
  }
3215
3283
  }
3216
3284
  if (videos.length === 0) {
3217
- throw new import_provider5.AISDKError({
3285
+ throw new AISDKError2({
3218
3286
  name: "GOOGLE_VIDEO_GENERATION_ERROR",
3219
3287
  message: "No valid videos in response"
3220
3288
  });
@@ -3235,37 +3303,37 @@ var GoogleGenerativeAIVideoModel = class {
3235
3303
  };
3236
3304
  }
3237
3305
  };
3238
- var googleOperationSchema = import_v415.z.object({
3239
- name: import_v415.z.string().nullish(),
3240
- done: import_v415.z.boolean().nullish(),
3241
- error: import_v415.z.object({
3242
- code: import_v415.z.number().nullish(),
3243
- message: import_v415.z.string(),
3244
- status: import_v415.z.string().nullish()
3306
+ var googleOperationSchema = z15.object({
3307
+ name: z15.string().nullish(),
3308
+ done: z15.boolean().nullish(),
3309
+ error: z15.object({
3310
+ code: z15.number().nullish(),
3311
+ message: z15.string(),
3312
+ status: z15.string().nullish()
3245
3313
  }).nullish(),
3246
- response: import_v415.z.object({
3247
- generateVideoResponse: import_v415.z.object({
3248
- generatedSamples: import_v415.z.array(
3249
- import_v415.z.object({
3250
- video: import_v415.z.object({
3251
- uri: import_v415.z.string().nullish()
3314
+ response: z15.object({
3315
+ generateVideoResponse: z15.object({
3316
+ generatedSamples: z15.array(
3317
+ z15.object({
3318
+ video: z15.object({
3319
+ uri: z15.string().nullish()
3252
3320
  }).nullish()
3253
3321
  })
3254
3322
  ).nullish()
3255
3323
  }).nullish()
3256
3324
  }).nullish()
3257
3325
  });
3258
- var googleVideoModelOptionsSchema = (0, import_provider_utils16.lazySchema)(
3259
- () => (0, import_provider_utils16.zodSchema)(
3260
- import_v415.z.object({
3261
- pollIntervalMs: import_v415.z.number().positive().nullish(),
3262
- pollTimeoutMs: import_v415.z.number().positive().nullish(),
3263
- personGeneration: import_v415.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3264
- negativePrompt: import_v415.z.string().nullish(),
3265
- referenceImages: import_v415.z.array(
3266
- import_v415.z.object({
3267
- bytesBase64Encoded: import_v415.z.string().nullish(),
3268
- gcsUri: import_v415.z.string().nullish()
3326
+ var googleVideoModelOptionsSchema = lazySchema13(
3327
+ () => zodSchema13(
3328
+ z15.object({
3329
+ pollIntervalMs: z15.number().positive().nullish(),
3330
+ pollTimeoutMs: z15.number().positive().nullish(),
3331
+ personGeneration: z15.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3332
+ negativePrompt: z15.string().nullish(),
3333
+ referenceImages: z15.array(
3334
+ z15.object({
3335
+ bytesBase64Encoded: z15.string().nullish(),
3336
+ gcsUri: z15.string().nullish()
3269
3337
  })
3270
3338
  ).nullish()
3271
3339
  }).passthrough()
@@ -3275,11 +3343,11 @@ var googleVideoModelOptionsSchema = (0, import_provider_utils16.lazySchema)(
3275
3343
  // src/google-provider.ts
3276
3344
  function createGoogleGenerativeAI(options = {}) {
3277
3345
  var _a, _b;
3278
- const baseURL = (_a = (0, import_provider_utils17.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
3346
+ const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
3279
3347
  const providerName = (_b = options.name) != null ? _b : "google.generative-ai";
3280
- const getHeaders = () => (0, import_provider_utils17.withUserAgentSuffix)(
3348
+ const getHeaders = () => withUserAgentSuffix(
3281
3349
  {
3282
- "x-goog-api-key": (0, import_provider_utils17.loadApiKey)({
3350
+ "x-goog-api-key": loadApiKey({
3283
3351
  apiKey: options.apiKey,
3284
3352
  environmentVariableName: "GOOGLE_GENERATIVE_AI_API_KEY",
3285
3353
  description: "Google Generative AI"
@@ -3294,7 +3362,7 @@ function createGoogleGenerativeAI(options = {}) {
3294
3362
  provider: providerName,
3295
3363
  baseURL,
3296
3364
  headers: getHeaders,
3297
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils17.generateId,
3365
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
3298
3366
  supportedUrls: () => ({
3299
3367
  "*": [
3300
3368
  // Google Generative Language "files" endpoint
@@ -3335,7 +3403,7 @@ function createGoogleGenerativeAI(options = {}) {
3335
3403
  baseURL,
3336
3404
  headers: getHeaders,
3337
3405
  fetch: options.fetch,
3338
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils17.generateId
3406
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId2
3339
3407
  });
3340
3408
  };
3341
3409
  const provider = function(modelId) {
@@ -3363,10 +3431,9 @@ function createGoogleGenerativeAI(options = {}) {
3363
3431
  return provider;
3364
3432
  }
3365
3433
  var google = createGoogleGenerativeAI();
3366
- // Annotate the CommonJS export names for ESM import in node:
3367
- 0 && (module.exports = {
3434
+ export {
3368
3435
  VERSION,
3369
3436
  createGoogleGenerativeAI,
3370
3437
  google
3371
- });
3438
+ };
3372
3439
  //# sourceMappingURL=index.js.map