@ai-sdk/google 3.0.114 → 3.0.118

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
@@ -20,21 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ GoogleTranscriptionModel: () => GoogleTranscriptionModel,
23
24
  VERSION: () => VERSION,
24
25
  createGoogleGenerativeAI: () => createGoogleGenerativeAI,
25
26
  google: () => google
26
27
  });
27
28
  module.exports = __toCommonJS(index_exports);
28
29
 
29
- // src/google-provider.ts
30
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
31
-
32
- // src/version.ts
33
- var VERSION = true ? "3.0.114" : "0.0.0-test";
34
-
35
- // src/google-generative-ai-embedding-model.ts
30
+ // src/transcription/google-transcription-model.ts
36
31
  var import_provider = require("@ai-sdk/provider");
37
- var import_provider_utils3 = require("@ai-sdk/provider-utils");
32
+ var import_provider_utils2 = require("@ai-sdk/provider-utils");
38
33
  var import_v43 = require("zod/v4");
39
34
 
40
35
  // src/google-error.ts
@@ -57,32 +52,222 @@ var googleFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
57
52
  errorToMessage: (data) => data.error.message
58
53
  });
59
54
 
60
- // src/google-generative-ai-embedding-options.ts
61
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
55
+ // src/transcription/google-transcription-model-options.ts
62
56
  var import_v42 = require("zod/v4");
63
- var googleEmbeddingContentPartSchema = import_v42.z.union([
64
- import_v42.z.object({ text: import_v42.z.string() }),
65
- import_v42.z.object({
66
- inlineData: import_v42.z.object({
67
- mimeType: import_v42.z.string(),
68
- data: import_v42.z.string()
57
+ var googleTranscriptionModelOptions = import_v42.z.object({
58
+ /**
59
+ * BCP-47 language codes providing hints about the languages present in the
60
+ * audio. If omitted or empty, defaults to automatic language detection.
61
+ */
62
+ languageCodes: import_v42.z.array(import_v42.z.string()).optional(),
63
+ /**
64
+ * Custom vocabulary phrases, which bias the speech recognition model
65
+ * toward recognizing specific terms.
66
+ */
67
+ customVocabulary: import_v42.z.array(import_v42.z.string()).optional(),
68
+ /**
69
+ * Enables word-level timestamp generation.
70
+ */
71
+ wordTimestamp: import_v42.z.boolean().optional(),
72
+ /**
73
+ * Enables speaker diarization.
74
+ */
75
+ diarization: import_v42.z.boolean().optional(),
76
+ /**
77
+ * Transcription output formatting mode.
78
+ *
79
+ * - `VERBATIM` (default): exact literal transcript preserving filler
80
+ * words, repetitions, and false starts.
81
+ * - `SMART`: cleans up and structures the transcript in real time —
82
+ * disfluency removal, inline self-corrections, structured formatting
83
+ * (lists, numbers, dates, paragraph breaks), and grammar/casing polish.
84
+ */
85
+ mode: import_v42.z.enum(["SMART", "VERBATIM"]).optional()
86
+ });
87
+
88
+ // src/transcription/google-transcription-model.ts
89
+ function isLiveTranscriptionModelId(modelId) {
90
+ return modelId.includes("-live");
91
+ }
92
+ var GoogleTranscriptionModel = class {
93
+ constructor(modelId, config) {
94
+ this.modelId = modelId;
95
+ this.config = config;
96
+ this.specificationVersion = "v3";
97
+ }
98
+ get provider() {
99
+ return this.config.provider;
100
+ }
101
+ async parseOptions(providerOptions) {
102
+ return (0, import_provider_utils2.parseProviderOptions)({
103
+ provider: "google",
104
+ providerOptions,
105
+ schema: googleTranscriptionModelOptions
106
+ });
107
+ }
108
+ async doGenerate(options) {
109
+ var _a, _b, _c, _d, _e, _f;
110
+ if (isLiveTranscriptionModelId(this.modelId)) {
111
+ throw new import_provider.InvalidArgumentError({
112
+ argument: "modelId",
113
+ message: `Model '${this.modelId}' only supports streaming transcription, which requires AI SDK v7. Use a unary model such as 'gemini-3.5-transcribe'.`
114
+ });
115
+ }
116
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
117
+ const warnings = [];
118
+ const googleOptions = await this.parseOptions(options.providerOptions);
119
+ const transcriptionConfig = buildTranscriptionConfig(googleOptions);
120
+ const requestBody = {
121
+ model: this.modelId,
122
+ input: [
123
+ {
124
+ type: "audio",
125
+ data: (0, import_provider_utils2.convertToBase64)(options.audio),
126
+ mime_type: options.mediaType
127
+ }
128
+ ],
129
+ ...transcriptionConfig != null ? { generation_config: { transcription_config: transcriptionConfig } } : {}
130
+ };
131
+ const {
132
+ value: response,
133
+ responseHeaders,
134
+ rawValue: rawResponse
135
+ } = await (0, import_provider_utils2.postJsonToApi)({
136
+ url: `${this.config.baseURL}/interactions`,
137
+ headers: (0, import_provider_utils2.combineHeaders)(
138
+ this.config.headers ? await (0, import_provider_utils2.resolve)(this.config.headers) : void 0,
139
+ options.headers
140
+ ),
141
+ body: requestBody,
142
+ failedResponseHandler: googleFailedResponseHandler,
143
+ successfulResponseHandler: (0, import_provider_utils2.createJsonResponseHandler)(
144
+ googleInteractionsTranscriptionResponseSchema
145
+ ),
146
+ abortSignal: options.abortSignal,
147
+ fetch: this.config.fetch
148
+ });
149
+ let text = "";
150
+ const segments = [];
151
+ for (const step of (_d = response.steps) != null ? _d : []) {
152
+ for (const content of (_e = step.content) != null ? _e : []) {
153
+ if (content.type !== "text" || content.text == null) continue;
154
+ text += content.text;
155
+ for (const annotation of (_f = content.annotations) != null ? _f : []) {
156
+ if (annotation.type !== "word_info") continue;
157
+ const startSecond = parseOffsetSeconds(annotation.start_offset);
158
+ const endSecond = parseOffsetSeconds(annotation.end_offset);
159
+ if (annotation.text == null || startSecond == null || endSecond == null) {
160
+ continue;
161
+ }
162
+ segments.push({ text: annotation.text, startSecond, endSecond });
163
+ }
164
+ }
165
+ }
166
+ return {
167
+ text,
168
+ segments,
169
+ language: void 0,
170
+ durationInSeconds: void 0,
171
+ warnings,
172
+ response: {
173
+ timestamp: currentDate,
174
+ modelId: this.modelId,
175
+ headers: responseHeaders,
176
+ body: rawResponse
177
+ },
178
+ ...response.usage != null ? {
179
+ providerMetadata: {
180
+ google: { usage: response.usage }
181
+ }
182
+ } : {}
183
+ };
184
+ }
185
+ };
186
+ function buildTranscriptionConfig(options) {
187
+ var _a;
188
+ if (options == null) return void 0;
189
+ const config = {};
190
+ if (options.languageCodes != null) {
191
+ config.language_codes = options.languageCodes;
192
+ }
193
+ if (options.customVocabulary != null) {
194
+ config.custom_vocabulary = options.customVocabulary;
195
+ }
196
+ if (options.mode != null || options.diarization === true || options.wordTimestamp === true) {
197
+ config.mode = {
198
+ type: ((_a = options.mode) != null ? _a : "VERBATIM").toLowerCase(),
199
+ ...options.diarization === true ? { diarization_mode: "speaker" } : {},
200
+ ...options.wordTimestamp === true ? { timestamp_granularities: ["word"] } : {}
201
+ };
202
+ }
203
+ return Object.keys(config).length > 0 ? config : void 0;
204
+ }
205
+ function parseOffsetSeconds(offset) {
206
+ if (offset == null) return void 0;
207
+ const parsed = Number.parseFloat(offset);
208
+ return Number.isFinite(parsed) ? parsed : void 0;
209
+ }
210
+ var googleInteractionsWordAnnotationSchema = import_v43.z.object({
211
+ type: import_v43.z.string().nullish(),
212
+ text: import_v43.z.string().nullish(),
213
+ speaker: import_v43.z.string().nullish(),
214
+ start_offset: import_v43.z.string().nullish(),
215
+ end_offset: import_v43.z.string().nullish()
216
+ });
217
+ var googleInteractionsTranscriptionResponseSchema = import_v43.z.object({
218
+ status: import_v43.z.string().nullish(),
219
+ steps: import_v43.z.array(
220
+ import_v43.z.object({
221
+ type: import_v43.z.string().nullish(),
222
+ content: import_v43.z.array(
223
+ import_v43.z.object({
224
+ type: import_v43.z.string().nullish(),
225
+ text: import_v43.z.string().nullish(),
226
+ annotations: import_v43.z.array(googleInteractionsWordAnnotationSchema).nullish()
227
+ })
228
+ ).nullish()
229
+ })
230
+ ).nullish(),
231
+ usage: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish()
232
+ });
233
+
234
+ // src/google-provider.ts
235
+ var import_provider_utils24 = require("@ai-sdk/provider-utils");
236
+
237
+ // src/version.ts
238
+ var VERSION = true ? "3.0.118" : "0.0.0-test";
239
+
240
+ // src/google-generative-ai-embedding-model.ts
241
+ var import_provider2 = require("@ai-sdk/provider");
242
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
243
+ var import_v45 = require("zod/v4");
244
+
245
+ // src/google-generative-ai-embedding-options.ts
246
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
247
+ var import_v44 = require("zod/v4");
248
+ var googleEmbeddingContentPartSchema = import_v44.z.union([
249
+ import_v44.z.object({ text: import_v44.z.string() }),
250
+ import_v44.z.object({
251
+ inlineData: import_v44.z.object({
252
+ mimeType: import_v44.z.string(),
253
+ data: import_v44.z.string()
69
254
  })
70
255
  }),
71
- import_v42.z.object({
72
- fileData: import_v42.z.object({
73
- fileUri: import_v42.z.string(),
74
- mimeType: import_v42.z.string()
256
+ import_v44.z.object({
257
+ fileData: import_v44.z.object({
258
+ fileUri: import_v44.z.string(),
259
+ mimeType: import_v44.z.string()
75
260
  })
76
261
  })
77
262
  ]);
78
- var googleEmbeddingModelOptions = (0, import_provider_utils2.lazySchema)(
79
- () => (0, import_provider_utils2.zodSchema)(
80
- import_v42.z.object({
263
+ var googleEmbeddingModelOptions = (0, import_provider_utils3.lazySchema)(
264
+ () => (0, import_provider_utils3.zodSchema)(
265
+ import_v44.z.object({
81
266
  /**
82
267
  * Optional. Optional reduced dimension for the output embedding.
83
268
  * If set, excessive values in the output embedding are truncated from the end.
84
269
  */
85
- outputDimensionality: import_v42.z.number().optional(),
270
+ outputDimensionality: import_v44.z.number().optional(),
86
271
  /**
87
272
  * Optional. Specifies the task type for generating embeddings.
88
273
  * Supported task types:
@@ -95,7 +280,7 @@ var googleEmbeddingModelOptions = (0, import_provider_utils2.lazySchema)(
95
280
  * - FACT_VERIFICATION: Optimized for verifying factual information.
96
281
  * - CODE_RETRIEVAL_QUERY: Optimized for retrieving code blocks based on natural language queries.
97
282
  */
98
- taskType: import_v42.z.enum([
283
+ taskType: import_v44.z.enum([
99
284
  "SEMANTIC_SIMILARITY",
100
285
  "CLASSIFICATION",
101
286
  "CLUSTERING",
@@ -114,7 +299,7 @@ var googleEmbeddingModelOptions = (0, import_provider_utils2.lazySchema)(
114
299
  * The array length must match the number of values being embedded. In
115
300
  * the case of a single embedding, the array length must be 1.
116
301
  */
117
- content: import_v42.z.array(import_v42.z.array(googleEmbeddingContentPartSchema).min(1).nullable()).optional()
302
+ content: import_v44.z.array(import_v44.z.array(googleEmbeddingContentPartSchema).min(1).nullable()).optional()
118
303
  })
119
304
  )
120
305
  );
@@ -137,21 +322,21 @@ var GoogleGenerativeAIEmbeddingModel = class {
137
322
  abortSignal,
138
323
  providerOptions
139
324
  }) {
140
- const googleOptions = await (0, import_provider_utils3.parseProviderOptions)({
325
+ const googleOptions = await (0, import_provider_utils4.parseProviderOptions)({
141
326
  provider: "google",
142
327
  providerOptions,
143
328
  schema: googleEmbeddingModelOptions
144
329
  });
145
330
  if (values.length > this.maxEmbeddingsPerCall) {
146
- throw new import_provider.TooManyEmbeddingValuesForCallError({
331
+ throw new import_provider2.TooManyEmbeddingValuesForCallError({
147
332
  provider: this.provider,
148
333
  modelId: this.modelId,
149
334
  maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
150
335
  values
151
336
  });
152
337
  }
153
- const mergedHeaders = (0, import_provider_utils3.combineHeaders)(
154
- await (0, import_provider_utils3.resolve)(this.config.headers),
338
+ const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
339
+ await (0, import_provider_utils4.resolve)(this.config.headers),
155
340
  headers
156
341
  );
157
342
  const multimodalContent = googleOptions == null ? void 0 : googleOptions.content;
@@ -168,7 +353,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
168
353
  responseHeaders: responseHeaders2,
169
354
  value: response2,
170
355
  rawValue: rawValue2
171
- } = await (0, import_provider_utils3.postJsonToApi)({
356
+ } = await (0, import_provider_utils4.postJsonToApi)({
172
357
  url: `${this.config.baseURL}/models/${this.modelId}:embedContent`,
173
358
  headers: mergedHeaders,
174
359
  body: {
@@ -180,7 +365,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
180
365
  taskType: googleOptions == null ? void 0 : googleOptions.taskType
181
366
  },
182
367
  failedResponseHandler: googleFailedResponseHandler,
183
- successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)(
368
+ successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(
184
369
  googleGenerativeAISingleEmbeddingResponseSchema
185
370
  ),
186
371
  abortSignal,
@@ -197,7 +382,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
197
382
  responseHeaders,
198
383
  value: response,
199
384
  rawValue
200
- } = await (0, import_provider_utils3.postJsonToApi)({
385
+ } = await (0, import_provider_utils4.postJsonToApi)({
201
386
  url: `${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,
202
387
  headers: mergedHeaders,
203
388
  body: {
@@ -216,7 +401,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
216
401
  })
217
402
  },
218
403
  failedResponseHandler: googleFailedResponseHandler,
219
- successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)(
404
+ successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(
220
405
  googleGenerativeAITextEmbeddingResponseSchema
221
406
  ),
222
407
  abortSignal,
@@ -230,24 +415,24 @@ var GoogleGenerativeAIEmbeddingModel = class {
230
415
  };
231
416
  }
232
417
  };
233
- var googleGenerativeAITextEmbeddingResponseSchema = (0, import_provider_utils3.lazySchema)(
234
- () => (0, import_provider_utils3.zodSchema)(
235
- import_v43.z.object({
236
- embeddings: import_v43.z.array(import_v43.z.object({ values: import_v43.z.array(import_v43.z.number()) }))
418
+ var googleGenerativeAITextEmbeddingResponseSchema = (0, import_provider_utils4.lazySchema)(
419
+ () => (0, import_provider_utils4.zodSchema)(
420
+ import_v45.z.object({
421
+ embeddings: import_v45.z.array(import_v45.z.object({ values: import_v45.z.array(import_v45.z.number()) }))
237
422
  })
238
423
  )
239
424
  );
240
- var googleGenerativeAISingleEmbeddingResponseSchema = (0, import_provider_utils3.lazySchema)(
241
- () => (0, import_provider_utils3.zodSchema)(
242
- import_v43.z.object({
243
- embedding: import_v43.z.object({ values: import_v43.z.array(import_v43.z.number()) })
425
+ var googleGenerativeAISingleEmbeddingResponseSchema = (0, import_provider_utils4.lazySchema)(
426
+ () => (0, import_provider_utils4.zodSchema)(
427
+ import_v45.z.object({
428
+ embedding: import_v45.z.object({ values: import_v45.z.array(import_v45.z.number()) })
244
429
  })
245
430
  )
246
431
  );
247
432
 
248
433
  // src/google-generative-ai-language-model.ts
249
- var import_provider_utils6 = require("@ai-sdk/provider-utils");
250
- var import_v45 = require("zod/v4");
434
+ var import_provider_utils7 = require("@ai-sdk/provider-utils");
435
+ var import_v47 = require("zod/v4");
251
436
 
252
437
  // src/convert-google-generative-ai-usage.ts
253
438
  function convertGoogleGenerativeAIUsage(usage) {
@@ -289,10 +474,10 @@ function convertGoogleGenerativeAIUsage(usage) {
289
474
  }
290
475
 
291
476
  // src/convert-json-schema-to-openapi-schema.ts
292
- var import_provider2 = require("@ai-sdk/provider");
477
+ var import_provider3 = require("@ai-sdk/provider");
293
478
  var recursiveReferenceFunctionalityPrefix = "recursive JSON Schema reference:";
294
479
  function isRecursiveJSONSchemaReferenceError(error) {
295
- return import_provider2.UnsupportedFunctionalityError.isInstance(error) && error.functionality.startsWith(recursiveReferenceFunctionalityPrefix);
480
+ return import_provider3.UnsupportedFunctionalityError.isInstance(error) && error.functionality.startsWith(recursiveReferenceFunctionalityPrefix);
296
481
  }
297
482
  function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
298
483
  const rootSchema = typeof jsonSchema === "object" ? jsonSchema : void 0;
@@ -344,9 +529,6 @@ function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
344
529
  if (description) result.description = description;
345
530
  if (required) result.required = required;
346
531
  if (format) result.format = format;
347
- if (constValue !== void 0) {
348
- result.enum = [constValue];
349
- }
350
532
  if (type) {
351
533
  if (Array.isArray(type)) {
352
534
  const hasNull = type.includes("null");
@@ -363,8 +545,9 @@ function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
363
545
  result.type = type;
364
546
  }
365
547
  }
366
- if (enumValues !== void 0) {
367
- result.enum = enumValues;
548
+ const values = enumValues != null ? enumValues : constValue !== void 0 ? [constValue] : void 0;
549
+ if (values !== void 0) {
550
+ addEnumToSchema({ values, type, result });
368
551
  }
369
552
  if (properties != null) {
370
553
  result.properties = Object.entries(properties).reduce(
@@ -424,6 +607,68 @@ function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
424
607
  }
425
608
  return result;
426
609
  }
610
+ function addEnumToSchema({
611
+ values,
612
+ type,
613
+ result
614
+ }) {
615
+ const nullable = Array.isArray(type) && type.includes("null") || type === void 0 && values.includes(null);
616
+ const enumValues = nullable ? values.filter((value) => value !== null) : values;
617
+ if (values.length > 0 && values.every((value) => value === null)) {
618
+ const typeAllowsNull = type === void 0 || type === "null" || Array.isArray(type) && type.includes("null");
619
+ if (typeAllowsNull) {
620
+ result.type = "null";
621
+ if (Array.isArray(type)) {
622
+ delete result.anyOf;
623
+ }
624
+ return;
625
+ }
626
+ }
627
+ const enumType = getEnumType({ values: enumValues, type });
628
+ if (enumType === void 0) {
629
+ throw new import_provider3.UnsupportedFunctionalityError({
630
+ functionality: "JSON Schema enum with mixed or unsupported values",
631
+ message: "Google does not support this JSON Schema enum. Enum values must share one supported primitive type and match the schema type."
632
+ });
633
+ }
634
+ result.type = enumType;
635
+ if (Array.isArray(type)) {
636
+ delete result.anyOf;
637
+ }
638
+ if (nullable) {
639
+ result.nullable = true;
640
+ }
641
+ if (enumType === "string") {
642
+ result.enum = enumValues;
643
+ } else {
644
+ result.format = "enum";
645
+ result.enum = enumValues.map(String);
646
+ }
647
+ }
648
+ function getEnumType({
649
+ values,
650
+ type
651
+ }) {
652
+ if (values.length === 0) {
653
+ return void 0;
654
+ }
655
+ const typeAllows = (enumType) => type === void 0 || type === enumType || Array.isArray(type) && type.includes(enumType);
656
+ if (typeAllows("string") && values.every((value) => typeof value === "string")) {
657
+ return "string";
658
+ }
659
+ if ((typeAllows("number") || typeAllows("integer")) && values.every((value) => typeof value === "number" && Number.isFinite(value))) {
660
+ if (typeAllows("number")) {
661
+ return "number";
662
+ }
663
+ if (values.every((value) => Number.isInteger(value))) {
664
+ return "integer";
665
+ }
666
+ }
667
+ if (typeAllows("boolean") && values.every((value) => typeof value === "boolean")) {
668
+ return "boolean";
669
+ }
670
+ return void 0;
671
+ }
427
672
  function convertJSONSchemaReference({
428
673
  jsonSchema,
429
674
  reference,
@@ -435,7 +680,7 @@ function convertJSONSchemaReference({
435
680
  referenceContext
436
681
  );
437
682
  if (referenceContext.resolvingReferences.has(referenceKey)) {
438
- throw new import_provider2.UnsupportedFunctionalityError({
683
+ throw new import_provider3.UnsupportedFunctionalityError({
439
684
  functionality: `${recursiveReferenceFunctionalityPrefix} ${reference}`,
440
685
  message: "Google schema conversion does not support recursive JSON Schema references."
441
686
  });
@@ -489,7 +734,7 @@ function getReferencedDefinition(reference, referenceContext) {
489
734
  };
490
735
  }
491
736
  function throwUnsupportedReference(reference) {
492
- throw new import_provider2.UnsupportedFunctionalityError({
737
+ throw new import_provider3.UnsupportedFunctionalityError({
493
738
  functionality: `JSON Schema reference: ${reference}`,
494
739
  message: "Google schema conversion only supports references to direct children of root-level $defs or definitions."
495
740
  });
@@ -499,8 +744,8 @@ function isEmptyObjectSchema(jsonSchema) {
499
744
  }
500
745
 
501
746
  // src/convert-to-google-generative-ai-messages.ts
502
- var import_provider3 = require("@ai-sdk/provider");
503
- var import_provider_utils4 = require("@ai-sdk/provider-utils");
747
+ var import_provider4 = require("@ai-sdk/provider");
748
+ var import_provider_utils5 = require("@ai-sdk/provider-utils");
504
749
  var SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
505
750
  function getGoogleProviderOptions(providerOptions, providerOptionsName) {
506
751
  const namespaces = [
@@ -649,7 +894,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
649
894
  switch (role) {
650
895
  case "system": {
651
896
  if (!systemMessagesAllowed) {
652
- throw new import_provider3.UnsupportedFunctionalityError({
897
+ throw new import_provider4.UnsupportedFunctionalityError({
653
898
  functionality: "system messages are only supported at the beginning of the conversation"
654
899
  });
655
900
  }
@@ -676,7 +921,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
676
921
  } : {
677
922
  inlineData: {
678
923
  mimeType: mediaType,
679
- data: (0, import_provider_utils4.convertToBase64)(part.data)
924
+ data: (0, import_provider_utils5.convertToBase64)(part.data)
680
925
  }
681
926
  }
682
927
  );
@@ -714,14 +959,14 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
714
959
  }
715
960
  case "file": {
716
961
  if (part.data instanceof URL) {
717
- throw new import_provider3.UnsupportedFunctionalityError({
962
+ throw new import_provider4.UnsupportedFunctionalityError({
718
963
  functionality: "File data URLs in assistant messages are not supported"
719
964
  });
720
965
  }
721
966
  return {
722
967
  inlineData: {
723
968
  mimeType: part.mediaType,
724
- data: (0, import_provider_utils4.convertToBase64)(part.data)
969
+ data: (0, import_provider_utils5.convertToBase64)(part.data)
725
970
  },
726
971
  ...(providerOpts == null ? void 0 : providerOpts.thought) === true ? { thought: true } : {},
727
972
  thoughtSignature
@@ -746,7 +991,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
746
991
  return {
747
992
  toolCall: {
748
993
  toolType: serverToolType,
749
- args: typeof part.input === "string" ? (0, import_provider_utils4.secureJsonParse)(part.input) : part.input,
994
+ args: typeof part.input === "string" ? (0, import_provider_utils5.secureJsonParse)(part.input) : part.input,
750
995
  id: serverToolCallId
751
996
  },
752
997
  thoughtSignature: effectiveThoughtSignature
@@ -874,24 +1119,24 @@ function getModelPath(modelId) {
874
1119
  }
875
1120
 
876
1121
  // src/google-generative-ai-options.ts
877
- var import_provider_utils5 = require("@ai-sdk/provider-utils");
878
- var import_v44 = require("zod/v4");
879
- var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
880
- () => (0, import_provider_utils5.zodSchema)(
881
- import_v44.z.object({
882
- responseModalities: import_v44.z.array(import_v44.z.enum(["TEXT", "IMAGE"])).optional(),
883
- thinkingConfig: import_v44.z.object({
884
- thinkingBudget: import_v44.z.number().optional(),
885
- includeThoughts: import_v44.z.boolean().optional(),
1122
+ var import_provider_utils6 = require("@ai-sdk/provider-utils");
1123
+ var import_v46 = require("zod/v4");
1124
+ var googleLanguageModelOptions = (0, import_provider_utils6.lazySchema)(
1125
+ () => (0, import_provider_utils6.zodSchema)(
1126
+ import_v46.z.object({
1127
+ responseModalities: import_v46.z.array(import_v46.z.enum(["TEXT", "IMAGE"])).optional(),
1128
+ thinkingConfig: import_v46.z.object({
1129
+ thinkingBudget: import_v46.z.number().optional(),
1130
+ includeThoughts: import_v46.z.boolean().optional(),
886
1131
  // https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
887
- thinkingLevel: import_v44.z.enum(["minimal", "low", "medium", "high"]).optional()
1132
+ thinkingLevel: import_v46.z.enum(["minimal", "low", "medium", "high"]).optional()
888
1133
  }).optional(),
889
1134
  /**
890
1135
  * Optional.
891
1136
  * The name of the cached content used as context to serve the prediction.
892
1137
  * Format: cachedContents/{cachedContent}
893
1138
  */
894
- cachedContent: import_v44.z.string().optional(),
1139
+ cachedContent: import_v46.z.string().optional(),
895
1140
  /**
896
1141
  * Optional. Enable structured output. Default is true.
897
1142
  *
@@ -900,13 +1145,13 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
900
1145
  * Google Generative AI uses. You can use this to disable
901
1146
  * structured outputs if you need to.
902
1147
  */
903
- structuredOutputs: import_v44.z.boolean().optional(),
1148
+ structuredOutputs: import_v46.z.boolean().optional(),
904
1149
  /**
905
1150
  * Optional. A list of unique safety settings for blocking unsafe content.
906
1151
  */
907
- safetySettings: import_v44.z.array(
908
- import_v44.z.object({
909
- category: import_v44.z.enum([
1152
+ safetySettings: import_v46.z.array(
1153
+ import_v46.z.object({
1154
+ category: import_v46.z.enum([
910
1155
  "HARM_CATEGORY_UNSPECIFIED",
911
1156
  "HARM_CATEGORY_HATE_SPEECH",
912
1157
  "HARM_CATEGORY_DANGEROUS_CONTENT",
@@ -914,7 +1159,7 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
914
1159
  "HARM_CATEGORY_SEXUALLY_EXPLICIT",
915
1160
  "HARM_CATEGORY_CIVIC_INTEGRITY"
916
1161
  ]),
917
- threshold: import_v44.z.enum([
1162
+ threshold: import_v46.z.enum([
918
1163
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
919
1164
  "BLOCK_LOW_AND_ABOVE",
920
1165
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -924,7 +1169,7 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
924
1169
  ])
925
1170
  })
926
1171
  ).optional(),
927
- threshold: import_v44.z.enum([
1172
+ threshold: import_v46.z.enum([
928
1173
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
929
1174
  "BLOCK_LOW_AND_ABOVE",
930
1175
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -937,19 +1182,19 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
937
1182
  *
938
1183
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
939
1184
  */
940
- audioTimestamp: import_v44.z.boolean().optional(),
1185
+ audioTimestamp: import_v46.z.boolean().optional(),
941
1186
  /**
942
1187
  * Optional. Defines labels used in billing reports. Available on Vertex AI only.
943
1188
  *
944
1189
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
945
1190
  */
946
- labels: import_v44.z.record(import_v44.z.string(), import_v44.z.string()).optional(),
1191
+ labels: import_v46.z.record(import_v46.z.string(), import_v46.z.string()).optional(),
947
1192
  /**
948
1193
  * Optional. If specified, the media resolution specified will be used.
949
1194
  *
950
1195
  * https://ai.google.dev/api/generate-content#MediaResolution
951
1196
  */
952
- mediaResolution: import_v44.z.enum([
1197
+ mediaResolution: import_v46.z.enum([
953
1198
  "MEDIA_RESOLUTION_UNSPECIFIED",
954
1199
  "MEDIA_RESOLUTION_LOW",
955
1200
  "MEDIA_RESOLUTION_MEDIUM",
@@ -960,8 +1205,8 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
960
1205
  *
961
1206
  * https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
962
1207
  */
963
- imageConfig: import_v44.z.object({
964
- aspectRatio: import_v44.z.enum([
1208
+ imageConfig: import_v46.z.object({
1209
+ aspectRatio: import_v46.z.enum([
965
1210
  "1:1",
966
1211
  "2:3",
967
1212
  "3:2",
@@ -977,12 +1222,12 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
977
1222
  "1:4",
978
1223
  "4:1"
979
1224
  ]).optional(),
980
- imageSize: import_v44.z.enum(["1K", "2K", "4K", "512"]).optional(),
1225
+ imageSize: import_v46.z.enum(["1K", "2K", "4K", "512"]).optional(),
981
1226
  /**
982
1227
  * Optional. Controls the generation of people in images.
983
1228
  * Vertex AI only.
984
1229
  */
985
- personGeneration: import_v44.z.enum([
1230
+ personGeneration: import_v46.z.enum([
986
1231
  "PERSON_GENERATION_UNSPECIFIED",
987
1232
  "ALLOW_ALL",
988
1233
  "ALLOW_ADULT",
@@ -996,7 +1241,7 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
996
1241
  *
997
1242
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
998
1243
  */
999
- prominentPeople: import_v44.z.enum([
1244
+ prominentPeople: import_v46.z.enum([
1000
1245
  "PROMINENT_PEOPLE_UNSPECIFIED",
1001
1246
  "ALLOW_PROMINENT_PEOPLE",
1002
1247
  "BLOCK_PROMINENT_PEOPLE"
@@ -1005,9 +1250,9 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
1005
1250
  * Optional. The image output format for generated images.
1006
1251
  * Vertex AI only.
1007
1252
  */
1008
- imageOutputOptions: import_v44.z.object({
1009
- mimeType: import_v44.z.enum(["image/jpeg", "image/png"]).optional(),
1010
- compressionQuality: import_v44.z.number().optional()
1253
+ imageOutputOptions: import_v46.z.object({
1254
+ mimeType: import_v46.z.enum(["image/jpeg", "image/png"]).optional(),
1255
+ compressionQuality: import_v46.z.number().optional()
1011
1256
  }).optional()
1012
1257
  }).optional(),
1013
1258
  /**
@@ -1016,10 +1261,10 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
1016
1261
  *
1017
1262
  * https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
1018
1263
  */
1019
- retrievalConfig: import_v44.z.object({
1020
- latLng: import_v44.z.object({
1021
- latitude: import_v44.z.number(),
1022
- longitude: import_v44.z.number()
1264
+ retrievalConfig: import_v46.z.object({
1265
+ latLng: import_v46.z.object({
1266
+ latitude: import_v46.z.number(),
1267
+ longitude: import_v46.z.number()
1023
1268
  }).optional()
1024
1269
  }).optional(),
1025
1270
  /**
@@ -1032,12 +1277,12 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
1032
1277
  *
1033
1278
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
1034
1279
  */
1035
- streamFunctionCallArguments: import_v44.z.boolean().optional(),
1280
+ streamFunctionCallArguments: import_v46.z.boolean().optional(),
1036
1281
  /**
1037
1282
  * Optional. The service tier to use for the request. Sent as the
1038
1283
  * `serviceTier` body field. Gemini API only.
1039
1284
  */
1040
- serviceTier: import_v44.z.enum(["standard", "flex", "priority"]).optional(),
1285
+ serviceTier: import_v46.z.enum(["standard", "flex", "priority"]).optional(),
1041
1286
  /**
1042
1287
  * Optional. Vertex AI only. Sent as the
1043
1288
  * `X-Vertex-AI-LLM-Shared-Request-Type` request header to select a
@@ -1048,7 +1293,7 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
1048
1293
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
1049
1294
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/flex-paygo
1050
1295
  */
1051
- sharedRequestType: import_v44.z.enum(["priority", "flex", "standard"]).optional(),
1296
+ sharedRequestType: import_v46.z.enum(["priority", "flex", "standard"]).optional(),
1052
1297
  /**
1053
1298
  * Optional. Vertex AI only. Sent as the `X-Vertex-AI-LLM-Request-Type`
1054
1299
  * request header. Set to `'shared'` together with `sharedRequestType`
@@ -1056,7 +1301,7 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
1056
1301
  *
1057
1302
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
1058
1303
  */
1059
- requestType: import_v44.z.enum(["shared"]).optional()
1304
+ requestType: import_v46.z.enum(["shared"]).optional()
1060
1305
  })
1061
1306
  )
1062
1307
  );
@@ -1083,7 +1328,7 @@ function getGoogleModelCapabilities(modelId) {
1083
1328
  }
1084
1329
 
1085
1330
  // src/google-prepare-tools.ts
1086
- var import_provider4 = require("@ai-sdk/provider");
1331
+ var import_provider5 = require("@ai-sdk/provider");
1087
1332
  function prepareTools({
1088
1333
  tools,
1089
1334
  toolChoice,
@@ -1312,7 +1557,7 @@ function prepareTools({
1312
1557
  };
1313
1558
  default: {
1314
1559
  const _exhaustiveCheck = type;
1315
- throw new import_provider4.UnsupportedFunctionalityError({
1560
+ throw new import_provider5.UnsupportedFunctionalityError({
1316
1561
  functionality: `tool choice type: ${_exhaustiveCheck}`
1317
1562
  });
1318
1563
  }
@@ -1610,13 +1855,14 @@ var configurableSafetySettingCategories = [
1610
1855
  "HARM_CATEGORY_HARASSMENT",
1611
1856
  "HARM_CATEGORY_SEXUALLY_EXPLICIT"
1612
1857
  ];
1858
+ var gemini25ModelPattern2 = /(^|\/)gemini-2\.5(?:[.-]|$)/i;
1613
1859
  var GoogleGenerativeAILanguageModel = class {
1614
1860
  constructor(modelId, config) {
1615
1861
  this.specificationVersion = "v3";
1616
1862
  var _a;
1617
1863
  this.modelId = modelId;
1618
1864
  this.config = config;
1619
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils6.generateId;
1865
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils7.generateId;
1620
1866
  }
1621
1867
  get provider() {
1622
1868
  return this.config.provider;
@@ -1643,13 +1889,13 @@ var GoogleGenerativeAILanguageModel = class {
1643
1889
  var _a, _b, _c;
1644
1890
  const warnings = [];
1645
1891
  const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
1646
- let googleOptions = await (0, import_provider_utils6.parseProviderOptions)({
1892
+ let googleOptions = await (0, import_provider_utils7.parseProviderOptions)({
1647
1893
  provider: providerOptionsName,
1648
1894
  providerOptions,
1649
1895
  schema: googleLanguageModelOptions
1650
1896
  });
1651
1897
  if (googleOptions == null && providerOptionsName !== "google") {
1652
- googleOptions = await (0, import_provider_utils6.parseProviderOptions)({
1898
+ googleOptions = await (0, import_provider_utils7.parseProviderOptions)({
1653
1899
  provider: "google",
1654
1900
  providerOptions,
1655
1901
  schema: googleLanguageModelOptions
@@ -1713,6 +1959,19 @@ var GoogleGenerativeAILanguageModel = class {
1713
1959
  }
1714
1960
  }
1715
1961
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
1962
+ const isGemini25DeveloperApiModel = !isVertexProvider && gemini25ModelPattern2.test(this.modelId);
1963
+ if (isGemini25DeveloperApiModel && frequencyPenalty != null) {
1964
+ warnings.push({
1965
+ type: "unsupported",
1966
+ feature: "frequencyPenalty"
1967
+ });
1968
+ }
1969
+ if (isGemini25DeveloperApiModel && presencePenalty != null) {
1970
+ warnings.push({
1971
+ type: "unsupported",
1972
+ feature: "presencePenalty"
1973
+ });
1974
+ }
1716
1975
  const { usesGemini3Features } = getGoogleModelCapabilities(this.modelId);
1717
1976
  const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
1718
1977
  prompt,
@@ -1761,8 +2020,8 @@ var GoogleGenerativeAILanguageModel = class {
1761
2020
  temperature,
1762
2021
  topK,
1763
2022
  topP,
1764
- frequencyPenalty,
1765
- presencePenalty,
2023
+ frequencyPenalty: isGemini25DeveloperApiModel ? void 0 : frequencyPenalty,
2024
+ presencePenalty: isGemini25DeveloperApiModel ? void 0 : presencePenalty,
1766
2025
  stopSequences,
1767
2026
  seed,
1768
2027
  // response format:
@@ -1797,10 +2056,10 @@ var GoogleGenerativeAILanguageModel = class {
1797
2056
  };
1798
2057
  }
1799
2058
  async doGenerate(options) {
1800
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
2059
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
1801
2060
  const { args, warnings, providerOptionsName, extraHeaders } = await this.getArgs(options);
1802
- const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
1803
- await (0, import_provider_utils6.resolve)(this.config.headers),
2061
+ const mergedHeaders = (0, import_provider_utils7.combineHeaders)(
2062
+ await (0, import_provider_utils7.resolve)(this.config.headers),
1804
2063
  options.headers,
1805
2064
  extraHeaders
1806
2065
  );
@@ -1808,25 +2067,28 @@ var GoogleGenerativeAILanguageModel = class {
1808
2067
  responseHeaders,
1809
2068
  value: response,
1810
2069
  rawValue: rawResponse
1811
- } = await (0, import_provider_utils6.postJsonToApi)({
2070
+ } = await (0, import_provider_utils7.postJsonToApi)({
1812
2071
  url: `${this.config.baseURL}/${getModelPath(
1813
2072
  this.modelId
1814
2073
  )}:generateContent`,
1815
2074
  headers: mergedHeaders,
1816
2075
  body: args,
1817
2076
  failedResponseHandler: googleFailedResponseHandler,
1818
- successfulResponseHandler: (0, import_provider_utils6.createJsonResponseHandler)(responseSchema),
2077
+ successfulResponseHandler: (0, import_provider_utils7.createJsonResponseHandler)(responseSchema),
1819
2078
  abortSignal: options.abortSignal,
1820
2079
  fetch: this.config.fetch
1821
2080
  });
1822
- const candidate = response.candidates[0];
2081
+ const candidate = (_a = response.candidates) == null ? void 0 : _a[0];
2082
+ const promptBlockReason = (_b = response.promptFeedback) == null ? void 0 : _b.blockReason;
2083
+ const isPromptBlocked = (candidate == null ? void 0 : candidate.finishReason) == null && promptBlockReason != null;
2084
+ const rawFinishReason = (_d = (_c = candidate == null ? void 0 : candidate.finishReason) != null ? _c : promptBlockReason) != null ? _d : void 0;
1823
2085
  const content = [];
1824
- const parts = (_b = (_a = candidate.content) == null ? void 0 : _a.parts) != null ? _b : [];
2086
+ const parts = (_f = (_e = candidate == null ? void 0 : candidate.content) == null ? void 0 : _e.parts) != null ? _f : [];
1825
2087
  const usageMetadata = response.usageMetadata;
1826
2088
  let lastCodeExecutionToolCallId;
1827
2089
  let lastServerToolCallId;
1828
2090
  for (const part of parts) {
1829
- if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
2091
+ if ("executableCode" in part && ((_g = part.executableCode) == null ? void 0 : _g.code)) {
1830
2092
  const toolCallId = this.config.generateId();
1831
2093
  lastCodeExecutionToolCallId = toolCallId;
1832
2094
  content.push({
@@ -1844,7 +2106,7 @@ var GoogleGenerativeAILanguageModel = class {
1844
2106
  toolName: "code_execution",
1845
2107
  result: {
1846
2108
  outcome: part.codeExecutionResult.outcome,
1847
- output: (_d = part.codeExecutionResult.output) != null ? _d : ""
2109
+ output: (_h = part.codeExecutionResult.output) != null ? _h : ""
1848
2110
  }
1849
2111
  });
1850
2112
  } else if ("text" in part && part.text != null) {
@@ -1868,9 +2130,9 @@ var GoogleGenerativeAILanguageModel = class {
1868
2130
  } else if ("functionCall" in part && part.functionCall.name != null) {
1869
2131
  content.push({
1870
2132
  type: "tool-call",
1871
- toolCallId: (_e = part.functionCall.id) != null ? _e : this.config.generateId(),
2133
+ toolCallId: (_i = part.functionCall.id) != null ? _i : this.config.generateId(),
1872
2134
  toolName: part.functionCall.name,
1873
- input: JSON.stringify((_f = part.functionCall.args) != null ? _f : {}),
2135
+ input: JSON.stringify((_j = part.functionCall.args) != null ? _j : {}),
1874
2136
  providerMetadata: part.thoughtSignature ? {
1875
2137
  [providerOptionsName]: {
1876
2138
  thoughtSignature: part.thoughtSignature
@@ -1892,13 +2154,13 @@ var GoogleGenerativeAILanguageModel = class {
1892
2154
  } : void 0
1893
2155
  });
1894
2156
  } else if ("toolCall" in part && part.toolCall) {
1895
- const toolCallId = (_g = part.toolCall.id) != null ? _g : this.config.generateId();
2157
+ const toolCallId = (_k = part.toolCall.id) != null ? _k : this.config.generateId();
1896
2158
  lastServerToolCallId = toolCallId;
1897
2159
  content.push({
1898
2160
  type: "tool-call",
1899
2161
  toolCallId,
1900
2162
  toolName: `server:${part.toolCall.toolType}`,
1901
- input: JSON.stringify((_h = part.toolCall.args) != null ? _h : {}),
2163
+ input: JSON.stringify((_l = part.toolCall.args) != null ? _l : {}),
1902
2164
  providerExecuted: true,
1903
2165
  dynamic: true,
1904
2166
  providerMetadata: part.thoughtSignature ? {
@@ -1915,12 +2177,12 @@ var GoogleGenerativeAILanguageModel = class {
1915
2177
  }
1916
2178
  });
1917
2179
  } else if ("toolResponse" in part && part.toolResponse) {
1918
- const responseToolCallId = (_i = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _i : this.config.generateId();
2180
+ const responseToolCallId = (_m = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _m : this.config.generateId();
1919
2181
  content.push({
1920
2182
  type: "tool-result",
1921
2183
  toolCallId: responseToolCallId,
1922
2184
  toolName: `server:${part.toolResponse.toolType}`,
1923
- result: (_j = part.toolResponse.response) != null ? _j : {},
2185
+ result: (_n = part.toolResponse.response) != null ? _n : {},
1924
2186
  providerMetadata: part.thoughtSignature ? {
1925
2187
  [providerOptionsName]: {
1926
2188
  thoughtSignature: part.thoughtSignature,
@@ -1937,42 +2199,42 @@ var GoogleGenerativeAILanguageModel = class {
1937
2199
  lastServerToolCallId = void 0;
1938
2200
  }
1939
2201
  }
1940
- const sources = (_k = extractSources({
1941
- groundingMetadata: candidate.groundingMetadata,
2202
+ const sources = (_o = extractSources({
2203
+ groundingMetadata: candidate == null ? void 0 : candidate.groundingMetadata,
1942
2204
  generateId: this.config.generateId
1943
- })) != null ? _k : [];
2205
+ })) != null ? _o : [];
1944
2206
  for (const source of sources) {
1945
2207
  content.push(source);
1946
2208
  }
1947
2209
  return {
1948
2210
  content,
1949
2211
  finishReason: {
1950
- unified: mapGoogleGenerativeAIFinishReason({
1951
- finishReason: candidate.finishReason,
2212
+ unified: isPromptBlocked ? "content-filter" : mapGoogleGenerativeAIFinishReason({
2213
+ finishReason: rawFinishReason,
1952
2214
  // Only count client-executed tool calls for finish reason determination.
1953
2215
  hasToolCalls: content.some(
1954
2216
  (part) => part.type === "tool-call" && !part.providerExecuted
1955
2217
  )
1956
2218
  }),
1957
- raw: (_l = candidate.finishReason) != null ? _l : void 0
2219
+ raw: rawFinishReason
1958
2220
  },
1959
2221
  usage: convertGoogleGenerativeAIUsage(usageMetadata),
1960
2222
  warnings,
1961
2223
  providerMetadata: {
1962
2224
  [providerOptionsName]: {
1963
- promptFeedback: (_m = response.promptFeedback) != null ? _m : null,
1964
- groundingMetadata: (_n = candidate.groundingMetadata) != null ? _n : null,
1965
- urlContextMetadata: (_o = candidate.urlContextMetadata) != null ? _o : null,
1966
- safetyRatings: (_p = candidate.safetyRatings) != null ? _p : null,
2225
+ promptFeedback: (_p = response.promptFeedback) != null ? _p : null,
2226
+ groundingMetadata: (_q = candidate == null ? void 0 : candidate.groundingMetadata) != null ? _q : null,
2227
+ urlContextMetadata: (_r = candidate == null ? void 0 : candidate.urlContextMetadata) != null ? _r : null,
2228
+ safetyRatings: (_s = candidate == null ? void 0 : candidate.safetyRatings) != null ? _s : null,
1967
2229
  usageMetadata: usageMetadata != null ? usageMetadata : null,
1968
- finishMessage: (_q = candidate.finishMessage) != null ? _q : null,
1969
- serviceTier: (_r = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _r : null
2230
+ finishMessage: (_t = candidate == null ? void 0 : candidate.finishMessage) != null ? _t : null,
2231
+ serviceTier: (_u = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _u : null
1970
2232
  }
1971
2233
  },
1972
2234
  request: { body: args },
1973
2235
  response: {
1974
2236
  // TODO timestamp, model id
1975
- id: (_s = response.responseId) != null ? _s : void 0,
2237
+ id: (_v = response.responseId) != null ? _v : void 0,
1976
2238
  headers: responseHeaders,
1977
2239
  body: rawResponse
1978
2240
  }
@@ -1980,19 +2242,19 @@ var GoogleGenerativeAILanguageModel = class {
1980
2242
  }
1981
2243
  async doStream(options) {
1982
2244
  const { args, warnings, providerOptionsName, extraHeaders } = await this.getArgs(options, { isStreaming: true });
1983
- const headers = (0, import_provider_utils6.combineHeaders)(
1984
- await (0, import_provider_utils6.resolve)(this.config.headers),
2245
+ const headers = (0, import_provider_utils7.combineHeaders)(
2246
+ await (0, import_provider_utils7.resolve)(this.config.headers),
1985
2247
  options.headers,
1986
2248
  extraHeaders
1987
2249
  );
1988
- const { responseHeaders, value: response } = await (0, import_provider_utils6.postJsonToApi)({
2250
+ const { responseHeaders, value: response } = await (0, import_provider_utils7.postJsonToApi)({
1989
2251
  url: `${this.config.baseURL}/${getModelPath(
1990
2252
  this.modelId
1991
2253
  )}:streamGenerateContent?alt=sse`,
1992
2254
  headers,
1993
2255
  body: args,
1994
2256
  failedResponseHandler: googleFailedResponseHandler,
1995
- successfulResponseHandler: (0, import_provider_utils6.createEventSourceResponseHandler)(chunkSchema),
2257
+ successfulResponseHandler: (0, import_provider_utils7.createEventSourceResponseHandler)(chunkSchema),
1996
2258
  abortSignal: options.abortSignal,
1997
2259
  fetch: this.config.fetch
1998
2260
  });
@@ -2049,7 +2311,7 @@ var GoogleGenerativeAILanguageModel = class {
2049
2311
  controller.enqueue({ type: "stream-start", warnings });
2050
2312
  },
2051
2313
  transform(chunk, controller) {
2052
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
2314
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2053
2315
  if (options.includeRawChunks) {
2054
2316
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2055
2317
  }
@@ -2071,6 +2333,24 @@ var GoogleGenerativeAILanguageModel = class {
2071
2333
  }
2072
2334
  const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
2073
2335
  if (candidate == null) {
2336
+ const promptBlockReason2 = (_b = value.promptFeedback) == null ? void 0 : _b.blockReason;
2337
+ if (promptBlockReason2 != null) {
2338
+ finishReason = {
2339
+ unified: "content-filter",
2340
+ raw: promptBlockReason2
2341
+ };
2342
+ providerMetadata = {
2343
+ [providerOptionsName]: {
2344
+ promptFeedback: (_c = value.promptFeedback) != null ? _c : null,
2345
+ groundingMetadata: lastGroundingMetadata,
2346
+ urlContextMetadata: lastUrlContextMetadata,
2347
+ safetyRatings: null,
2348
+ usageMetadata: usageMetadata != null ? usageMetadata : null,
2349
+ finishMessage: null,
2350
+ serviceTier: (_d = usage == null ? void 0 : usage.serviceTier) != null ? _d : null
2351
+ }
2352
+ };
2353
+ }
2074
2354
  return;
2075
2355
  }
2076
2356
  const content = candidate.content;
@@ -2093,9 +2373,9 @@ var GoogleGenerativeAILanguageModel = class {
2093
2373
  }
2094
2374
  }
2095
2375
  if (content != null) {
2096
- const parts = (_b = content.parts) != null ? _b : [];
2376
+ const parts = (_e = content.parts) != null ? _e : [];
2097
2377
  for (const part of parts) {
2098
- if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
2378
+ if ("executableCode" in part && ((_f = part.executableCode) == null ? void 0 : _f.code)) {
2099
2379
  const toolCallId = generateId3();
2100
2380
  lastCodeExecutionToolCallId = toolCallId;
2101
2381
  controller.enqueue({
@@ -2114,7 +2394,7 @@ var GoogleGenerativeAILanguageModel = class {
2114
2394
  toolName: "code_execution",
2115
2395
  result: {
2116
2396
  outcome: part.codeExecutionResult.outcome,
2117
- output: (_d = part.codeExecutionResult.output) != null ? _d : ""
2397
+ output: (_g = part.codeExecutionResult.output) != null ? _g : ""
2118
2398
  }
2119
2399
  });
2120
2400
  }
@@ -2208,7 +2488,7 @@ var GoogleGenerativeAILanguageModel = class {
2208
2488
  providerMetadata: fileMeta
2209
2489
  });
2210
2490
  } else if ("toolCall" in part && part.toolCall) {
2211
- const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId3();
2491
+ const toolCallId = (_h = part.toolCall.id) != null ? _h : generateId3();
2212
2492
  lastServerToolCallId = toolCallId;
2213
2493
  const serverMeta = {
2214
2494
  [providerOptionsName]: {
@@ -2221,13 +2501,13 @@ var GoogleGenerativeAILanguageModel = class {
2221
2501
  type: "tool-call",
2222
2502
  toolCallId,
2223
2503
  toolName: `server:${part.toolCall.toolType}`,
2224
- input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
2504
+ input: JSON.stringify((_i = part.toolCall.args) != null ? _i : {}),
2225
2505
  providerExecuted: true,
2226
2506
  dynamic: true,
2227
2507
  providerMetadata: serverMeta
2228
2508
  });
2229
2509
  } else if ("toolResponse" in part && part.toolResponse) {
2230
- const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId3();
2510
+ const responseToolCallId = (_j = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _j : generateId3();
2231
2511
  const serverMeta = {
2232
2512
  [providerOptionsName]: {
2233
2513
  ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
@@ -2239,7 +2519,7 @@ var GoogleGenerativeAILanguageModel = class {
2239
2519
  type: "tool-result",
2240
2520
  toolCallId: responseToolCallId,
2241
2521
  toolName: `server:${part.toolResponse.toolType}`,
2242
- result: (_h = part.toolResponse.response) != null ? _h : {},
2522
+ result: (_k = part.toolResponse.response) != null ? _k : {},
2243
2523
  providerMetadata: serverMeta
2244
2524
  });
2245
2525
  lastServerToolCallId = void 0;
@@ -2258,7 +2538,7 @@ var GoogleGenerativeAILanguageModel = class {
2258
2538
  const isNoArgsCompleteCall = part.functionCall.name != null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue !== true;
2259
2539
  if (isStreamingChunk) {
2260
2540
  if (part.functionCall.name != null) {
2261
- const toolCallId = (_i = part.functionCall.id) != null ? _i : generateId3();
2541
+ const toolCallId = (_l = part.functionCall.id) != null ? _l : generateId3();
2262
2542
  const accumulator = new GoogleJSONAccumulator();
2263
2543
  activeStreamingToolCalls.push({
2264
2544
  toolCallId,
@@ -2306,9 +2586,9 @@ var GoogleGenerativeAILanguageModel = class {
2306
2586
  } else if (isTerminalChunk && activeStreamingToolCalls.length > 0) {
2307
2587
  finishActiveStreamingToolCall(controller);
2308
2588
  } else if (isCompleteCall) {
2309
- const toolCallId = (_j = part.functionCall.id) != null ? _j : generateId3();
2589
+ const toolCallId = (_m = part.functionCall.id) != null ? _m : generateId3();
2310
2590
  const toolName = part.functionCall.name;
2311
- const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_k = part.functionCall.args) != null ? _k : {});
2591
+ const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_n = part.functionCall.args) != null ? _n : {});
2312
2592
  controller.enqueue({
2313
2593
  type: "tool-input-start",
2314
2594
  id: toolCallId,
@@ -2335,7 +2615,7 @@ var GoogleGenerativeAILanguageModel = class {
2335
2615
  });
2336
2616
  hasToolCalls = true;
2337
2617
  } else if (isNoArgsCompleteCall) {
2338
- const toolCallId = (_l = part.functionCall.id) != null ? _l : generateId3();
2618
+ const toolCallId = (_o = part.functionCall.id) != null ? _o : generateId3();
2339
2619
  const toolName = part.functionCall.name;
2340
2620
  controller.enqueue({
2341
2621
  type: "tool-input-start",
@@ -2359,23 +2639,26 @@ var GoogleGenerativeAILanguageModel = class {
2359
2639
  }
2360
2640
  }
2361
2641
  }
2362
- if (candidate.finishReason != null) {
2642
+ const promptBlockReason = (_p = value.promptFeedback) == null ? void 0 : _p.blockReason;
2643
+ const isPromptBlocked = candidate.finishReason == null && promptBlockReason != null;
2644
+ const rawFinishReason = (_r = (_q = candidate.finishReason) != null ? _q : promptBlockReason) != null ? _r : void 0;
2645
+ if (rawFinishReason != null) {
2363
2646
  finishReason = {
2364
- unified: mapGoogleGenerativeAIFinishReason({
2365
- finishReason: candidate.finishReason,
2647
+ unified: isPromptBlocked ? "content-filter" : mapGoogleGenerativeAIFinishReason({
2648
+ finishReason: rawFinishReason,
2366
2649
  hasToolCalls
2367
2650
  }),
2368
- raw: candidate.finishReason
2651
+ raw: rawFinishReason
2369
2652
  };
2370
2653
  providerMetadata = {
2371
2654
  [providerOptionsName]: {
2372
- promptFeedback: (_m = value.promptFeedback) != null ? _m : null,
2655
+ promptFeedback: (_s = value.promptFeedback) != null ? _s : null,
2373
2656
  groundingMetadata: lastGroundingMetadata,
2374
2657
  urlContextMetadata: lastUrlContextMetadata,
2375
- safetyRatings: (_n = candidate.safetyRatings) != null ? _n : null,
2658
+ safetyRatings: (_t = candidate.safetyRatings) != null ? _t : null,
2376
2659
  usageMetadata: usageMetadata != null ? usageMetadata : null,
2377
- finishMessage: (_o = candidate.finishMessage) != null ? _o : null,
2378
- serviceTier: (_p = usage == null ? void 0 : usage.serviceTier) != null ? _p : null
2660
+ finishMessage: (_u = candidate.finishMessage) != null ? _u : null,
2661
+ serviceTier: (_v = usage == null ? void 0 : usage.serviceTier) != null ? _v : null
2379
2662
  }
2380
2663
  };
2381
2664
  }
@@ -2501,272 +2784,272 @@ function extractSources({
2501
2784
  }
2502
2785
  return sources.length > 0 ? sources : void 0;
2503
2786
  }
2504
- var getGroundingMetadataSchema = () => import_v45.z.object({
2505
- webSearchQueries: import_v45.z.array(import_v45.z.string()).nullish(),
2506
- imageSearchQueries: import_v45.z.array(import_v45.z.string()).nullish(),
2507
- retrievalQueries: import_v45.z.array(import_v45.z.string()).nullish(),
2508
- searchEntryPoint: import_v45.z.object({ renderedContent: import_v45.z.string() }).nullish(),
2509
- groundingChunks: import_v45.z.array(
2510
- import_v45.z.object({
2511
- web: import_v45.z.object({ uri: import_v45.z.string(), title: import_v45.z.string().nullish() }).nullish(),
2512
- image: import_v45.z.object({
2513
- sourceUri: import_v45.z.string(),
2514
- imageUri: import_v45.z.string(),
2515
- title: import_v45.z.string().nullish(),
2516
- domain: import_v45.z.string().nullish()
2787
+ var getGroundingMetadataSchema = () => import_v47.z.object({
2788
+ webSearchQueries: import_v47.z.array(import_v47.z.string()).nullish(),
2789
+ imageSearchQueries: import_v47.z.array(import_v47.z.string()).nullish(),
2790
+ retrievalQueries: import_v47.z.array(import_v47.z.string()).nullish(),
2791
+ searchEntryPoint: import_v47.z.object({ renderedContent: import_v47.z.string() }).nullish(),
2792
+ groundingChunks: import_v47.z.array(
2793
+ import_v47.z.object({
2794
+ web: import_v47.z.object({ uri: import_v47.z.string(), title: import_v47.z.string().nullish() }).nullish(),
2795
+ image: import_v47.z.object({
2796
+ sourceUri: import_v47.z.string(),
2797
+ imageUri: import_v47.z.string(),
2798
+ title: import_v47.z.string().nullish(),
2799
+ domain: import_v47.z.string().nullish()
2517
2800
  }).nullish(),
2518
- retrievedContext: import_v45.z.object({
2519
- uri: import_v45.z.string().nullish(),
2520
- title: import_v45.z.string().nullish(),
2521
- text: import_v45.z.string().nullish(),
2522
- fileSearchStore: import_v45.z.string().nullish()
2801
+ retrievedContext: import_v47.z.object({
2802
+ uri: import_v47.z.string().nullish(),
2803
+ title: import_v47.z.string().nullish(),
2804
+ text: import_v47.z.string().nullish(),
2805
+ fileSearchStore: import_v47.z.string().nullish()
2523
2806
  }).nullish(),
2524
- maps: import_v45.z.object({
2525
- uri: import_v45.z.string().nullish(),
2526
- title: import_v45.z.string().nullish(),
2527
- text: import_v45.z.string().nullish(),
2528
- placeId: import_v45.z.string().nullish()
2807
+ maps: import_v47.z.object({
2808
+ uri: import_v47.z.string().nullish(),
2809
+ title: import_v47.z.string().nullish(),
2810
+ text: import_v47.z.string().nullish(),
2811
+ placeId: import_v47.z.string().nullish()
2529
2812
  }).nullish()
2530
2813
  })
2531
2814
  ).nullish(),
2532
- groundingSupports: import_v45.z.array(
2533
- import_v45.z.object({
2534
- segment: import_v45.z.object({
2535
- startIndex: import_v45.z.number().nullish(),
2536
- endIndex: import_v45.z.number().nullish(),
2537
- text: import_v45.z.string().nullish()
2815
+ groundingSupports: import_v47.z.array(
2816
+ import_v47.z.object({
2817
+ segment: import_v47.z.object({
2818
+ startIndex: import_v47.z.number().nullish(),
2819
+ endIndex: import_v47.z.number().nullish(),
2820
+ text: import_v47.z.string().nullish()
2538
2821
  }).nullish(),
2539
- segment_text: import_v45.z.string().nullish(),
2540
- groundingChunkIndices: import_v45.z.array(import_v45.z.number()).nullish(),
2541
- supportChunkIndices: import_v45.z.array(import_v45.z.number()).nullish(),
2542
- confidenceScores: import_v45.z.array(import_v45.z.number()).nullish(),
2543
- confidenceScore: import_v45.z.array(import_v45.z.number()).nullish()
2822
+ segment_text: import_v47.z.string().nullish(),
2823
+ groundingChunkIndices: import_v47.z.array(import_v47.z.number()).nullish(),
2824
+ supportChunkIndices: import_v47.z.array(import_v47.z.number()).nullish(),
2825
+ confidenceScores: import_v47.z.array(import_v47.z.number()).nullish(),
2826
+ confidenceScore: import_v47.z.array(import_v47.z.number()).nullish()
2544
2827
  })
2545
2828
  ).nullish(),
2546
- retrievalMetadata: import_v45.z.union([
2547
- import_v45.z.object({
2548
- webDynamicRetrievalScore: import_v45.z.number()
2829
+ retrievalMetadata: import_v47.z.union([
2830
+ import_v47.z.object({
2831
+ webDynamicRetrievalScore: import_v47.z.number()
2549
2832
  }),
2550
- import_v45.z.object({})
2833
+ import_v47.z.object({})
2551
2834
  ]).nullish()
2552
2835
  });
2553
- var partialArgSchema = import_v45.z.object({
2554
- jsonPath: import_v45.z.string(),
2555
- stringValue: import_v45.z.string().nullish(),
2556
- numberValue: import_v45.z.number().nullish(),
2557
- boolValue: import_v45.z.boolean().nullish(),
2558
- nullValue: import_v45.z.unknown().nullish(),
2559
- willContinue: import_v45.z.boolean().nullish()
2836
+ var partialArgSchema = import_v47.z.object({
2837
+ jsonPath: import_v47.z.string(),
2838
+ stringValue: import_v47.z.string().nullish(),
2839
+ numberValue: import_v47.z.number().nullish(),
2840
+ boolValue: import_v47.z.boolean().nullish(),
2841
+ nullValue: import_v47.z.unknown().nullish(),
2842
+ willContinue: import_v47.z.boolean().nullish()
2560
2843
  });
2561
- var getContentSchema = () => import_v45.z.object({
2562
- parts: import_v45.z.array(
2563
- import_v45.z.union([
2844
+ var getContentSchema = () => import_v47.z.object({
2845
+ parts: import_v47.z.array(
2846
+ import_v47.z.union([
2564
2847
  // note: order matters since text can be fully empty
2565
- import_v45.z.object({
2566
- functionCall: import_v45.z.object({
2567
- id: import_v45.z.string().nullish(),
2568
- name: import_v45.z.string().nullish(),
2569
- args: import_v45.z.unknown().nullish(),
2570
- partialArgs: import_v45.z.array(partialArgSchema).nullish(),
2571
- willContinue: import_v45.z.boolean().nullish()
2848
+ import_v47.z.object({
2849
+ functionCall: import_v47.z.object({
2850
+ id: import_v47.z.string().nullish(),
2851
+ name: import_v47.z.string().nullish(),
2852
+ args: import_v47.z.unknown().nullish(),
2853
+ partialArgs: import_v47.z.array(partialArgSchema).nullish(),
2854
+ willContinue: import_v47.z.boolean().nullish()
2572
2855
  }),
2573
- thoughtSignature: import_v45.z.string().nullish()
2856
+ thoughtSignature: import_v47.z.string().nullish()
2574
2857
  }),
2575
- import_v45.z.object({
2576
- inlineData: import_v45.z.object({
2577
- mimeType: import_v45.z.string(),
2578
- data: import_v45.z.string()
2858
+ import_v47.z.object({
2859
+ inlineData: import_v47.z.object({
2860
+ mimeType: import_v47.z.string(),
2861
+ data: import_v47.z.string()
2579
2862
  }),
2580
- thought: import_v45.z.boolean().nullish(),
2581
- thoughtSignature: import_v45.z.string().nullish()
2863
+ thought: import_v47.z.boolean().nullish(),
2864
+ thoughtSignature: import_v47.z.string().nullish()
2582
2865
  }),
2583
- import_v45.z.object({
2584
- toolCall: import_v45.z.object({
2585
- toolType: import_v45.z.string(),
2586
- args: import_v45.z.unknown().nullish(),
2587
- id: import_v45.z.string()
2866
+ import_v47.z.object({
2867
+ toolCall: import_v47.z.object({
2868
+ toolType: import_v47.z.string(),
2869
+ args: import_v47.z.unknown().nullish(),
2870
+ id: import_v47.z.string()
2588
2871
  }),
2589
- thoughtSignature: import_v45.z.string().nullish()
2872
+ thoughtSignature: import_v47.z.string().nullish()
2590
2873
  }),
2591
- import_v45.z.object({
2592
- toolResponse: import_v45.z.object({
2593
- toolType: import_v45.z.string(),
2594
- response: import_v45.z.unknown().nullish(),
2595
- id: import_v45.z.string()
2874
+ import_v47.z.object({
2875
+ toolResponse: import_v47.z.object({
2876
+ toolType: import_v47.z.string(),
2877
+ response: import_v47.z.unknown().nullish(),
2878
+ id: import_v47.z.string()
2596
2879
  }),
2597
- thoughtSignature: import_v45.z.string().nullish()
2880
+ thoughtSignature: import_v47.z.string().nullish()
2598
2881
  }),
2599
- import_v45.z.object({
2600
- executableCode: import_v45.z.object({
2601
- language: import_v45.z.string(),
2602
- code: import_v45.z.string()
2882
+ import_v47.z.object({
2883
+ executableCode: import_v47.z.object({
2884
+ language: import_v47.z.string(),
2885
+ code: import_v47.z.string()
2603
2886
  }).nullish(),
2604
- codeExecutionResult: import_v45.z.object({
2605
- outcome: import_v45.z.string(),
2606
- output: import_v45.z.string().nullish()
2887
+ codeExecutionResult: import_v47.z.object({
2888
+ outcome: import_v47.z.string(),
2889
+ output: import_v47.z.string().nullish()
2607
2890
  }).nullish(),
2608
- text: import_v45.z.string().nullish(),
2609
- thought: import_v45.z.boolean().nullish(),
2610
- thoughtSignature: import_v45.z.string().nullish()
2891
+ text: import_v47.z.string().nullish(),
2892
+ thought: import_v47.z.boolean().nullish(),
2893
+ thoughtSignature: import_v47.z.string().nullish()
2611
2894
  })
2612
2895
  ])
2613
2896
  ).nullish()
2614
2897
  });
2615
- var getSafetyRatingSchema = () => import_v45.z.object({
2616
- category: import_v45.z.string().nullish(),
2617
- probability: import_v45.z.string().nullish(),
2618
- probabilityScore: import_v45.z.number().nullish(),
2619
- severity: import_v45.z.string().nullish(),
2620
- severityScore: import_v45.z.number().nullish(),
2621
- blocked: import_v45.z.boolean().nullish()
2898
+ var getSafetyRatingSchema = () => import_v47.z.object({
2899
+ category: import_v47.z.string().nullish(),
2900
+ probability: import_v47.z.string().nullish(),
2901
+ probabilityScore: import_v47.z.number().nullish(),
2902
+ severity: import_v47.z.string().nullish(),
2903
+ severityScore: import_v47.z.number().nullish(),
2904
+ blocked: import_v47.z.boolean().nullish()
2622
2905
  });
2623
- var tokenDetailsSchema = import_v45.z.array(
2624
- import_v45.z.object({
2625
- modality: import_v45.z.string(),
2626
- tokenCount: import_v45.z.number()
2906
+ var tokenDetailsSchema = import_v47.z.array(
2907
+ import_v47.z.object({
2908
+ modality: import_v47.z.string(),
2909
+ tokenCount: import_v47.z.number()
2627
2910
  })
2628
2911
  ).nullish();
2629
- var usageSchema = import_v45.z.object({
2630
- cachedContentTokenCount: import_v45.z.number().nullish(),
2631
- thoughtsTokenCount: import_v45.z.number().nullish(),
2632
- promptTokenCount: import_v45.z.number().nullish(),
2633
- candidatesTokenCount: import_v45.z.number().nullish(),
2634
- totalTokenCount: import_v45.z.number().nullish(),
2912
+ var usageSchema = import_v47.z.object({
2913
+ cachedContentTokenCount: import_v47.z.number().nullish(),
2914
+ thoughtsTokenCount: import_v47.z.number().nullish(),
2915
+ promptTokenCount: import_v47.z.number().nullish(),
2916
+ candidatesTokenCount: import_v47.z.number().nullish(),
2917
+ totalTokenCount: import_v47.z.number().nullish(),
2635
2918
  // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
2636
- trafficType: import_v45.z.string().nullish(),
2637
- serviceTier: import_v45.z.string().nullish(),
2919
+ trafficType: import_v47.z.string().nullish(),
2920
+ serviceTier: import_v47.z.string().nullish(),
2638
2921
  // https://ai.google.dev/api/generate-content#Modality
2639
2922
  promptTokensDetails: tokenDetailsSchema,
2640
2923
  candidatesTokensDetails: tokenDetailsSchema
2641
2924
  });
2642
- var getUrlContextMetadataSchema = () => import_v45.z.object({
2643
- urlMetadata: import_v45.z.array(
2644
- import_v45.z.object({
2645
- retrievedUrl: import_v45.z.string(),
2646
- urlRetrievalStatus: import_v45.z.string()
2925
+ var getUrlContextMetadataSchema = () => import_v47.z.object({
2926
+ urlMetadata: import_v47.z.array(
2927
+ import_v47.z.object({
2928
+ retrievedUrl: import_v47.z.string(),
2929
+ urlRetrievalStatus: import_v47.z.string()
2647
2930
  })
2648
2931
  ).nullish()
2649
2932
  });
2650
- var responseSchema = (0, import_provider_utils6.lazySchema)(
2651
- () => (0, import_provider_utils6.zodSchema)(
2652
- import_v45.z.object({
2653
- responseId: import_v45.z.string().nullish(),
2654
- candidates: import_v45.z.array(
2655
- import_v45.z.object({
2656
- content: getContentSchema().nullish().or(import_v45.z.object({}).strict()),
2657
- finishReason: import_v45.z.string().nullish(),
2658
- finishMessage: import_v45.z.string().nullish(),
2659
- safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish(),
2933
+ var responseSchema = (0, import_provider_utils7.lazySchema)(
2934
+ () => (0, import_provider_utils7.zodSchema)(
2935
+ import_v47.z.object({
2936
+ responseId: import_v47.z.string().nullish(),
2937
+ candidates: import_v47.z.array(
2938
+ import_v47.z.object({
2939
+ content: getContentSchema().nullish().or(import_v47.z.object({}).strict()),
2940
+ finishReason: import_v47.z.string().nullish(),
2941
+ finishMessage: import_v47.z.string().nullish(),
2942
+ safetyRatings: import_v47.z.array(getSafetyRatingSchema()).nullish(),
2660
2943
  groundingMetadata: getGroundingMetadataSchema().nullish(),
2661
2944
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
2662
2945
  })
2663
- ),
2946
+ ).nullish(),
2664
2947
  usageMetadata: usageSchema.nullish(),
2665
- promptFeedback: import_v45.z.object({
2666
- blockReason: import_v45.z.string().nullish(),
2667
- safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
2948
+ promptFeedback: import_v47.z.object({
2949
+ blockReason: import_v47.z.string().nullish(),
2950
+ safetyRatings: import_v47.z.array(getSafetyRatingSchema()).nullish()
2668
2951
  }).nullish()
2669
2952
  })
2670
2953
  )
2671
2954
  );
2672
- var chunkSchema = (0, import_provider_utils6.lazySchema)(
2673
- () => (0, import_provider_utils6.zodSchema)(
2674
- import_v45.z.object({
2675
- responseId: import_v45.z.string().nullish(),
2676
- candidates: import_v45.z.array(
2677
- import_v45.z.object({
2955
+ var chunkSchema = (0, import_provider_utils7.lazySchema)(
2956
+ () => (0, import_provider_utils7.zodSchema)(
2957
+ import_v47.z.object({
2958
+ responseId: import_v47.z.string().nullish(),
2959
+ candidates: import_v47.z.array(
2960
+ import_v47.z.object({
2678
2961
  content: getContentSchema().nullish(),
2679
- finishReason: import_v45.z.string().nullish(),
2680
- finishMessage: import_v45.z.string().nullish(),
2681
- safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish(),
2962
+ finishReason: import_v47.z.string().nullish(),
2963
+ finishMessage: import_v47.z.string().nullish(),
2964
+ safetyRatings: import_v47.z.array(getSafetyRatingSchema()).nullish(),
2682
2965
  groundingMetadata: getGroundingMetadataSchema().nullish(),
2683
2966
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
2684
2967
  })
2685
2968
  ).nullish(),
2686
2969
  usageMetadata: usageSchema.nullish(),
2687
- promptFeedback: import_v45.z.object({
2688
- blockReason: import_v45.z.string().nullish(),
2689
- safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
2970
+ promptFeedback: import_v47.z.object({
2971
+ blockReason: import_v47.z.string().nullish(),
2972
+ safetyRatings: import_v47.z.array(getSafetyRatingSchema()).nullish()
2690
2973
  }).nullish()
2691
2974
  })
2692
2975
  )
2693
2976
  );
2694
2977
 
2695
2978
  // src/tool/code-execution.ts
2696
- var import_provider_utils7 = require("@ai-sdk/provider-utils");
2697
- var import_v46 = require("zod/v4");
2698
- var codeExecution = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
2979
+ var import_provider_utils8 = require("@ai-sdk/provider-utils");
2980
+ var import_v48 = require("zod/v4");
2981
+ var codeExecution = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
2699
2982
  id: "google.code_execution",
2700
- inputSchema: import_v46.z.object({
2701
- language: import_v46.z.string().describe("The programming language of the code."),
2702
- code: import_v46.z.string().describe("The code to be executed.")
2983
+ inputSchema: import_v48.z.object({
2984
+ language: import_v48.z.string().describe("The programming language of the code."),
2985
+ code: import_v48.z.string().describe("The code to be executed.")
2703
2986
  }),
2704
- outputSchema: import_v46.z.object({
2705
- outcome: import_v46.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
2706
- output: import_v46.z.string().describe("The output from the code execution.")
2987
+ outputSchema: import_v48.z.object({
2988
+ outcome: import_v48.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
2989
+ output: import_v48.z.string().describe("The output from the code execution.")
2707
2990
  })
2708
2991
  });
2709
2992
 
2710
2993
  // src/tool/enterprise-web-search.ts
2711
- var import_provider_utils8 = require("@ai-sdk/provider-utils");
2712
- var import_v47 = require("zod/v4");
2713
- var enterpriseWebSearch = (0, import_provider_utils8.createProviderToolFactory)({
2994
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
2995
+ var import_v49 = require("zod/v4");
2996
+ var enterpriseWebSearch = (0, import_provider_utils9.createProviderToolFactory)({
2714
2997
  id: "google.enterprise_web_search",
2715
- inputSchema: (0, import_provider_utils8.lazySchema)(() => (0, import_provider_utils8.zodSchema)(import_v47.z.object({})))
2998
+ inputSchema: (0, import_provider_utils9.lazySchema)(() => (0, import_provider_utils9.zodSchema)(import_v49.z.object({})))
2716
2999
  });
2717
3000
 
2718
3001
  // src/tool/file-search.ts
2719
- var import_provider_utils9 = require("@ai-sdk/provider-utils");
2720
- var import_v48 = require("zod/v4");
2721
- var fileSearchArgsBaseSchema = import_v48.z.object({
3002
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
3003
+ var import_v410 = require("zod/v4");
3004
+ var fileSearchArgsBaseSchema = import_v410.z.object({
2722
3005
  /** The names of the file_search_stores to retrieve from.
2723
3006
  * Example: `fileSearchStores/my-file-search-store-123`
2724
3007
  */
2725
- fileSearchStoreNames: import_v48.z.array(import_v48.z.string()).describe(
3008
+ fileSearchStoreNames: import_v410.z.array(import_v410.z.string()).describe(
2726
3009
  "The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
2727
3010
  ),
2728
3011
  /** The number of file search retrieval chunks to retrieve. */
2729
- topK: import_v48.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
3012
+ topK: import_v410.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
2730
3013
  /** Metadata filter to apply to the file search retrieval documents.
2731
3014
  * See https://google.aip.dev/160 for the syntax of the filter expression.
2732
3015
  */
2733
- metadataFilter: import_v48.z.string().describe(
3016
+ metadataFilter: import_v410.z.string().describe(
2734
3017
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
2735
3018
  ).optional()
2736
3019
  }).passthrough();
2737
- var fileSearchArgsSchema = (0, import_provider_utils9.lazySchema)(
2738
- () => (0, import_provider_utils9.zodSchema)(fileSearchArgsBaseSchema)
3020
+ var fileSearchArgsSchema = (0, import_provider_utils10.lazySchema)(
3021
+ () => (0, import_provider_utils10.zodSchema)(fileSearchArgsBaseSchema)
2739
3022
  );
2740
- var fileSearch = (0, import_provider_utils9.createProviderToolFactory)({
3023
+ var fileSearch = (0, import_provider_utils10.createProviderToolFactory)({
2741
3024
  id: "google.file_search",
2742
3025
  inputSchema: fileSearchArgsSchema
2743
3026
  });
2744
3027
 
2745
3028
  // src/tool/google-maps.ts
2746
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
2747
- var import_v49 = require("zod/v4");
2748
- var googleMaps = (0, import_provider_utils10.createProviderToolFactory)({
3029
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
3030
+ var import_v411 = require("zod/v4");
3031
+ var googleMaps = (0, import_provider_utils11.createProviderToolFactory)({
2749
3032
  id: "google.google_maps",
2750
- inputSchema: (0, import_provider_utils10.lazySchema)(() => (0, import_provider_utils10.zodSchema)(import_v49.z.object({})))
3033
+ inputSchema: (0, import_provider_utils11.lazySchema)(() => (0, import_provider_utils11.zodSchema)(import_v411.z.object({})))
2751
3034
  });
2752
3035
 
2753
3036
  // src/tool/google-search.ts
2754
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
2755
- var import_v410 = require("zod/v4");
2756
- var googleSearchToolArgsBaseSchema = import_v410.z.object({
2757
- searchTypes: import_v410.z.object({
2758
- webSearch: import_v410.z.object({}).optional(),
2759
- imageSearch: import_v410.z.object({}).optional()
3037
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
3038
+ var import_v412 = require("zod/v4");
3039
+ var googleSearchToolArgsBaseSchema = import_v412.z.object({
3040
+ searchTypes: import_v412.z.object({
3041
+ webSearch: import_v412.z.object({}).optional(),
3042
+ imageSearch: import_v412.z.object({}).optional()
2760
3043
  }).optional(),
2761
- timeRangeFilter: import_v410.z.object({
2762
- startTime: import_v410.z.string(),
2763
- endTime: import_v410.z.string()
3044
+ timeRangeFilter: import_v412.z.object({
3045
+ startTime: import_v412.z.string(),
3046
+ endTime: import_v412.z.string()
2764
3047
  }).optional()
2765
3048
  }).passthrough();
2766
- var googleSearchToolArgsSchema = (0, import_provider_utils11.lazySchema)(
2767
- () => (0, import_provider_utils11.zodSchema)(googleSearchToolArgsBaseSchema)
3049
+ var googleSearchToolArgsSchema = (0, import_provider_utils12.lazySchema)(
3050
+ () => (0, import_provider_utils12.zodSchema)(googleSearchToolArgsBaseSchema)
2768
3051
  );
2769
- var googleSearch = (0, import_provider_utils11.createProviderToolFactory)(
3052
+ var googleSearch = (0, import_provider_utils12.createProviderToolFactory)(
2770
3053
  {
2771
3054
  id: "google.google_search",
2772
3055
  inputSchema: googleSearchToolArgsSchema
@@ -2774,21 +3057,21 @@ var googleSearch = (0, import_provider_utils11.createProviderToolFactory)(
2774
3057
  );
2775
3058
 
2776
3059
  // src/tool/url-context.ts
2777
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
2778
- var import_v411 = require("zod/v4");
2779
- var urlContext = (0, import_provider_utils12.createProviderToolFactory)({
3060
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
3061
+ var import_v413 = require("zod/v4");
3062
+ var urlContext = (0, import_provider_utils13.createProviderToolFactory)({
2780
3063
  id: "google.url_context",
2781
- inputSchema: (0, import_provider_utils12.lazySchema)(() => (0, import_provider_utils12.zodSchema)(import_v411.z.object({})))
3064
+ inputSchema: (0, import_provider_utils13.lazySchema)(() => (0, import_provider_utils13.zodSchema)(import_v413.z.object({})))
2782
3065
  });
2783
3066
 
2784
3067
  // src/tool/vertex-rag-store.ts
2785
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
2786
- var import_v412 = require("zod/v4");
2787
- var vertexRagStore = (0, import_provider_utils13.createProviderToolFactory)({
3068
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
3069
+ var import_v414 = require("zod/v4");
3070
+ var vertexRagStore = (0, import_provider_utils14.createProviderToolFactory)({
2788
3071
  id: "google.vertex_rag_store",
2789
- inputSchema: import_v412.z.object({
2790
- ragCorpus: import_v412.z.string(),
2791
- topK: import_v412.z.number().optional()
3072
+ inputSchema: import_v414.z.object({
3073
+ ragCorpus: import_v414.z.string(),
3074
+ topK: import_v414.z.number().optional()
2792
3075
  })
2793
3076
  });
2794
3077
 
@@ -2853,8 +3136,8 @@ var googleTools = {
2853
3136
  };
2854
3137
 
2855
3138
  // src/google-generative-ai-image-model.ts
2856
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
2857
- var import_v413 = require("zod/v4");
3139
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
3140
+ var import_v415 = require("zod/v4");
2858
3141
  var GoogleGenerativeAIImageModel = class {
2859
3142
  constructor(modelId, settings, config) {
2860
3143
  this.modelId = modelId;
@@ -2919,7 +3202,7 @@ var GoogleGenerativeAIImageModel = class {
2919
3202
  details: "This model does not support the `seed` option through this provider."
2920
3203
  });
2921
3204
  }
2922
- const googleOptions = await (0, import_provider_utils14.parseProviderOptions)({
3205
+ const googleOptions = await (0, import_provider_utils15.parseProviderOptions)({
2923
3206
  provider: "google",
2924
3207
  providerOptions,
2925
3208
  schema: googleImageModelOptionsSchema
@@ -2946,12 +3229,12 @@ var GoogleGenerativeAIImageModel = class {
2946
3229
  instances: [{ prompt }],
2947
3230
  parameters
2948
3231
  };
2949
- const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
3232
+ const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
2950
3233
  url: `${this.config.baseURL}/models/${this.modelId}:predict`,
2951
- headers: (0, import_provider_utils14.combineHeaders)(await (0, import_provider_utils14.resolve)(this.config.headers), headers),
3234
+ headers: (0, import_provider_utils15.combineHeaders)(await (0, import_provider_utils15.resolve)(this.config.headers), headers),
2952
3235
  body,
2953
3236
  failedResponseHandler: googleFailedResponseHandler,
2954
- successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
3237
+ successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
2955
3238
  googleImageResponseSchema
2956
3239
  ),
2957
3240
  abortSignal,
@@ -3032,7 +3315,7 @@ var GoogleGenerativeAIImageModel = class {
3032
3315
  const languageModelPrompt = [
3033
3316
  { role: "user", content: userContent }
3034
3317
  ];
3035
- const googleImageOptions = await (0, import_provider_utils14.parseProviderOptions)({
3318
+ const googleImageOptions = await (0, import_provider_utils15.parseProviderOptions)({
3036
3319
  provider: "google",
3037
3320
  providerOptions,
3038
3321
  schema: googleImageModelOptionsSchema
@@ -3043,7 +3326,7 @@ var GoogleGenerativeAIImageModel = class {
3043
3326
  baseURL: this.config.baseURL,
3044
3327
  headers: (_b = this.config.headers) != null ? _b : {},
3045
3328
  fetch: this.config.fetch,
3046
- generateId: (_c = this.config.generateId) != null ? _c : import_provider_utils14.generateId
3329
+ generateId: (_c = this.config.generateId) != null ? _c : import_provider_utils15.generateId
3047
3330
  });
3048
3331
  const result = await languageModel.doGenerate({
3049
3332
  prompt: languageModelPrompt,
@@ -3072,7 +3355,7 @@ var GoogleGenerativeAIImageModel = class {
3072
3355
  const images = [];
3073
3356
  for (const part of result.content) {
3074
3357
  if (part.type === "file" && part.mediaType.startsWith("image/")) {
3075
- images.push((0, import_provider_utils14.convertToBase64)(part.data));
3358
+ images.push((0, import_provider_utils15.convertToBase64)(part.data));
3076
3359
  }
3077
3360
  }
3078
3361
  const languageModelGoogleMetadata = (_h = (_g = result.providerMetadata) == null ? void 0 : _g.google) != null ? _h : {};
@@ -3101,18 +3384,18 @@ var GoogleGenerativeAIImageModel = class {
3101
3384
  function isGeminiModel(modelId) {
3102
3385
  return modelId.startsWith("gemini-");
3103
3386
  }
3104
- var googleImageResponseSchema = (0, import_provider_utils14.lazySchema)(
3105
- () => (0, import_provider_utils14.zodSchema)(
3106
- import_v413.z.object({
3107
- predictions: import_v413.z.array(import_v413.z.object({ bytesBase64Encoded: import_v413.z.string() })).default([])
3387
+ var googleImageResponseSchema = (0, import_provider_utils15.lazySchema)(
3388
+ () => (0, import_provider_utils15.zodSchema)(
3389
+ import_v415.z.object({
3390
+ predictions: import_v415.z.array(import_v415.z.object({ bytesBase64Encoded: import_v415.z.string() })).default([])
3108
3391
  })
3109
3392
  )
3110
3393
  );
3111
- var googleImageModelOptionsSchema = (0, import_provider_utils14.lazySchema)(
3112
- () => (0, import_provider_utils14.zodSchema)(
3113
- import_v413.z.object({
3114
- personGeneration: import_v413.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3115
- aspectRatio: import_v413.z.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish(),
3394
+ var googleImageModelOptionsSchema = (0, import_provider_utils15.lazySchema)(
3395
+ () => (0, import_provider_utils15.zodSchema)(
3396
+ import_v415.z.object({
3397
+ personGeneration: import_v415.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3398
+ aspectRatio: import_v415.z.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish(),
3116
3399
  /**
3117
3400
  * Enable Google Search grounding for Gemini image models. The value is
3118
3401
  * forwarded as the args of the `google.tools.googleSearch` provider
@@ -3128,9 +3411,9 @@ var googleImageModelOptionsSchema = (0, import_provider_utils14.lazySchema)(
3128
3411
  );
3129
3412
 
3130
3413
  // src/google-generative-ai-video-model.ts
3131
- var import_provider5 = require("@ai-sdk/provider");
3132
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
3133
- var import_v414 = require("zod/v4");
3414
+ var import_provider6 = require("@ai-sdk/provider");
3415
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
3416
+ var import_v416 = require("zod/v4");
3134
3417
  function getFirstFrameImage(options) {
3135
3418
  var _a, _b;
3136
3419
  return (_b = (_a = options.frameImages) == null ? void 0 : _a.find((frame) => frame.frameType === "first_frame")) == null ? void 0 : _b.image;
@@ -3164,7 +3447,7 @@ function convertFileToGoogleImage(file, warnings) {
3164
3447
  });
3165
3448
  return void 0;
3166
3449
  }
3167
- const base64Data = typeof file.data === "string" ? file.data : (0, import_provider_utils15.convertUint8ArrayToBase64)(file.data);
3450
+ const base64Data = typeof file.data === "string" ? file.data : (0, import_provider_utils16.convertUint8ArrayToBase64)(file.data);
3168
3451
  return {
3169
3452
  bytesBase64Encoded: base64Data,
3170
3453
  mimeType: file.mediaType || "image/png"
@@ -3209,7 +3492,7 @@ var GoogleGenerativeAIVideoModel = class {
3209
3492
  var _a, _b, _c, _d, _e, _f, _g, _h;
3210
3493
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
3211
3494
  const warnings = [];
3212
- const googleOptions = await (0, import_provider_utils15.parseProviderOptions)({
3495
+ const googleOptions = await (0, import_provider_utils16.parseProviderOptions)({
3213
3496
  provider: "google",
3214
3497
  providerOptions: options.providerOptions,
3215
3498
  schema: googleVideoModelOptionsSchema
@@ -3284,17 +3567,17 @@ var GoogleGenerativeAIVideoModel = class {
3284
3567
  }
3285
3568
  }
3286
3569
  }
3287
- const { value: operation } = await (0, import_provider_utils15.postJsonToApi)({
3570
+ const { value: operation } = await (0, import_provider_utils16.postJsonToApi)({
3288
3571
  url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
3289
- headers: (0, import_provider_utils15.combineHeaders)(
3290
- await (0, import_provider_utils15.resolve)(this.config.headers),
3572
+ headers: (0, import_provider_utils16.combineHeaders)(
3573
+ await (0, import_provider_utils16.resolve)(this.config.headers),
3291
3574
  options.headers
3292
3575
  ),
3293
3576
  body: {
3294
3577
  instances,
3295
3578
  parameters
3296
3579
  },
3297
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3580
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3298
3581
  googleOperationSchema
3299
3582
  ),
3300
3583
  failedResponseHandler: googleFailedResponseHandler,
@@ -3303,7 +3586,7 @@ var GoogleGenerativeAIVideoModel = class {
3303
3586
  });
3304
3587
  const operationName = operation.name;
3305
3588
  if (!operationName) {
3306
- throw new import_provider5.AISDKError({
3589
+ throw new import_provider6.AISDKError({
3307
3590
  name: "GOOGLE_VIDEO_GENERATION_ERROR",
3308
3591
  message: "No operation name returned from API"
3309
3592
  });
@@ -3315,25 +3598,25 @@ var GoogleGenerativeAIVideoModel = class {
3315
3598
  let responseHeaders;
3316
3599
  while (!finalOperation.done) {
3317
3600
  if (Date.now() - startTime > pollTimeoutMs) {
3318
- throw new import_provider5.AISDKError({
3601
+ throw new import_provider6.AISDKError({
3319
3602
  name: "GOOGLE_VIDEO_GENERATION_TIMEOUT",
3320
3603
  message: `Video generation timed out after ${pollTimeoutMs}ms`
3321
3604
  });
3322
3605
  }
3323
- await (0, import_provider_utils15.delay)(pollIntervalMs);
3606
+ await (0, import_provider_utils16.delay)(pollIntervalMs);
3324
3607
  if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
3325
- throw new import_provider5.AISDKError({
3608
+ throw new import_provider6.AISDKError({
3326
3609
  name: "GOOGLE_VIDEO_GENERATION_ABORTED",
3327
3610
  message: "Video generation request was aborted"
3328
3611
  });
3329
3612
  }
3330
- const { value: statusOperation, responseHeaders: pollHeaders } = await (0, import_provider_utils15.getFromApi)({
3613
+ const { value: statusOperation, responseHeaders: pollHeaders } = await (0, import_provider_utils16.getFromApi)({
3331
3614
  url: `${this.config.baseURL}/${operationName}`,
3332
- headers: (0, import_provider_utils15.combineHeaders)(
3333
- await (0, import_provider_utils15.resolve)(this.config.headers),
3615
+ headers: (0, import_provider_utils16.combineHeaders)(
3616
+ await (0, import_provider_utils16.resolve)(this.config.headers),
3334
3617
  options.headers
3335
3618
  ),
3336
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3619
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3337
3620
  googleOperationSchema
3338
3621
  ),
3339
3622
  failedResponseHandler: googleFailedResponseHandler,
@@ -3344,25 +3627,25 @@ var GoogleGenerativeAIVideoModel = class {
3344
3627
  responseHeaders = pollHeaders;
3345
3628
  }
3346
3629
  if (finalOperation.error) {
3347
- throw new import_provider5.AISDKError({
3630
+ throw new import_provider6.AISDKError({
3348
3631
  name: "GOOGLE_VIDEO_GENERATION_FAILED",
3349
3632
  message: `Video generation failed: ${finalOperation.error.message}`
3350
3633
  });
3351
3634
  }
3352
3635
  const response = finalOperation.response;
3353
3636
  if (!((_g = response == null ? void 0 : response.generateVideoResponse) == null ? void 0 : _g.generatedSamples) || response.generateVideoResponse.generatedSamples.length === 0) {
3354
- throw new import_provider5.AISDKError({
3637
+ throw new import_provider6.AISDKError({
3355
3638
  name: "GOOGLE_VIDEO_GENERATION_ERROR",
3356
3639
  message: `No videos in response. Response: ${JSON.stringify(finalOperation)}`
3357
3640
  });
3358
3641
  }
3359
3642
  const videos = [];
3360
3643
  const videoMetadata = [];
3361
- const resolvedHeaders = await (0, import_provider_utils15.resolve)(this.config.headers);
3644
+ const resolvedHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
3362
3645
  const apiKey = resolvedHeaders == null ? void 0 : resolvedHeaders["x-goog-api-key"];
3363
3646
  for (const generatedSample of response.generateVideoResponse.generatedSamples) {
3364
3647
  if ((_h = generatedSample.video) == null ? void 0 : _h.uri) {
3365
- const urlWithAuth = apiKey && (0, import_provider_utils15.isSameOrigin)(generatedSample.video.uri, this.config.baseURL) ? `${generatedSample.video.uri}${generatedSample.video.uri.includes("?") ? "&" : "?"}key=${apiKey}` : generatedSample.video.uri;
3648
+ const urlWithAuth = apiKey && (0, import_provider_utils16.isSameOrigin)(generatedSample.video.uri, this.config.baseURL) ? `${generatedSample.video.uri}${generatedSample.video.uri.includes("?") ? "&" : "?"}key=${apiKey}` : generatedSample.video.uri;
3366
3649
  videos.push({
3367
3650
  type: "url",
3368
3651
  url: urlWithAuth,
@@ -3374,7 +3657,7 @@ var GoogleGenerativeAIVideoModel = class {
3374
3657
  }
3375
3658
  }
3376
3659
  if (videos.length === 0) {
3377
- throw new import_provider5.AISDKError({
3660
+ throw new import_provider6.AISDKError({
3378
3661
  name: "GOOGLE_VIDEO_GENERATION_ERROR",
3379
3662
  message: "No valid videos in response"
3380
3663
  });
@@ -3395,37 +3678,37 @@ var GoogleGenerativeAIVideoModel = class {
3395
3678
  };
3396
3679
  }
3397
3680
  };
3398
- var googleOperationSchema = import_v414.z.object({
3399
- name: import_v414.z.string().nullish(),
3400
- done: import_v414.z.boolean().nullish(),
3401
- error: import_v414.z.object({
3402
- code: import_v414.z.number().nullish(),
3403
- message: import_v414.z.string(),
3404
- status: import_v414.z.string().nullish()
3681
+ var googleOperationSchema = import_v416.z.object({
3682
+ name: import_v416.z.string().nullish(),
3683
+ done: import_v416.z.boolean().nullish(),
3684
+ error: import_v416.z.object({
3685
+ code: import_v416.z.number().nullish(),
3686
+ message: import_v416.z.string(),
3687
+ status: import_v416.z.string().nullish()
3405
3688
  }).nullish(),
3406
- response: import_v414.z.object({
3407
- generateVideoResponse: import_v414.z.object({
3408
- generatedSamples: import_v414.z.array(
3409
- import_v414.z.object({
3410
- video: import_v414.z.object({
3411
- uri: import_v414.z.string().nullish()
3689
+ response: import_v416.z.object({
3690
+ generateVideoResponse: import_v416.z.object({
3691
+ generatedSamples: import_v416.z.array(
3692
+ import_v416.z.object({
3693
+ video: import_v416.z.object({
3694
+ uri: import_v416.z.string().nullish()
3412
3695
  }).nullish()
3413
3696
  })
3414
3697
  ).nullish()
3415
3698
  }).nullish()
3416
3699
  }).nullish()
3417
3700
  });
3418
- var googleVideoModelOptionsSchema = (0, import_provider_utils15.lazySchema)(
3419
- () => (0, import_provider_utils15.zodSchema)(
3420
- import_v414.z.object({
3421
- pollIntervalMs: import_v414.z.number().positive().nullish(),
3422
- pollTimeoutMs: import_v414.z.number().positive().nullish(),
3423
- personGeneration: import_v414.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3424
- negativePrompt: import_v414.z.string().nullish(),
3425
- referenceImages: import_v414.z.array(
3426
- import_v414.z.object({
3427
- bytesBase64Encoded: import_v414.z.string().nullish(),
3428
- gcsUri: import_v414.z.string().nullish()
3701
+ var googleVideoModelOptionsSchema = (0, import_provider_utils16.lazySchema)(
3702
+ () => (0, import_provider_utils16.zodSchema)(
3703
+ import_v416.z.object({
3704
+ pollIntervalMs: import_v416.z.number().positive().nullish(),
3705
+ pollTimeoutMs: import_v416.z.number().positive().nullish(),
3706
+ personGeneration: import_v416.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3707
+ negativePrompt: import_v416.z.string().nullish(),
3708
+ referenceImages: import_v416.z.array(
3709
+ import_v416.z.object({
3710
+ bytesBase64Encoded: import_v416.z.string().nullish(),
3711
+ gcsUri: import_v416.z.string().nullish()
3429
3712
  })
3430
3713
  ).nullish()
3431
3714
  }).passthrough()
@@ -3433,7 +3716,7 @@ var googleVideoModelOptionsSchema = (0, import_provider_utils15.lazySchema)(
3433
3716
  );
3434
3717
 
3435
3718
  // src/interactions/google-interactions-language-model.ts
3436
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
3719
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
3437
3720
 
3438
3721
  // src/interactions/convert-google-interactions-usage.ts
3439
3722
  function convertGoogleInteractionsUsage(usage) {
@@ -4199,7 +4482,7 @@ function buildGoogleInteractionsStreamTransform({
4199
4482
  }
4200
4483
 
4201
4484
  // src/interactions/convert-to-google-interactions-input.ts
4202
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
4485
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
4203
4486
  function getTopLevelMediaType(mediaType) {
4204
4487
  const slashIndex = mediaType.indexOf("/");
4205
4488
  return slashIndex === -1 ? mediaType : mediaType.substring(0, slashIndex);
@@ -4388,7 +4671,7 @@ function convertFilePartToContent({
4388
4671
  }
4389
4672
  return {
4390
4673
  type: kind,
4391
- data: (0, import_provider_utils16.convertToBase64)(part.data),
4674
+ data: (0, import_provider_utils17.convertToBase64)(part.data),
4392
4675
  mime_type: part.mediaType,
4393
4676
  ...resolutionField
4394
4677
  };
@@ -4439,7 +4722,7 @@ function compactPromptForPreviousInteraction({
4439
4722
  }
4440
4723
  function safeParseToolArgs(input) {
4441
4724
  try {
4442
- const parsed = (0, import_provider_utils16.secureJsonParse)(input);
4725
+ const parsed = (0, import_provider_utils17.secureJsonParse)(input);
4443
4726
  if (parsed != null && typeof parsed === "object" && !Array.isArray(parsed)) {
4444
4727
  return parsed;
4445
4728
  }
@@ -4562,7 +4845,7 @@ function filePartToImageBlock({
4562
4845
  }
4563
4846
  return {
4564
4847
  type: "image",
4565
- data: (0, import_provider_utils16.convertToBase64)(part.data),
4848
+ data: (0, import_provider_utils17.convertToBase64)(part.data),
4566
4849
  mime_type: part.mediaType
4567
4850
  };
4568
4851
  }
@@ -4589,31 +4872,31 @@ ${block.text}`
4589
4872
  }
4590
4873
 
4591
4874
  // src/interactions/google-interactions-api.ts
4592
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
4593
- var import_v415 = require("zod/v4");
4594
- var tokenByModalitySchema = () => import_v415.z.object({
4595
- modality: import_v415.z.string().nullish(),
4596
- tokens: import_v415.z.number().nullish()
4875
+ var import_provider_utils18 = require("@ai-sdk/provider-utils");
4876
+ var import_v417 = require("zod/v4");
4877
+ var tokenByModalitySchema = () => import_v417.z.object({
4878
+ modality: import_v417.z.string().nullish(),
4879
+ tokens: import_v417.z.number().nullish()
4597
4880
  }).loose();
4598
- var usageSchema2 = () => import_v415.z.object({
4599
- total_input_tokens: import_v415.z.number().nullish(),
4600
- total_output_tokens: import_v415.z.number().nullish(),
4601
- total_thought_tokens: import_v415.z.number().nullish(),
4602
- total_cached_tokens: import_v415.z.number().nullish(),
4603
- total_tool_use_tokens: import_v415.z.number().nullish(),
4604
- total_tokens: import_v415.z.number().nullish(),
4605
- input_tokens_by_modality: import_v415.z.array(tokenByModalitySchema()).nullish(),
4606
- output_tokens_by_modality: import_v415.z.array(tokenByModalitySchema()).nullish(),
4607
- cached_tokens_by_modality: import_v415.z.array(tokenByModalitySchema()).nullish(),
4608
- tool_use_tokens_by_modality: import_v415.z.array(tokenByModalitySchema()).nullish(),
4609
- grounding_tool_count: import_v415.z.array(
4610
- import_v415.z.object({
4611
- type: import_v415.z.string().nullish(),
4612
- count: import_v415.z.number().nullish()
4881
+ var usageSchema2 = () => import_v417.z.object({
4882
+ total_input_tokens: import_v417.z.number().nullish(),
4883
+ total_output_tokens: import_v417.z.number().nullish(),
4884
+ total_thought_tokens: import_v417.z.number().nullish(),
4885
+ total_cached_tokens: import_v417.z.number().nullish(),
4886
+ total_tool_use_tokens: import_v417.z.number().nullish(),
4887
+ total_tokens: import_v417.z.number().nullish(),
4888
+ input_tokens_by_modality: import_v417.z.array(tokenByModalitySchema()).nullish(),
4889
+ output_tokens_by_modality: import_v417.z.array(tokenByModalitySchema()).nullish(),
4890
+ cached_tokens_by_modality: import_v417.z.array(tokenByModalitySchema()).nullish(),
4891
+ tool_use_tokens_by_modality: import_v417.z.array(tokenByModalitySchema()).nullish(),
4892
+ grounding_tool_count: import_v417.z.array(
4893
+ import_v417.z.object({
4894
+ type: import_v417.z.string().nullish(),
4895
+ count: import_v417.z.number().nullish()
4613
4896
  }).loose()
4614
4897
  ).nullish()
4615
4898
  }).loose();
4616
- var interactionStatusSchema = () => import_v415.z.enum([
4899
+ var interactionStatusSchema = () => import_v417.z.enum([
4617
4900
  "in_progress",
4618
4901
  "requires_action",
4619
4902
  "completed",
@@ -4622,69 +4905,69 @@ var interactionStatusSchema = () => import_v415.z.enum([
4622
4905
  "incomplete"
4623
4906
  ]);
4624
4907
  var annotationSchema = () => {
4625
- const urlCitation = import_v415.z.object({
4626
- type: import_v415.z.literal("url_citation"),
4627
- url: import_v415.z.string().nullish(),
4628
- title: import_v415.z.string().nullish(),
4629
- start_index: import_v415.z.number().nullish(),
4630
- end_index: import_v415.z.number().nullish()
4908
+ const urlCitation = import_v417.z.object({
4909
+ type: import_v417.z.literal("url_citation"),
4910
+ url: import_v417.z.string().nullish(),
4911
+ title: import_v417.z.string().nullish(),
4912
+ start_index: import_v417.z.number().nullish(),
4913
+ end_index: import_v417.z.number().nullish()
4631
4914
  }).loose();
4632
- const fileCitation = import_v415.z.object({
4633
- type: import_v415.z.literal("file_citation"),
4634
- file_name: import_v415.z.string().nullish(),
4635
- document_uri: import_v415.z.string().nullish(),
4636
- url: import_v415.z.string().nullish(),
4637
- page_number: import_v415.z.number().nullish(),
4638
- media_id: import_v415.z.string().nullish(),
4639
- start_index: import_v415.z.number().nullish(),
4640
- end_index: import_v415.z.number().nullish(),
4641
- custom_metadata: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).nullish()
4915
+ const fileCitation = import_v417.z.object({
4916
+ type: import_v417.z.literal("file_citation"),
4917
+ file_name: import_v417.z.string().nullish(),
4918
+ document_uri: import_v417.z.string().nullish(),
4919
+ url: import_v417.z.string().nullish(),
4920
+ page_number: import_v417.z.number().nullish(),
4921
+ media_id: import_v417.z.string().nullish(),
4922
+ start_index: import_v417.z.number().nullish(),
4923
+ end_index: import_v417.z.number().nullish(),
4924
+ custom_metadata: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).nullish()
4642
4925
  }).loose();
4643
- const placeCitation = import_v415.z.object({
4644
- type: import_v415.z.literal("place_citation"),
4645
- name: import_v415.z.string().nullish(),
4646
- url: import_v415.z.string().nullish(),
4647
- place_id: import_v415.z.string().nullish(),
4648
- start_index: import_v415.z.number().nullish(),
4649
- end_index: import_v415.z.number().nullish()
4926
+ const placeCitation = import_v417.z.object({
4927
+ type: import_v417.z.literal("place_citation"),
4928
+ name: import_v417.z.string().nullish(),
4929
+ url: import_v417.z.string().nullish(),
4930
+ place_id: import_v417.z.string().nullish(),
4931
+ start_index: import_v417.z.number().nullish(),
4932
+ end_index: import_v417.z.number().nullish()
4650
4933
  }).loose();
4651
- return import_v415.z.union([
4934
+ return import_v417.z.union([
4652
4935
  urlCitation,
4653
4936
  fileCitation,
4654
4937
  placeCitation,
4655
- import_v415.z.object({ type: import_v415.z.string() }).loose()
4938
+ import_v417.z.object({ type: import_v417.z.string() }).loose()
4656
4939
  ]);
4657
4940
  };
4658
- var thoughtSummaryItemSchema = () => import_v415.z.object({
4659
- type: import_v415.z.string(),
4660
- text: import_v415.z.string().nullish(),
4661
- data: import_v415.z.string().nullish(),
4662
- mime_type: import_v415.z.string().nullish()
4941
+ var thoughtSummaryItemSchema = () => import_v417.z.object({
4942
+ type: import_v417.z.string(),
4943
+ text: import_v417.z.string().nullish(),
4944
+ data: import_v417.z.string().nullish(),
4945
+ mime_type: import_v417.z.string().nullish()
4663
4946
  }).loose();
4664
4947
  var contentBlockSchema = () => {
4665
- const textContent = import_v415.z.object({
4666
- type: import_v415.z.literal("text"),
4667
- text: import_v415.z.string(),
4668
- annotations: import_v415.z.array(annotationSchema()).nullish()
4948
+ const textContent = import_v417.z.object({
4949
+ type: import_v417.z.literal("text"),
4950
+ text: import_v417.z.string(),
4951
+ annotations: import_v417.z.array(annotationSchema()).nullish()
4669
4952
  }).loose();
4670
- const imageContent = import_v415.z.object({
4671
- type: import_v415.z.literal("image"),
4672
- data: import_v415.z.string().nullish(),
4673
- mime_type: import_v415.z.string().nullish(),
4674
- resolution: import_v415.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4675
- uri: import_v415.z.string().nullish()
4953
+ const imageContent = import_v417.z.object({
4954
+ type: import_v417.z.literal("image"),
4955
+ data: import_v417.z.string().nullish(),
4956
+ mime_type: import_v417.z.string().nullish(),
4957
+ resolution: import_v417.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4958
+ uri: import_v417.z.string().nullish()
4676
4959
  }).loose();
4677
- const videoContent = import_v415.z.object({
4678
- type: import_v415.z.literal("video"),
4679
- data: import_v415.z.string().nullish(),
4680
- mime_type: import_v415.z.string().nullish(),
4681
- uri: import_v415.z.string().nullish()
4960
+ const videoContent = import_v417.z.object({
4961
+ type: import_v417.z.literal("video"),
4962
+ data: import_v417.z.string().nullish(),
4963
+ mime_type: import_v417.z.string().nullish(),
4964
+ uri: import_v417.z.string().nullish()
4682
4965
  }).loose();
4683
- return import_v415.z.union([
4966
+ return import_v417.z.union([
4684
4967
  textContent,
4685
4968
  imageContent,
4686
4969
  videoContent,
4687
- import_v415.z.object({ type: import_v415.z.string() }).loose()
4970
+ import_v417.z.object({ type: import_v417.z.string() }).loose()
4688
4971
  ]);
4689
4972
  };
4690
4973
  var BUILTIN_TOOL_CALL_STEP_TYPES = [
@@ -4704,158 +4987,158 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
4704
4987
  "mcp_server_tool_result"
4705
4988
  ];
4706
4989
  var stepSchema = () => {
4707
- const userInputStep = import_v415.z.object({
4708
- type: import_v415.z.literal("user_input"),
4709
- content: import_v415.z.array(contentBlockSchema()).nullish()
4990
+ const userInputStep = import_v417.z.object({
4991
+ type: import_v417.z.literal("user_input"),
4992
+ content: import_v417.z.array(contentBlockSchema()).nullish()
4710
4993
  }).loose();
4711
- const modelOutputStep = import_v415.z.object({
4712
- type: import_v415.z.literal("model_output"),
4713
- content: import_v415.z.array(contentBlockSchema()).nullish()
4994
+ const modelOutputStep = import_v417.z.object({
4995
+ type: import_v417.z.literal("model_output"),
4996
+ content: import_v417.z.array(contentBlockSchema()).nullish()
4714
4997
  }).loose();
4715
- const functionCallStep = import_v415.z.object({
4716
- type: import_v415.z.literal("function_call"),
4717
- id: import_v415.z.string(),
4718
- name: import_v415.z.string(),
4719
- arguments: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).nullish(),
4720
- signature: import_v415.z.string().nullish()
4998
+ const functionCallStep = import_v417.z.object({
4999
+ type: import_v417.z.literal("function_call"),
5000
+ id: import_v417.z.string(),
5001
+ name: import_v417.z.string(),
5002
+ arguments: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).nullish(),
5003
+ signature: import_v417.z.string().nullish()
4721
5004
  }).loose();
4722
- const thoughtStep = import_v415.z.object({
4723
- type: import_v415.z.literal("thought"),
4724
- signature: import_v415.z.string().nullish(),
4725
- summary: import_v415.z.array(thoughtSummaryItemSchema()).nullish()
5005
+ const thoughtStep = import_v417.z.object({
5006
+ type: import_v417.z.literal("thought"),
5007
+ signature: import_v417.z.string().nullish(),
5008
+ summary: import_v417.z.array(thoughtSummaryItemSchema()).nullish()
4726
5009
  }).loose();
4727
- const builtinToolCallStep = import_v415.z.object({
4728
- type: import_v415.z.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
4729
- id: import_v415.z.string(),
4730
- arguments: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).nullish(),
4731
- name: import_v415.z.string().nullish(),
4732
- server_name: import_v415.z.string().nullish(),
4733
- search_type: import_v415.z.string().nullish(),
4734
- signature: import_v415.z.string().nullish()
5010
+ const builtinToolCallStep = import_v417.z.object({
5011
+ type: import_v417.z.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5012
+ id: import_v417.z.string(),
5013
+ arguments: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).nullish(),
5014
+ name: import_v417.z.string().nullish(),
5015
+ server_name: import_v417.z.string().nullish(),
5016
+ search_type: import_v417.z.string().nullish(),
5017
+ signature: import_v417.z.string().nullish()
4735
5018
  }).loose();
4736
- const builtinToolResultStep = import_v415.z.object({
4737
- type: import_v415.z.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
4738
- call_id: import_v415.z.string(),
4739
- result: import_v415.z.unknown().nullish(),
4740
- is_error: import_v415.z.boolean().nullish(),
4741
- name: import_v415.z.string().nullish(),
4742
- server_name: import_v415.z.string().nullish(),
4743
- signature: import_v415.z.string().nullish()
5019
+ const builtinToolResultStep = import_v417.z.object({
5020
+ type: import_v417.z.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5021
+ call_id: import_v417.z.string(),
5022
+ result: import_v417.z.unknown().nullish(),
5023
+ is_error: import_v417.z.boolean().nullish(),
5024
+ name: import_v417.z.string().nullish(),
5025
+ server_name: import_v417.z.string().nullish(),
5026
+ signature: import_v417.z.string().nullish()
4744
5027
  }).loose();
4745
- return import_v415.z.union([
5028
+ return import_v417.z.union([
4746
5029
  userInputStep,
4747
5030
  modelOutputStep,
4748
5031
  functionCallStep,
4749
5032
  thoughtStep,
4750
5033
  builtinToolCallStep,
4751
5034
  builtinToolResultStep,
4752
- import_v415.z.object({ type: import_v415.z.string() }).loose()
5035
+ import_v417.z.object({ type: import_v417.z.string() }).loose()
4753
5036
  ]);
4754
5037
  };
4755
- var googleInteractionsResponseSchema = (0, import_provider_utils17.lazySchema)(
4756
- () => (0, import_provider_utils17.zodSchema)(
4757
- import_v415.z.object({
5038
+ var googleInteractionsResponseSchema = (0, import_provider_utils18.lazySchema)(
5039
+ () => (0, import_provider_utils18.zodSchema)(
5040
+ import_v417.z.object({
4758
5041
  /*
4759
5042
  * `id` is omitted from the response body when `store: false` (fully
4760
5043
  * stateless mode) — there is no server-side interaction record for the
4761
5044
  * client to reference. `nullish` lets the schema accept that shape.
4762
5045
  */
4763
- id: import_v415.z.string().nullish(),
4764
- created: import_v415.z.string().nullish(),
4765
- updated: import_v415.z.string().nullish(),
5046
+ id: import_v417.z.string().nullish(),
5047
+ created: import_v417.z.string().nullish(),
5048
+ updated: import_v417.z.string().nullish(),
4766
5049
  status: interactionStatusSchema(),
4767
- model: import_v415.z.string().nullish(),
4768
- agent: import_v415.z.string().nullish(),
4769
- steps: import_v415.z.array(stepSchema()).nullish(),
5050
+ model: import_v417.z.string().nullish(),
5051
+ agent: import_v417.z.string().nullish(),
5052
+ steps: import_v417.z.array(stepSchema()).nullish(),
4770
5053
  usage: usageSchema2().nullish(),
4771
- service_tier: import_v415.z.string().nullish(),
4772
- previous_interaction_id: import_v415.z.string().nullish(),
4773
- response_modalities: import_v415.z.array(import_v415.z.string()).nullish()
5054
+ service_tier: import_v417.z.string().nullish(),
5055
+ previous_interaction_id: import_v417.z.string().nullish(),
5056
+ response_modalities: import_v417.z.array(import_v417.z.string()).nullish()
4774
5057
  }).loose()
4775
5058
  )
4776
5059
  );
4777
- var googleInteractionsEventSchema = (0, import_provider_utils17.lazySchema)(
4778
- () => (0, import_provider_utils17.zodSchema)(
5060
+ var googleInteractionsEventSchema = (0, import_provider_utils18.lazySchema)(
5061
+ () => (0, import_provider_utils18.zodSchema)(
4779
5062
  (() => {
4780
5063
  const status = interactionStatusSchema();
4781
5064
  const annotation = annotationSchema();
4782
5065
  const thoughtSummaryItem = thoughtSummaryItemSchema();
4783
- const interactionCreatedEvent = import_v415.z.object({
4784
- event_type: import_v415.z.literal("interaction.created"),
4785
- event_id: import_v415.z.string().nullish(),
4786
- interaction: import_v415.z.object({
5066
+ const interactionCreatedEvent = import_v417.z.object({
5067
+ event_type: import_v417.z.literal("interaction.created"),
5068
+ event_id: import_v417.z.string().nullish(),
5069
+ interaction: import_v417.z.object({
4787
5070
  /*
4788
5071
  * `id` is omitted when `store: false` (fully stateless mode);
4789
5072
  * see the matching note on `googleInteractionsResponseSchema.id`.
4790
5073
  */
4791
- id: import_v415.z.string().nullish(),
4792
- created: import_v415.z.string().nullish(),
4793
- model: import_v415.z.string().nullish(),
4794
- agent: import_v415.z.string().nullish(),
5074
+ id: import_v417.z.string().nullish(),
5075
+ created: import_v417.z.string().nullish(),
5076
+ model: import_v417.z.string().nullish(),
5077
+ agent: import_v417.z.string().nullish(),
4795
5078
  status: status.nullish()
4796
5079
  }).loose()
4797
5080
  }).loose();
4798
- const stepStartEvent = import_v415.z.object({
4799
- event_type: import_v415.z.literal("step.start"),
4800
- event_id: import_v415.z.string().nullish(),
4801
- index: import_v415.z.number(),
5081
+ const stepStartEvent = import_v417.z.object({
5082
+ event_type: import_v417.z.literal("step.start"),
5083
+ event_id: import_v417.z.string().nullish(),
5084
+ index: import_v417.z.number(),
4802
5085
  step: stepSchema()
4803
5086
  }).loose();
4804
- const stepDeltaText = import_v415.z.object({
4805
- type: import_v415.z.literal("text"),
4806
- text: import_v415.z.string()
5087
+ const stepDeltaText = import_v417.z.object({
5088
+ type: import_v417.z.literal("text"),
5089
+ text: import_v417.z.string()
4807
5090
  }).loose();
4808
- const stepDeltaThoughtSummary = import_v415.z.object({
4809
- type: import_v415.z.literal("thought_summary"),
5091
+ const stepDeltaThoughtSummary = import_v417.z.object({
5092
+ type: import_v417.z.literal("thought_summary"),
4810
5093
  content: thoughtSummaryItem.nullish()
4811
5094
  }).loose();
4812
- const stepDeltaThoughtSignature = import_v415.z.object({
4813
- type: import_v415.z.literal("thought_signature"),
4814
- signature: import_v415.z.string().nullish()
5095
+ const stepDeltaThoughtSignature = import_v417.z.object({
5096
+ type: import_v417.z.literal("thought_signature"),
5097
+ signature: import_v417.z.string().nullish()
4815
5098
  }).loose();
4816
- const stepDeltaArgumentsDelta = import_v415.z.object({
4817
- type: import_v415.z.literal("arguments_delta"),
4818
- arguments: import_v415.z.string().nullish(),
4819
- id: import_v415.z.string().nullish(),
4820
- signature: import_v415.z.string().nullish()
5099
+ const stepDeltaArgumentsDelta = import_v417.z.object({
5100
+ type: import_v417.z.literal("arguments_delta"),
5101
+ arguments: import_v417.z.string().nullish(),
5102
+ id: import_v417.z.string().nullish(),
5103
+ signature: import_v417.z.string().nullish()
4821
5104
  }).loose();
4822
- const stepDeltaTextAnnotation = import_v415.z.object({
4823
- type: import_v415.z.enum(["text_annotation_delta", "text_annotation"]),
4824
- annotations: import_v415.z.array(annotation).nullish()
5105
+ const stepDeltaTextAnnotation = import_v417.z.object({
5106
+ type: import_v417.z.enum(["text_annotation_delta", "text_annotation"]),
5107
+ annotations: import_v417.z.array(annotation).nullish()
4825
5108
  }).loose();
4826
- const stepDeltaImage = import_v415.z.object({
4827
- type: import_v415.z.literal("image"),
4828
- data: import_v415.z.string().nullish(),
4829
- mime_type: import_v415.z.string().nullish(),
4830
- resolution: import_v415.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4831
- uri: import_v415.z.string().nullish()
5109
+ const stepDeltaImage = import_v417.z.object({
5110
+ type: import_v417.z.literal("image"),
5111
+ data: import_v417.z.string().nullish(),
5112
+ mime_type: import_v417.z.string().nullish(),
5113
+ resolution: import_v417.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5114
+ uri: import_v417.z.string().nullish()
4832
5115
  }).loose();
4833
- const stepDeltaVideo = import_v415.z.object({
4834
- type: import_v415.z.literal("video"),
4835
- data: import_v415.z.string().nullish(),
4836
- mime_type: import_v415.z.string().nullish(),
4837
- uri: import_v415.z.string().nullish()
5116
+ const stepDeltaVideo = import_v417.z.object({
5117
+ type: import_v417.z.literal("video"),
5118
+ data: import_v417.z.string().nullish(),
5119
+ mime_type: import_v417.z.string().nullish(),
5120
+ uri: import_v417.z.string().nullish()
4838
5121
  }).loose();
4839
- const stepDeltaBuiltinToolCall = import_v415.z.object({
4840
- type: import_v415.z.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
4841
- id: import_v415.z.string().nullish(),
4842
- arguments: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).nullish(),
4843
- name: import_v415.z.string().nullish(),
4844
- server_name: import_v415.z.string().nullish(),
4845
- search_type: import_v415.z.string().nullish(),
4846
- signature: import_v415.z.string().nullish()
5122
+ const stepDeltaBuiltinToolCall = import_v417.z.object({
5123
+ type: import_v417.z.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5124
+ id: import_v417.z.string().nullish(),
5125
+ arguments: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).nullish(),
5126
+ name: import_v417.z.string().nullish(),
5127
+ server_name: import_v417.z.string().nullish(),
5128
+ search_type: import_v417.z.string().nullish(),
5129
+ signature: import_v417.z.string().nullish()
4847
5130
  }).loose();
4848
- const stepDeltaBuiltinToolResult = import_v415.z.object({
4849
- type: import_v415.z.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
4850
- call_id: import_v415.z.string().nullish(),
4851
- result: import_v415.z.unknown().nullish(),
4852
- is_error: import_v415.z.boolean().nullish(),
4853
- name: import_v415.z.string().nullish(),
4854
- server_name: import_v415.z.string().nullish(),
4855
- signature: import_v415.z.string().nullish()
5131
+ const stepDeltaBuiltinToolResult = import_v417.z.object({
5132
+ type: import_v417.z.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5133
+ call_id: import_v417.z.string().nullish(),
5134
+ result: import_v417.z.unknown().nullish(),
5135
+ is_error: import_v417.z.boolean().nullish(),
5136
+ name: import_v417.z.string().nullish(),
5137
+ server_name: import_v417.z.string().nullish(),
5138
+ signature: import_v417.z.string().nullish()
4856
5139
  }).loose();
4857
- const stepDeltaUnknown = import_v415.z.object({ type: import_v415.z.string() }).loose();
4858
- const stepDeltaUnion = import_v415.z.union([
5140
+ const stepDeltaUnknown = import_v417.z.object({ type: import_v417.z.string() }).loose();
5141
+ const stepDeltaUnion = import_v417.z.union([
4859
5142
  stepDeltaText,
4860
5143
  stepDeltaImage,
4861
5144
  stepDeltaVideo,
@@ -4867,55 +5150,55 @@ var googleInteractionsEventSchema = (0, import_provider_utils17.lazySchema)(
4867
5150
  stepDeltaBuiltinToolResult,
4868
5151
  stepDeltaUnknown
4869
5152
  ]);
4870
- const stepDeltaEvent = import_v415.z.object({
4871
- event_type: import_v415.z.literal("step.delta"),
4872
- event_id: import_v415.z.string().nullish(),
4873
- index: import_v415.z.number(),
5153
+ const stepDeltaEvent = import_v417.z.object({
5154
+ event_type: import_v417.z.literal("step.delta"),
5155
+ event_id: import_v417.z.string().nullish(),
5156
+ index: import_v417.z.number(),
4874
5157
  delta: stepDeltaUnion
4875
5158
  }).loose();
4876
- const stepStopEvent = import_v415.z.object({
4877
- event_type: import_v415.z.literal("step.stop"),
4878
- event_id: import_v415.z.string().nullish(),
4879
- index: import_v415.z.number()
5159
+ const stepStopEvent = import_v417.z.object({
5160
+ event_type: import_v417.z.literal("step.stop"),
5161
+ event_id: import_v417.z.string().nullish(),
5162
+ index: import_v417.z.number()
4880
5163
  }).loose();
4881
- const interactionStatusUpdateEvent = import_v415.z.object({
4882
- event_type: import_v415.z.literal("interaction.status_update"),
4883
- event_id: import_v415.z.string().nullish(),
4884
- interaction_id: import_v415.z.string().nullish(),
5164
+ const interactionStatusUpdateEvent = import_v417.z.object({
5165
+ event_type: import_v417.z.literal("interaction.status_update"),
5166
+ event_id: import_v417.z.string().nullish(),
5167
+ interaction_id: import_v417.z.string().nullish(),
4885
5168
  status: status.nullish()
4886
5169
  }).loose();
4887
- const interactionInProgressEvent = import_v415.z.object({
4888
- event_type: import_v415.z.literal("interaction.in_progress"),
4889
- event_id: import_v415.z.string().nullish(),
4890
- interaction_id: import_v415.z.string().nullish(),
5170
+ const interactionInProgressEvent = import_v417.z.object({
5171
+ event_type: import_v417.z.literal("interaction.in_progress"),
5172
+ event_id: import_v417.z.string().nullish(),
5173
+ interaction_id: import_v417.z.string().nullish(),
4891
5174
  status: status.nullish()
4892
5175
  }).loose();
4893
- const interactionRequiresActionEvent = import_v415.z.object({
4894
- event_type: import_v415.z.literal("interaction.requires_action"),
4895
- event_id: import_v415.z.string().nullish(),
4896
- interaction_id: import_v415.z.string().nullish(),
5176
+ const interactionRequiresActionEvent = import_v417.z.object({
5177
+ event_type: import_v417.z.literal("interaction.requires_action"),
5178
+ event_id: import_v417.z.string().nullish(),
5179
+ interaction_id: import_v417.z.string().nullish(),
4897
5180
  status: status.nullish()
4898
5181
  }).loose();
4899
- const interactionCompletedEvent = import_v415.z.object({
4900
- event_type: import_v415.z.literal("interaction.completed"),
4901
- event_id: import_v415.z.string().nullish(),
4902
- interaction: import_v415.z.object({
4903
- id: import_v415.z.string().nullish(),
5182
+ const interactionCompletedEvent = import_v417.z.object({
5183
+ event_type: import_v417.z.literal("interaction.completed"),
5184
+ event_id: import_v417.z.string().nullish(),
5185
+ interaction: import_v417.z.object({
5186
+ id: import_v417.z.string().nullish(),
4904
5187
  status: status.nullish(),
4905
5188
  usage: usageSchema2().nullish(),
4906
- service_tier: import_v415.z.string().nullish()
5189
+ service_tier: import_v417.z.string().nullish()
4907
5190
  }).loose()
4908
5191
  }).loose();
4909
- const errorEvent = import_v415.z.object({
4910
- event_type: import_v415.z.literal("error"),
4911
- event_id: import_v415.z.string().nullish(),
4912
- error: import_v415.z.object({
4913
- code: import_v415.z.string().nullish(),
4914
- message: import_v415.z.string().nullish()
5192
+ const errorEvent = import_v417.z.object({
5193
+ event_type: import_v417.z.literal("error"),
5194
+ event_id: import_v417.z.string().nullish(),
5195
+ error: import_v417.z.object({
5196
+ code: import_v417.z.string().nullish(),
5197
+ message: import_v417.z.string().nullish()
4915
5198
  }).loose().nullish()
4916
5199
  }).loose();
4917
- const unknownEvent = import_v415.z.object({ event_type: import_v415.z.string() }).loose();
4918
- return import_v415.z.union([
5200
+ const unknownEvent = import_v417.z.object({ event_type: import_v417.z.string() }).loose();
5201
+ return import_v417.z.union([
4919
5202
  interactionCreatedEvent,
4920
5203
  stepStartEvent,
4921
5204
  stepDeltaEvent,
@@ -4932,27 +5215,27 @@ var googleInteractionsEventSchema = (0, import_provider_utils17.lazySchema)(
4932
5215
  );
4933
5216
 
4934
5217
  // src/interactions/google-interactions-language-model-options.ts
4935
- var import_provider_utils18 = require("@ai-sdk/provider-utils");
4936
- var import_v416 = require("zod/v4");
4937
- var googleInteractionsLanguageModelOptions = (0, import_provider_utils18.lazySchema)(
4938
- () => (0, import_provider_utils18.zodSchema)(
4939
- import_v416.z.object({
4940
- previousInteractionId: import_v416.z.string().nullish(),
4941
- store: import_v416.z.boolean().nullish(),
4942
- agent: import_v416.z.string().nullish(),
4943
- agentConfig: import_v416.z.union([
4944
- import_v416.z.object({
4945
- type: import_v416.z.literal("dynamic")
5218
+ var import_provider_utils19 = require("@ai-sdk/provider-utils");
5219
+ var import_v418 = require("zod/v4");
5220
+ var googleInteractionsLanguageModelOptions = (0, import_provider_utils19.lazySchema)(
5221
+ () => (0, import_provider_utils19.zodSchema)(
5222
+ import_v418.z.object({
5223
+ previousInteractionId: import_v418.z.string().nullish(),
5224
+ store: import_v418.z.boolean().nullish(),
5225
+ agent: import_v418.z.string().nullish(),
5226
+ agentConfig: import_v418.z.union([
5227
+ import_v418.z.object({
5228
+ type: import_v418.z.literal("dynamic")
4946
5229
  }).loose(),
4947
- import_v416.z.object({
4948
- type: import_v416.z.literal("deep-research"),
4949
- thinkingSummaries: import_v416.z.enum(["auto", "none"]).nullish(),
4950
- visualization: import_v416.z.enum(["off", "auto"]).nullish(),
4951
- collaborativePlanning: import_v416.z.boolean().nullish()
5230
+ import_v418.z.object({
5231
+ type: import_v418.z.literal("deep-research"),
5232
+ thinkingSummaries: import_v418.z.enum(["auto", "none"]).nullish(),
5233
+ visualization: import_v418.z.enum(["off", "auto"]).nullish(),
5234
+ collaborativePlanning: import_v418.z.boolean().nullish()
4952
5235
  })
4953
5236
  ]).nullish(),
4954
- thinkingLevel: import_v416.z.enum(["minimal", "low", "medium", "high"]).nullish(),
4955
- thinkingSummaries: import_v416.z.enum(["auto", "none"]).nullish(),
5237
+ thinkingLevel: import_v418.z.enum(["minimal", "low", "medium", "high"]).nullish(),
5238
+ thinkingSummaries: import_v418.z.enum(["auto", "none"]).nullish(),
4956
5239
  /**
4957
5240
  * Output-format entries that map directly to the API's `response_format`
4958
5241
  * array. Use this to request image, audio, or non-JSON text outputs
@@ -4962,17 +5245,17 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils18.lazySch
4962
5245
  * type: 'json', schema }` still drives JSON-mode and adds a matching
4963
5246
  * text entry automatically; entries listed here are appended.
4964
5247
  */
4965
- responseFormat: import_v416.z.array(
4966
- import_v416.z.union([
4967
- import_v416.z.object({
4968
- type: import_v416.z.literal("text"),
4969
- mimeType: import_v416.z.string().nullish(),
4970
- schema: import_v416.z.unknown().nullish()
5248
+ responseFormat: import_v418.z.array(
5249
+ import_v418.z.union([
5250
+ import_v418.z.object({
5251
+ type: import_v418.z.literal("text"),
5252
+ mimeType: import_v418.z.string().nullish(),
5253
+ schema: import_v418.z.unknown().nullish()
4971
5254
  }).loose(),
4972
- import_v416.z.object({
4973
- type: import_v416.z.literal("image"),
4974
- mimeType: import_v416.z.string().nullish(),
4975
- aspectRatio: import_v416.z.enum([
5255
+ import_v418.z.object({
5256
+ type: import_v418.z.literal("image"),
5257
+ mimeType: import_v418.z.string().nullish(),
5258
+ aspectRatio: import_v418.z.enum([
4976
5259
  "1:1",
4977
5260
  "2:3",
4978
5261
  "3:2",
@@ -4988,11 +5271,11 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils18.lazySch
4988
5271
  "1:4",
4989
5272
  "4:1"
4990
5273
  ]).nullish(),
4991
- imageSize: import_v416.z.enum(["1K", "2K", "4K", "512"]).nullish()
5274
+ imageSize: import_v418.z.enum(["1K", "2K", "4K", "512"]).nullish()
4992
5275
  }).loose(),
4993
- import_v416.z.object({
4994
- type: import_v416.z.literal("audio"),
4995
- mimeType: import_v416.z.string().nullish()
5276
+ import_v418.z.object({
5277
+ type: import_v418.z.literal("audio"),
5278
+ mimeType: import_v418.z.string().nullish()
4996
5279
  }).loose()
4997
5280
  ])
4998
5281
  ).nullish(),
@@ -5002,8 +5285,8 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils18.lazySch
5002
5285
  * translates it into a matching `response_format` image entry and
5003
5286
  * emits a warning when set.
5004
5287
  */
5005
- imageConfig: import_v416.z.object({
5006
- aspectRatio: import_v416.z.enum([
5288
+ imageConfig: import_v418.z.object({
5289
+ aspectRatio: import_v418.z.enum([
5007
5290
  "1:1",
5008
5291
  "2:3",
5009
5292
  "3:2",
@@ -5019,35 +5302,35 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils18.lazySch
5019
5302
  "1:4",
5020
5303
  "4:1"
5021
5304
  ]).nullish(),
5022
- imageSize: import_v416.z.enum(["1K", "2K", "4K", "512"]).nullish()
5305
+ imageSize: import_v418.z.enum(["1K", "2K", "4K", "512"]).nullish()
5023
5306
  }).nullish(),
5024
- mediaResolution: import_v416.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5025
- responseModalities: import_v416.z.array(import_v416.z.enum(["text", "image", "audio", "video", "document"])).nullish(),
5026
- serviceTier: import_v416.z.enum(["flex", "standard", "priority"]).nullish(),
5307
+ mediaResolution: import_v418.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5308
+ responseModalities: import_v418.z.array(import_v418.z.enum(["text", "image", "audio", "video", "document"])).nullish(),
5309
+ serviceTier: import_v418.z.enum(["flex", "standard", "priority"]).nullish(),
5027
5310
  /**
5028
5311
  * Alternative to AI SDK `system` message. If both are set, the AI SDK
5029
5312
  * `system` message wins and a warning is emitted.
5030
5313
  */
5031
- systemInstruction: import_v416.z.string().nullish(),
5314
+ systemInstruction: import_v418.z.string().nullish(),
5032
5315
  /**
5033
5316
  * Per-block signature for round-tripping `thought.signature` and
5034
5317
  * `function_call.signature` blocks. Set by the SDK on output reasoning /
5035
5318
  * tool-call parts; passed back unchanged on input parts so the API
5036
5319
  * accepts the prior turn.
5037
5320
  */
5038
- signature: import_v416.z.string().nullish(),
5321
+ signature: import_v418.z.string().nullish(),
5039
5322
  /**
5040
5323
  * Set by the SDK on output assistant messages. The converter uses it to
5041
5324
  * decide which messages to drop when compacting under
5042
5325
  * `previousInteractionId`.
5043
5326
  */
5044
- interactionId: import_v416.z.string().nullish(),
5327
+ interactionId: import_v418.z.string().nullish(),
5045
5328
  /**
5046
5329
  * Maximum time, in milliseconds, to poll a background interaction (agent
5047
5330
  * call) before giving up. Defaults to 30 minutes. Long-running agents
5048
5331
  * such as deep research can take tens of minutes — increase if needed.
5049
5332
  */
5050
- pollingTimeoutMs: import_v416.z.number().int().positive().nullish(),
5333
+ pollingTimeoutMs: import_v418.z.number().int().positive().nullish(),
5051
5334
  /**
5052
5335
  * Run the interaction in the background. Required for agents whose
5053
5336
  * server-side workflow cannot complete within a single request/response.
@@ -5056,7 +5339,7 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils18.lazySch
5056
5339
  * reject `true`; see the agent's documentation for which mode it
5057
5340
  * requires.
5058
5341
  */
5059
- background: import_v416.z.boolean().nullish(),
5342
+ background: import_v418.z.boolean().nullish(),
5060
5343
  /**
5061
5344
  * Environment configuration for the agent sandbox. Only applies to agent
5062
5345
  * calls (`google.interactions({ agent })`); ignored on model-id calls.
@@ -5066,36 +5349,36 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils18.lazySch
5066
5349
  * - object: provision a fresh sandbox and optionally preload `sources`
5067
5350
  * and/or constrain outbound traffic via `network`.
5068
5351
  */
5069
- environment: import_v416.z.union([
5070
- import_v416.z.string(),
5071
- import_v416.z.object({
5072
- type: import_v416.z.literal("remote"),
5073
- sources: import_v416.z.array(
5074
- import_v416.z.union([
5075
- import_v416.z.object({
5076
- type: import_v416.z.literal("gcs"),
5077
- source: import_v416.z.string(),
5078
- target: import_v416.z.string().nullish()
5352
+ environment: import_v418.z.union([
5353
+ import_v418.z.string(),
5354
+ import_v418.z.object({
5355
+ type: import_v418.z.literal("remote"),
5356
+ sources: import_v418.z.array(
5357
+ import_v418.z.union([
5358
+ import_v418.z.object({
5359
+ type: import_v418.z.literal("gcs"),
5360
+ source: import_v418.z.string(),
5361
+ target: import_v418.z.string().nullish()
5079
5362
  }),
5080
- import_v416.z.object({
5081
- type: import_v416.z.literal("repository"),
5082
- source: import_v416.z.string(),
5083
- target: import_v416.z.string().nullish()
5363
+ import_v418.z.object({
5364
+ type: import_v418.z.literal("repository"),
5365
+ source: import_v418.z.string(),
5366
+ target: import_v418.z.string().nullish()
5084
5367
  }),
5085
- import_v416.z.object({
5086
- type: import_v416.z.literal("inline"),
5087
- content: import_v416.z.string(),
5088
- target: import_v416.z.string()
5368
+ import_v418.z.object({
5369
+ type: import_v418.z.literal("inline"),
5370
+ content: import_v418.z.string(),
5371
+ target: import_v418.z.string()
5089
5372
  })
5090
5373
  ])
5091
5374
  ).nullish(),
5092
- network: import_v416.z.union([
5093
- import_v416.z.literal("disabled"),
5094
- import_v416.z.object({
5095
- allowlist: import_v416.z.array(
5096
- import_v416.z.object({
5097
- domain: import_v416.z.string(),
5098
- transform: import_v416.z.array(import_v416.z.record(import_v416.z.string(), import_v416.z.string())).nullish()
5375
+ network: import_v418.z.union([
5376
+ import_v418.z.literal("disabled"),
5377
+ import_v418.z.object({
5378
+ allowlist: import_v418.z.array(
5379
+ import_v418.z.object({
5380
+ domain: import_v418.z.string(),
5381
+ transform: import_v418.z.array(import_v418.z.record(import_v418.z.string(), import_v418.z.string())).nullish()
5099
5382
  })
5100
5383
  )
5101
5384
  })
@@ -5294,10 +5577,10 @@ function parseGoogleInteractionsOutputs({
5294
5577
  }
5295
5578
 
5296
5579
  // src/interactions/poll-google-interactions.ts
5297
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
5580
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
5298
5581
 
5299
5582
  // src/interactions/cancel-google-interaction.ts
5300
- var import_provider_utils19 = require("@ai-sdk/provider-utils");
5583
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
5301
5584
  var getOriginalFetch = () => globalThis.fetch;
5302
5585
  async function cancelGoogleInteraction({
5303
5586
  baseURL,
@@ -5312,9 +5595,9 @@ async function cancelGoogleInteraction({
5312
5595
  try {
5313
5596
  const response = await fetch(url, {
5314
5597
  method: "POST",
5315
- headers: (0, import_provider_utils19.withUserAgentSuffix)(
5316
- (0, import_provider_utils19.combineHeaders)({ "Content-Type": "application/json" }, headers),
5317
- (0, import_provider_utils19.getRuntimeEnvironmentUserAgent)()
5598
+ headers: (0, import_provider_utils20.withUserAgentSuffix)(
5599
+ (0, import_provider_utils20.combineHeaders)({ "Content-Type": "application/json" }, headers),
5600
+ (0, import_provider_utils20.getRuntimeEnvironmentUserAgent)()
5318
5601
  ),
5319
5602
  body: "{}"
5320
5603
  });
@@ -5364,16 +5647,16 @@ async function pollGoogleInteractionUntilTerminal({
5364
5647
  `google.interactions: timed out polling interaction ${interactionId} after ${timeoutMs}ms.`
5365
5648
  );
5366
5649
  }
5367
- await (0, import_provider_utils20.delay)(nextDelayMs, { abortSignal });
5650
+ await (0, import_provider_utils21.delay)(nextDelayMs, { abortSignal });
5368
5651
  const {
5369
5652
  value: response,
5370
5653
  rawValue: rawResponse,
5371
5654
  responseHeaders
5372
- } = await (0, import_provider_utils20.getFromApi)({
5655
+ } = await (0, import_provider_utils21.getFromApi)({
5373
5656
  url,
5374
5657
  headers,
5375
5658
  failedResponseHandler: googleFailedResponseHandler,
5376
- successfulResponseHandler: (0, import_provider_utils20.createJsonResponseHandler)(
5659
+ successfulResponseHandler: (0, import_provider_utils21.createJsonResponseHandler)(
5377
5660
  googleInteractionsResponseSchema
5378
5661
  ),
5379
5662
  abortSignal,
@@ -5385,7 +5668,7 @@ async function pollGoogleInteractionUntilTerminal({
5385
5668
  nextDelayMs = Math.min(nextDelayMs * 2, maxDelayMs);
5386
5669
  }
5387
5670
  } catch (error) {
5388
- if ((0, import_provider_utils20.isAbortError)(error)) {
5671
+ if ((0, import_provider_utils21.isAbortError)(error)) {
5389
5672
  await cancelOnServer();
5390
5673
  }
5391
5674
  throw error;
@@ -5541,7 +5824,7 @@ function prepareGoogleInteractionsTools({
5541
5824
  }
5542
5825
 
5543
5826
  // src/interactions/stream-google-interactions.ts
5544
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
5827
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
5545
5828
  var DEFAULT_MAX_RETRIES = 3;
5546
5829
  var DEFAULT_RETRY_DELAY_MS = 500;
5547
5830
  function streamGoogleInteractionEvents({
@@ -5588,11 +5871,11 @@ function streamGoogleInteractionEvents({
5588
5871
  return `${base}?${params.toString()}`;
5589
5872
  }
5590
5873
  async function openReader() {
5591
- const { value: stream } = await (0, import_provider_utils21.getFromApi)({
5874
+ const { value: stream } = await (0, import_provider_utils22.getFromApi)({
5592
5875
  url: buildUrl(),
5593
5876
  headers: eventSourceHeaders,
5594
5877
  failedResponseHandler: googleFailedResponseHandler,
5595
- successfulResponseHandler: (0, import_provider_utils21.createEventSourceResponseHandler)(
5878
+ successfulResponseHandler: (0, import_provider_utils22.createEventSourceResponseHandler)(
5596
5879
  googleInteractionsEventSchema
5597
5880
  ),
5598
5881
  abortSignal: effectiveSignal,
@@ -5609,7 +5892,7 @@ function streamGoogleInteractionEvents({
5609
5892
  currentReader = await openReader();
5610
5893
  receivedAnyEventThisAttempt = false;
5611
5894
  } catch (error) {
5612
- if ((0, import_provider_utils21.isAbortError)(error) || effectiveSignal.aborted) {
5895
+ if ((0, import_provider_utils22.isAbortError)(error) || effectiveSignal.aborted) {
5613
5896
  controller.error(error);
5614
5897
  return;
5615
5898
  }
@@ -5618,7 +5901,7 @@ function streamGoogleInteractionEvents({
5618
5901
  controller.error(error);
5619
5902
  return;
5620
5903
  }
5621
- await (0, import_provider_utils21.delay)(retryDelayMs * attempt, {
5904
+ await (0, import_provider_utils22.delay)(retryDelayMs * attempt, {
5622
5905
  abortSignal: effectiveSignal
5623
5906
  });
5624
5907
  continue;
@@ -5639,7 +5922,7 @@ function streamGoogleInteractionEvents({
5639
5922
  );
5640
5923
  return;
5641
5924
  }
5642
- await (0, import_provider_utils21.delay)(retryDelayMs * attempt, {
5925
+ await (0, import_provider_utils22.delay)(retryDelayMs * attempt, {
5643
5926
  abortSignal: effectiveSignal
5644
5927
  });
5645
5928
  } else {
@@ -5659,7 +5942,7 @@ function streamGoogleInteractionEvents({
5659
5942
  }
5660
5943
  controller.enqueue(value);
5661
5944
  } catch (error) {
5662
- if ((0, import_provider_utils21.isAbortError)(error) || effectiveSignal.aborted) {
5945
+ if ((0, import_provider_utils22.isAbortError)(error) || effectiveSignal.aborted) {
5663
5946
  controller.error(error);
5664
5947
  return;
5665
5948
  }
@@ -5669,7 +5952,7 @@ function streamGoogleInteractionEvents({
5669
5952
  controller.error(error);
5670
5953
  return;
5671
5954
  }
5672
- await (0, import_provider_utils21.delay)(retryDelayMs * attempt, {
5955
+ await (0, import_provider_utils22.delay)(retryDelayMs * attempt, {
5673
5956
  abortSignal: effectiveSignal
5674
5957
  });
5675
5958
  }
@@ -5881,7 +6164,7 @@ var GoogleInteractionsLanguageModel = class {
5881
6164
  async getArgs(options) {
5882
6165
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
5883
6166
  const warnings = [];
5884
- const opts = await (0, import_provider_utils22.parseProviderOptions)({
6167
+ const opts = await (0, import_provider_utils23.parseProviderOptions)({
5885
6168
  provider: "google",
5886
6169
  providerOptions: options.providerOptions,
5887
6170
  schema: googleInteractionsLanguageModelOptions
@@ -6127,17 +6410,17 @@ var GoogleInteractionsLanguageModel = class {
6127
6410
  var _a, _b, _c, _d, _e, _f;
6128
6411
  const { args, warnings, isAgent, pollingTimeoutMs } = await this.getArgs(options);
6129
6412
  const url = `${this.config.baseURL}/interactions`;
6130
- const mergedHeaders = (0, import_provider_utils22.combineHeaders)(
6413
+ const mergedHeaders = (0, import_provider_utils23.combineHeaders)(
6131
6414
  INTERACTIONS_API_REVISION_HEADER,
6132
- this.config.headers ? await (0, import_provider_utils22.resolve)(this.config.headers) : void 0,
6415
+ this.config.headers ? await (0, import_provider_utils23.resolve)(this.config.headers) : void 0,
6133
6416
  options.headers
6134
6417
  );
6135
- const postResult = await (0, import_provider_utils22.postJsonToApi)({
6418
+ const postResult = await (0, import_provider_utils23.postJsonToApi)({
6136
6419
  url,
6137
6420
  headers: mergedHeaders,
6138
6421
  body: args,
6139
6422
  failedResponseHandler: googleFailedResponseHandler,
6140
- successfulResponseHandler: (0, import_provider_utils22.createJsonResponseHandler)(
6423
+ successfulResponseHandler: (0, import_provider_utils23.createJsonResponseHandler)(
6141
6424
  googleInteractionsResponseSchema
6142
6425
  ),
6143
6426
  abortSignal: options.abortSignal,
@@ -6164,7 +6447,7 @@ var GoogleInteractionsLanguageModel = class {
6164
6447
  const interactionId = typeof response.id === "string" && response.id.length > 0 ? response.id : void 0;
6165
6448
  const { content, hasFunctionCall } = parseGoogleInteractionsOutputs({
6166
6449
  steps: (_b = response.steps) != null ? _b : null,
6167
- generateId: (_c = this.config.generateId) != null ? _c : import_provider_utils22.generateId,
6450
+ generateId: (_c = this.config.generateId) != null ? _c : import_provider_utils23.generateId,
6168
6451
  interactionId
6169
6452
  });
6170
6453
  const finishReason = {
@@ -6212,9 +6495,9 @@ var GoogleInteractionsLanguageModel = class {
6212
6495
  var _a;
6213
6496
  const { args, warnings, isBackground, pollingTimeoutMs } = await this.getArgs(options);
6214
6497
  const url = `${this.config.baseURL}/interactions`;
6215
- const mergedHeaders = (0, import_provider_utils22.combineHeaders)(
6498
+ const mergedHeaders = (0, import_provider_utils23.combineHeaders)(
6216
6499
  INTERACTIONS_API_REVISION_HEADER,
6217
- this.config.headers ? await (0, import_provider_utils22.resolve)(this.config.headers) : void 0,
6500
+ this.config.headers ? await (0, import_provider_utils23.resolve)(this.config.headers) : void 0,
6218
6501
  options.headers
6219
6502
  );
6220
6503
  if (isBackground) {
@@ -6228,12 +6511,12 @@ var GoogleInteractionsLanguageModel = class {
6228
6511
  });
6229
6512
  }
6230
6513
  const body = { ...args, stream: true };
6231
- const { responseHeaders, value: response } = await (0, import_provider_utils22.postJsonToApi)({
6514
+ const { responseHeaders, value: response } = await (0, import_provider_utils23.postJsonToApi)({
6232
6515
  url,
6233
6516
  headers: mergedHeaders,
6234
6517
  body,
6235
6518
  failedResponseHandler: googleFailedResponseHandler,
6236
- successfulResponseHandler: (0, import_provider_utils22.createEventSourceResponseHandler)(
6519
+ successfulResponseHandler: (0, import_provider_utils23.createEventSourceResponseHandler)(
6237
6520
  googleInteractionsEventSchema
6238
6521
  ),
6239
6522
  abortSignal: options.abortSignal,
@@ -6242,7 +6525,7 @@ var GoogleInteractionsLanguageModel = class {
6242
6525
  const headerServiceTier = responseHeaders == null ? void 0 : responseHeaders["x-gemini-service-tier"];
6243
6526
  const transform = buildGoogleInteractionsStreamTransform({
6244
6527
  warnings,
6245
- generateId: (_a = this.config.generateId) != null ? _a : import_provider_utils22.generateId,
6528
+ generateId: (_a = this.config.generateId) != null ? _a : import_provider_utils23.generateId,
6246
6529
  includeRawChunks: options.includeRawChunks,
6247
6530
  serviceTier: headerServiceTier
6248
6531
  });
@@ -6279,12 +6562,12 @@ var GoogleInteractionsLanguageModel = class {
6279
6562
  pollingTimeoutMs
6280
6563
  }) {
6281
6564
  var _a, _b;
6282
- const postResult = await (0, import_provider_utils22.postJsonToApi)({
6565
+ const postResult = await (0, import_provider_utils23.postJsonToApi)({
6283
6566
  url,
6284
6567
  headers: mergedHeaders,
6285
6568
  body: args,
6286
6569
  failedResponseHandler: googleFailedResponseHandler,
6287
- successfulResponseHandler: (0, import_provider_utils22.createJsonResponseHandler)(
6570
+ successfulResponseHandler: (0, import_provider_utils23.createJsonResponseHandler)(
6288
6571
  googleInteractionsResponseSchema
6289
6572
  ),
6290
6573
  abortSignal: options.abortSignal,
@@ -6302,7 +6585,7 @@ var GoogleInteractionsLanguageModel = class {
6302
6585
  const synthesized = synthesizeGoogleInteractionsAgentStream({
6303
6586
  response: postResponse,
6304
6587
  warnings,
6305
- generateId: (_a = this.config.generateId) != null ? _a : import_provider_utils22.generateId,
6588
+ generateId: (_a = this.config.generateId) != null ? _a : import_provider_utils23.generateId,
6306
6589
  includeRawChunks: options.includeRawChunks,
6307
6590
  headerServiceTier
6308
6591
  });
@@ -6322,7 +6605,7 @@ var GoogleInteractionsLanguageModel = class {
6322
6605
  });
6323
6606
  const transform = buildGoogleInteractionsStreamTransform({
6324
6607
  warnings,
6325
- generateId: (_b = this.config.generateId) != null ? _b : import_provider_utils22.generateId,
6608
+ generateId: (_b = this.config.generateId) != null ? _b : import_provider_utils23.generateId,
6326
6609
  includeRawChunks: options.includeRawChunks,
6327
6610
  serviceTier: headerServiceTier
6328
6611
  });
@@ -6376,11 +6659,11 @@ function supportsExternalFileUrls(modelId) {
6376
6659
  }
6377
6660
  function createGoogleGenerativeAI(options = {}) {
6378
6661
  var _a, _b;
6379
- const baseURL = (_a = (0, import_provider_utils23.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
6662
+ const baseURL = (_a = (0, import_provider_utils24.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
6380
6663
  const providerName = (_b = options.name) != null ? _b : "google.generative-ai";
6381
- const getHeaders = () => (0, import_provider_utils23.withUserAgentSuffix)(
6664
+ const getHeaders = () => (0, import_provider_utils24.withUserAgentSuffix)(
6382
6665
  {
6383
- "x-goog-api-key": (0, import_provider_utils23.loadApiKey)({
6666
+ "x-goog-api-key": (0, import_provider_utils24.loadApiKey)({
6384
6667
  apiKey: options.apiKey,
6385
6668
  environmentVariableName: "GOOGLE_GENERATIVE_AI_API_KEY",
6386
6669
  description: "Google Generative AI"
@@ -6395,7 +6678,7 @@ function createGoogleGenerativeAI(options = {}) {
6395
6678
  provider: providerName,
6396
6679
  baseURL,
6397
6680
  headers: getHeaders,
6398
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils23.generateId,
6681
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils24.generateId,
6399
6682
  supportedUrls: () => ({
6400
6683
  "*": [
6401
6684
  // Google Generative Language "files" endpoint
@@ -6429,6 +6712,12 @@ function createGoogleGenerativeAI(options = {}) {
6429
6712
  headers: getHeaders,
6430
6713
  fetch: options.fetch
6431
6714
  });
6715
+ const createTranscriptionModel = (modelId) => new GoogleTranscriptionModel(modelId, {
6716
+ provider: `${providerName}.transcription`,
6717
+ baseURL,
6718
+ headers: getHeaders,
6719
+ fetch: options.fetch
6720
+ });
6432
6721
  const createVideoModel = (modelId) => {
6433
6722
  var _a2;
6434
6723
  return new GoogleGenerativeAIVideoModel(modelId, {
@@ -6436,7 +6725,7 @@ function createGoogleGenerativeAI(options = {}) {
6436
6725
  baseURL,
6437
6726
  headers: getHeaders,
6438
6727
  fetch: options.fetch,
6439
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils23.generateId
6728
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils24.generateId
6440
6729
  });
6441
6730
  };
6442
6731
  const createInteractionsModel = (modelIdOrAgent) => {
@@ -6447,7 +6736,7 @@ function createGoogleGenerativeAI(options = {}) {
6447
6736
  provider: `${providerName}.interactions`,
6448
6737
  baseURL,
6449
6738
  headers: getHeaders,
6450
- generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils23.generateId,
6739
+ generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils24.generateId,
6451
6740
  fetch: options.fetch
6452
6741
  }
6453
6742
  );
@@ -6470,6 +6759,8 @@ function createGoogleGenerativeAI(options = {}) {
6470
6759
  provider.textEmbeddingModel = createEmbeddingModel;
6471
6760
  provider.image = createImageModel;
6472
6761
  provider.imageModel = createImageModel;
6762
+ provider.transcription = createTranscriptionModel;
6763
+ provider.transcriptionModel = createTranscriptionModel;
6473
6764
  provider.video = createVideoModel;
6474
6765
  provider.videoModel = createVideoModel;
6475
6766
  provider.interactions = createInteractionsModel;
@@ -6479,6 +6770,7 @@ function createGoogleGenerativeAI(options = {}) {
6479
6770
  var google = createGoogleGenerativeAI();
6480
6771
  // Annotate the CommonJS export names for ESM import in node:
6481
6772
  0 && (module.exports = {
6773
+ GoogleTranscriptionModel,
6482
6774
  VERSION,
6483
6775
  createGoogleGenerativeAI,
6484
6776
  google