@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.
package/dist/genai.d.ts CHANGED
@@ -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;
@@ -3423,6 +3422,8 @@ export declare interface GoogleGenAIOptions {
3423
3422
  export declare interface GoogleMaps {
3424
3423
  /** Optional. Auth config for the Google Maps tool. */
3425
3424
  authConfig?: AuthConfig;
3425
+ /** Optional. If true, include the widget context token in the response. */
3426
+ enableWidget?: boolean;
3426
3427
  }
3427
3428
 
3428
3429
  /** 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). */
@@ -3516,6 +3517,10 @@ export declare interface GroundingChunkMapsPlaceAnswerSourcesReviewSnippet {
3516
3517
  relativePublishTimeDescription?: string;
3517
3518
  /** A reference representing this place review which may be used to look up this place review again. */
3518
3519
  review?: string;
3520
+ /** Id of the review referencing the place. */
3521
+ reviewId?: string;
3522
+ /** Title of the review. */
3523
+ title?: string;
3519
3524
  }
3520
3525
 
3521
3526
  /** Chunk from context retrieved by the retrieval tools. */
@@ -3556,10 +3561,20 @@ export declare interface GroundingMetadata {
3556
3561
  retrievalQueries?: string[];
3557
3562
  /** Optional. Google search entry for the following-up web searches. */
3558
3563
  searchEntryPoint?: SearchEntryPoint;
3564
+ /** Optional. Output only. List of source flagging uris. This is currently populated only for Google Maps grounding. */
3565
+ sourceFlaggingUris?: GroundingMetadataSourceFlaggingUri[];
3559
3566
  /** Optional. Web search queries for the following-up web search. */
3560
3567
  webSearchQueries?: string[];
3561
3568
  }
3562
3569
 
3570
+ /** Source content flagging uri for a place or review. This is currently populated only for Google Maps grounding. */
3571
+ export declare interface GroundingMetadataSourceFlaggingUri {
3572
+ /** A link where users can flag a problem with the source (place or review). */
3573
+ flagContentUri?: string;
3574
+ /** Id of the place or review. */
3575
+ sourceId?: string;
3576
+ }
3577
+
3563
3578
  /** Grounding support. */
3564
3579
  export declare interface GroundingSupport {
3565
3580
  /** 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. */
@@ -3859,6 +3874,8 @@ export declare interface InlinedRequest {
3859
3874
  /** Content of the request.
3860
3875
  */
3861
3876
  contents?: ContentListUnion;
3877
+ /** The metadata to be associated with the request. */
3878
+ metadata?: Record<string, string>;
3862
3879
  /** Configuration that contains optional model parameters.
3863
3880
  */
3864
3881
  config?: GenerateContentConfig;
@@ -7329,6 +7346,7 @@ declare namespace types {
7329
7346
  GroundingSupport,
7330
7347
  RetrievalMetadata,
7331
7348
  SearchEntryPoint,
7349
+ GroundingMetadataSourceFlaggingUri,
7332
7350
  GroundingMetadata,
7333
7351
  LogprobsResultCandidate,
7334
7352
  LogprobsResultTopCandidates,
package/dist/index.cjs CHANGED
@@ -165,6 +165,98 @@ function getValueByPath(data, keys, defaultValue = undefined) {
165
165
  throw error;
166
166
  }
167
167
  }
168
+ /**
169
+ * Moves values from source paths to destination paths.
170
+ *
171
+ * Examples:
172
+ * moveValueByPath(
173
+ * {'requests': [{'content': v1}, {'content': v2}]},
174
+ * {'requests[].*': 'requests[].request.*'}
175
+ * )
176
+ * -> {'requests': [{'request': {'content': v1}}, {'request': {'content': v2}}]}
177
+ */
178
+ function moveValueByPath(data, paths) {
179
+ for (const [sourcePath, destPath] of Object.entries(paths)) {
180
+ const sourceKeys = sourcePath.split('.');
181
+ const destKeys = destPath.split('.');
182
+ // Determine keys to exclude from wildcard to avoid cyclic references
183
+ const excludeKeys = new Set();
184
+ let wildcardIdx = -1;
185
+ for (let i = 0; i < sourceKeys.length; i++) {
186
+ if (sourceKeys[i] === '*') {
187
+ wildcardIdx = i;
188
+ break;
189
+ }
190
+ }
191
+ if (wildcardIdx !== -1 && destKeys.length > wildcardIdx) {
192
+ // Extract the intermediate key between source and dest paths
193
+ // Example: source=['requests[]', '*'], dest=['requests[]', 'request', '*']
194
+ // We want to exclude 'request'
195
+ for (let i = wildcardIdx; i < destKeys.length; i++) {
196
+ const key = destKeys[i];
197
+ if (key !== '*' && !key.endsWith('[]') && !key.endsWith('[0]')) {
198
+ excludeKeys.add(key);
199
+ }
200
+ }
201
+ }
202
+ _moveValueRecursive(data, sourceKeys, destKeys, 0, excludeKeys);
203
+ }
204
+ }
205
+ /**
206
+ * Recursively moves values from source path to destination path.
207
+ */
208
+ function _moveValueRecursive(data, sourceKeys, destKeys, keyIdx, excludeKeys) {
209
+ if (keyIdx >= sourceKeys.length) {
210
+ return;
211
+ }
212
+ if (typeof data !== 'object' || data === null) {
213
+ return;
214
+ }
215
+ const key = sourceKeys[keyIdx];
216
+ if (key.endsWith('[]')) {
217
+ const keyName = key.slice(0, -2);
218
+ const dataRecord = data;
219
+ if (keyName in dataRecord && Array.isArray(dataRecord[keyName])) {
220
+ for (const item of dataRecord[keyName]) {
221
+ _moveValueRecursive(item, sourceKeys, destKeys, keyIdx + 1, excludeKeys);
222
+ }
223
+ }
224
+ }
225
+ else if (key === '*') {
226
+ // wildcard - move all fields
227
+ if (typeof data === 'object' && data !== null && !Array.isArray(data)) {
228
+ const dataRecord = data;
229
+ const keysToMove = Object.keys(dataRecord).filter((k) => !k.startsWith('_') && !excludeKeys.has(k));
230
+ const valuesToMove = {};
231
+ for (const k of keysToMove) {
232
+ valuesToMove[k] = dataRecord[k];
233
+ }
234
+ // Set values at destination
235
+ for (const [k, v] of Object.entries(valuesToMove)) {
236
+ const newDestKeys = [];
237
+ for (const dk of destKeys.slice(keyIdx)) {
238
+ if (dk === '*') {
239
+ newDestKeys.push(k);
240
+ }
241
+ else {
242
+ newDestKeys.push(dk);
243
+ }
244
+ }
245
+ setValueByPath(dataRecord, newDestKeys, v);
246
+ }
247
+ for (const k of keysToMove) {
248
+ delete dataRecord[k];
249
+ }
250
+ }
251
+ }
252
+ else {
253
+ // Navigate to next level
254
+ const dataRecord = data;
255
+ if (key in dataRecord) {
256
+ _moveValueRecursive(dataRecord[key], sourceKeys, destKeys, keyIdx + 1, excludeKeys);
257
+ }
258
+ }
259
+ }
168
260
 
169
261
  /**
170
262
  * @license
@@ -306,7 +398,7 @@ function generateVideosResponseFromVertex$1(fromObject) {
306
398
  }
307
399
  function generatedVideoFromMldev$1(fromObject) {
308
400
  const toObject = {};
309
- const fromVideo = getValueByPath(fromObject, ['_self']);
401
+ const fromVideo = getValueByPath(fromObject, ['video']);
310
402
  if (fromVideo != null) {
311
403
  setValueByPath(toObject, ['video'], videoFromMldev$1(fromVideo));
312
404
  }
@@ -342,14 +434,11 @@ function getOperationParametersToVertex(fromObject) {
342
434
  }
343
435
  function videoFromMldev$1(fromObject) {
344
436
  const toObject = {};
345
- const fromUri = getValueByPath(fromObject, ['video', 'uri']);
437
+ const fromUri = getValueByPath(fromObject, ['uri']);
346
438
  if (fromUri != null) {
347
439
  setValueByPath(toObject, ['uri'], fromUri);
348
440
  }
349
- const fromVideoBytes = getValueByPath(fromObject, [
350
- 'video',
351
- 'encodedVideo',
352
- ]);
441
+ const fromVideoBytes = getValueByPath(fromObject, ['encodedVideo']);
353
442
  if (fromVideoBytes != null) {
354
443
  setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
355
444
  }
@@ -3482,6 +3571,7 @@ function embedContentBatchToMldev(apiClient, fromObject) {
3482
3571
  const fromConfig = getValueByPath(fromObject, ['config']);
3483
3572
  if (fromConfig != null) {
3484
3573
  setValueByPath(toObject, ['_self'], embedContentConfigToMldev$1(fromConfig, toObject));
3574
+ moveValueByPath(toObject, { 'requests[].*': 'requests[].request.*' });
3485
3575
  }
3486
3576
  return toObject;
3487
3577
  }
@@ -3748,6 +3838,17 @@ function getBatchJobParametersToVertex(apiClient, fromObject) {
3748
3838
  }
3749
3839
  return toObject;
3750
3840
  }
3841
+ function googleMapsToMldev$4(fromObject) {
3842
+ const toObject = {};
3843
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
3844
+ throw new Error('authConfig parameter is not supported in Gemini API.');
3845
+ }
3846
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
3847
+ if (fromEnableWidget != null) {
3848
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
3849
+ }
3850
+ return toObject;
3851
+ }
3751
3852
  function googleSearchToMldev$4(fromObject) {
3752
3853
  const toObject = {};
3753
3854
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -3777,6 +3878,10 @@ function inlinedRequestToMldev(apiClient, fromObject) {
3777
3878
  }
3778
3879
  setValueByPath(toObject, ['request', 'contents'], transformedList);
3779
3880
  }
3881
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
3882
+ if (fromMetadata != null) {
3883
+ setValueByPath(toObject, ['metadata'], fromMetadata);
3884
+ }
3780
3885
  const fromConfig = getValueByPath(fromObject, ['config']);
3781
3886
  if (fromConfig != null) {
3782
3887
  setValueByPath(toObject, ['request', 'generationConfig'], generateContentConfigToMldev$1(apiClient, fromConfig, getValueByPath(toObject, ['request'], {})));
@@ -3995,8 +4100,9 @@ function toolToMldev$4(fromObject) {
3995
4100
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
3996
4101
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
3997
4102
  }
3998
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
3999
- throw new Error('googleMaps parameter is not supported in Gemini API.');
4103
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4104
+ if (fromGoogleMaps != null) {
4105
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4000
4106
  }
4001
4107
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4002
4108
  if (fromUrlContext != null) {
@@ -4247,38 +4353,11 @@ class Batches extends BaseModule {
4247
4353
  * ```
4248
4354
  */
4249
4355
  this.createEmbeddings = async (params) => {
4250
- var _a, _b;
4251
4356
  console.warn('batches.createEmbeddings() is experimental and may change without notice.');
4252
4357
  if (this.apiClient.isVertexAI()) {
4253
4358
  throw new Error('Vertex AI does not support batches.createEmbeddings.');
4254
4359
  }
4255
- // MLDEV
4256
- const src = params.src;
4257
- const is_inlined = src.inlinedRequests !== undefined;
4258
- if (!is_inlined) {
4259
- return this.createEmbeddingsInternal(params); // Fixed typo here
4260
- }
4261
- // Inlined embed content requests handling
4262
- const result = this.createInlinedEmbedContentRequest(params);
4263
- const path = result.path;
4264
- const requestBody = result.body;
4265
- const queryParams = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
4266
- const response = this.apiClient
4267
- .request({
4268
- path: path,
4269
- queryParams: queryParams,
4270
- body: JSON.stringify(requestBody),
4271
- httpMethod: 'POST',
4272
- httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4273
- abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4274
- })
4275
- .then((httpResponse) => {
4276
- return httpResponse.json();
4277
- });
4278
- return response.then((apiResponse) => {
4279
- const resp = batchJobFromMldev(apiResponse);
4280
- return resp;
4281
- });
4360
+ return this.createEmbeddingsInternal(params);
4282
4361
  };
4283
4362
  /**
4284
4363
  * Lists batch job configurations.
@@ -4326,35 +4405,6 @@ class Batches extends BaseModule {
4326
4405
  delete body['_query'];
4327
4406
  return { path, body };
4328
4407
  }
4329
- // Helper function to handle inlined embedding requests
4330
- createInlinedEmbedContentRequest(params) {
4331
- const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
4332
- params);
4333
- const urlParams = body['_url'];
4334
- const path = formatMap('{model}:asyncBatchEmbedContent', urlParams);
4335
- const batch = body['batch'];
4336
- const inputConfig = batch['inputConfig'];
4337
- const requestsWrapper = inputConfig['requests'];
4338
- const requests = requestsWrapper['requests'];
4339
- const newRequests = [];
4340
- delete requestsWrapper['config']; // Remove top-level config
4341
- for (const request of requests) {
4342
- const requestDict = Object.assign({}, request); // Clone
4343
- const innerRequest = requestDict['request'];
4344
- for (const key in requestDict) {
4345
- if (key !== 'request') {
4346
- innerRequest[key] = requestDict[key];
4347
- delete requestDict[key];
4348
- }
4349
- }
4350
- newRequests.push(requestDict);
4351
- }
4352
- requestsWrapper['requests'] = newRequests;
4353
- delete body['config'];
4354
- delete body['_url'];
4355
- delete body['_query'];
4356
- return { path, body };
4357
- }
4358
4408
  // Helper function to get the first GCS URI
4359
4409
  getGcsUri(src) {
4360
4410
  if (typeof src === 'string') {
@@ -5019,6 +5069,17 @@ function getCachedContentParametersToVertex(apiClient, fromObject) {
5019
5069
  }
5020
5070
  return toObject;
5021
5071
  }
5072
+ function googleMapsToMldev$3(fromObject) {
5073
+ const toObject = {};
5074
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
5075
+ throw new Error('authConfig parameter is not supported in Gemini API.');
5076
+ }
5077
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
5078
+ if (fromEnableWidget != null) {
5079
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
5080
+ }
5081
+ return toObject;
5082
+ }
5022
5083
  function googleSearchToMldev$3(fromObject) {
5023
5084
  const toObject = {};
5024
5085
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -5212,8 +5273,9 @@ function toolToMldev$3(fromObject) {
5212
5273
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5213
5274
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5214
5275
  }
5215
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
5216
- throw new Error('googleMaps parameter is not supported in Gemini API.');
5276
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5277
+ if (fromGoogleMaps != null) {
5278
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5217
5279
  }
5218
5280
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5219
5281
  if (fromUrlContext != null) {
@@ -6119,7 +6181,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6119
6181
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6120
6182
  const USER_AGENT_HEADER = 'User-Agent';
6121
6183
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6122
- const SDK_VERSION = '1.23.0'; // x-release-please-version
6184
+ const SDK_VERSION = '1.25.0'; // x-release-please-version
6123
6185
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6124
6186
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6125
6187
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -7393,6 +7455,17 @@ function generationConfigToVertex$1(fromObject) {
7393
7455
  }
7394
7456
  return toObject;
7395
7457
  }
7458
+ function googleMapsToMldev$2(fromObject) {
7459
+ const toObject = {};
7460
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
7461
+ throw new Error('authConfig parameter is not supported in Gemini API.');
7462
+ }
7463
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
7464
+ if (fromEnableWidget != null) {
7465
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
7466
+ }
7467
+ return toObject;
7468
+ }
7396
7469
  function googleSearchToMldev$2(fromObject) {
7397
7470
  const toObject = {};
7398
7471
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -7912,8 +7985,9 @@ function toolToMldev$2(fromObject) {
7912
7985
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7913
7986
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7914
7987
  }
7915
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
7916
- throw new Error('googleMaps parameter is not supported in Gemini API.');
7988
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7989
+ if (fromGoogleMaps != null) {
7990
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7917
7991
  }
7918
7992
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7919
7993
  if (fromUrlContext != null) {
@@ -9902,7 +9976,7 @@ function generatedImageMaskFromVertex(fromObject) {
9902
9976
  }
9903
9977
  function generatedVideoFromMldev(fromObject) {
9904
9978
  const toObject = {};
9905
- const fromVideo = getValueByPath(fromObject, ['_self']);
9979
+ const fromVideo = getValueByPath(fromObject, ['video']);
9906
9980
  if (fromVideo != null) {
9907
9981
  setValueByPath(toObject, ['video'], videoFromMldev(fromVideo));
9908
9982
  }
@@ -10056,6 +10130,17 @@ function getModelParametersToVertex(apiClient, fromObject) {
10056
10130
  }
10057
10131
  return toObject;
10058
10132
  }
10133
+ function googleMapsToMldev$1(fromObject) {
10134
+ const toObject = {};
10135
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
10136
+ throw new Error('authConfig parameter is not supported in Gemini API.');
10137
+ }
10138
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
10139
+ if (fromEnableWidget != null) {
10140
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
10141
+ }
10142
+ return toObject;
10143
+ }
10059
10144
  function googleSearchToMldev$1(fromObject) {
10060
10145
  const toObject = {};
10061
10146
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -10770,8 +10855,9 @@ function toolToMldev$1(fromObject) {
10770
10855
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10771
10856
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10772
10857
  }
10773
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
10774
- throw new Error('googleMaps parameter is not supported in Gemini API.');
10858
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10859
+ if (fromGoogleMaps != null) {
10860
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10775
10861
  }
10776
10862
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10777
10863
  if (fromUrlContext != null) {
@@ -11036,14 +11122,11 @@ function upscaleImageResponseFromVertex(fromObject) {
11036
11122
  }
11037
11123
  function videoFromMldev(fromObject) {
11038
11124
  const toObject = {};
11039
- const fromUri = getValueByPath(fromObject, ['video', 'uri']);
11125
+ const fromUri = getValueByPath(fromObject, ['uri']);
11040
11126
  if (fromUri != null) {
11041
11127
  setValueByPath(toObject, ['uri'], fromUri);
11042
11128
  }
11043
- const fromVideoBytes = getValueByPath(fromObject, [
11044
- 'video',
11045
- 'encodedVideo',
11046
- ]);
11129
+ const fromVideoBytes = getValueByPath(fromObject, ['encodedVideo']);
11047
11130
  if (fromVideoBytes != null) {
11048
11131
  setValueByPath(toObject, ['videoBytes'], tBytes(fromVideoBytes));
11049
11132
  }
@@ -11115,11 +11198,11 @@ function videoToMldev(fromObject) {
11115
11198
  const toObject = {};
11116
11199
  const fromUri = getValueByPath(fromObject, ['uri']);
11117
11200
  if (fromUri != null) {
11118
- setValueByPath(toObject, ['video', 'uri'], fromUri);
11201
+ setValueByPath(toObject, ['uri'], fromUri);
11119
11202
  }
11120
11203
  const fromVideoBytes = getValueByPath(fromObject, ['videoBytes']);
11121
11204
  if (fromVideoBytes != null) {
11122
- setValueByPath(toObject, ['video', 'encodedVideo'], tBytes(fromVideoBytes));
11205
+ setValueByPath(toObject, ['encodedVideo'], tBytes(fromVideoBytes));
11123
11206
  }
11124
11207
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
11125
11208
  if (fromMimeType != null) {
@@ -12357,9 +12440,26 @@ class Models extends BaseModule {
12357
12440
  * ```
12358
12441
  */
12359
12442
  this.generateVideos = async (params) => {
12443
+ var _a, _b, _c, _d, _e, _f;
12360
12444
  if ((params.prompt || params.image || params.video) && params.source) {
12361
12445
  throw new Error('Source and prompt/image/video are mutually exclusive. Please only use source.');
12362
12446
  }
12447
+ // Gemini API does not support video bytes.
12448
+ if (!this.apiClient.isVertexAI()) {
12449
+ if (((_a = params.video) === null || _a === void 0 ? void 0 : _a.uri) && ((_b = params.video) === null || _b === void 0 ? void 0 : _b.videoBytes)) {
12450
+ params.video = {
12451
+ uri: params.video.uri,
12452
+ mimeType: params.video.mimeType,
12453
+ };
12454
+ }
12455
+ else if (((_d = (_c = params.source) === null || _c === void 0 ? void 0 : _c.video) === null || _d === void 0 ? void 0 : _d.uri) &&
12456
+ ((_f = (_e = params.source) === null || _e === void 0 ? void 0 : _e.video) === null || _f === void 0 ? void 0 : _f.videoBytes)) {
12457
+ params.source.video = {
12458
+ uri: params.source.video.uri,
12459
+ mimeType: params.source.video.mimeType,
12460
+ };
12461
+ }
12462
+ }
12363
12463
  return await this.generateVideosInternal(params);
12364
12464
  };
12365
12465
  }
@@ -13785,6 +13885,17 @@ function fileDataToMldev(fromObject) {
13785
13885
  }
13786
13886
  return toObject;
13787
13887
  }
13888
+ function googleMapsToMldev(fromObject) {
13889
+ const toObject = {};
13890
+ if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
13891
+ throw new Error('authConfig parameter is not supported in Gemini API.');
13892
+ }
13893
+ const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
13894
+ if (fromEnableWidget != null) {
13895
+ setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
13896
+ }
13897
+ return toObject;
13898
+ }
13788
13899
  function googleSearchToMldev(fromObject) {
13789
13900
  const toObject = {};
13790
13901
  const fromTimeRangeFilter = getValueByPath(fromObject, [
@@ -14015,8 +14126,9 @@ function toolToMldev(fromObject) {
14015
14126
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14016
14127
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14017
14128
  }
14018
- if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
14019
- throw new Error('googleMaps parameter is not supported in Gemini API.');
14129
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
14130
+ if (fromGoogleMaps != null) {
14131
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14020
14132
  }
14021
14133
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
14022
14134
  if (fromUrlContext != null) {