@google/genai 1.17.0 → 1.19.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.
@@ -151,7 +151,16 @@ function setValueByPath(data, keys, value) {
151
151
  }
152
152
  }
153
153
  else {
154
- data[keyToSet] = value;
154
+ if (keyToSet === '_self' &&
155
+ typeof value === 'object' &&
156
+ value !== null &&
157
+ !Array.isArray(value)) {
158
+ const valueAsRecord = value;
159
+ Object.assign(data, valueAsRecord);
160
+ }
161
+ else {
162
+ data[keyToSet] = value;
163
+ }
155
164
  }
156
165
  }
157
166
  function getValueByPath(data, keys) {
@@ -210,6 +219,216 @@ function tBytes$1(fromBytes) {
210
219
  * SPDX-License-Identifier: Apache-2.0
211
220
  */
212
221
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
222
+ function getOperationParametersToMldev(fromObject) {
223
+ const toObject = {};
224
+ const fromOperationName = getValueByPath(fromObject, [
225
+ 'operationName',
226
+ ]);
227
+ if (fromOperationName != null) {
228
+ setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
229
+ }
230
+ const fromConfig = getValueByPath(fromObject, ['config']);
231
+ if (fromConfig != null) {
232
+ setValueByPath(toObject, ['config'], fromConfig);
233
+ }
234
+ return toObject;
235
+ }
236
+ function fetchPredictOperationParametersToVertex(fromObject) {
237
+ const toObject = {};
238
+ const fromOperationName = getValueByPath(fromObject, [
239
+ 'operationName',
240
+ ]);
241
+ if (fromOperationName != null) {
242
+ setValueByPath(toObject, ['operationName'], fromOperationName);
243
+ }
244
+ const fromResourceName = getValueByPath(fromObject, ['resourceName']);
245
+ if (fromResourceName != null) {
246
+ setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
247
+ }
248
+ const fromConfig = getValueByPath(fromObject, ['config']);
249
+ if (fromConfig != null) {
250
+ setValueByPath(toObject, ['config'], fromConfig);
251
+ }
252
+ return toObject;
253
+ }
254
+ function getOperationParametersToVertex(fromObject) {
255
+ const toObject = {};
256
+ const fromOperationName = getValueByPath(fromObject, [
257
+ 'operationName',
258
+ ]);
259
+ if (fromOperationName != null) {
260
+ setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
261
+ }
262
+ const fromConfig = getValueByPath(fromObject, ['config']);
263
+ if (fromConfig != null) {
264
+ setValueByPath(toObject, ['config'], fromConfig);
265
+ }
266
+ return toObject;
267
+ }
268
+ function videoFromMldev$1(fromObject) {
269
+ const toObject = {};
270
+ const fromUri = getValueByPath(fromObject, ['video', 'uri']);
271
+ if (fromUri != null) {
272
+ setValueByPath(toObject, ['uri'], fromUri);
273
+ }
274
+ const fromVideoBytes = getValueByPath(fromObject, [
275
+ 'video',
276
+ 'encodedVideo',
277
+ ]);
278
+ if (fromVideoBytes != null) {
279
+ setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
280
+ }
281
+ const fromMimeType = getValueByPath(fromObject, ['encoding']);
282
+ if (fromMimeType != null) {
283
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
284
+ }
285
+ return toObject;
286
+ }
287
+ function generatedVideoFromMldev$1(fromObject) {
288
+ const toObject = {};
289
+ const fromVideo = getValueByPath(fromObject, ['_self']);
290
+ if (fromVideo != null) {
291
+ setValueByPath(toObject, ['video'], videoFromMldev$1(fromVideo));
292
+ }
293
+ return toObject;
294
+ }
295
+ function generateVideosResponseFromMldev$1(fromObject) {
296
+ const toObject = {};
297
+ const fromGeneratedVideos = getValueByPath(fromObject, [
298
+ 'generatedSamples',
299
+ ]);
300
+ if (fromGeneratedVideos != null) {
301
+ let transformedList = fromGeneratedVideos;
302
+ if (Array.isArray(transformedList)) {
303
+ transformedList = transformedList.map((item) => {
304
+ return generatedVideoFromMldev$1(item);
305
+ });
306
+ }
307
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
308
+ }
309
+ const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
310
+ 'raiMediaFilteredCount',
311
+ ]);
312
+ if (fromRaiMediaFilteredCount != null) {
313
+ setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
314
+ }
315
+ const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
316
+ 'raiMediaFilteredReasons',
317
+ ]);
318
+ if (fromRaiMediaFilteredReasons != null) {
319
+ setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
320
+ }
321
+ return toObject;
322
+ }
323
+ function generateVideosOperationFromMldev$1(fromObject) {
324
+ const toObject = {};
325
+ const fromName = getValueByPath(fromObject, ['name']);
326
+ if (fromName != null) {
327
+ setValueByPath(toObject, ['name'], fromName);
328
+ }
329
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
330
+ if (fromMetadata != null) {
331
+ setValueByPath(toObject, ['metadata'], fromMetadata);
332
+ }
333
+ const fromDone = getValueByPath(fromObject, ['done']);
334
+ if (fromDone != null) {
335
+ setValueByPath(toObject, ['done'], fromDone);
336
+ }
337
+ const fromError = getValueByPath(fromObject, ['error']);
338
+ if (fromError != null) {
339
+ setValueByPath(toObject, ['error'], fromError);
340
+ }
341
+ const fromResponse = getValueByPath(fromObject, [
342
+ 'response',
343
+ 'generateVideoResponse',
344
+ ]);
345
+ if (fromResponse != null) {
346
+ setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(fromResponse));
347
+ }
348
+ return toObject;
349
+ }
350
+ function videoFromVertex$1(fromObject) {
351
+ const toObject = {};
352
+ const fromUri = getValueByPath(fromObject, ['gcsUri']);
353
+ if (fromUri != null) {
354
+ setValueByPath(toObject, ['uri'], fromUri);
355
+ }
356
+ const fromVideoBytes = getValueByPath(fromObject, [
357
+ 'bytesBase64Encoded',
358
+ ]);
359
+ if (fromVideoBytes != null) {
360
+ setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
361
+ }
362
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
363
+ if (fromMimeType != null) {
364
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
365
+ }
366
+ return toObject;
367
+ }
368
+ function generatedVideoFromVertex$1(fromObject) {
369
+ const toObject = {};
370
+ const fromVideo = getValueByPath(fromObject, ['_self']);
371
+ if (fromVideo != null) {
372
+ setValueByPath(toObject, ['video'], videoFromVertex$1(fromVideo));
373
+ }
374
+ return toObject;
375
+ }
376
+ function generateVideosResponseFromVertex$1(fromObject) {
377
+ const toObject = {};
378
+ const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
379
+ if (fromGeneratedVideos != null) {
380
+ let transformedList = fromGeneratedVideos;
381
+ if (Array.isArray(transformedList)) {
382
+ transformedList = transformedList.map((item) => {
383
+ return generatedVideoFromVertex$1(item);
384
+ });
385
+ }
386
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
387
+ }
388
+ const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
389
+ 'raiMediaFilteredCount',
390
+ ]);
391
+ if (fromRaiMediaFilteredCount != null) {
392
+ setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
393
+ }
394
+ const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
395
+ 'raiMediaFilteredReasons',
396
+ ]);
397
+ if (fromRaiMediaFilteredReasons != null) {
398
+ setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
399
+ }
400
+ return toObject;
401
+ }
402
+ function generateVideosOperationFromVertex$1(fromObject) {
403
+ const toObject = {};
404
+ const fromName = getValueByPath(fromObject, ['name']);
405
+ if (fromName != null) {
406
+ setValueByPath(toObject, ['name'], fromName);
407
+ }
408
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
409
+ if (fromMetadata != null) {
410
+ setValueByPath(toObject, ['metadata'], fromMetadata);
411
+ }
412
+ const fromDone = getValueByPath(fromObject, ['done']);
413
+ if (fromDone != null) {
414
+ setValueByPath(toObject, ['done'], fromDone);
415
+ }
416
+ const fromError = getValueByPath(fromObject, ['error']);
417
+ if (fromError != null) {
418
+ setValueByPath(toObject, ['error'], fromError);
419
+ }
420
+ const fromResponse = getValueByPath(fromObject, ['response']);
421
+ if (fromResponse != null) {
422
+ setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(fromResponse));
423
+ }
424
+ return toObject;
425
+ }
426
+
427
+ /**
428
+ * @license
429
+ * Copyright 2025 Google LLC
430
+ * SPDX-License-Identifier: Apache-2.0
431
+ */
213
432
  /** Required. Outcome of the code execution. */
214
433
  var Outcome;
215
434
  (function (Outcome) {
@@ -1601,54 +1820,15 @@ class GenerateVideosOperation {
1601
1820
  */
1602
1821
  _fromAPIResponse({ apiResponse, isVertexAI, }) {
1603
1822
  const operation = new GenerateVideosOperation();
1604
- operation.name = apiResponse['name'];
1605
- operation.metadata = apiResponse['metadata'];
1606
- operation.done = apiResponse['done'];
1607
- operation.error = apiResponse['error'];
1823
+ let response;
1824
+ const op = apiResponse;
1608
1825
  if (isVertexAI) {
1609
- const response = apiResponse['response'];
1610
- if (response) {
1611
- const operationResponse = new GenerateVideosResponse();
1612
- const responseVideos = response['videos'];
1613
- operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
1614
- return {
1615
- video: {
1616
- uri: generatedVideo['gcsUri'],
1617
- videoBytes: generatedVideo['bytesBase64Encoded']
1618
- ? tBytes$1(generatedVideo['bytesBase64Encoded'])
1619
- : undefined,
1620
- mimeType: generatedVideo['mimeType'],
1621
- },
1622
- };
1623
- });
1624
- operationResponse.raiMediaFilteredCount = response['raiMediaFilteredCount'];
1625
- operationResponse.raiMediaFilteredReasons = response['raiMediaFilteredReasons'];
1626
- operation.response = operationResponse;
1627
- }
1826
+ response = generateVideosOperationFromVertex$1(op);
1628
1827
  }
1629
1828
  else {
1630
- const response = apiResponse['response'];
1631
- if (response) {
1632
- const operationResponse = new GenerateVideosResponse();
1633
- const generatedVideoResponse = response['generateVideoResponse'];
1634
- const responseVideos = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['generatedSamples'];
1635
- operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
1636
- const video = generatedVideo['video'];
1637
- return {
1638
- video: {
1639
- uri: video === null || video === void 0 ? void 0 : video['uri'],
1640
- videoBytes: (video === null || video === void 0 ? void 0 : video['encodedVideo'])
1641
- ? tBytes$1(video === null || video === void 0 ? void 0 : video['encodedVideo'])
1642
- : undefined,
1643
- mimeType: generatedVideo['encoding'],
1644
- },
1645
- };
1646
- });
1647
- operationResponse.raiMediaFilteredCount = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredCount'];
1648
- operationResponse.raiMediaFilteredReasons = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredReasons'];
1649
- operation.response = operationResponse;
1650
- }
1829
+ response = generateVideosOperationFromMldev$1(op);
1651
1830
  }
1831
+ Object.assign(operation, response);
1652
1832
  return operation;
1653
1833
  }
1654
1834
  }
@@ -1672,6 +1852,12 @@ class DeleteFileResponse {
1672
1852
  /** Config for `inlined_responses` parameter. */
1673
1853
  class InlinedResponse {
1674
1854
  }
1855
+ /** Config for `response` parameter. */
1856
+ class SingleEmbedContentResponse {
1857
+ }
1858
+ /** Config for `inlined_embedding_responses` parameter. */
1859
+ class InlinedEmbedContentResponse {
1860
+ }
1675
1861
  /** Config for batches.list return value. */
1676
1862
  class ListBatchJobsResponse {
1677
1863
  }
@@ -2523,51 +2709,59 @@ function mcpToolsToGeminiTool(mcpTools, config = {}) {
2523
2709
  return { functionDeclarations: functionDeclarations };
2524
2710
  }
2525
2711
  // Transforms a source input into a BatchJobSource object with validation.
2526
- function tBatchJobSource(apiClient, src) {
2527
- if (typeof src !== 'string' && !Array.isArray(src)) {
2528
- if (apiClient && apiClient.isVertexAI()) {
2529
- if (src.gcsUri && src.bigqueryUri) {
2530
- throw new Error('Only one of `gcsUri` or `bigqueryUri` can be set.');
2712
+ function tBatchJobSource(client, src) {
2713
+ let sourceObj;
2714
+ if (typeof src === 'string') {
2715
+ if (client.isVertexAI()) {
2716
+ if (src.startsWith('gs://')) {
2717
+ sourceObj = { format: 'jsonl', gcsUri: [src] };
2718
+ }
2719
+ else if (src.startsWith('bq://')) {
2720
+ sourceObj = { format: 'bigquery', bigqueryUri: src };
2531
2721
  }
2532
- else if (!src.gcsUri && !src.bigqueryUri) {
2533
- throw new Error('One of `gcsUri` or `bigqueryUri` must be set.');
2722
+ else {
2723
+ throw new Error(`Unsupported string source for Vertex AI: ${src}`);
2534
2724
  }
2535
2725
  }
2536
2726
  else {
2537
- // Logic for non-Vertex AI client (inlined_requests, file_name)
2538
- if (src.inlinedRequests && src.fileName) {
2539
- throw new Error('Only one of `inlinedRequests` or `fileName` can be set.');
2727
+ // MLDEV
2728
+ if (src.startsWith('files/')) {
2729
+ sourceObj = { fileName: src }; // Default to fileName for string input
2540
2730
  }
2541
- else if (!src.inlinedRequests && !src.fileName) {
2542
- throw new Error('One of `inlinedRequests` or `fileName` must be set.');
2731
+ else {
2732
+ throw new Error(`Unsupported string source for Gemini API: ${src}`);
2543
2733
  }
2544
2734
  }
2545
- return src;
2546
2735
  }
2547
- // If src is an array (list in Python)
2548
2736
  else if (Array.isArray(src)) {
2549
- return { inlinedRequests: src };
2550
- }
2551
- else if (typeof src === 'string') {
2552
- if (src.startsWith('gs://')) {
2553
- return {
2554
- format: 'jsonl',
2555
- gcsUri: [src], // GCS URI is expected as an array
2556
- };
2737
+ if (client.isVertexAI()) {
2738
+ throw new Error('InlinedRequest[] is not supported in Vertex AI.');
2557
2739
  }
2558
- else if (src.startsWith('bq://')) {
2559
- return {
2560
- format: 'bigquery',
2561
- bigqueryUri: src,
2562
- };
2740
+ sourceObj = { inlinedRequests: src };
2741
+ }
2742
+ else {
2743
+ // It's already a BatchJobSource object
2744
+ sourceObj = src;
2745
+ }
2746
+ // Validation logic
2747
+ const vertexSourcesCount = [sourceObj.gcsUri, sourceObj.bigqueryUri].filter(Boolean).length;
2748
+ const mldevSourcesCount = [
2749
+ sourceObj.inlinedRequests,
2750
+ sourceObj.fileName,
2751
+ ].filter(Boolean).length;
2752
+ if (client.isVertexAI()) {
2753
+ if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
2754
+ throw new Error('Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.');
2563
2755
  }
2564
- else if (src.startsWith('files/')) {
2565
- return {
2566
- fileName: src,
2567
- };
2756
+ }
2757
+ else {
2758
+ // MLDEV
2759
+ if (vertexSourcesCount > 0 || mldevSourcesCount !== 1) {
2760
+ throw new Error('Exactly one of `inlinedRequests`, `fileName`, ' +
2761
+ 'must be set for Gemini API.');
2568
2762
  }
2569
2763
  }
2570
- throw new Error(`Unsupported source: ${src}`);
2764
+ return sourceObj;
2571
2765
  }
2572
2766
  function tBatchJobDestination(dest) {
2573
2767
  if (typeof dest !== 'string') {
@@ -2590,6 +2784,52 @@ function tBatchJobDestination(dest) {
2590
2784
  throw new Error(`Unsupported destination: ${destString}`);
2591
2785
  }
2592
2786
  }
2787
+ function tRecvBatchJobDestination(dest) {
2788
+ // Ensure dest is a non-null object before proceeding.
2789
+ if (typeof dest !== 'object' || dest === null) {
2790
+ // If the input is not an object, it cannot be a valid BatchJobDestination
2791
+ // based on the operations performed. Return it cast, or handle as an error.
2792
+ // Casting an empty object might be a safe default.
2793
+ return {};
2794
+ }
2795
+ // Cast to Record<string, unknown> to allow string property access.
2796
+ const obj = dest;
2797
+ // Safely access nested properties.
2798
+ const inlineResponsesVal = obj['inlinedResponses'];
2799
+ if (typeof inlineResponsesVal !== 'object' || inlineResponsesVal === null) {
2800
+ return dest;
2801
+ }
2802
+ const inlineResponsesObj = inlineResponsesVal;
2803
+ const responsesArray = inlineResponsesObj['inlinedResponses'];
2804
+ if (!Array.isArray(responsesArray) || responsesArray.length === 0) {
2805
+ return dest;
2806
+ }
2807
+ // Check if any response has the 'embedding' property.
2808
+ let hasEmbedding = false;
2809
+ for (const responseItem of responsesArray) {
2810
+ if (typeof responseItem !== 'object' || responseItem === null) {
2811
+ continue;
2812
+ }
2813
+ const responseItemObj = responseItem;
2814
+ const responseVal = responseItemObj['response'];
2815
+ if (typeof responseVal !== 'object' || responseVal === null) {
2816
+ continue;
2817
+ }
2818
+ const responseObj = responseVal;
2819
+ // Check for the existence of the 'embedding' key.
2820
+ if (responseObj['embedding'] !== undefined) {
2821
+ hasEmbedding = true;
2822
+ break;
2823
+ }
2824
+ }
2825
+ // Perform the transformation if an embedding was found.
2826
+ if (hasEmbedding) {
2827
+ obj['inlinedEmbedContentResponses'] = obj['inlinedResponses'];
2828
+ delete obj['inlinedResponses'];
2829
+ }
2830
+ // Cast the (potentially) modified object to the target type.
2831
+ return dest;
2832
+ }
2593
2833
  function tBatchJobName(apiClient, name) {
2594
2834
  const nameString = name;
2595
2835
  if (!apiClient.isVertexAI()) {
@@ -2685,6 +2925,22 @@ function fileDataToMldev$4(fromObject) {
2685
2925
  }
2686
2926
  return toObject;
2687
2927
  }
2928
+ function functionCallToMldev$4(fromObject) {
2929
+ const toObject = {};
2930
+ const fromId = getValueByPath(fromObject, ['id']);
2931
+ if (fromId != null) {
2932
+ setValueByPath(toObject, ['id'], fromId);
2933
+ }
2934
+ const fromArgs = getValueByPath(fromObject, ['args']);
2935
+ if (fromArgs != null) {
2936
+ setValueByPath(toObject, ['args'], fromArgs);
2937
+ }
2938
+ const fromName = getValueByPath(fromObject, ['name']);
2939
+ if (fromName != null) {
2940
+ setValueByPath(toObject, ['name'], fromName);
2941
+ }
2942
+ return toObject;
2943
+ }
2688
2944
  function partToMldev$4(fromObject) {
2689
2945
  const toObject = {};
2690
2946
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -2711,6 +2967,10 @@ function partToMldev$4(fromObject) {
2711
2967
  if (fromThoughtSignature != null) {
2712
2968
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
2713
2969
  }
2970
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2971
+ if (fromFunctionCall != null) {
2972
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
2973
+ }
2714
2974
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2715
2975
  'codeExecutionResult',
2716
2976
  ]);
@@ -2723,10 +2983,6 @@ function partToMldev$4(fromObject) {
2723
2983
  if (fromExecutableCode != null) {
2724
2984
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2725
2985
  }
2726
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2727
- if (fromFunctionCall != null) {
2728
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
2729
- }
2730
2986
  const fromFunctionResponse = getValueByPath(fromObject, [
2731
2987
  'functionResponse',
2732
2988
  ]);
@@ -3351,18 +3607,92 @@ function batchJobSourceToMldev(apiClient, fromObject) {
3351
3607
  }
3352
3608
  return toObject;
3353
3609
  }
3354
- function createBatchJobConfigToMldev(fromObject, parentObject) {
3610
+ function createBatchJobConfigToMldev(fromObject, parentObject) {
3611
+ const toObject = {};
3612
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
3613
+ if (parentObject !== undefined && fromDisplayName != null) {
3614
+ setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
3615
+ }
3616
+ if (getValueByPath(fromObject, ['dest']) !== undefined) {
3617
+ throw new Error('dest parameter is not supported in Gemini API.');
3618
+ }
3619
+ return toObject;
3620
+ }
3621
+ function createBatchJobParametersToMldev(apiClient, fromObject) {
3622
+ const toObject = {};
3623
+ const fromModel = getValueByPath(fromObject, ['model']);
3624
+ if (fromModel != null) {
3625
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
3626
+ }
3627
+ const fromSrc = getValueByPath(fromObject, ['src']);
3628
+ if (fromSrc != null) {
3629
+ setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
3630
+ }
3631
+ const fromConfig = getValueByPath(fromObject, ['config']);
3632
+ if (fromConfig != null) {
3633
+ setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
3634
+ }
3635
+ return toObject;
3636
+ }
3637
+ function embedContentConfigToMldev$1(fromObject, parentObject) {
3638
+ const toObject = {};
3639
+ const fromTaskType = getValueByPath(fromObject, ['taskType']);
3640
+ if (parentObject !== undefined && fromTaskType != null) {
3641
+ setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
3642
+ }
3643
+ const fromTitle = getValueByPath(fromObject, ['title']);
3644
+ if (parentObject !== undefined && fromTitle != null) {
3645
+ setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
3646
+ }
3647
+ const fromOutputDimensionality = getValueByPath(fromObject, [
3648
+ 'outputDimensionality',
3649
+ ]);
3650
+ if (parentObject !== undefined && fromOutputDimensionality != null) {
3651
+ setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
3652
+ }
3653
+ if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
3654
+ throw new Error('mimeType parameter is not supported in Gemini API.');
3655
+ }
3656
+ if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
3657
+ throw new Error('autoTruncate parameter is not supported in Gemini API.');
3658
+ }
3659
+ return toObject;
3660
+ }
3661
+ function embedContentBatchToMldev(apiClient, fromObject) {
3662
+ const toObject = {};
3663
+ const fromContents = getValueByPath(fromObject, ['contents']);
3664
+ if (fromContents != null) {
3665
+ setValueByPath(toObject, ['requests[]', 'request', 'content'], tContentsForEmbed(apiClient, fromContents));
3666
+ }
3667
+ const fromConfig = getValueByPath(fromObject, ['config']);
3668
+ if (fromConfig != null) {
3669
+ setValueByPath(toObject, ['config'], embedContentConfigToMldev$1(fromConfig, toObject));
3670
+ }
3671
+ return toObject;
3672
+ }
3673
+ function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
3674
+ const toObject = {};
3675
+ const fromFileName = getValueByPath(fromObject, ['fileName']);
3676
+ if (fromFileName != null) {
3677
+ setValueByPath(toObject, ['file_name'], fromFileName);
3678
+ }
3679
+ const fromInlinedRequests = getValueByPath(fromObject, [
3680
+ 'inlinedRequests',
3681
+ ]);
3682
+ if (fromInlinedRequests != null) {
3683
+ setValueByPath(toObject, ['requests'], embedContentBatchToMldev(apiClient, fromInlinedRequests));
3684
+ }
3685
+ return toObject;
3686
+ }
3687
+ function createEmbeddingsBatchJobConfigToMldev(fromObject, parentObject) {
3355
3688
  const toObject = {};
3356
3689
  const fromDisplayName = getValueByPath(fromObject, ['displayName']);
3357
3690
  if (parentObject !== undefined && fromDisplayName != null) {
3358
3691
  setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
3359
3692
  }
3360
- if (getValueByPath(fromObject, ['dest']) !== undefined) {
3361
- throw new Error('dest parameter is not supported in Gemini API.');
3362
- }
3363
3693
  return toObject;
3364
3694
  }
3365
- function createBatchJobParametersToMldev(apiClient, fromObject) {
3695
+ function createEmbeddingsBatchJobParametersToMldev(apiClient, fromObject) {
3366
3696
  const toObject = {};
3367
3697
  const fromModel = getValueByPath(fromObject, ['model']);
3368
3698
  if (fromModel != null) {
@@ -3370,11 +3700,11 @@ function createBatchJobParametersToMldev(apiClient, fromObject) {
3370
3700
  }
3371
3701
  const fromSrc = getValueByPath(fromObject, ['src']);
3372
3702
  if (fromSrc != null) {
3373
- setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
3703
+ setValueByPath(toObject, ['batch', 'inputConfig'], embeddingsBatchJobSourceToMldev(apiClient, fromSrc));
3374
3704
  }
3375
3705
  const fromConfig = getValueByPath(fromObject, ['config']);
3376
3706
  if (fromConfig != null) {
3377
- setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
3707
+ setValueByPath(toObject, ['config'], createEmbeddingsBatchJobConfigToMldev(fromConfig, toObject));
3378
3708
  }
3379
3709
  return toObject;
3380
3710
  }
@@ -3479,6 +3809,10 @@ function batchJobDestinationToVertex(fromObject) {
3479
3809
  if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
3480
3810
  throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
3481
3811
  }
3812
+ if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
3813
+ undefined) {
3814
+ throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
3815
+ }
3482
3816
  return toObject;
3483
3817
  }
3484
3818
  function createBatchJobConfigToVertex(fromObject, parentObject) {
@@ -3609,6 +3943,22 @@ function fileDataFromMldev$2(fromObject) {
3609
3943
  }
3610
3944
  return toObject;
3611
3945
  }
3946
+ function functionCallFromMldev$2(fromObject) {
3947
+ const toObject = {};
3948
+ const fromId = getValueByPath(fromObject, ['id']);
3949
+ if (fromId != null) {
3950
+ setValueByPath(toObject, ['id'], fromId);
3951
+ }
3952
+ const fromArgs = getValueByPath(fromObject, ['args']);
3953
+ if (fromArgs != null) {
3954
+ setValueByPath(toObject, ['args'], fromArgs);
3955
+ }
3956
+ const fromName = getValueByPath(fromObject, ['name']);
3957
+ if (fromName != null) {
3958
+ setValueByPath(toObject, ['name'], fromName);
3959
+ }
3960
+ return toObject;
3961
+ }
3612
3962
  function partFromMldev$2(fromObject) {
3613
3963
  const toObject = {};
3614
3964
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -3635,6 +3985,10 @@ function partFromMldev$2(fromObject) {
3635
3985
  if (fromThoughtSignature != null) {
3636
3986
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
3637
3987
  }
3988
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
3989
+ if (fromFunctionCall != null) {
3990
+ setValueByPath(toObject, ['functionCall'], functionCallFromMldev$2(fromFunctionCall));
3991
+ }
3638
3992
  const fromCodeExecutionResult = getValueByPath(fromObject, [
3639
3993
  'codeExecutionResult',
3640
3994
  ]);
@@ -3647,10 +4001,6 @@ function partFromMldev$2(fromObject) {
3647
4001
  if (fromExecutableCode != null) {
3648
4002
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
3649
4003
  }
3650
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
3651
- if (fromFunctionCall != null) {
3652
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
3653
- }
3654
4004
  const fromFunctionResponse = getValueByPath(fromObject, [
3655
4005
  'functionResponse',
3656
4006
  ]);
@@ -3839,6 +4189,38 @@ function inlinedResponseFromMldev(fromObject) {
3839
4189
  }
3840
4190
  return toObject;
3841
4191
  }
4192
+ function contentEmbeddingFromMldev$1(fromObject) {
4193
+ const toObject = {};
4194
+ const fromValues = getValueByPath(fromObject, ['values']);
4195
+ if (fromValues != null) {
4196
+ setValueByPath(toObject, ['values'], fromValues);
4197
+ }
4198
+ return toObject;
4199
+ }
4200
+ function singleEmbedContentResponseFromMldev(fromObject) {
4201
+ const toObject = {};
4202
+ const fromEmbedding = getValueByPath(fromObject, ['embedding']);
4203
+ if (fromEmbedding != null) {
4204
+ setValueByPath(toObject, ['embedding'], contentEmbeddingFromMldev$1(fromEmbedding));
4205
+ }
4206
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
4207
+ if (fromTokenCount != null) {
4208
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
4209
+ }
4210
+ return toObject;
4211
+ }
4212
+ function inlinedEmbedContentResponseFromMldev(fromObject) {
4213
+ const toObject = {};
4214
+ const fromResponse = getValueByPath(fromObject, ['response']);
4215
+ if (fromResponse != null) {
4216
+ setValueByPath(toObject, ['response'], singleEmbedContentResponseFromMldev(fromResponse));
4217
+ }
4218
+ const fromError = getValueByPath(fromObject, ['error']);
4219
+ if (fromError != null) {
4220
+ setValueByPath(toObject, ['error'], jobErrorFromMldev(fromError));
4221
+ }
4222
+ return toObject;
4223
+ }
3842
4224
  function batchJobDestinationFromMldev(fromObject) {
3843
4225
  const toObject = {};
3844
4226
  const fromFileName = getValueByPath(fromObject, ['responsesFile']);
@@ -3858,6 +4240,19 @@ function batchJobDestinationFromMldev(fromObject) {
3858
4240
  }
3859
4241
  setValueByPath(toObject, ['inlinedResponses'], transformedList);
3860
4242
  }
4243
+ const fromInlinedEmbedContentResponses = getValueByPath(fromObject, [
4244
+ 'inlinedEmbedContentResponses',
4245
+ 'inlinedResponses',
4246
+ ]);
4247
+ if (fromInlinedEmbedContentResponses != null) {
4248
+ let transformedList = fromInlinedEmbedContentResponses;
4249
+ if (Array.isArray(transformedList)) {
4250
+ transformedList = transformedList.map((item) => {
4251
+ return inlinedEmbedContentResponseFromMldev(item);
4252
+ });
4253
+ }
4254
+ setValueByPath(toObject, ['inlinedEmbedContentResponses'], transformedList);
4255
+ }
3861
4256
  return toObject;
3862
4257
  }
3863
4258
  function batchJobFromMldev(fromObject) {
@@ -3904,7 +4299,7 @@ function batchJobFromMldev(fromObject) {
3904
4299
  }
3905
4300
  const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
3906
4301
  if (fromDest != null) {
3907
- setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
4302
+ setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(tRecvBatchJobDestination(fromDest)));
3908
4303
  }
3909
4304
  return toObject;
3910
4305
  }
@@ -4057,7 +4452,7 @@ function batchJobFromVertex(fromObject) {
4057
4452
  }
4058
4453
  const fromDest = getValueByPath(fromObject, ['outputConfig']);
4059
4454
  if (fromDest != null) {
4060
- setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
4455
+ setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
4061
4456
  }
4062
4457
  return toObject;
4063
4458
  }
@@ -4323,79 +4718,87 @@ class Batches extends BaseModule {
4323
4718
  this.create = async (params) => {
4324
4719
  var _a, _b;
4325
4720
  if (this.apiClient.isVertexAI()) {
4326
- const timestamp = Date.now();
4327
- const timestampStr = timestamp.toString();
4328
- if (Array.isArray(params.src)) {
4329
- throw new Error('InlinedRequest[] is not supported in Vertex AI. Please use ' +
4330
- 'Google Cloud Storage URI or BigQuery URI instead.');
4331
- }
4332
- params.config = params.config || {};
4333
- if (params.config.displayName === undefined) {
4334
- params.config.displayName = 'genaiBatchJob_${timestampStr}';
4335
- }
4336
- if (params.config.dest === undefined && typeof params.src === 'string') {
4337
- if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
4338
- params.config.dest = `${params.src.slice(0, -6)}/dest`;
4339
- }
4340
- else if (params.src.startsWith('bq://')) {
4341
- params.config.dest =
4342
- `${params.src}_dest_${timestampStr}`;
4343
- }
4344
- else {
4345
- throw new Error('Unsupported source:' + params.src);
4346
- }
4347
- }
4721
+ // Format destination if not provided
4722
+ // Cast params.src as Vertex AI path does not handle InlinedRequest[]
4723
+ params.config = this.formatDestination(params.src, params.config);
4724
+ return this.createInternal(params);
4348
4725
  }
4349
- else {
4350
- if (Array.isArray(params.src) ||
4351
- (typeof params.src !== 'string' && params.src.inlinedRequests)) {
4352
- // Move system instruction to httpOptions extraBody.
4353
- let path = '';
4354
- let queryParams = {};
4355
- const body = createBatchJobParametersToMldev(this.apiClient, params);
4356
- path = formatMap('{model}:batchGenerateContent', body['_url']);
4357
- queryParams = body['_query'];
4358
- // Move system instruction to 'request':
4359
- // {'systemInstruction': system_instruction}
4360
- const batch = body['batch'];
4361
- const inputConfig = batch['inputConfig'];
4362
- const requestsWrapper = inputConfig['requests'];
4363
- const requests = requestsWrapper['requests'];
4364
- const newRequests = [];
4365
- for (const request of requests) {
4366
- const requestDict = request;
4367
- if (requestDict['systemInstruction']) {
4368
- const systemInstructionValue = requestDict['systemInstruction'];
4369
- delete requestDict['systemInstruction'];
4370
- const requestContent = requestDict['request'];
4371
- requestContent['systemInstruction'] = systemInstructionValue;
4372
- requestDict['request'] = requestContent;
4373
- }
4374
- newRequests.push(requestDict);
4375
- }
4376
- requestsWrapper['requests'] = newRequests;
4377
- delete body['config'];
4378
- delete body['_url'];
4379
- delete body['_query'];
4380
- const response = this.apiClient
4381
- .request({
4382
- path: path,
4383
- queryParams: queryParams,
4384
- body: JSON.stringify(body),
4385
- httpMethod: 'POST',
4386
- httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4387
- abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4388
- })
4389
- .then((httpResponse) => {
4390
- return httpResponse.json();
4391
- });
4392
- return response.then((apiResponse) => {
4393
- const resp = batchJobFromMldev(apiResponse);
4394
- return resp;
4395
- });
4396
- }
4726
+ // MLDEV
4727
+ const src = params.src;
4728
+ const is_inlined = Array.isArray(params.src) || src.inlinedRequests !== undefined;
4729
+ if (!is_inlined) {
4730
+ return this.createInternal(params);
4731
+ }
4732
+ // Inlined generate content requests handling
4733
+ const result = this.createInlinedGenerateContentRequest(params);
4734
+ const path = result.path;
4735
+ const requestBody = result.body;
4736
+ const queryParams = createBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
4737
+ const response = this.apiClient
4738
+ .request({
4739
+ path: path,
4740
+ queryParams: queryParams,
4741
+ body: JSON.stringify(requestBody),
4742
+ httpMethod: 'POST',
4743
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4744
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4745
+ })
4746
+ .then((httpResponse) => {
4747
+ return httpResponse.json();
4748
+ });
4749
+ return response.then((apiResponse) => {
4750
+ const resp = batchJobFromMldev(apiResponse);
4751
+ return resp;
4752
+ });
4753
+ };
4754
+ /**
4755
+ * **Experimental** Creates an embedding batch job.
4756
+ *
4757
+ * @param params - The parameters for create embedding batch job request.
4758
+ * @return The created batch job.
4759
+ *
4760
+ * @example
4761
+ * ```ts
4762
+ * const response = await ai.batches.createEmbeddings({
4763
+ * model: 'text-embedding-004',
4764
+ * src: {fileName: 'files/my_embedding_input'},
4765
+ * });
4766
+ * console.log(response);
4767
+ * ```
4768
+ */
4769
+ this.createEmbeddings = async (params) => {
4770
+ var _a, _b;
4771
+ console.warn('batches.createEmbeddings() is experimental and may change without notice.');
4772
+ if (this.apiClient.isVertexAI()) {
4773
+ throw new Error('Vertex AI does not support batches.createEmbeddings.');
4774
+ }
4775
+ // MLDEV
4776
+ const src = params.src;
4777
+ const is_inlined = src.inlinedRequests !== undefined;
4778
+ if (!is_inlined) {
4779
+ return this.createEmbeddingsInternal(params); // Fixed typo here
4397
4780
  }
4398
- return await this.createInternal(params);
4781
+ // Inlined embed content requests handling
4782
+ const result = this.createInlinedEmbedContentRequest(params);
4783
+ const path = result.path;
4784
+ const requestBody = result.body;
4785
+ const queryParams = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
4786
+ const response = this.apiClient
4787
+ .request({
4788
+ path: path,
4789
+ queryParams: queryParams,
4790
+ body: JSON.stringify(requestBody),
4791
+ httpMethod: 'POST',
4792
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4793
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4794
+ })
4795
+ .then((httpResponse) => {
4796
+ return httpResponse.json();
4797
+ });
4798
+ return response.then((apiResponse) => {
4799
+ const resp = batchJobFromMldev(apiResponse);
4800
+ return resp;
4801
+ });
4399
4802
  };
4400
4803
  /**
4401
4804
  * Lists batch job configurations.
@@ -4415,6 +4818,112 @@ class Batches extends BaseModule {
4415
4818
  return new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
4416
4819
  };
4417
4820
  }
4821
+ // Helper function to handle inlined generate content requests
4822
+ createInlinedGenerateContentRequest(params) {
4823
+ const body = createBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
4824
+ params);
4825
+ const urlParams = body['_url'];
4826
+ const path = formatMap('{model}:batchGenerateContent', urlParams);
4827
+ const batch = body['batch'];
4828
+ const inputConfig = batch['inputConfig'];
4829
+ const requestsWrapper = inputConfig['requests'];
4830
+ const requests = requestsWrapper['requests'];
4831
+ const newRequests = [];
4832
+ for (const request of requests) {
4833
+ const requestDict = Object.assign({}, request); // Clone
4834
+ if (requestDict['systemInstruction']) {
4835
+ const systemInstructionValue = requestDict['systemInstruction'];
4836
+ delete requestDict['systemInstruction'];
4837
+ const requestContent = requestDict['request'];
4838
+ requestContent['systemInstruction'] = systemInstructionValue;
4839
+ requestDict['request'] = requestContent;
4840
+ }
4841
+ newRequests.push(requestDict);
4842
+ }
4843
+ requestsWrapper['requests'] = newRequests;
4844
+ delete body['config'];
4845
+ delete body['_url'];
4846
+ delete body['_query'];
4847
+ return { path, body };
4848
+ }
4849
+ // Helper function to handle inlined embedding requests
4850
+ createInlinedEmbedContentRequest(params) {
4851
+ const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
4852
+ params);
4853
+ const urlParams = body['_url'];
4854
+ const path = formatMap('{model}:asyncBatchEmbedContent', urlParams);
4855
+ const batch = body['batch'];
4856
+ const inputConfig = batch['inputConfig'];
4857
+ const requestsWrapper = inputConfig['requests'];
4858
+ const requests = requestsWrapper['requests'];
4859
+ const newRequests = [];
4860
+ delete requestsWrapper['config']; // Remove top-level config
4861
+ for (const request of requests) {
4862
+ const requestDict = Object.assign({}, request); // Clone
4863
+ const innerRequest = requestDict['request'];
4864
+ for (const key in requestDict) {
4865
+ if (key !== 'request') {
4866
+ innerRequest[key] = requestDict[key];
4867
+ delete requestDict[key];
4868
+ }
4869
+ }
4870
+ newRequests.push(requestDict);
4871
+ }
4872
+ requestsWrapper['requests'] = newRequests;
4873
+ delete body['config'];
4874
+ delete body['_url'];
4875
+ delete body['_query'];
4876
+ return { path, body };
4877
+ }
4878
+ // Helper function to get the first GCS URI
4879
+ getGcsUri(src) {
4880
+ if (typeof src === 'string') {
4881
+ return src.startsWith('gs://') ? src : undefined;
4882
+ }
4883
+ if (!Array.isArray(src) && src.gcsUri && src.gcsUri.length > 0) {
4884
+ return src.gcsUri[0];
4885
+ }
4886
+ return undefined;
4887
+ }
4888
+ // Helper function to get the BigQuery URI
4889
+ getBigqueryUri(src) {
4890
+ if (typeof src === 'string') {
4891
+ return src.startsWith('bq://') ? src : undefined;
4892
+ }
4893
+ if (!Array.isArray(src)) {
4894
+ return src.bigqueryUri;
4895
+ }
4896
+ return undefined;
4897
+ }
4898
+ // Function to format the destination configuration for Vertex AI
4899
+ formatDestination(src, config) {
4900
+ const newConfig = config ? Object.assign({}, config) : {};
4901
+ const timestampStr = Date.now().toString();
4902
+ if (!newConfig.displayName) {
4903
+ newConfig.displayName = `genaiBatchJob_${timestampStr}`;
4904
+ }
4905
+ if (newConfig.dest === undefined) {
4906
+ const gcsUri = this.getGcsUri(src);
4907
+ const bigqueryUri = this.getBigqueryUri(src);
4908
+ if (gcsUri) {
4909
+ if (gcsUri.endsWith('.jsonl')) {
4910
+ // For .jsonl files, remove suffix and add /dest
4911
+ newConfig.dest = `${gcsUri.slice(0, -6)}/dest`;
4912
+ }
4913
+ else {
4914
+ // Fallback for other GCS URIs
4915
+ newConfig.dest = `${gcsUri}_dest_${timestampStr}`;
4916
+ }
4917
+ }
4918
+ else if (bigqueryUri) {
4919
+ newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
4920
+ }
4921
+ else {
4922
+ throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
4923
+ }
4924
+ }
4925
+ return newConfig;
4926
+ }
4418
4927
  /**
4419
4928
  * Internal method to create batch job.
4420
4929
  *
@@ -4476,6 +4985,46 @@ class Batches extends BaseModule {
4476
4985
  });
4477
4986
  }
4478
4987
  }
4988
+ /**
4989
+ * Internal method to create batch job.
4990
+ *
4991
+ * @param params - The parameters for create batch job request.
4992
+ * @return The created batch job.
4993
+ *
4994
+ */
4995
+ async createEmbeddingsInternal(params) {
4996
+ var _a, _b;
4997
+ let response;
4998
+ let path = '';
4999
+ let queryParams = {};
5000
+ if (this.apiClient.isVertexAI()) {
5001
+ throw new Error('This method is only supported by the Gemini Developer API.');
5002
+ }
5003
+ else {
5004
+ const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params);
5005
+ path = formatMap('{model}:asyncBatchEmbedContent', body['_url']);
5006
+ queryParams = body['_query'];
5007
+ delete body['config'];
5008
+ delete body['_url'];
5009
+ delete body['_query'];
5010
+ response = this.apiClient
5011
+ .request({
5012
+ path: path,
5013
+ queryParams: queryParams,
5014
+ body: JSON.stringify(body),
5015
+ httpMethod: 'POST',
5016
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
5017
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
5018
+ })
5019
+ .then((httpResponse) => {
5020
+ return httpResponse.json();
5021
+ });
5022
+ return response.then((apiResponse) => {
5023
+ const resp = batchJobFromMldev(apiResponse);
5024
+ return resp;
5025
+ });
5026
+ }
5027
+ }
4479
5028
  /**
4480
5029
  * Gets batch job configurations.
4481
5030
  *
@@ -4789,6 +5338,22 @@ function fileDataToMldev$3(fromObject) {
4789
5338
  }
4790
5339
  return toObject;
4791
5340
  }
5341
+ function functionCallToMldev$3(fromObject) {
5342
+ const toObject = {};
5343
+ const fromId = getValueByPath(fromObject, ['id']);
5344
+ if (fromId != null) {
5345
+ setValueByPath(toObject, ['id'], fromId);
5346
+ }
5347
+ const fromArgs = getValueByPath(fromObject, ['args']);
5348
+ if (fromArgs != null) {
5349
+ setValueByPath(toObject, ['args'], fromArgs);
5350
+ }
5351
+ const fromName = getValueByPath(fromObject, ['name']);
5352
+ if (fromName != null) {
5353
+ setValueByPath(toObject, ['name'], fromName);
5354
+ }
5355
+ return toObject;
5356
+ }
4792
5357
  function partToMldev$3(fromObject) {
4793
5358
  const toObject = {};
4794
5359
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -4815,6 +5380,10 @@ function partToMldev$3(fromObject) {
4815
5380
  if (fromThoughtSignature != null) {
4816
5381
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4817
5382
  }
5383
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5384
+ if (fromFunctionCall != null) {
5385
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
5386
+ }
4818
5387
  const fromCodeExecutionResult = getValueByPath(fromObject, [
4819
5388
  'codeExecutionResult',
4820
5389
  ]);
@@ -4827,10 +5396,6 @@ function partToMldev$3(fromObject) {
4827
5396
  if (fromExecutableCode != null) {
4828
5397
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4829
5398
  }
4830
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4831
- if (fromFunctionCall != null) {
4832
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4833
- }
4834
5399
  const fromFunctionResponse = getValueByPath(fromObject, [
4835
5400
  'functionResponse',
4836
5401
  ]);
@@ -5238,6 +5803,22 @@ function fileDataToVertex$2(fromObject) {
5238
5803
  }
5239
5804
  return toObject;
5240
5805
  }
5806
+ function functionCallToVertex$2(fromObject) {
5807
+ const toObject = {};
5808
+ const fromId = getValueByPath(fromObject, ['id']);
5809
+ if (fromId != null) {
5810
+ setValueByPath(toObject, ['id'], fromId);
5811
+ }
5812
+ const fromArgs = getValueByPath(fromObject, ['args']);
5813
+ if (fromArgs != null) {
5814
+ setValueByPath(toObject, ['args'], fromArgs);
5815
+ }
5816
+ const fromName = getValueByPath(fromObject, ['name']);
5817
+ if (fromName != null) {
5818
+ setValueByPath(toObject, ['name'], fromName);
5819
+ }
5820
+ return toObject;
5821
+ }
5241
5822
  function partToVertex$2(fromObject) {
5242
5823
  const toObject = {};
5243
5824
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -5264,6 +5845,10 @@ function partToVertex$2(fromObject) {
5264
5845
  if (fromThoughtSignature != null) {
5265
5846
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5266
5847
  }
5848
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5849
+ if (fromFunctionCall != null) {
5850
+ setValueByPath(toObject, ['functionCall'], functionCallToVertex$2(fromFunctionCall));
5851
+ }
5267
5852
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5268
5853
  'codeExecutionResult',
5269
5854
  ]);
@@ -5276,10 +5861,6 @@ function partToVertex$2(fromObject) {
5276
5861
  if (fromExecutableCode != null) {
5277
5862
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5278
5863
  }
5279
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5280
- if (fromFunctionCall != null) {
5281
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5282
- }
5283
5864
  const fromFunctionResponse = getValueByPath(fromObject, [
5284
5865
  'functionResponse',
5285
5866
  ]);
@@ -7309,6 +7890,22 @@ function fileDataToMldev$2(fromObject) {
7309
7890
  }
7310
7891
  return toObject;
7311
7892
  }
7893
+ function functionCallToMldev$2(fromObject) {
7894
+ const toObject = {};
7895
+ const fromId = getValueByPath(fromObject, ['id']);
7896
+ if (fromId != null) {
7897
+ setValueByPath(toObject, ['id'], fromId);
7898
+ }
7899
+ const fromArgs = getValueByPath(fromObject, ['args']);
7900
+ if (fromArgs != null) {
7901
+ setValueByPath(toObject, ['args'], fromArgs);
7902
+ }
7903
+ const fromName = getValueByPath(fromObject, ['name']);
7904
+ if (fromName != null) {
7905
+ setValueByPath(toObject, ['name'], fromName);
7906
+ }
7907
+ return toObject;
7908
+ }
7312
7909
  function partToMldev$2(fromObject) {
7313
7910
  const toObject = {};
7314
7911
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -7335,6 +7932,10 @@ function partToMldev$2(fromObject) {
7335
7932
  if (fromThoughtSignature != null) {
7336
7933
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7337
7934
  }
7935
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7936
+ if (fromFunctionCall != null) {
7937
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
7938
+ }
7338
7939
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7339
7940
  'codeExecutionResult',
7340
7941
  ]);
@@ -7347,10 +7948,6 @@ function partToMldev$2(fromObject) {
7347
7948
  if (fromExecutableCode != null) {
7348
7949
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7349
7950
  }
7350
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7351
- if (fromFunctionCall != null) {
7352
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
7353
- }
7354
7951
  const fromFunctionResponse = getValueByPath(fromObject, [
7355
7952
  'functionResponse',
7356
7953
  ]);
@@ -8013,6 +8610,22 @@ function fileDataToVertex$1(fromObject) {
8013
8610
  }
8014
8611
  return toObject;
8015
8612
  }
8613
+ function functionCallToVertex$1(fromObject) {
8614
+ const toObject = {};
8615
+ const fromId = getValueByPath(fromObject, ['id']);
8616
+ if (fromId != null) {
8617
+ setValueByPath(toObject, ['id'], fromId);
8618
+ }
8619
+ const fromArgs = getValueByPath(fromObject, ['args']);
8620
+ if (fromArgs != null) {
8621
+ setValueByPath(toObject, ['args'], fromArgs);
8622
+ }
8623
+ const fromName = getValueByPath(fromObject, ['name']);
8624
+ if (fromName != null) {
8625
+ setValueByPath(toObject, ['name'], fromName);
8626
+ }
8627
+ return toObject;
8628
+ }
8016
8629
  function partToVertex$1(fromObject) {
8017
8630
  const toObject = {};
8018
8631
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -8039,6 +8652,10 @@ function partToVertex$1(fromObject) {
8039
8652
  if (fromThoughtSignature != null) {
8040
8653
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
8041
8654
  }
8655
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
8656
+ if (fromFunctionCall != null) {
8657
+ setValueByPath(toObject, ['functionCall'], functionCallToVertex$1(fromFunctionCall));
8658
+ }
8042
8659
  const fromCodeExecutionResult = getValueByPath(fromObject, [
8043
8660
  'codeExecutionResult',
8044
8661
  ]);
@@ -8051,10 +8668,6 @@ function partToVertex$1(fromObject) {
8051
8668
  if (fromExecutableCode != null) {
8052
8669
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
8053
8670
  }
8054
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
8055
- if (fromFunctionCall != null) {
8056
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
8057
- }
8058
8671
  const fromFunctionResponse = getValueByPath(fromObject, [
8059
8672
  'functionResponse',
8060
8673
  ]);
@@ -8602,6 +9215,22 @@ function fileDataFromMldev$1(fromObject) {
8602
9215
  }
8603
9216
  return toObject;
8604
9217
  }
9218
+ function functionCallFromMldev$1(fromObject) {
9219
+ const toObject = {};
9220
+ const fromId = getValueByPath(fromObject, ['id']);
9221
+ if (fromId != null) {
9222
+ setValueByPath(toObject, ['id'], fromId);
9223
+ }
9224
+ const fromArgs = getValueByPath(fromObject, ['args']);
9225
+ if (fromArgs != null) {
9226
+ setValueByPath(toObject, ['args'], fromArgs);
9227
+ }
9228
+ const fromName = getValueByPath(fromObject, ['name']);
9229
+ if (fromName != null) {
9230
+ setValueByPath(toObject, ['name'], fromName);
9231
+ }
9232
+ return toObject;
9233
+ }
8605
9234
  function partFromMldev$1(fromObject) {
8606
9235
  const toObject = {};
8607
9236
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -8628,6 +9257,10 @@ function partFromMldev$1(fromObject) {
8628
9257
  if (fromThoughtSignature != null) {
8629
9258
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
8630
9259
  }
9260
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9261
+ if (fromFunctionCall != null) {
9262
+ setValueByPath(toObject, ['functionCall'], functionCallFromMldev$1(fromFunctionCall));
9263
+ }
8631
9264
  const fromCodeExecutionResult = getValueByPath(fromObject, [
8632
9265
  'codeExecutionResult',
8633
9266
  ]);
@@ -8640,10 +9273,6 @@ function partFromMldev$1(fromObject) {
8640
9273
  if (fromExecutableCode != null) {
8641
9274
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
8642
9275
  }
8643
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
8644
- if (fromFunctionCall != null) {
8645
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
8646
- }
8647
9276
  const fromFunctionResponse = getValueByPath(fromObject, [
8648
9277
  'functionResponse',
8649
9278
  ]);
@@ -8760,22 +9389,6 @@ function liveServerContentFromMldev(fromObject) {
8760
9389
  }
8761
9390
  return toObject;
8762
9391
  }
8763
- function functionCallFromMldev(fromObject) {
8764
- const toObject = {};
8765
- const fromId = getValueByPath(fromObject, ['id']);
8766
- if (fromId != null) {
8767
- setValueByPath(toObject, ['id'], fromId);
8768
- }
8769
- const fromArgs = getValueByPath(fromObject, ['args']);
8770
- if (fromArgs != null) {
8771
- setValueByPath(toObject, ['args'], fromArgs);
8772
- }
8773
- const fromName = getValueByPath(fromObject, ['name']);
8774
- if (fromName != null) {
8775
- setValueByPath(toObject, ['name'], fromName);
8776
- }
8777
- return toObject;
8778
- }
8779
9392
  function liveServerToolCallFromMldev(fromObject) {
8780
9393
  const toObject = {};
8781
9394
  const fromFunctionCalls = getValueByPath(fromObject, [
@@ -8785,7 +9398,7 @@ function liveServerToolCallFromMldev(fromObject) {
8785
9398
  let transformedList = fromFunctionCalls;
8786
9399
  if (Array.isArray(transformedList)) {
8787
9400
  transformedList = transformedList.map((item) => {
8788
- return functionCallFromMldev(item);
9401
+ return functionCallFromMldev$1(item);
8789
9402
  });
8790
9403
  }
8791
9404
  setValueByPath(toObject, ['functionCalls'], transformedList);
@@ -9196,6 +9809,22 @@ function fileDataFromVertex$1(fromObject) {
9196
9809
  }
9197
9810
  return toObject;
9198
9811
  }
9812
+ function functionCallFromVertex$1(fromObject) {
9813
+ const toObject = {};
9814
+ const fromId = getValueByPath(fromObject, ['id']);
9815
+ if (fromId != null) {
9816
+ setValueByPath(toObject, ['id'], fromId);
9817
+ }
9818
+ const fromArgs = getValueByPath(fromObject, ['args']);
9819
+ if (fromArgs != null) {
9820
+ setValueByPath(toObject, ['args'], fromArgs);
9821
+ }
9822
+ const fromName = getValueByPath(fromObject, ['name']);
9823
+ if (fromName != null) {
9824
+ setValueByPath(toObject, ['name'], fromName);
9825
+ }
9826
+ return toObject;
9827
+ }
9199
9828
  function partFromVertex$1(fromObject) {
9200
9829
  const toObject = {};
9201
9830
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -9222,6 +9851,10 @@ function partFromVertex$1(fromObject) {
9222
9851
  if (fromThoughtSignature != null) {
9223
9852
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
9224
9853
  }
9854
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9855
+ if (fromFunctionCall != null) {
9856
+ setValueByPath(toObject, ['functionCall'], functionCallFromVertex$1(fromFunctionCall));
9857
+ }
9225
9858
  const fromCodeExecutionResult = getValueByPath(fromObject, [
9226
9859
  'codeExecutionResult',
9227
9860
  ]);
@@ -9234,10 +9867,6 @@ function partFromVertex$1(fromObject) {
9234
9867
  if (fromExecutableCode != null) {
9235
9868
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9236
9869
  }
9237
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9238
- if (fromFunctionCall != null) {
9239
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
9240
- }
9241
9870
  const fromFunctionResponse = getValueByPath(fromObject, [
9242
9871
  'functionResponse',
9243
9872
  ]);
@@ -9320,18 +9949,6 @@ function liveServerContentFromVertex(fromObject) {
9320
9949
  }
9321
9950
  return toObject;
9322
9951
  }
9323
- function functionCallFromVertex(fromObject) {
9324
- const toObject = {};
9325
- const fromArgs = getValueByPath(fromObject, ['args']);
9326
- if (fromArgs != null) {
9327
- setValueByPath(toObject, ['args'], fromArgs);
9328
- }
9329
- const fromName = getValueByPath(fromObject, ['name']);
9330
- if (fromName != null) {
9331
- setValueByPath(toObject, ['name'], fromName);
9332
- }
9333
- return toObject;
9334
- }
9335
9952
  function liveServerToolCallFromVertex(fromObject) {
9336
9953
  const toObject = {};
9337
9954
  const fromFunctionCalls = getValueByPath(fromObject, [
@@ -9341,7 +9958,7 @@ function liveServerToolCallFromVertex(fromObject) {
9341
9958
  let transformedList = fromFunctionCalls;
9342
9959
  if (Array.isArray(transformedList)) {
9343
9960
  transformedList = transformedList.map((item) => {
9344
- return functionCallFromVertex(item);
9961
+ return functionCallFromVertex$1(item);
9345
9962
  });
9346
9963
  }
9347
9964
  setValueByPath(toObject, ['functionCalls'], transformedList);
@@ -9580,6 +10197,22 @@ function fileDataToMldev$1(fromObject) {
9580
10197
  }
9581
10198
  return toObject;
9582
10199
  }
10200
+ function functionCallToMldev$1(fromObject) {
10201
+ const toObject = {};
10202
+ const fromId = getValueByPath(fromObject, ['id']);
10203
+ if (fromId != null) {
10204
+ setValueByPath(toObject, ['id'], fromId);
10205
+ }
10206
+ const fromArgs = getValueByPath(fromObject, ['args']);
10207
+ if (fromArgs != null) {
10208
+ setValueByPath(toObject, ['args'], fromArgs);
10209
+ }
10210
+ const fromName = getValueByPath(fromObject, ['name']);
10211
+ if (fromName != null) {
10212
+ setValueByPath(toObject, ['name'], fromName);
10213
+ }
10214
+ return toObject;
10215
+ }
9583
10216
  function partToMldev$1(fromObject) {
9584
10217
  const toObject = {};
9585
10218
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -9606,6 +10239,10 @@ function partToMldev$1(fromObject) {
9606
10239
  if (fromThoughtSignature != null) {
9607
10240
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
9608
10241
  }
10242
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10243
+ if (fromFunctionCall != null) {
10244
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
10245
+ }
9609
10246
  const fromCodeExecutionResult = getValueByPath(fromObject, [
9610
10247
  'codeExecutionResult',
9611
10248
  ]);
@@ -9618,10 +10255,6 @@ function partToMldev$1(fromObject) {
9618
10255
  if (fromExecutableCode != null) {
9619
10256
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9620
10257
  }
9621
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9622
- if (fromFunctionCall != null) {
9623
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
9624
- }
9625
10258
  const fromFunctionResponse = getValueByPath(fromObject, [
9626
10259
  'functionResponse',
9627
10260
  ]);
@@ -10564,6 +11197,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
10564
11197
  if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
10565
11198
  throw new Error('referenceImages parameter is not supported in Gemini API.');
10566
11199
  }
11200
+ if (getValueByPath(fromObject, ['mask']) !== undefined) {
11201
+ throw new Error('mask parameter is not supported in Gemini API.');
11202
+ }
10567
11203
  if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
10568
11204
  throw new Error('compressionQuality parameter is not supported in Gemini API.');
10569
11205
  }
@@ -10644,6 +11280,22 @@ function fileDataToVertex(fromObject) {
10644
11280
  }
10645
11281
  return toObject;
10646
11282
  }
11283
+ function functionCallToVertex(fromObject) {
11284
+ const toObject = {};
11285
+ const fromId = getValueByPath(fromObject, ['id']);
11286
+ if (fromId != null) {
11287
+ setValueByPath(toObject, ['id'], fromId);
11288
+ }
11289
+ const fromArgs = getValueByPath(fromObject, ['args']);
11290
+ if (fromArgs != null) {
11291
+ setValueByPath(toObject, ['args'], fromArgs);
11292
+ }
11293
+ const fromName = getValueByPath(fromObject, ['name']);
11294
+ if (fromName != null) {
11295
+ setValueByPath(toObject, ['name'], fromName);
11296
+ }
11297
+ return toObject;
11298
+ }
10647
11299
  function partToVertex(fromObject) {
10648
11300
  const toObject = {};
10649
11301
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -10670,6 +11322,10 @@ function partToVertex(fromObject) {
10670
11322
  if (fromThoughtSignature != null) {
10671
11323
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
10672
11324
  }
11325
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
11326
+ if (fromFunctionCall != null) {
11327
+ setValueByPath(toObject, ['functionCall'], functionCallToVertex(fromFunctionCall));
11328
+ }
10673
11329
  const fromCodeExecutionResult = getValueByPath(fromObject, [
10674
11330
  'codeExecutionResult',
10675
11331
  ]);
@@ -10682,10 +11338,6 @@ function partToVertex(fromObject) {
10682
11338
  if (fromExecutableCode != null) {
10683
11339
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
10684
11340
  }
10685
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10686
- if (fromFunctionCall != null) {
10687
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
10688
- }
10689
11341
  const fromFunctionResponse = getValueByPath(fromObject, [
10690
11342
  'functionResponse',
10691
11343
  ]);
@@ -12156,6 +12808,18 @@ function videoGenerationReferenceImageToVertex(fromObject) {
12156
12808
  }
12157
12809
  return toObject;
12158
12810
  }
12811
+ function videoGenerationMaskToVertex(fromObject) {
12812
+ const toObject = {};
12813
+ const fromImage = getValueByPath(fromObject, ['image']);
12814
+ if (fromImage != null) {
12815
+ setValueByPath(toObject, ['_self'], imageToVertex(fromImage));
12816
+ }
12817
+ const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
12818
+ if (fromMaskMode != null) {
12819
+ setValueByPath(toObject, ['maskMode'], fromMaskMode);
12820
+ }
12821
+ return toObject;
12822
+ }
12159
12823
  function generateVideosConfigToVertex(fromObject, parentObject) {
12160
12824
  const toObject = {};
12161
12825
  const fromNumberOfVideos = getValueByPath(fromObject, [
@@ -12234,6 +12898,10 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
12234
12898
  }
12235
12899
  setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
12236
12900
  }
12901
+ const fromMask = getValueByPath(fromObject, ['mask']);
12902
+ if (parentObject !== undefined && fromMask != null) {
12903
+ setValueByPath(parentObject, ['instances[0]', 'mask'], videoGenerationMaskToVertex(fromMask));
12904
+ }
12237
12905
  const fromCompressionQuality = getValueByPath(fromObject, [
12238
12906
  'compressionQuality',
12239
12907
  ]);
@@ -12310,6 +12978,22 @@ function fileDataFromMldev(fromObject) {
12310
12978
  }
12311
12979
  return toObject;
12312
12980
  }
12981
+ function functionCallFromMldev(fromObject) {
12982
+ const toObject = {};
12983
+ const fromId = getValueByPath(fromObject, ['id']);
12984
+ if (fromId != null) {
12985
+ setValueByPath(toObject, ['id'], fromId);
12986
+ }
12987
+ const fromArgs = getValueByPath(fromObject, ['args']);
12988
+ if (fromArgs != null) {
12989
+ setValueByPath(toObject, ['args'], fromArgs);
12990
+ }
12991
+ const fromName = getValueByPath(fromObject, ['name']);
12992
+ if (fromName != null) {
12993
+ setValueByPath(toObject, ['name'], fromName);
12994
+ }
12995
+ return toObject;
12996
+ }
12313
12997
  function partFromMldev(fromObject) {
12314
12998
  const toObject = {};
12315
12999
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -12336,6 +13020,10 @@ function partFromMldev(fromObject) {
12336
13020
  if (fromThoughtSignature != null) {
12337
13021
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
12338
13022
  }
13023
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
13024
+ if (fromFunctionCall != null) {
13025
+ setValueByPath(toObject, ['functionCall'], functionCallFromMldev(fromFunctionCall));
13026
+ }
12339
13027
  const fromCodeExecutionResult = getValueByPath(fromObject, [
12340
13028
  'codeExecutionResult',
12341
13029
  ]);
@@ -12348,10 +13036,6 @@ function partFromMldev(fromObject) {
12348
13036
  if (fromExecutableCode != null) {
12349
13037
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
12350
13038
  }
12351
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
12352
- if (fromFunctionCall != null) {
12353
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
12354
- }
12355
13039
  const fromFunctionResponse = getValueByPath(fromObject, [
12356
13040
  'functionResponse',
12357
13041
  ]);
@@ -12874,6 +13558,22 @@ function fileDataFromVertex(fromObject) {
12874
13558
  }
12875
13559
  return toObject;
12876
13560
  }
13561
+ function functionCallFromVertex(fromObject) {
13562
+ const toObject = {};
13563
+ const fromId = getValueByPath(fromObject, ['id']);
13564
+ if (fromId != null) {
13565
+ setValueByPath(toObject, ['id'], fromId);
13566
+ }
13567
+ const fromArgs = getValueByPath(fromObject, ['args']);
13568
+ if (fromArgs != null) {
13569
+ setValueByPath(toObject, ['args'], fromArgs);
13570
+ }
13571
+ const fromName = getValueByPath(fromObject, ['name']);
13572
+ if (fromName != null) {
13573
+ setValueByPath(toObject, ['name'], fromName);
13574
+ }
13575
+ return toObject;
13576
+ }
12877
13577
  function partFromVertex(fromObject) {
12878
13578
  const toObject = {};
12879
13579
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -12900,6 +13600,10 @@ function partFromVertex(fromObject) {
12900
13600
  if (fromThoughtSignature != null) {
12901
13601
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
12902
13602
  }
13603
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
13604
+ if (fromFunctionCall != null) {
13605
+ setValueByPath(toObject, ['functionCall'], functionCallFromVertex(fromFunctionCall));
13606
+ }
12903
13607
  const fromCodeExecutionResult = getValueByPath(fromObject, [
12904
13608
  'codeExecutionResult',
12905
13609
  ]);
@@ -12912,10 +13616,6 @@ function partFromVertex(fromObject) {
12912
13616
  if (fromExecutableCode != null) {
12913
13617
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
12914
13618
  }
12915
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
12916
- if (fromFunctionCall != null) {
12917
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
12918
- }
12919
13619
  const fromFunctionResponse = getValueByPath(fromObject, [
12920
13620
  'functionResponse',
12921
13621
  ]);
@@ -13590,7 +14290,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
13590
14290
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
13591
14291
  const USER_AGENT_HEADER = 'User-Agent';
13592
14292
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
13593
- const SDK_VERSION = '1.17.0'; // x-release-please-version
14293
+ const SDK_VERSION = '1.19.0'; // x-release-please-version
13594
14294
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
13595
14295
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
13596
14296
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -16575,59 +17275,6 @@ class Models extends BaseModule {
16575
17275
  }
16576
17276
  }
16577
17277
 
16578
- /**
16579
- * @license
16580
- * Copyright 2025 Google LLC
16581
- * SPDX-License-Identifier: Apache-2.0
16582
- */
16583
- // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
16584
- function getOperationParametersToMldev(fromObject) {
16585
- const toObject = {};
16586
- const fromOperationName = getValueByPath(fromObject, [
16587
- 'operationName',
16588
- ]);
16589
- if (fromOperationName != null) {
16590
- setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
16591
- }
16592
- const fromConfig = getValueByPath(fromObject, ['config']);
16593
- if (fromConfig != null) {
16594
- setValueByPath(toObject, ['config'], fromConfig);
16595
- }
16596
- return toObject;
16597
- }
16598
- function fetchPredictOperationParametersToVertex(fromObject) {
16599
- const toObject = {};
16600
- const fromOperationName = getValueByPath(fromObject, [
16601
- 'operationName',
16602
- ]);
16603
- if (fromOperationName != null) {
16604
- setValueByPath(toObject, ['operationName'], fromOperationName);
16605
- }
16606
- const fromResourceName = getValueByPath(fromObject, ['resourceName']);
16607
- if (fromResourceName != null) {
16608
- setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
16609
- }
16610
- const fromConfig = getValueByPath(fromObject, ['config']);
16611
- if (fromConfig != null) {
16612
- setValueByPath(toObject, ['config'], fromConfig);
16613
- }
16614
- return toObject;
16615
- }
16616
- function getOperationParametersToVertex(fromObject) {
16617
- const toObject = {};
16618
- const fromOperationName = getValueByPath(fromObject, [
16619
- 'operationName',
16620
- ]);
16621
- if (fromOperationName != null) {
16622
- setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
16623
- }
16624
- const fromConfig = getValueByPath(fromObject, ['config']);
16625
- if (fromConfig != null) {
16626
- setValueByPath(toObject, ['config'], fromConfig);
16627
- }
16628
- return toObject;
16629
- }
16630
-
16631
17278
  /**
16632
17279
  * @license
16633
17280
  * Copyright 2025 Google LLC
@@ -16911,6 +17558,22 @@ function fileDataToMldev(fromObject) {
16911
17558
  }
16912
17559
  return toObject;
16913
17560
  }
17561
+ function functionCallToMldev(fromObject) {
17562
+ const toObject = {};
17563
+ const fromId = getValueByPath(fromObject, ['id']);
17564
+ if (fromId != null) {
17565
+ setValueByPath(toObject, ['id'], fromId);
17566
+ }
17567
+ const fromArgs = getValueByPath(fromObject, ['args']);
17568
+ if (fromArgs != null) {
17569
+ setValueByPath(toObject, ['args'], fromArgs);
17570
+ }
17571
+ const fromName = getValueByPath(fromObject, ['name']);
17572
+ if (fromName != null) {
17573
+ setValueByPath(toObject, ['name'], fromName);
17574
+ }
17575
+ return toObject;
17576
+ }
16914
17577
  function partToMldev(fromObject) {
16915
17578
  const toObject = {};
16916
17579
  const fromVideoMetadata = getValueByPath(fromObject, [
@@ -16937,6 +17600,10 @@ function partToMldev(fromObject) {
16937
17600
  if (fromThoughtSignature != null) {
16938
17601
  setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
16939
17602
  }
17603
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
17604
+ if (fromFunctionCall != null) {
17605
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
17606
+ }
16940
17607
  const fromCodeExecutionResult = getValueByPath(fromObject, [
16941
17608
  'codeExecutionResult',
16942
17609
  ]);
@@ -16949,10 +17616,6 @@ function partToMldev(fromObject) {
16949
17616
  if (fromExecutableCode != null) {
16950
17617
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
16951
17618
  }
16952
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
16953
- if (fromFunctionCall != null) {
16954
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
16955
- }
16956
17619
  const fromFunctionResponse = getValueByPath(fromObject, [
16957
17620
  'functionResponse',
16958
17621
  ]);
@@ -17967,6 +18630,9 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17967
18630
  if (parentObject !== undefined && fromLearningRate != null) {
17968
18631
  setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
17969
18632
  }
18633
+ if (getValueByPath(fromObject, ['labels']) !== undefined) {
18634
+ throw new Error('labels parameter is not supported in Gemini API.');
18635
+ }
17970
18636
  return toObject;
17971
18637
  }
17972
18638
  function createTuningJobParametersPrivateToMldev(fromObject) {
@@ -18122,6 +18788,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
18122
18788
  if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
18123
18789
  throw new Error('learningRate parameter is not supported in Vertex AI.');
18124
18790
  }
18791
+ const fromLabels = getValueByPath(fromObject, ['labels']);
18792
+ if (parentObject !== undefined && fromLabels != null) {
18793
+ setValueByPath(parentObject, ['labels'], fromLabels);
18794
+ }
18125
18795
  return toObject;
18126
18796
  }
18127
18797
  function createTuningJobParametersPrivateToVertex(fromObject) {
@@ -19228,5 +19898,5 @@ function getApiKeyFromEnv() {
19228
19898
  return envGoogleApiKey || envGeminiApiKey || undefined;
19229
19899
  }
19230
19900
 
19231
- export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationReferenceType, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
19901
+ export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationReferenceType, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
19232
19902
  //# sourceMappingURL=index.mjs.map