@google/genai 1.23.0 → 1.25.0

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.
@@ -467,7 +467,6 @@ export declare class Batches extends BaseModule {
467
467
  */
468
468
  list: (params?: types.ListBatchJobsParameters) => Promise<Pager<types.BatchJob>>;
469
469
  private createInlinedGenerateContentRequest;
470
- private createInlinedEmbedContentRequest;
471
470
  private getGcsUri;
472
471
  private getBigqueryUri;
473
472
  private formatDestination;
@@ -3435,6 +3434,8 @@ export declare interface GoogleGenAIOptions {
3435
3434
  export declare interface GoogleMaps {
3436
3435
  /** Optional. Auth config for the Google Maps tool. */
3437
3436
  authConfig?: AuthConfig;
3437
+ /** Optional. If true, include the widget context token in the response. */
3438
+ enableWidget?: boolean;
3438
3439
  }
3439
3440
 
3440
3441
  /** The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). */
@@ -3528,6 +3529,10 @@ export declare interface GroundingChunkMapsPlaceAnswerSourcesReviewSnippet {
3528
3529
  relativePublishTimeDescription?: string;
3529
3530
  /** A reference representing this place review which may be used to look up this place review again. */
3530
3531
  review?: string;
3532
+ /** Id of the review referencing the place. */
3533
+ reviewId?: string;
3534
+ /** Title of the review. */
3535
+ title?: string;
3531
3536
  }
3532
3537
 
3533
3538
  /** Chunk from context retrieved by the retrieval tools. */
@@ -3568,10 +3573,20 @@ export declare interface GroundingMetadata {
3568
3573
  retrievalQueries?: string[];
3569
3574
  /** Optional. Google search entry for the following-up web searches. */
3570
3575
  searchEntryPoint?: SearchEntryPoint;
3576
+ /** Optional. Output only. List of source flagging uris. This is currently populated only for Google Maps grounding. */
3577
+ sourceFlaggingUris?: GroundingMetadataSourceFlaggingUri[];
3571
3578
  /** Optional. Web search queries for the following-up web search. */
3572
3579
  webSearchQueries?: string[];
3573
3580
  }
3574
3581
 
3582
+ /** Source content flagging uri for a place or review. This is currently populated only for Google Maps grounding. */
3583
+ export declare interface GroundingMetadataSourceFlaggingUri {
3584
+ /** A link where users can flag a problem with the source (place or review). */
3585
+ flagContentUri?: string;
3586
+ /** Id of the place or review. */
3587
+ sourceId?: string;
3588
+ }
3589
+
3575
3590
  /** Grounding support. */
3576
3591
  export declare interface GroundingSupport {
3577
3592
  /** Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored. */
@@ -3871,6 +3886,8 @@ export declare interface InlinedRequest {
3871
3886
  /** Content of the request.
3872
3887
  */
3873
3888
  contents?: ContentListUnion;
3889
+ /** The metadata to be associated with the request. */
3890
+ metadata?: Record<string, string>;
3874
3891
  /** Configuration that contains optional model parameters.
3875
3892
  */
3876
3893
  config?: GenerateContentConfig;
@@ -7341,6 +7358,7 @@ declare namespace types {
7341
7358
  GroundingSupport,
7342
7359
  RetrievalMetadata,
7343
7360
  SearchEntryPoint,
7361
+ GroundingMetadataSourceFlaggingUri,
7344
7362
  GroundingMetadata,
7345
7363
  LogprobsResultCandidate,
7346
7364
  LogprobsResultTopCandidates,
@@ -193,6 +193,98 @@ function getValueByPath(data, keys, defaultValue = undefined) {
193
193
  throw error;
194
194
  }
195
195
  }
196
+ /**
197
+ * Moves values from source paths to destination paths.
198
+ *
199
+ * Examples:
200
+ * moveValueByPath(
201
+ * {'requests': [{'content': v1}, {'content': v2}]},
202
+ * {'requests[].*': 'requests[].request.*'}
203
+ * )
204
+ * -> {'requests': [{'request': {'content': v1}}, {'request': {'content': v2}}]}
205
+ */
206
+ function moveValueByPath(data, paths) {
207
+ for (const [sourcePath, destPath] of Object.entries(paths)) {
208
+ const sourceKeys = sourcePath.split('.');
209
+ const destKeys = destPath.split('.');
210
+ // Determine keys to exclude from wildcard to avoid cyclic references
211
+ const excludeKeys = new Set();
212
+ let wildcardIdx = -1;
213
+ for (let i = 0; i < sourceKeys.length; i++) {
214
+ if (sourceKeys[i] === '*') {
215
+ wildcardIdx = i;
216
+ break;
217
+ }
218
+ }
219
+ if (wildcardIdx !== -1 && destKeys.length > wildcardIdx) {
220
+ // Extract the intermediate key between source and dest paths
221
+ // Example: source=['requests[]', '*'], dest=['requests[]', 'request', '*']
222
+ // We want to exclude 'request'
223
+ for (let i = wildcardIdx; i < destKeys.length; i++) {
224
+ const key = destKeys[i];
225
+ if (key !== '*' && !key.endsWith('[]') && !key.endsWith('[0]')) {
226
+ excludeKeys.add(key);
227
+ }
228
+ }
229
+ }
230
+ _moveValueRecursive(data, sourceKeys, destKeys, 0, excludeKeys);
231
+ }
232
+ }
233
+ /**
234
+ * Recursively moves values from source path to destination path.
235
+ */
236
+ function _moveValueRecursive(data, sourceKeys, destKeys, keyIdx, excludeKeys) {
237
+ if (keyIdx >= sourceKeys.length) {
238
+ return;
239
+ }
240
+ if (typeof data !== 'object' || data === null) {
241
+ return;
242
+ }
243
+ const key = sourceKeys[keyIdx];
244
+ if (key.endsWith('[]')) {
245
+ const keyName = key.slice(0, -2);
246
+ const dataRecord = data;
247
+ if (keyName in dataRecord && Array.isArray(dataRecord[keyName])) {
248
+ for (const item of dataRecord[keyName]) {
249
+ _moveValueRecursive(item, sourceKeys, destKeys, keyIdx + 1, excludeKeys);
250
+ }
251
+ }
252
+ }
253
+ else if (key === '*') {
254
+ // wildcard - move all fields
255
+ if (typeof data === 'object' && data !== null && !Array.isArray(data)) {
256
+ const dataRecord = data;
257
+ const keysToMove = Object.keys(dataRecord).filter((k) => !k.startsWith('_') && !excludeKeys.has(k));
258
+ const valuesToMove = {};
259
+ for (const k of keysToMove) {
260
+ valuesToMove[k] = dataRecord[k];
261
+ }
262
+ // Set values at destination
263
+ for (const [k, v] of Object.entries(valuesToMove)) {
264
+ const newDestKeys = [];
265
+ for (const dk of destKeys.slice(keyIdx)) {
266
+ if (dk === '*') {
267
+ newDestKeys.push(k);
268
+ }
269
+ else {
270
+ newDestKeys.push(dk);
271
+ }
272
+ }
273
+ setValueByPath(dataRecord, newDestKeys, v);
274
+ }
275
+ for (const k of keysToMove) {
276
+ delete dataRecord[k];
277
+ }
278
+ }
279
+ }
280
+ else {
281
+ // Navigate to next level
282
+ const dataRecord = data;
283
+ if (key in dataRecord) {
284
+ _moveValueRecursive(dataRecord[key], sourceKeys, destKeys, keyIdx + 1, excludeKeys);
285
+ }
286
+ }
287
+ }
196
288
 
197
289
  /**
198
290
  * @license
@@ -334,7 +426,7 @@ function generateVideosResponseFromVertex$1(fromObject) {
334
426
  }
335
427
  function generatedVideoFromMldev$1(fromObject) {
336
428
  const toObject = {};
337
- const fromVideo = getValueByPath(fromObject, ['_self']);
429
+ const fromVideo = getValueByPath(fromObject, ['video']);
338
430
  if (fromVideo != null) {
339
431
  setValueByPath(toObject, ['video'], videoFromMldev$1(fromVideo));
340
432
  }
@@ -370,14 +462,11 @@ function getOperationParametersToVertex(fromObject) {
370
462
  }
371
463
  function videoFromMldev$1(fromObject) {
372
464
  const toObject = {};
373
- const fromUri = getValueByPath(fromObject, ['video', 'uri']);
465
+ const fromUri = getValueByPath(fromObject, ['uri']);
374
466
  if (fromUri != null) {
375
467
  setValueByPath(toObject, ['uri'], fromUri);
376
468
  }
377
- const fromVideoBytes = getValueByPath(fromObject, [
378
- 'video',
379
- 'encodedVideo',
380
- ]);
469
+ const fromVideoBytes = getValueByPath(fromObject, ['encodedVideo']);
381
470
  if (fromVideoBytes != null) {
382
471
  setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
383
472
  }
@@ -3510,6 +3599,7 @@ function embedContentBatchToMldev(apiClient, fromObject) {
3510
3599
  const fromConfig = getValueByPath(fromObject, ['config']);
3511
3600
  if (fromConfig != null) {
3512
3601
  setValueByPath(toObject, ['_self'], embedContentConfigToMldev$1(fromConfig, toObject));
3602
+ moveValueByPath(toObject, { 'requests[].*': 'requests[].request.*' });
3513
3603
  }
3514
3604
  return toObject;
3515
3605
  }
@@ -3776,6 +3866,17 @@ function getBatchJobParametersToVertex(apiClient, fromObject) {
3776
3866
  }
3777
3867
  return toObject;
3778
3868
  }
3869
+ function googleMapsToMldev$4(fromObject) {
3870
+ const toObject = {};
3871
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
3872
+ throw new Error('authConfig parameter is not supported in Gemini API.');
3873
+ }
3874
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
3875
+ if (fromEnableWidget != null) {
3876
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
3877
+ }
3878
+ return toObject;
3879
+ }
3779
3880
  function googleSearchToMldev$4(fromObject) {
3780
3881
  const toObject = {};
3781
3882
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -3805,6 +3906,10 @@ function inlinedRequestToMldev(apiClient, fromObject) {
3805
3906
  }
3806
3907
  setValueByPath(toObject, ['request', 'contents'], transformedList);
3807
3908
  }
3909
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
3910
+ if (fromMetadata != null) {
3911
+ setValueByPath(toObject, ['metadata'], fromMetadata);
3912
+ }
3808
3913
  const fromConfig = getValueByPath(fromObject, ['config']);
3809
3914
  if (fromConfig != null) {
3810
3915
  setValueByPath(toObject, ['request', 'generationConfig'], generateContentConfigToMldev$1(apiClient, fromConfig, getValueByPath(toObject, ['request'], {})));
@@ -4023,8 +4128,9 @@ function toolToMldev$4(fromObject) {
4023
4128
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4024
4129
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4025
4130
  }
4026
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
4027
- throw new Error('googleMaps parameter is not supported in Gemini API.');
4131
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4132
+ if (fromGoogleMaps != null) {
4133
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4028
4134
  }
4029
4135
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4030
4136
  if (fromUrlContext != null) {
@@ -4275,38 +4381,11 @@ class Batches extends BaseModule {
4275
4381
  * ```
4276
4382
  */
4277
4383
  this.createEmbeddings = async (params) => {
4278
- var _a, _b;
4279
4384
  console.warn('batches.createEmbeddings() is experimental and may change without notice.');
4280
4385
  if (this.apiClient.isVertexAI()) {
4281
4386
  throw new Error('Vertex AI does not support batches.createEmbeddings.');
4282
4387
  }
4283
- // MLDEV
4284
- const src = params.src;
4285
- const is_inlined = src.inlinedRequests !== undefined;
4286
- if (!is_inlined) {
4287
- return this.createEmbeddingsInternal(params); // Fixed typo here
4288
- }
4289
- // Inlined embed content requests handling
4290
- const result = this.createInlinedEmbedContentRequest(params);
4291
- const path = result.path;
4292
- const requestBody = result.body;
4293
- const queryParams = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
4294
- const response = this.apiClient
4295
- .request({
4296
- path: path,
4297
- queryParams: queryParams,
4298
- body: JSON.stringify(requestBody),
4299
- httpMethod: 'POST',
4300
- httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4301
- abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4302
- })
4303
- .then((httpResponse) => {
4304
- return httpResponse.json();
4305
- });
4306
- return response.then((apiResponse) => {
4307
- const resp = batchJobFromMldev(apiResponse);
4308
- return resp;
4309
- });
4388
+ return this.createEmbeddingsInternal(params);
4310
4389
  };
4311
4390
  /**
4312
4391
  * Lists batch job configurations.
@@ -4354,35 +4433,6 @@ class Batches extends BaseModule {
4354
4433
  delete body['_query'];
4355
4434
  return { path, body };
4356
4435
  }
4357
- // Helper function to handle inlined embedding requests
4358
- createInlinedEmbedContentRequest(params) {
4359
- const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
4360
- params);
4361
- const urlParams = body['_url'];
4362
- const path = formatMap('{model}:asyncBatchEmbedContent', urlParams);
4363
- const batch = body['batch'];
4364
- const inputConfig = batch['inputConfig'];
4365
- const requestsWrapper = inputConfig['requests'];
4366
- const requests = requestsWrapper['requests'];
4367
- const newRequests = [];
4368
- delete requestsWrapper['config']; // Remove top-level config
4369
- for (const request of requests) {
4370
- const requestDict = Object.assign({}, request); // Clone
4371
- const innerRequest = requestDict['request'];
4372
- for (const key in requestDict) {
4373
- if (key !== 'request') {
4374
- innerRequest[key] = requestDict[key];
4375
- delete requestDict[key];
4376
- }
4377
- }
4378
- newRequests.push(requestDict);
4379
- }
4380
- requestsWrapper['requests'] = newRequests;
4381
- delete body['config'];
4382
- delete body['_url'];
4383
- delete body['_query'];
4384
- return { path, body };
4385
- }
4386
4436
  // Helper function to get the first GCS URI
4387
4437
  getGcsUri(src) {
4388
4438
  if (typeof src === 'string') {
@@ -5047,6 +5097,17 @@ function getCachedContentParametersToVertex(apiClient, fromObject) {
5047
5097
  }
5048
5098
  return toObject;
5049
5099
  }
5100
+ function googleMapsToMldev$3(fromObject) {
5101
+ const toObject = {};
5102
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
5103
+ throw new Error('authConfig parameter is not supported in Gemini API.');
5104
+ }
5105
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
5106
+ if (fromEnableWidget != null) {
5107
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
5108
+ }
5109
+ return toObject;
5110
+ }
5050
5111
  function googleSearchToMldev$3(fromObject) {
5051
5112
  const toObject = {};
5052
5113
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -5240,8 +5301,9 @@ function toolToMldev$3(fromObject) {
5240
5301
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5241
5302
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5242
5303
  }
5243
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
5244
- throw new Error('googleMaps parameter is not supported in Gemini API.');
5304
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5305
+ if (fromGoogleMaps != null) {
5306
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5245
5307
  }
5246
5308
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5247
5309
  if (fromUrlContext != null) {
@@ -6724,6 +6786,17 @@ function generationConfigToVertex$1(fromObject) {
6724
6786
  }
6725
6787
  return toObject;
6726
6788
  }
6789
+ function googleMapsToMldev$2(fromObject) {
6790
+ const toObject = {};
6791
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
6792
+ throw new Error('authConfig parameter is not supported in Gemini API.');
6793
+ }
6794
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
6795
+ if (fromEnableWidget != null) {
6796
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
6797
+ }
6798
+ return toObject;
6799
+ }
6727
6800
  function googleSearchToMldev$2(fromObject) {
6728
6801
  const toObject = {};
6729
6802
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -7243,8 +7316,9 @@ function toolToMldev$2(fromObject) {
7243
7316
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7244
7317
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7245
7318
  }
7246
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
7247
- throw new Error('googleMaps parameter is not supported in Gemini API.');
7319
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7320
+ if (fromGoogleMaps != null) {
7321
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7248
7322
  }
7249
7323
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7250
7324
  if (fromUrlContext != null) {
@@ -9233,7 +9307,7 @@ function generatedImageMaskFromVertex(fromObject) {
9233
9307
  }
9234
9308
  function generatedVideoFromMldev(fromObject) {
9235
9309
  const toObject = {};
9236
- const fromVideo = getValueByPath(fromObject, ['_self']);
9310
+ const fromVideo = getValueByPath(fromObject, ['video']);
9237
9311
  if (fromVideo != null) {
9238
9312
  setValueByPath(toObject, ['video'], videoFromMldev(fromVideo));
9239
9313
  }
@@ -9387,6 +9461,17 @@ function getModelParametersToVertex(apiClient, fromObject) {
9387
9461
  }
9388
9462
  return toObject;
9389
9463
  }
9464
+ function googleMapsToMldev$1(fromObject) {
9465
+ const toObject = {};
9466
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
9467
+ throw new Error('authConfig parameter is not supported in Gemini API.');
9468
+ }
9469
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
9470
+ if (fromEnableWidget != null) {
9471
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
9472
+ }
9473
+ return toObject;
9474
+ }
9390
9475
  function googleSearchToMldev$1(fromObject) {
9391
9476
  const toObject = {};
9392
9477
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -10101,8 +10186,9 @@ function toolToMldev$1(fromObject) {
10101
10186
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10102
10187
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10103
10188
  }
10104
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
10105
- throw new Error('googleMaps parameter is not supported in Gemini API.');
10189
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10190
+ if (fromGoogleMaps != null) {
10191
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10106
10192
  }
10107
10193
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10108
10194
  if (fromUrlContext != null) {
@@ -10367,14 +10453,11 @@ function upscaleImageResponseFromVertex(fromObject) {
10367
10453
  }
10368
10454
  function videoFromMldev(fromObject) {
10369
10455
  const toObject = {};
10370
- const fromUri = getValueByPath(fromObject, ['video', 'uri']);
10456
+ const fromUri = getValueByPath(fromObject, ['uri']);
10371
10457
  if (fromUri != null) {
10372
10458
  setValueByPath(toObject, ['uri'], fromUri);
10373
10459
  }
10374
- const fromVideoBytes = getValueByPath(fromObject, [
10375
- 'video',
10376
- 'encodedVideo',
10377
- ]);
10460
+ const fromVideoBytes = getValueByPath(fromObject, ['encodedVideo']);
10378
10461
  if (fromVideoBytes != null) {
10379
10462
  setValueByPath(toObject, ['videoBytes'], tBytes(fromVideoBytes));
10380
10463
  }
@@ -10446,11 +10529,11 @@ function videoToMldev(fromObject) {
10446
10529
  const toObject = {};
10447
10530
  const fromUri = getValueByPath(fromObject, ['uri']);
10448
10531
  if (fromUri != null) {
10449
- setValueByPath(toObject, ['video', 'uri'], fromUri);
10532
+ setValueByPath(toObject, ['uri'], fromUri);
10450
10533
  }
10451
10534
  const fromVideoBytes = getValueByPath(fromObject, ['videoBytes']);
10452
10535
  if (fromVideoBytes != null) {
10453
- setValueByPath(toObject, ['video', 'encodedVideo'], tBytes(fromVideoBytes));
10536
+ setValueByPath(toObject, ['encodedVideo'], tBytes(fromVideoBytes));
10454
10537
  }
10455
10538
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
10456
10539
  if (fromMimeType != null) {
@@ -10484,7 +10567,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10484
10567
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10485
10568
  const USER_AGENT_HEADER = 'User-Agent';
10486
10569
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10487
- const SDK_VERSION = '1.23.0'; // x-release-please-version
10570
+ const SDK_VERSION = '1.25.0'; // x-release-please-version
10488
10571
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10489
10572
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10490
10573
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -12262,9 +12345,26 @@ class Models extends BaseModule {
12262
12345
  * ```
12263
12346
  */
12264
12347
  this.generateVideos = async (params) => {
12348
+ var _a, _b, _c, _d, _e, _f;
12265
12349
  if ((params.prompt || params.image || params.video) && params.source) {
12266
12350
  throw new Error('Source and prompt/image/video are mutually exclusive. Please only use source.');
12267
12351
  }
12352
+ // Gemini API does not support video bytes.
12353
+ if (!this.apiClient.isVertexAI()) {
12354
+ if (((_a = params.video) === null || _a === void 0 ? void 0 : _a.uri) && ((_b = params.video) === null || _b === void 0 ? void 0 : _b.videoBytes)) {
12355
+ params.video = {
12356
+ uri: params.video.uri,
12357
+ mimeType: params.video.mimeType,
12358
+ };
12359
+ }
12360
+ else if (((_d = (_c = params.source) === null || _c === void 0 ? void 0 : _c.video) === null || _d === void 0 ? void 0 : _d.uri) &&
12361
+ ((_f = (_e = params.source) === null || _e === void 0 ? void 0 : _e.video) === null || _f === void 0 ? void 0 : _f.videoBytes)) {
12362
+ params.source.video = {
12363
+ uri: params.source.video.uri,
12364
+ mimeType: params.source.video.mimeType,
12365
+ };
12366
+ }
12367
+ }
12268
12368
  return await this.generateVideosInternal(params);
12269
12369
  };
12270
12370
  }
@@ -13690,6 +13790,17 @@ function fileDataToMldev(fromObject) {
13690
13790
  }
13691
13791
  return toObject;
13692
13792
  }
13793
+ function googleMapsToMldev(fromObject) {
13794
+ const toObject = {};
13795
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
13796
+ throw new Error('authConfig parameter is not supported in Gemini API.');
13797
+ }
13798
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
13799
+ if (fromEnableWidget != null) {
13800
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
13801
+ }
13802
+ return toObject;
13803
+ }
13693
13804
  function googleSearchToMldev(fromObject) {
13694
13805
  const toObject = {};
13695
13806
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -13920,8 +14031,9 @@ function toolToMldev(fromObject) {
13920
14031
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
13921
14032
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
13922
14033
  }
13923
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
13924
- throw new Error('googleMaps parameter is not supported in Gemini API.');
14034
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
14035
+ if (fromGoogleMaps != null) {
14036
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
13925
14037
  }
13926
14038
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
13927
14039
  if (fromUrlContext != null) {