@google/genai 1.6.0 → 1.8.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.
@@ -287,6 +287,22 @@ var HarmCategory;
287
287
  * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
288
288
  */
289
289
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
290
+ /**
291
+ * The harm category is image hate.
292
+ */
293
+ HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
294
+ /**
295
+ * The harm category is image dangerous content.
296
+ */
297
+ HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
298
+ /**
299
+ * The harm category is image harassment.
300
+ */
301
+ HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
302
+ /**
303
+ * The harm category is image sexually explicit content.
304
+ */
305
+ HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
290
306
  })(HarmCategory || (HarmCategory = {}));
291
307
  /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
292
308
  var HarmBlockMethod;
@@ -373,6 +389,50 @@ var AuthType;
373
389
  */
374
390
  AuthType["OIDC_AUTH"] = "OIDC_AUTH";
375
391
  })(AuthType || (AuthType = {}));
392
+ /** The API spec that the external API implements. */
393
+ var ApiSpec;
394
+ (function (ApiSpec) {
395
+ /**
396
+ * Unspecified API spec. This value should not be used.
397
+ */
398
+ ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
399
+ /**
400
+ * Simple search API spec.
401
+ */
402
+ ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
403
+ /**
404
+ * Elastic search API spec.
405
+ */
406
+ ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
407
+ })(ApiSpec || (ApiSpec = {}));
408
+ /** Required. The environment being operated. */
409
+ var Environment;
410
+ (function (Environment) {
411
+ /**
412
+ * Defaults to browser.
413
+ */
414
+ Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
415
+ /**
416
+ * Operates in a web browser.
417
+ */
418
+ Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
419
+ })(Environment || (Environment = {}));
420
+ /** Status of the url retrieval. */
421
+ var UrlRetrievalStatus;
422
+ (function (UrlRetrievalStatus) {
423
+ /**
424
+ * Default value. This value is unused
425
+ */
426
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
427
+ /**
428
+ * Url retrieval is successful.
429
+ */
430
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
431
+ /**
432
+ * Url retrieval is failed due to error.
433
+ */
434
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
435
+ })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
376
436
  /** Output only. The reason why the model stopped generating tokens.
377
437
 
378
438
  If empty, the model has not stopped generating the tokens.
@@ -503,6 +563,10 @@ var BlockedReason;
503
563
  * Candidates blocked due to prohibited content.
504
564
  */
505
565
  BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
566
+ /**
567
+ * Candidates blocked due to unsafe image generation content.
568
+ */
569
+ BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
506
570
  })(BlockedReason || (BlockedReason = {}));
507
571
  /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
508
572
  var TrafficType;
@@ -560,7 +624,7 @@ var MediaResolution;
560
624
  */
561
625
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
562
626
  })(MediaResolution || (MediaResolution = {}));
563
- /** Output only. The detailed state of the job. */
627
+ /** Job state. */
564
628
  var JobState;
565
629
  (function (JobState) {
566
630
  /**
@@ -604,7 +668,7 @@ var JobState;
604
668
  */
605
669
  JobState["JOB_STATE_EXPIRED"] = "JOB_STATE_EXPIRED";
606
670
  /**
607
- * The job is being updated. Only jobs in the `RUNNING` state can be updated. After updating, the job goes back to the `RUNNING` state.
671
+ * The job is being updated. Only jobs in the `JOB_STATE_RUNNING` state can be updated. After updating, the job goes back to the `JOB_STATE_RUNNING` state.
608
672
  */
609
673
  JobState["JOB_STATE_UPDATING"] = "JOB_STATE_UPDATING";
610
674
  /**
@@ -700,22 +764,6 @@ var FunctionCallingConfigMode;
700
764
  */
701
765
  FunctionCallingConfigMode["NONE"] = "NONE";
702
766
  })(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
703
- /** Status of the url retrieval. */
704
- var UrlRetrievalStatus;
705
- (function (UrlRetrievalStatus) {
706
- /**
707
- * Default value. This value is unused
708
- */
709
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
710
- /**
711
- * Url retrieval is successful.
712
- */
713
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
714
- /**
715
- * Url retrieval is failed due to error.
716
- */
717
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
718
- })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
719
767
  /** Enum that controls the safety filter level for objectionable content. */
720
768
  var SafetyFilterLevel;
721
769
  (function (SafetyFilterLevel) {
@@ -727,8 +775,17 @@ var SafetyFilterLevel;
727
775
  /** Enum that controls the generation of people. */
728
776
  var PersonGeneration;
729
777
  (function (PersonGeneration) {
778
+ /**
779
+ * Block generation of images of people.
780
+ */
730
781
  PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
782
+ /**
783
+ * Generate images of adults, but not children.
784
+ */
731
785
  PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
786
+ /**
787
+ * Generate images that include adults and children.
788
+ */
732
789
  PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
733
790
  })(PersonGeneration || (PersonGeneration = {}));
734
791
  /** Enum that specifies the language of the text in the prompt. */
@@ -777,6 +834,20 @@ var EditMode;
777
834
  EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
778
835
  EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
779
836
  })(EditMode || (EditMode = {}));
837
+ /** Enum that controls the compression quality of the generated videos. */
838
+ var VideoCompressionQuality;
839
+ (function (VideoCompressionQuality) {
840
+ /**
841
+ * Optimized video compression quality. This will produce videos
842
+ with a compressed, smaller file size.
843
+ */
844
+ VideoCompressionQuality["OPTIMIZED"] = "OPTIMIZED";
845
+ /**
846
+ * Lossless video compression quality. This will produce videos
847
+ with a larger file size.
848
+ */
849
+ VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
850
+ })(VideoCompressionQuality || (VideoCompressionQuality = {}));
780
851
  /** State for the lifecycle of a File. */
781
852
  var FileState;
782
853
  (function (FileState) {
@@ -1413,6 +1484,12 @@ class CreateFileResponse {
1413
1484
  /** Response for the delete file method. */
1414
1485
  class DeleteFileResponse {
1415
1486
  }
1487
+ /** Config for `inlined_responses` parameter. */
1488
+ class InlinedResponse {
1489
+ }
1490
+ /** Config for batches.list return value. */
1491
+ class ListBatchJobsResponse {
1492
+ }
1416
1493
  /** Represents a single response in a replay. */
1417
1494
  class ReplayResponse {
1418
1495
  }
@@ -2409,11 +2486,2088 @@ function filterToJsonSchema(schema) {
2409
2486
  ? typeValue
2410
2487
  : Type.TYPE_UNSPECIFIED;
2411
2488
  }
2412
- else if (supportedJsonSchemaFields.has(fieldName)) {
2413
- filteredSchema[fieldName] = fieldValue;
2489
+ else if (supportedJsonSchemaFields.has(fieldName)) {
2490
+ filteredSchema[fieldName] = fieldValue;
2491
+ }
2492
+ }
2493
+ return filteredSchema;
2494
+ }
2495
+ // Transforms a source input into a BatchJobSource object with validation.
2496
+ function tBatchJobSource(apiClient, src) {
2497
+ if (typeof src !== 'string' && !Array.isArray(src)) {
2498
+ if (apiClient && apiClient.isVertexAI()) {
2499
+ if (src.gcsUri && src.bigqueryUri) {
2500
+ throw new Error('Only one of `gcsUri` or `bigqueryUri` can be set.');
2501
+ }
2502
+ else if (!src.gcsUri && !src.bigqueryUri) {
2503
+ throw new Error('One of `gcsUri` or `bigqueryUri` must be set.');
2504
+ }
2505
+ }
2506
+ else {
2507
+ // Logic for non-Vertex AI client (inlined_requests, file_name)
2508
+ if (src.inlinedRequests && src.fileName) {
2509
+ throw new Error('Only one of `inlinedRequests` or `fileName` can be set.');
2510
+ }
2511
+ else if (!src.inlinedRequests && !src.fileName) {
2512
+ throw new Error('One of `inlinedRequests` or `fileName` must be set.');
2513
+ }
2514
+ }
2515
+ return src;
2516
+ }
2517
+ // If src is an array (list in Python)
2518
+ else if (Array.isArray(src)) {
2519
+ return { inlinedRequests: src };
2520
+ }
2521
+ else if (typeof src === 'string') {
2522
+ if (src.startsWith('gs://')) {
2523
+ return {
2524
+ format: 'jsonl',
2525
+ gcsUri: [src], // GCS URI is expected as an array
2526
+ };
2527
+ }
2528
+ else if (src.startsWith('bq://')) {
2529
+ return {
2530
+ format: 'bigquery',
2531
+ bigqueryUri: src,
2532
+ };
2533
+ }
2534
+ else if (src.startsWith('files/')) {
2535
+ return {
2536
+ fileName: src,
2537
+ };
2538
+ }
2539
+ }
2540
+ throw new Error(`Unsupported source: ${src}`);
2541
+ }
2542
+ function tBatchJobDestination(dest) {
2543
+ const destString = dest;
2544
+ if (destString.startsWith('gs://')) {
2545
+ return {
2546
+ format: 'jsonl',
2547
+ gcsUri: destString,
2548
+ };
2549
+ }
2550
+ else if (destString.startsWith('bq://')) {
2551
+ return {
2552
+ format: 'bigquery',
2553
+ bigqueryUri: destString,
2554
+ };
2555
+ }
2556
+ else {
2557
+ throw new Error(`Unsupported destination: ${destString}`);
2558
+ }
2559
+ }
2560
+ function tBatchJobName(apiClient, name) {
2561
+ const nameString = name;
2562
+ if (!apiClient.isVertexAI()) {
2563
+ const mldevPattern = /batches\/[^/]+$/;
2564
+ if (mldevPattern.test(nameString)) {
2565
+ return nameString.split('/').pop();
2566
+ }
2567
+ else {
2568
+ throw new Error(`Invalid batch job name: ${nameString}.`);
2569
+ }
2570
+ }
2571
+ const vertexPattern = /^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/;
2572
+ if (vertexPattern.test(nameString)) {
2573
+ return nameString.split('/').pop();
2574
+ }
2575
+ else if (/^\d+$/.test(nameString)) {
2576
+ return nameString;
2577
+ }
2578
+ else {
2579
+ throw new Error(`Invalid batch job name: ${nameString}.`);
2580
+ }
2581
+ }
2582
+ function tJobState(state) {
2583
+ const stateString = state;
2584
+ if (stateString === 'BATCH_STATE_UNSPECIFIED') {
2585
+ return 'JOB_STATE_UNSPECIFIED';
2586
+ }
2587
+ else if (stateString === 'BATCH_STATE_PENDING') {
2588
+ return 'JOB_STATE_PENDING';
2589
+ }
2590
+ else if (stateString === 'BATCH_STATE_SUCCEEDED') {
2591
+ return 'JOB_STATE_SUCCEEDED';
2592
+ }
2593
+ else if (stateString === 'BATCH_STATE_FAILED') {
2594
+ return 'JOB_STATE_FAILED';
2595
+ }
2596
+ else if (stateString === 'BATCH_STATE_CANCELLED') {
2597
+ return 'JOB_STATE_CANCELLED';
2598
+ }
2599
+ else {
2600
+ return stateString;
2601
+ }
2602
+ }
2603
+
2604
+ /**
2605
+ * @license
2606
+ * Copyright 2025 Google LLC
2607
+ * SPDX-License-Identifier: Apache-2.0
2608
+ */
2609
+ function videoMetadataToMldev$4(fromObject) {
2610
+ const toObject = {};
2611
+ const fromFps = getValueByPath(fromObject, ['fps']);
2612
+ if (fromFps != null) {
2613
+ setValueByPath(toObject, ['fps'], fromFps);
2614
+ }
2615
+ const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
2616
+ if (fromEndOffset != null) {
2617
+ setValueByPath(toObject, ['endOffset'], fromEndOffset);
2618
+ }
2619
+ const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
2620
+ if (fromStartOffset != null) {
2621
+ setValueByPath(toObject, ['startOffset'], fromStartOffset);
2622
+ }
2623
+ return toObject;
2624
+ }
2625
+ function blobToMldev$4(fromObject) {
2626
+ const toObject = {};
2627
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2628
+ throw new Error('displayName parameter is not supported in Gemini API.');
2629
+ }
2630
+ const fromData = getValueByPath(fromObject, ['data']);
2631
+ if (fromData != null) {
2632
+ setValueByPath(toObject, ['data'], fromData);
2633
+ }
2634
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2635
+ if (fromMimeType != null) {
2636
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2637
+ }
2638
+ return toObject;
2639
+ }
2640
+ function fileDataToMldev$4(fromObject) {
2641
+ const toObject = {};
2642
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2643
+ throw new Error('displayName parameter is not supported in Gemini API.');
2644
+ }
2645
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
2646
+ if (fromFileUri != null) {
2647
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
2648
+ }
2649
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2650
+ if (fromMimeType != null) {
2651
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2652
+ }
2653
+ return toObject;
2654
+ }
2655
+ function partToMldev$4(fromObject) {
2656
+ const toObject = {};
2657
+ const fromVideoMetadata = getValueByPath(fromObject, [
2658
+ 'videoMetadata',
2659
+ ]);
2660
+ if (fromVideoMetadata != null) {
2661
+ setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$4(fromVideoMetadata));
2662
+ }
2663
+ const fromThought = getValueByPath(fromObject, ['thought']);
2664
+ if (fromThought != null) {
2665
+ setValueByPath(toObject, ['thought'], fromThought);
2666
+ }
2667
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
2668
+ if (fromInlineData != null) {
2669
+ setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
2670
+ }
2671
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
2672
+ if (fromFileData != null) {
2673
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
2674
+ }
2675
+ const fromThoughtSignature = getValueByPath(fromObject, [
2676
+ 'thoughtSignature',
2677
+ ]);
2678
+ if (fromThoughtSignature != null) {
2679
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
2680
+ }
2681
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
2682
+ 'codeExecutionResult',
2683
+ ]);
2684
+ if (fromCodeExecutionResult != null) {
2685
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
2686
+ }
2687
+ const fromExecutableCode = getValueByPath(fromObject, [
2688
+ 'executableCode',
2689
+ ]);
2690
+ if (fromExecutableCode != null) {
2691
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2692
+ }
2693
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2694
+ if (fromFunctionCall != null) {
2695
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
2696
+ }
2697
+ const fromFunctionResponse = getValueByPath(fromObject, [
2698
+ 'functionResponse',
2699
+ ]);
2700
+ if (fromFunctionResponse != null) {
2701
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
2702
+ }
2703
+ const fromText = getValueByPath(fromObject, ['text']);
2704
+ if (fromText != null) {
2705
+ setValueByPath(toObject, ['text'], fromText);
2706
+ }
2707
+ return toObject;
2708
+ }
2709
+ function contentToMldev$4(fromObject) {
2710
+ const toObject = {};
2711
+ const fromParts = getValueByPath(fromObject, ['parts']);
2712
+ if (fromParts != null) {
2713
+ let transformedList = fromParts;
2714
+ if (Array.isArray(transformedList)) {
2715
+ transformedList = transformedList.map((item) => {
2716
+ return partToMldev$4(item);
2717
+ });
2718
+ }
2719
+ setValueByPath(toObject, ['parts'], transformedList);
2720
+ }
2721
+ const fromRole = getValueByPath(fromObject, ['role']);
2722
+ if (fromRole != null) {
2723
+ setValueByPath(toObject, ['role'], fromRole);
2724
+ }
2725
+ return toObject;
2726
+ }
2727
+ function schemaToMldev$1(fromObject) {
2728
+ const toObject = {};
2729
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
2730
+ if (fromAnyOf != null) {
2731
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
2732
+ }
2733
+ const fromDefault = getValueByPath(fromObject, ['default']);
2734
+ if (fromDefault != null) {
2735
+ setValueByPath(toObject, ['default'], fromDefault);
2736
+ }
2737
+ const fromDescription = getValueByPath(fromObject, ['description']);
2738
+ if (fromDescription != null) {
2739
+ setValueByPath(toObject, ['description'], fromDescription);
2740
+ }
2741
+ const fromEnum = getValueByPath(fromObject, ['enum']);
2742
+ if (fromEnum != null) {
2743
+ setValueByPath(toObject, ['enum'], fromEnum);
2744
+ }
2745
+ const fromExample = getValueByPath(fromObject, ['example']);
2746
+ if (fromExample != null) {
2747
+ setValueByPath(toObject, ['example'], fromExample);
2748
+ }
2749
+ const fromFormat = getValueByPath(fromObject, ['format']);
2750
+ if (fromFormat != null) {
2751
+ setValueByPath(toObject, ['format'], fromFormat);
2752
+ }
2753
+ const fromItems = getValueByPath(fromObject, ['items']);
2754
+ if (fromItems != null) {
2755
+ setValueByPath(toObject, ['items'], fromItems);
2756
+ }
2757
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
2758
+ if (fromMaxItems != null) {
2759
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
2760
+ }
2761
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
2762
+ if (fromMaxLength != null) {
2763
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
2764
+ }
2765
+ const fromMaxProperties = getValueByPath(fromObject, [
2766
+ 'maxProperties',
2767
+ ]);
2768
+ if (fromMaxProperties != null) {
2769
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
2770
+ }
2771
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
2772
+ if (fromMaximum != null) {
2773
+ setValueByPath(toObject, ['maximum'], fromMaximum);
2774
+ }
2775
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
2776
+ if (fromMinItems != null) {
2777
+ setValueByPath(toObject, ['minItems'], fromMinItems);
2778
+ }
2779
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
2780
+ if (fromMinLength != null) {
2781
+ setValueByPath(toObject, ['minLength'], fromMinLength);
2782
+ }
2783
+ const fromMinProperties = getValueByPath(fromObject, [
2784
+ 'minProperties',
2785
+ ]);
2786
+ if (fromMinProperties != null) {
2787
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
2788
+ }
2789
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
2790
+ if (fromMinimum != null) {
2791
+ setValueByPath(toObject, ['minimum'], fromMinimum);
2792
+ }
2793
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
2794
+ if (fromNullable != null) {
2795
+ setValueByPath(toObject, ['nullable'], fromNullable);
2796
+ }
2797
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
2798
+ if (fromPattern != null) {
2799
+ setValueByPath(toObject, ['pattern'], fromPattern);
2800
+ }
2801
+ const fromProperties = getValueByPath(fromObject, ['properties']);
2802
+ if (fromProperties != null) {
2803
+ setValueByPath(toObject, ['properties'], fromProperties);
2804
+ }
2805
+ const fromPropertyOrdering = getValueByPath(fromObject, [
2806
+ 'propertyOrdering',
2807
+ ]);
2808
+ if (fromPropertyOrdering != null) {
2809
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
2810
+ }
2811
+ const fromRequired = getValueByPath(fromObject, ['required']);
2812
+ if (fromRequired != null) {
2813
+ setValueByPath(toObject, ['required'], fromRequired);
2814
+ }
2815
+ const fromTitle = getValueByPath(fromObject, ['title']);
2816
+ if (fromTitle != null) {
2817
+ setValueByPath(toObject, ['title'], fromTitle);
2818
+ }
2819
+ const fromType = getValueByPath(fromObject, ['type']);
2820
+ if (fromType != null) {
2821
+ setValueByPath(toObject, ['type'], fromType);
2822
+ }
2823
+ return toObject;
2824
+ }
2825
+ function safetySettingToMldev$1(fromObject) {
2826
+ const toObject = {};
2827
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
2828
+ throw new Error('method parameter is not supported in Gemini API.');
2829
+ }
2830
+ const fromCategory = getValueByPath(fromObject, ['category']);
2831
+ if (fromCategory != null) {
2832
+ setValueByPath(toObject, ['category'], fromCategory);
2833
+ }
2834
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
2835
+ if (fromThreshold != null) {
2836
+ setValueByPath(toObject, ['threshold'], fromThreshold);
2837
+ }
2838
+ return toObject;
2839
+ }
2840
+ function functionDeclarationToMldev$4(fromObject) {
2841
+ const toObject = {};
2842
+ const fromBehavior = getValueByPath(fromObject, ['behavior']);
2843
+ if (fromBehavior != null) {
2844
+ setValueByPath(toObject, ['behavior'], fromBehavior);
2845
+ }
2846
+ const fromDescription = getValueByPath(fromObject, ['description']);
2847
+ if (fromDescription != null) {
2848
+ setValueByPath(toObject, ['description'], fromDescription);
2849
+ }
2850
+ const fromName = getValueByPath(fromObject, ['name']);
2851
+ if (fromName != null) {
2852
+ setValueByPath(toObject, ['name'], fromName);
2853
+ }
2854
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
2855
+ if (fromParameters != null) {
2856
+ setValueByPath(toObject, ['parameters'], fromParameters);
2857
+ }
2858
+ const fromParametersJsonSchema = getValueByPath(fromObject, [
2859
+ 'parametersJsonSchema',
2860
+ ]);
2861
+ if (fromParametersJsonSchema != null) {
2862
+ setValueByPath(toObject, ['parametersJsonSchema'], fromParametersJsonSchema);
2863
+ }
2864
+ const fromResponse = getValueByPath(fromObject, ['response']);
2865
+ if (fromResponse != null) {
2866
+ setValueByPath(toObject, ['response'], fromResponse);
2867
+ }
2868
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
2869
+ 'responseJsonSchema',
2870
+ ]);
2871
+ if (fromResponseJsonSchema != null) {
2872
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
2873
+ }
2874
+ return toObject;
2875
+ }
2876
+ function intervalToMldev$4(fromObject) {
2877
+ const toObject = {};
2878
+ const fromStartTime = getValueByPath(fromObject, ['startTime']);
2879
+ if (fromStartTime != null) {
2880
+ setValueByPath(toObject, ['startTime'], fromStartTime);
2881
+ }
2882
+ const fromEndTime = getValueByPath(fromObject, ['endTime']);
2883
+ if (fromEndTime != null) {
2884
+ setValueByPath(toObject, ['endTime'], fromEndTime);
2885
+ }
2886
+ return toObject;
2887
+ }
2888
+ function googleSearchToMldev$4(fromObject) {
2889
+ const toObject = {};
2890
+ const fromTimeRangeFilter = getValueByPath(fromObject, [
2891
+ 'timeRangeFilter',
2892
+ ]);
2893
+ if (fromTimeRangeFilter != null) {
2894
+ setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
2895
+ }
2896
+ return toObject;
2897
+ }
2898
+ function dynamicRetrievalConfigToMldev$4(fromObject) {
2899
+ const toObject = {};
2900
+ const fromMode = getValueByPath(fromObject, ['mode']);
2901
+ if (fromMode != null) {
2902
+ setValueByPath(toObject, ['mode'], fromMode);
2903
+ }
2904
+ const fromDynamicThreshold = getValueByPath(fromObject, [
2905
+ 'dynamicThreshold',
2906
+ ]);
2907
+ if (fromDynamicThreshold != null) {
2908
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
2909
+ }
2910
+ return toObject;
2911
+ }
2912
+ function googleSearchRetrievalToMldev$4(fromObject) {
2913
+ const toObject = {};
2914
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
2915
+ 'dynamicRetrievalConfig',
2916
+ ]);
2917
+ if (fromDynamicRetrievalConfig != null) {
2918
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$4(fromDynamicRetrievalConfig));
2919
+ }
2920
+ return toObject;
2921
+ }
2922
+ function urlContextToMldev$4() {
2923
+ const toObject = {};
2924
+ return toObject;
2925
+ }
2926
+ function toolToMldev$4(fromObject) {
2927
+ const toObject = {};
2928
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
2929
+ 'functionDeclarations',
2930
+ ]);
2931
+ if (fromFunctionDeclarations != null) {
2932
+ let transformedList = fromFunctionDeclarations;
2933
+ if (Array.isArray(transformedList)) {
2934
+ transformedList = transformedList.map((item) => {
2935
+ return functionDeclarationToMldev$4(item);
2936
+ });
2937
+ }
2938
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
2939
+ }
2940
+ if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
2941
+ throw new Error('retrieval parameter is not supported in Gemini API.');
2942
+ }
2943
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
2944
+ if (fromGoogleSearch != null) {
2945
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
2946
+ }
2947
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
2948
+ 'googleSearchRetrieval',
2949
+ ]);
2950
+ if (fromGoogleSearchRetrieval != null) {
2951
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$4(fromGoogleSearchRetrieval));
2952
+ }
2953
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
2954
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
2955
+ }
2956
+ if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
2957
+ throw new Error('googleMaps parameter is not supported in Gemini API.');
2958
+ }
2959
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
2960
+ if (fromUrlContext != null) {
2961
+ setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
2962
+ }
2963
+ const fromCodeExecution = getValueByPath(fromObject, [
2964
+ 'codeExecution',
2965
+ ]);
2966
+ if (fromCodeExecution != null) {
2967
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2968
+ }
2969
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2970
+ if (fromComputerUse != null) {
2971
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
2972
+ }
2973
+ return toObject;
2974
+ }
2975
+ function functionCallingConfigToMldev$2(fromObject) {
2976
+ const toObject = {};
2977
+ const fromMode = getValueByPath(fromObject, ['mode']);
2978
+ if (fromMode != null) {
2979
+ setValueByPath(toObject, ['mode'], fromMode);
2980
+ }
2981
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
2982
+ 'allowedFunctionNames',
2983
+ ]);
2984
+ if (fromAllowedFunctionNames != null) {
2985
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
2986
+ }
2987
+ return toObject;
2988
+ }
2989
+ function latLngToMldev$2(fromObject) {
2990
+ const toObject = {};
2991
+ const fromLatitude = getValueByPath(fromObject, ['latitude']);
2992
+ if (fromLatitude != null) {
2993
+ setValueByPath(toObject, ['latitude'], fromLatitude);
2994
+ }
2995
+ const fromLongitude = getValueByPath(fromObject, ['longitude']);
2996
+ if (fromLongitude != null) {
2997
+ setValueByPath(toObject, ['longitude'], fromLongitude);
2998
+ }
2999
+ return toObject;
3000
+ }
3001
+ function retrievalConfigToMldev$2(fromObject) {
3002
+ const toObject = {};
3003
+ const fromLatLng = getValueByPath(fromObject, ['latLng']);
3004
+ if (fromLatLng != null) {
3005
+ setValueByPath(toObject, ['latLng'], latLngToMldev$2(fromLatLng));
3006
+ }
3007
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
3008
+ if (fromLanguageCode != null) {
3009
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
3010
+ }
3011
+ return toObject;
3012
+ }
3013
+ function toolConfigToMldev$2(fromObject) {
3014
+ const toObject = {};
3015
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
3016
+ 'functionCallingConfig',
3017
+ ]);
3018
+ if (fromFunctionCallingConfig != null) {
3019
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
3020
+ }
3021
+ const fromRetrievalConfig = getValueByPath(fromObject, [
3022
+ 'retrievalConfig',
3023
+ ]);
3024
+ if (fromRetrievalConfig != null) {
3025
+ setValueByPath(toObject, ['retrievalConfig'], retrievalConfigToMldev$2(fromRetrievalConfig));
3026
+ }
3027
+ return toObject;
3028
+ }
3029
+ function prebuiltVoiceConfigToMldev$3(fromObject) {
3030
+ const toObject = {};
3031
+ const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
3032
+ if (fromVoiceName != null) {
3033
+ setValueByPath(toObject, ['voiceName'], fromVoiceName);
3034
+ }
3035
+ return toObject;
3036
+ }
3037
+ function voiceConfigToMldev$3(fromObject) {
3038
+ const toObject = {};
3039
+ const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
3040
+ 'prebuiltVoiceConfig',
3041
+ ]);
3042
+ if (fromPrebuiltVoiceConfig != null) {
3043
+ setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$3(fromPrebuiltVoiceConfig));
3044
+ }
3045
+ return toObject;
3046
+ }
3047
+ function speakerVoiceConfigToMldev$3(fromObject) {
3048
+ const toObject = {};
3049
+ const fromSpeaker = getValueByPath(fromObject, ['speaker']);
3050
+ if (fromSpeaker != null) {
3051
+ setValueByPath(toObject, ['speaker'], fromSpeaker);
3052
+ }
3053
+ const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
3054
+ if (fromVoiceConfig != null) {
3055
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$3(fromVoiceConfig));
3056
+ }
3057
+ return toObject;
3058
+ }
3059
+ function multiSpeakerVoiceConfigToMldev$3(fromObject) {
3060
+ const toObject = {};
3061
+ const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
3062
+ 'speakerVoiceConfigs',
3063
+ ]);
3064
+ if (fromSpeakerVoiceConfigs != null) {
3065
+ let transformedList = fromSpeakerVoiceConfigs;
3066
+ if (Array.isArray(transformedList)) {
3067
+ transformedList = transformedList.map((item) => {
3068
+ return speakerVoiceConfigToMldev$3(item);
3069
+ });
3070
+ }
3071
+ setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
3072
+ }
3073
+ return toObject;
3074
+ }
3075
+ function speechConfigToMldev$3(fromObject) {
3076
+ const toObject = {};
3077
+ const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
3078
+ if (fromVoiceConfig != null) {
3079
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$3(fromVoiceConfig));
3080
+ }
3081
+ const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
3082
+ 'multiSpeakerVoiceConfig',
3083
+ ]);
3084
+ if (fromMultiSpeakerVoiceConfig != null) {
3085
+ setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$3(fromMultiSpeakerVoiceConfig));
3086
+ }
3087
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
3088
+ if (fromLanguageCode != null) {
3089
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
3090
+ }
3091
+ return toObject;
3092
+ }
3093
+ function thinkingConfigToMldev$1(fromObject) {
3094
+ const toObject = {};
3095
+ const fromIncludeThoughts = getValueByPath(fromObject, [
3096
+ 'includeThoughts',
3097
+ ]);
3098
+ if (fromIncludeThoughts != null) {
3099
+ setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
3100
+ }
3101
+ const fromThinkingBudget = getValueByPath(fromObject, [
3102
+ 'thinkingBudget',
3103
+ ]);
3104
+ if (fromThinkingBudget != null) {
3105
+ setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
3106
+ }
3107
+ return toObject;
3108
+ }
3109
+ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3110
+ const toObject = {};
3111
+ const fromSystemInstruction = getValueByPath(fromObject, [
3112
+ 'systemInstruction',
3113
+ ]);
3114
+ if (parentObject !== undefined && fromSystemInstruction != null) {
3115
+ setValueByPath(parentObject, ['systemInstruction'], contentToMldev$4(tContent(fromSystemInstruction)));
3116
+ }
3117
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
3118
+ if (fromTemperature != null) {
3119
+ setValueByPath(toObject, ['temperature'], fromTemperature);
3120
+ }
3121
+ const fromTopP = getValueByPath(fromObject, ['topP']);
3122
+ if (fromTopP != null) {
3123
+ setValueByPath(toObject, ['topP'], fromTopP);
3124
+ }
3125
+ const fromTopK = getValueByPath(fromObject, ['topK']);
3126
+ if (fromTopK != null) {
3127
+ setValueByPath(toObject, ['topK'], fromTopK);
3128
+ }
3129
+ const fromCandidateCount = getValueByPath(fromObject, [
3130
+ 'candidateCount',
3131
+ ]);
3132
+ if (fromCandidateCount != null) {
3133
+ setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
3134
+ }
3135
+ const fromMaxOutputTokens = getValueByPath(fromObject, [
3136
+ 'maxOutputTokens',
3137
+ ]);
3138
+ if (fromMaxOutputTokens != null) {
3139
+ setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
3140
+ }
3141
+ const fromStopSequences = getValueByPath(fromObject, [
3142
+ 'stopSequences',
3143
+ ]);
3144
+ if (fromStopSequences != null) {
3145
+ setValueByPath(toObject, ['stopSequences'], fromStopSequences);
3146
+ }
3147
+ const fromResponseLogprobs = getValueByPath(fromObject, [
3148
+ 'responseLogprobs',
3149
+ ]);
3150
+ if (fromResponseLogprobs != null) {
3151
+ setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
3152
+ }
3153
+ const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
3154
+ if (fromLogprobs != null) {
3155
+ setValueByPath(toObject, ['logprobs'], fromLogprobs);
3156
+ }
3157
+ const fromPresencePenalty = getValueByPath(fromObject, [
3158
+ 'presencePenalty',
3159
+ ]);
3160
+ if (fromPresencePenalty != null) {
3161
+ setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
3162
+ }
3163
+ const fromFrequencyPenalty = getValueByPath(fromObject, [
3164
+ 'frequencyPenalty',
3165
+ ]);
3166
+ if (fromFrequencyPenalty != null) {
3167
+ setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
3168
+ }
3169
+ const fromSeed = getValueByPath(fromObject, ['seed']);
3170
+ if (fromSeed != null) {
3171
+ setValueByPath(toObject, ['seed'], fromSeed);
3172
+ }
3173
+ const fromResponseMimeType = getValueByPath(fromObject, [
3174
+ 'responseMimeType',
3175
+ ]);
3176
+ if (fromResponseMimeType != null) {
3177
+ setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
3178
+ }
3179
+ const fromResponseSchema = getValueByPath(fromObject, [
3180
+ 'responseSchema',
3181
+ ]);
3182
+ if (fromResponseSchema != null) {
3183
+ setValueByPath(toObject, ['responseSchema'], schemaToMldev$1(tSchema(fromResponseSchema)));
3184
+ }
3185
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
3186
+ 'responseJsonSchema',
3187
+ ]);
3188
+ if (fromResponseJsonSchema != null) {
3189
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
3190
+ }
3191
+ if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
3192
+ throw new Error('routingConfig parameter is not supported in Gemini API.');
3193
+ }
3194
+ if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
3195
+ throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
3196
+ }
3197
+ const fromSafetySettings = getValueByPath(fromObject, [
3198
+ 'safetySettings',
3199
+ ]);
3200
+ if (parentObject !== undefined && fromSafetySettings != null) {
3201
+ let transformedList = fromSafetySettings;
3202
+ if (Array.isArray(transformedList)) {
3203
+ transformedList = transformedList.map((item) => {
3204
+ return safetySettingToMldev$1(item);
3205
+ });
3206
+ }
3207
+ setValueByPath(parentObject, ['safetySettings'], transformedList);
3208
+ }
3209
+ const fromTools = getValueByPath(fromObject, ['tools']);
3210
+ if (parentObject !== undefined && fromTools != null) {
3211
+ let transformedList = tTools(fromTools);
3212
+ if (Array.isArray(transformedList)) {
3213
+ transformedList = transformedList.map((item) => {
3214
+ return toolToMldev$4(tTool(item));
3215
+ });
3216
+ }
3217
+ setValueByPath(parentObject, ['tools'], transformedList);
3218
+ }
3219
+ const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
3220
+ if (parentObject !== undefined && fromToolConfig != null) {
3221
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
3222
+ }
3223
+ if (getValueByPath(fromObject, ['labels']) !== undefined) {
3224
+ throw new Error('labels parameter is not supported in Gemini API.');
3225
+ }
3226
+ const fromCachedContent = getValueByPath(fromObject, [
3227
+ 'cachedContent',
3228
+ ]);
3229
+ if (parentObject !== undefined && fromCachedContent != null) {
3230
+ setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
3231
+ }
3232
+ const fromResponseModalities = getValueByPath(fromObject, [
3233
+ 'responseModalities',
3234
+ ]);
3235
+ if (fromResponseModalities != null) {
3236
+ setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
3237
+ }
3238
+ const fromMediaResolution = getValueByPath(fromObject, [
3239
+ 'mediaResolution',
3240
+ ]);
3241
+ if (fromMediaResolution != null) {
3242
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
3243
+ }
3244
+ const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
3245
+ if (fromSpeechConfig != null) {
3246
+ setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$3(tSpeechConfig(fromSpeechConfig)));
3247
+ }
3248
+ if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
3249
+ throw new Error('audioTimestamp parameter is not supported in Gemini API.');
3250
+ }
3251
+ const fromThinkingConfig = getValueByPath(fromObject, [
3252
+ 'thinkingConfig',
3253
+ ]);
3254
+ if (fromThinkingConfig != null) {
3255
+ setValueByPath(toObject, ['thinkingConfig'], thinkingConfigToMldev$1(fromThinkingConfig));
3256
+ }
3257
+ return toObject;
3258
+ }
3259
+ function inlinedRequestToMldev(apiClient, fromObject) {
3260
+ const toObject = {};
3261
+ const fromModel = getValueByPath(fromObject, ['model']);
3262
+ if (fromModel != null) {
3263
+ setValueByPath(toObject, ['request', 'model'], tModel(apiClient, fromModel));
3264
+ }
3265
+ const fromContents = getValueByPath(fromObject, ['contents']);
3266
+ if (fromContents != null) {
3267
+ let transformedList = tContents(fromContents);
3268
+ if (Array.isArray(transformedList)) {
3269
+ transformedList = transformedList.map((item) => {
3270
+ return contentToMldev$4(item);
3271
+ });
3272
+ }
3273
+ setValueByPath(toObject, ['request', 'contents'], transformedList);
3274
+ }
3275
+ const fromConfig = getValueByPath(fromObject, ['config']);
3276
+ if (fromConfig != null) {
3277
+ setValueByPath(toObject, ['request', 'generationConfig'], generateContentConfigToMldev$1(apiClient, fromConfig, toObject));
3278
+ }
3279
+ return toObject;
3280
+ }
3281
+ function batchJobSourceToMldev(apiClient, fromObject) {
3282
+ const toObject = {};
3283
+ if (getValueByPath(fromObject, ['format']) !== undefined) {
3284
+ throw new Error('format parameter is not supported in Gemini API.');
3285
+ }
3286
+ if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
3287
+ throw new Error('gcsUri parameter is not supported in Gemini API.');
3288
+ }
3289
+ if (getValueByPath(fromObject, ['bigqueryUri']) !== undefined) {
3290
+ throw new Error('bigqueryUri parameter is not supported in Gemini API.');
3291
+ }
3292
+ const fromFileName = getValueByPath(fromObject, ['fileName']);
3293
+ if (fromFileName != null) {
3294
+ setValueByPath(toObject, ['fileName'], fromFileName);
3295
+ }
3296
+ const fromInlinedRequests = getValueByPath(fromObject, [
3297
+ 'inlinedRequests',
3298
+ ]);
3299
+ if (fromInlinedRequests != null) {
3300
+ let transformedList = fromInlinedRequests;
3301
+ if (Array.isArray(transformedList)) {
3302
+ transformedList = transformedList.map((item) => {
3303
+ return inlinedRequestToMldev(apiClient, item);
3304
+ });
3305
+ }
3306
+ setValueByPath(toObject, ['requests', 'requests'], transformedList);
3307
+ }
3308
+ return toObject;
3309
+ }
3310
+ function createBatchJobConfigToMldev(fromObject, parentObject) {
3311
+ const toObject = {};
3312
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
3313
+ if (parentObject !== undefined && fromDisplayName != null) {
3314
+ setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
3315
+ }
3316
+ if (getValueByPath(fromObject, ['dest']) !== undefined) {
3317
+ throw new Error('dest parameter is not supported in Gemini API.');
3318
+ }
3319
+ return toObject;
3320
+ }
3321
+ function createBatchJobParametersToMldev(apiClient, fromObject) {
3322
+ const toObject = {};
3323
+ const fromModel = getValueByPath(fromObject, ['model']);
3324
+ if (fromModel != null) {
3325
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
3326
+ }
3327
+ const fromSrc = getValueByPath(fromObject, ['src']);
3328
+ if (fromSrc != null) {
3329
+ setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
3330
+ }
3331
+ const fromConfig = getValueByPath(fromObject, ['config']);
3332
+ if (fromConfig != null) {
3333
+ setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
3334
+ }
3335
+ return toObject;
3336
+ }
3337
+ function getBatchJobParametersToMldev(apiClient, fromObject) {
3338
+ const toObject = {};
3339
+ const fromName = getValueByPath(fromObject, ['name']);
3340
+ if (fromName != null) {
3341
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3342
+ }
3343
+ const fromConfig = getValueByPath(fromObject, ['config']);
3344
+ if (fromConfig != null) {
3345
+ setValueByPath(toObject, ['config'], fromConfig);
3346
+ }
3347
+ return toObject;
3348
+ }
3349
+ function cancelBatchJobParametersToMldev(apiClient, fromObject) {
3350
+ const toObject = {};
3351
+ const fromName = getValueByPath(fromObject, ['name']);
3352
+ if (fromName != null) {
3353
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3354
+ }
3355
+ const fromConfig = getValueByPath(fromObject, ['config']);
3356
+ if (fromConfig != null) {
3357
+ setValueByPath(toObject, ['config'], fromConfig);
3358
+ }
3359
+ return toObject;
3360
+ }
3361
+ function listBatchJobsConfigToMldev(fromObject, parentObject) {
3362
+ const toObject = {};
3363
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
3364
+ if (parentObject !== undefined && fromPageSize != null) {
3365
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
3366
+ }
3367
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
3368
+ if (parentObject !== undefined && fromPageToken != null) {
3369
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
3370
+ }
3371
+ if (getValueByPath(fromObject, ['filter']) !== undefined) {
3372
+ throw new Error('filter parameter is not supported in Gemini API.');
3373
+ }
3374
+ return toObject;
3375
+ }
3376
+ function listBatchJobsParametersToMldev(fromObject) {
3377
+ const toObject = {};
3378
+ const fromConfig = getValueByPath(fromObject, ['config']);
3379
+ if (fromConfig != null) {
3380
+ setValueByPath(toObject, ['config'], listBatchJobsConfigToMldev(fromConfig, toObject));
3381
+ }
3382
+ return toObject;
3383
+ }
3384
+ function deleteBatchJobParametersToMldev(apiClient, fromObject) {
3385
+ const toObject = {};
3386
+ const fromName = getValueByPath(fromObject, ['name']);
3387
+ if (fromName != null) {
3388
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3389
+ }
3390
+ const fromConfig = getValueByPath(fromObject, ['config']);
3391
+ if (fromConfig != null) {
3392
+ setValueByPath(toObject, ['config'], fromConfig);
3393
+ }
3394
+ return toObject;
3395
+ }
3396
+ function batchJobSourceToVertex(fromObject) {
3397
+ const toObject = {};
3398
+ const fromFormat = getValueByPath(fromObject, ['format']);
3399
+ if (fromFormat != null) {
3400
+ setValueByPath(toObject, ['instancesFormat'], fromFormat);
3401
+ }
3402
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
3403
+ if (fromGcsUri != null) {
3404
+ setValueByPath(toObject, ['gcsSource', 'uris'], fromGcsUri);
3405
+ }
3406
+ const fromBigqueryUri = getValueByPath(fromObject, ['bigqueryUri']);
3407
+ if (fromBigqueryUri != null) {
3408
+ setValueByPath(toObject, ['bigquerySource', 'inputUri'], fromBigqueryUri);
3409
+ }
3410
+ if (getValueByPath(fromObject, ['fileName']) !== undefined) {
3411
+ throw new Error('fileName parameter is not supported in Vertex AI.');
3412
+ }
3413
+ if (getValueByPath(fromObject, ['inlinedRequests']) !== undefined) {
3414
+ throw new Error('inlinedRequests parameter is not supported in Vertex AI.');
3415
+ }
3416
+ return toObject;
3417
+ }
3418
+ function batchJobDestinationToVertex(fromObject) {
3419
+ const toObject = {};
3420
+ const fromFormat = getValueByPath(fromObject, ['format']);
3421
+ if (fromFormat != null) {
3422
+ setValueByPath(toObject, ['predictionsFormat'], fromFormat);
3423
+ }
3424
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
3425
+ if (fromGcsUri != null) {
3426
+ setValueByPath(toObject, ['gcsDestination', 'outputUriPrefix'], fromGcsUri);
3427
+ }
3428
+ const fromBigqueryUri = getValueByPath(fromObject, ['bigqueryUri']);
3429
+ if (fromBigqueryUri != null) {
3430
+ setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryUri);
3431
+ }
3432
+ if (getValueByPath(fromObject, ['fileName']) !== undefined) {
3433
+ throw new Error('fileName parameter is not supported in Vertex AI.');
3434
+ }
3435
+ if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
3436
+ throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
3437
+ }
3438
+ return toObject;
3439
+ }
3440
+ function createBatchJobConfigToVertex(fromObject, parentObject) {
3441
+ const toObject = {};
3442
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
3443
+ if (parentObject !== undefined && fromDisplayName != null) {
3444
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
3445
+ }
3446
+ const fromDest = getValueByPath(fromObject, ['dest']);
3447
+ if (parentObject !== undefined && fromDest != null) {
3448
+ setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
3449
+ }
3450
+ return toObject;
3451
+ }
3452
+ function createBatchJobParametersToVertex(apiClient, fromObject) {
3453
+ const toObject = {};
3454
+ const fromModel = getValueByPath(fromObject, ['model']);
3455
+ if (fromModel != null) {
3456
+ setValueByPath(toObject, ['model'], tModel(apiClient, fromModel));
3457
+ }
3458
+ const fromSrc = getValueByPath(fromObject, ['src']);
3459
+ if (fromSrc != null) {
3460
+ setValueByPath(toObject, ['inputConfig'], batchJobSourceToVertex(tBatchJobSource(apiClient, fromSrc)));
3461
+ }
3462
+ const fromConfig = getValueByPath(fromObject, ['config']);
3463
+ if (fromConfig != null) {
3464
+ setValueByPath(toObject, ['config'], createBatchJobConfigToVertex(fromConfig, toObject));
3465
+ }
3466
+ return toObject;
3467
+ }
3468
+ function getBatchJobParametersToVertex(apiClient, fromObject) {
3469
+ const toObject = {};
3470
+ const fromName = getValueByPath(fromObject, ['name']);
3471
+ if (fromName != null) {
3472
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3473
+ }
3474
+ const fromConfig = getValueByPath(fromObject, ['config']);
3475
+ if (fromConfig != null) {
3476
+ setValueByPath(toObject, ['config'], fromConfig);
3477
+ }
3478
+ return toObject;
3479
+ }
3480
+ function cancelBatchJobParametersToVertex(apiClient, fromObject) {
3481
+ const toObject = {};
3482
+ const fromName = getValueByPath(fromObject, ['name']);
3483
+ if (fromName != null) {
3484
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3485
+ }
3486
+ const fromConfig = getValueByPath(fromObject, ['config']);
3487
+ if (fromConfig != null) {
3488
+ setValueByPath(toObject, ['config'], fromConfig);
3489
+ }
3490
+ return toObject;
3491
+ }
3492
+ function listBatchJobsConfigToVertex(fromObject, parentObject) {
3493
+ const toObject = {};
3494
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
3495
+ if (parentObject !== undefined && fromPageSize != null) {
3496
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
3497
+ }
3498
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
3499
+ if (parentObject !== undefined && fromPageToken != null) {
3500
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
3501
+ }
3502
+ const fromFilter = getValueByPath(fromObject, ['filter']);
3503
+ if (parentObject !== undefined && fromFilter != null) {
3504
+ setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
3505
+ }
3506
+ return toObject;
3507
+ }
3508
+ function listBatchJobsParametersToVertex(fromObject) {
3509
+ const toObject = {};
3510
+ const fromConfig = getValueByPath(fromObject, ['config']);
3511
+ if (fromConfig != null) {
3512
+ setValueByPath(toObject, ['config'], listBatchJobsConfigToVertex(fromConfig, toObject));
3513
+ }
3514
+ return toObject;
3515
+ }
3516
+ function deleteBatchJobParametersToVertex(apiClient, fromObject) {
3517
+ const toObject = {};
3518
+ const fromName = getValueByPath(fromObject, ['name']);
3519
+ if (fromName != null) {
3520
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3521
+ }
3522
+ const fromConfig = getValueByPath(fromObject, ['config']);
3523
+ if (fromConfig != null) {
3524
+ setValueByPath(toObject, ['config'], fromConfig);
3525
+ }
3526
+ return toObject;
3527
+ }
3528
+ function jobErrorFromMldev() {
3529
+ const toObject = {};
3530
+ return toObject;
3531
+ }
3532
+ function videoMetadataFromMldev$2(fromObject) {
3533
+ const toObject = {};
3534
+ const fromFps = getValueByPath(fromObject, ['fps']);
3535
+ if (fromFps != null) {
3536
+ setValueByPath(toObject, ['fps'], fromFps);
3537
+ }
3538
+ const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
3539
+ if (fromEndOffset != null) {
3540
+ setValueByPath(toObject, ['endOffset'], fromEndOffset);
3541
+ }
3542
+ const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
3543
+ if (fromStartOffset != null) {
3544
+ setValueByPath(toObject, ['startOffset'], fromStartOffset);
3545
+ }
3546
+ return toObject;
3547
+ }
3548
+ function blobFromMldev$2(fromObject) {
3549
+ const toObject = {};
3550
+ const fromData = getValueByPath(fromObject, ['data']);
3551
+ if (fromData != null) {
3552
+ setValueByPath(toObject, ['data'], fromData);
3553
+ }
3554
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
3555
+ if (fromMimeType != null) {
3556
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
3557
+ }
3558
+ return toObject;
3559
+ }
3560
+ function fileDataFromMldev$2(fromObject) {
3561
+ const toObject = {};
3562
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
3563
+ if (fromFileUri != null) {
3564
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
3565
+ }
3566
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
3567
+ if (fromMimeType != null) {
3568
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
3569
+ }
3570
+ return toObject;
3571
+ }
3572
+ function partFromMldev$2(fromObject) {
3573
+ const toObject = {};
3574
+ const fromVideoMetadata = getValueByPath(fromObject, [
3575
+ 'videoMetadata',
3576
+ ]);
3577
+ if (fromVideoMetadata != null) {
3578
+ setValueByPath(toObject, ['videoMetadata'], videoMetadataFromMldev$2(fromVideoMetadata));
3579
+ }
3580
+ const fromThought = getValueByPath(fromObject, ['thought']);
3581
+ if (fromThought != null) {
3582
+ setValueByPath(toObject, ['thought'], fromThought);
3583
+ }
3584
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
3585
+ if (fromInlineData != null) {
3586
+ setValueByPath(toObject, ['inlineData'], blobFromMldev$2(fromInlineData));
3587
+ }
3588
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
3589
+ if (fromFileData != null) {
3590
+ setValueByPath(toObject, ['fileData'], fileDataFromMldev$2(fromFileData));
3591
+ }
3592
+ const fromThoughtSignature = getValueByPath(fromObject, [
3593
+ 'thoughtSignature',
3594
+ ]);
3595
+ if (fromThoughtSignature != null) {
3596
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
3597
+ }
3598
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
3599
+ 'codeExecutionResult',
3600
+ ]);
3601
+ if (fromCodeExecutionResult != null) {
3602
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
3603
+ }
3604
+ const fromExecutableCode = getValueByPath(fromObject, [
3605
+ 'executableCode',
3606
+ ]);
3607
+ if (fromExecutableCode != null) {
3608
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
3609
+ }
3610
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
3611
+ if (fromFunctionCall != null) {
3612
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
3613
+ }
3614
+ const fromFunctionResponse = getValueByPath(fromObject, [
3615
+ 'functionResponse',
3616
+ ]);
3617
+ if (fromFunctionResponse != null) {
3618
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
3619
+ }
3620
+ const fromText = getValueByPath(fromObject, ['text']);
3621
+ if (fromText != null) {
3622
+ setValueByPath(toObject, ['text'], fromText);
3623
+ }
3624
+ return toObject;
3625
+ }
3626
+ function contentFromMldev$2(fromObject) {
3627
+ const toObject = {};
3628
+ const fromParts = getValueByPath(fromObject, ['parts']);
3629
+ if (fromParts != null) {
3630
+ let transformedList = fromParts;
3631
+ if (Array.isArray(transformedList)) {
3632
+ transformedList = transformedList.map((item) => {
3633
+ return partFromMldev$2(item);
3634
+ });
3635
+ }
3636
+ setValueByPath(toObject, ['parts'], transformedList);
3637
+ }
3638
+ const fromRole = getValueByPath(fromObject, ['role']);
3639
+ if (fromRole != null) {
3640
+ setValueByPath(toObject, ['role'], fromRole);
3641
+ }
3642
+ return toObject;
3643
+ }
3644
+ function citationMetadataFromMldev$1(fromObject) {
3645
+ const toObject = {};
3646
+ const fromCitations = getValueByPath(fromObject, ['citationSources']);
3647
+ if (fromCitations != null) {
3648
+ setValueByPath(toObject, ['citations'], fromCitations);
3649
+ }
3650
+ return toObject;
3651
+ }
3652
+ function urlMetadataFromMldev$2(fromObject) {
3653
+ const toObject = {};
3654
+ const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
3655
+ if (fromRetrievedUrl != null) {
3656
+ setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
3657
+ }
3658
+ const fromUrlRetrievalStatus = getValueByPath(fromObject, [
3659
+ 'urlRetrievalStatus',
3660
+ ]);
3661
+ if (fromUrlRetrievalStatus != null) {
3662
+ setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
3663
+ }
3664
+ return toObject;
3665
+ }
3666
+ function urlContextMetadataFromMldev$2(fromObject) {
3667
+ const toObject = {};
3668
+ const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
3669
+ if (fromUrlMetadata != null) {
3670
+ let transformedList = fromUrlMetadata;
3671
+ if (Array.isArray(transformedList)) {
3672
+ transformedList = transformedList.map((item) => {
3673
+ return urlMetadataFromMldev$2(item);
3674
+ });
3675
+ }
3676
+ setValueByPath(toObject, ['urlMetadata'], transformedList);
3677
+ }
3678
+ return toObject;
3679
+ }
3680
+ function candidateFromMldev$1(fromObject) {
3681
+ const toObject = {};
3682
+ const fromContent = getValueByPath(fromObject, ['content']);
3683
+ if (fromContent != null) {
3684
+ setValueByPath(toObject, ['content'], contentFromMldev$2(fromContent));
3685
+ }
3686
+ const fromCitationMetadata = getValueByPath(fromObject, [
3687
+ 'citationMetadata',
3688
+ ]);
3689
+ if (fromCitationMetadata != null) {
3690
+ setValueByPath(toObject, ['citationMetadata'], citationMetadataFromMldev$1(fromCitationMetadata));
3691
+ }
3692
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
3693
+ if (fromTokenCount != null) {
3694
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
3695
+ }
3696
+ const fromFinishReason = getValueByPath(fromObject, ['finishReason']);
3697
+ if (fromFinishReason != null) {
3698
+ setValueByPath(toObject, ['finishReason'], fromFinishReason);
3699
+ }
3700
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
3701
+ 'urlContextMetadata',
3702
+ ]);
3703
+ if (fromUrlContextMetadata != null) {
3704
+ setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromMldev$2(fromUrlContextMetadata));
3705
+ }
3706
+ const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
3707
+ if (fromAvgLogprobs != null) {
3708
+ setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
3709
+ }
3710
+ const fromGroundingMetadata = getValueByPath(fromObject, [
3711
+ 'groundingMetadata',
3712
+ ]);
3713
+ if (fromGroundingMetadata != null) {
3714
+ setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
3715
+ }
3716
+ const fromIndex = getValueByPath(fromObject, ['index']);
3717
+ if (fromIndex != null) {
3718
+ setValueByPath(toObject, ['index'], fromIndex);
3719
+ }
3720
+ const fromLogprobsResult = getValueByPath(fromObject, [
3721
+ 'logprobsResult',
3722
+ ]);
3723
+ if (fromLogprobsResult != null) {
3724
+ setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
3725
+ }
3726
+ const fromSafetyRatings = getValueByPath(fromObject, [
3727
+ 'safetyRatings',
3728
+ ]);
3729
+ if (fromSafetyRatings != null) {
3730
+ setValueByPath(toObject, ['safetyRatings'], fromSafetyRatings);
3731
+ }
3732
+ return toObject;
3733
+ }
3734
+ function generateContentResponseFromMldev$1(fromObject) {
3735
+ const toObject = {};
3736
+ const fromCandidates = getValueByPath(fromObject, ['candidates']);
3737
+ if (fromCandidates != null) {
3738
+ let transformedList = fromCandidates;
3739
+ if (Array.isArray(transformedList)) {
3740
+ transformedList = transformedList.map((item) => {
3741
+ return candidateFromMldev$1(item);
3742
+ });
3743
+ }
3744
+ setValueByPath(toObject, ['candidates'], transformedList);
3745
+ }
3746
+ const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
3747
+ if (fromModelVersion != null) {
3748
+ setValueByPath(toObject, ['modelVersion'], fromModelVersion);
3749
+ }
3750
+ const fromPromptFeedback = getValueByPath(fromObject, [
3751
+ 'promptFeedback',
3752
+ ]);
3753
+ if (fromPromptFeedback != null) {
3754
+ setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
3755
+ }
3756
+ const fromUsageMetadata = getValueByPath(fromObject, [
3757
+ 'usageMetadata',
3758
+ ]);
3759
+ if (fromUsageMetadata != null) {
3760
+ setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
3761
+ }
3762
+ return toObject;
3763
+ }
3764
+ function inlinedResponseFromMldev(fromObject) {
3765
+ const toObject = {};
3766
+ const fromResponse = getValueByPath(fromObject, ['response']);
3767
+ if (fromResponse != null) {
3768
+ setValueByPath(toObject, ['response'], generateContentResponseFromMldev$1(fromResponse));
3769
+ }
3770
+ const fromError = getValueByPath(fromObject, ['error']);
3771
+ if (fromError != null) {
3772
+ setValueByPath(toObject, ['error'], jobErrorFromMldev());
3773
+ }
3774
+ return toObject;
3775
+ }
3776
+ function batchJobDestinationFromMldev(fromObject) {
3777
+ const toObject = {};
3778
+ const fromFileName = getValueByPath(fromObject, ['responsesFile']);
3779
+ if (fromFileName != null) {
3780
+ setValueByPath(toObject, ['fileName'], fromFileName);
3781
+ }
3782
+ const fromInlinedResponses = getValueByPath(fromObject, [
3783
+ 'inlinedResponses',
3784
+ 'inlinedResponses',
3785
+ ]);
3786
+ if (fromInlinedResponses != null) {
3787
+ let transformedList = fromInlinedResponses;
3788
+ if (Array.isArray(transformedList)) {
3789
+ transformedList = transformedList.map((item) => {
3790
+ return inlinedResponseFromMldev(item);
3791
+ });
3792
+ }
3793
+ setValueByPath(toObject, ['inlinedResponses'], transformedList);
3794
+ }
3795
+ return toObject;
3796
+ }
3797
+ function batchJobFromMldev(fromObject) {
3798
+ const toObject = {};
3799
+ const fromName = getValueByPath(fromObject, ['name']);
3800
+ if (fromName != null) {
3801
+ setValueByPath(toObject, ['name'], fromName);
3802
+ }
3803
+ const fromDisplayName = getValueByPath(fromObject, [
3804
+ 'metadata',
3805
+ 'displayName',
3806
+ ]);
3807
+ if (fromDisplayName != null) {
3808
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
3809
+ }
3810
+ const fromState = getValueByPath(fromObject, ['metadata', 'state']);
3811
+ if (fromState != null) {
3812
+ setValueByPath(toObject, ['state'], tJobState(fromState));
3813
+ }
3814
+ const fromCreateTime = getValueByPath(fromObject, [
3815
+ 'metadata',
3816
+ 'createTime',
3817
+ ]);
3818
+ if (fromCreateTime != null) {
3819
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
3820
+ }
3821
+ const fromEndTime = getValueByPath(fromObject, [
3822
+ 'metadata',
3823
+ 'endTime',
3824
+ ]);
3825
+ if (fromEndTime != null) {
3826
+ setValueByPath(toObject, ['endTime'], fromEndTime);
3827
+ }
3828
+ const fromUpdateTime = getValueByPath(fromObject, [
3829
+ 'metadata',
3830
+ 'updateTime',
3831
+ ]);
3832
+ if (fromUpdateTime != null) {
3833
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
3834
+ }
3835
+ const fromModel = getValueByPath(fromObject, ['metadata', 'model']);
3836
+ if (fromModel != null) {
3837
+ setValueByPath(toObject, ['model'], fromModel);
3838
+ }
3839
+ const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
3840
+ if (fromDest != null) {
3841
+ setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
3842
+ }
3843
+ return toObject;
3844
+ }
3845
+ function listBatchJobsResponseFromMldev(fromObject) {
3846
+ const toObject = {};
3847
+ const fromNextPageToken = getValueByPath(fromObject, [
3848
+ 'nextPageToken',
3849
+ ]);
3850
+ if (fromNextPageToken != null) {
3851
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
3852
+ }
3853
+ const fromBatchJobs = getValueByPath(fromObject, ['operations']);
3854
+ if (fromBatchJobs != null) {
3855
+ let transformedList = fromBatchJobs;
3856
+ if (Array.isArray(transformedList)) {
3857
+ transformedList = transformedList.map((item) => {
3858
+ return batchJobFromMldev(item);
3859
+ });
3860
+ }
3861
+ setValueByPath(toObject, ['batchJobs'], transformedList);
3862
+ }
3863
+ return toObject;
3864
+ }
3865
+ function deleteResourceJobFromMldev(fromObject) {
3866
+ const toObject = {};
3867
+ const fromName = getValueByPath(fromObject, ['name']);
3868
+ if (fromName != null) {
3869
+ setValueByPath(toObject, ['name'], fromName);
3870
+ }
3871
+ const fromDone = getValueByPath(fromObject, ['done']);
3872
+ if (fromDone != null) {
3873
+ setValueByPath(toObject, ['done'], fromDone);
3874
+ }
3875
+ const fromError = getValueByPath(fromObject, ['error']);
3876
+ if (fromError != null) {
3877
+ setValueByPath(toObject, ['error'], jobErrorFromMldev());
3878
+ }
3879
+ return toObject;
3880
+ }
3881
+ function jobErrorFromVertex(fromObject) {
3882
+ const toObject = {};
3883
+ const fromDetails = getValueByPath(fromObject, ['details']);
3884
+ if (fromDetails != null) {
3885
+ setValueByPath(toObject, ['details'], fromDetails);
3886
+ }
3887
+ const fromCode = getValueByPath(fromObject, ['code']);
3888
+ if (fromCode != null) {
3889
+ setValueByPath(toObject, ['code'], fromCode);
3890
+ }
3891
+ const fromMessage = getValueByPath(fromObject, ['message']);
3892
+ if (fromMessage != null) {
3893
+ setValueByPath(toObject, ['message'], fromMessage);
3894
+ }
3895
+ return toObject;
3896
+ }
3897
+ function batchJobSourceFromVertex(fromObject) {
3898
+ const toObject = {};
3899
+ const fromFormat = getValueByPath(fromObject, ['instancesFormat']);
3900
+ if (fromFormat != null) {
3901
+ setValueByPath(toObject, ['format'], fromFormat);
3902
+ }
3903
+ const fromGcsUri = getValueByPath(fromObject, ['gcsSource', 'uris']);
3904
+ if (fromGcsUri != null) {
3905
+ setValueByPath(toObject, ['gcsUri'], fromGcsUri);
3906
+ }
3907
+ const fromBigqueryUri = getValueByPath(fromObject, [
3908
+ 'bigquerySource',
3909
+ 'inputUri',
3910
+ ]);
3911
+ if (fromBigqueryUri != null) {
3912
+ setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
3913
+ }
3914
+ return toObject;
3915
+ }
3916
+ function batchJobDestinationFromVertex(fromObject) {
3917
+ const toObject = {};
3918
+ const fromFormat = getValueByPath(fromObject, ['predictionsFormat']);
3919
+ if (fromFormat != null) {
3920
+ setValueByPath(toObject, ['format'], fromFormat);
3921
+ }
3922
+ const fromGcsUri = getValueByPath(fromObject, [
3923
+ 'gcsDestination',
3924
+ 'outputUriPrefix',
3925
+ ]);
3926
+ if (fromGcsUri != null) {
3927
+ setValueByPath(toObject, ['gcsUri'], fromGcsUri);
3928
+ }
3929
+ const fromBigqueryUri = getValueByPath(fromObject, [
3930
+ 'bigqueryDestination',
3931
+ 'outputUri',
3932
+ ]);
3933
+ if (fromBigqueryUri != null) {
3934
+ setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
3935
+ }
3936
+ return toObject;
3937
+ }
3938
+ function batchJobFromVertex(fromObject) {
3939
+ const toObject = {};
3940
+ const fromName = getValueByPath(fromObject, ['name']);
3941
+ if (fromName != null) {
3942
+ setValueByPath(toObject, ['name'], fromName);
3943
+ }
3944
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
3945
+ if (fromDisplayName != null) {
3946
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
3947
+ }
3948
+ const fromState = getValueByPath(fromObject, ['state']);
3949
+ if (fromState != null) {
3950
+ setValueByPath(toObject, ['state'], tJobState(fromState));
3951
+ }
3952
+ const fromError = getValueByPath(fromObject, ['error']);
3953
+ if (fromError != null) {
3954
+ setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
3955
+ }
3956
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
3957
+ if (fromCreateTime != null) {
3958
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
3959
+ }
3960
+ const fromStartTime = getValueByPath(fromObject, ['startTime']);
3961
+ if (fromStartTime != null) {
3962
+ setValueByPath(toObject, ['startTime'], fromStartTime);
3963
+ }
3964
+ const fromEndTime = getValueByPath(fromObject, ['endTime']);
3965
+ if (fromEndTime != null) {
3966
+ setValueByPath(toObject, ['endTime'], fromEndTime);
3967
+ }
3968
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
3969
+ if (fromUpdateTime != null) {
3970
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
3971
+ }
3972
+ const fromModel = getValueByPath(fromObject, ['model']);
3973
+ if (fromModel != null) {
3974
+ setValueByPath(toObject, ['model'], fromModel);
3975
+ }
3976
+ const fromSrc = getValueByPath(fromObject, ['inputConfig']);
3977
+ if (fromSrc != null) {
3978
+ setValueByPath(toObject, ['src'], batchJobSourceFromVertex(fromSrc));
3979
+ }
3980
+ const fromDest = getValueByPath(fromObject, ['outputConfig']);
3981
+ if (fromDest != null) {
3982
+ setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
3983
+ }
3984
+ return toObject;
3985
+ }
3986
+ function listBatchJobsResponseFromVertex(fromObject) {
3987
+ const toObject = {};
3988
+ const fromNextPageToken = getValueByPath(fromObject, [
3989
+ 'nextPageToken',
3990
+ ]);
3991
+ if (fromNextPageToken != null) {
3992
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
3993
+ }
3994
+ const fromBatchJobs = getValueByPath(fromObject, [
3995
+ 'batchPredictionJobs',
3996
+ ]);
3997
+ if (fromBatchJobs != null) {
3998
+ let transformedList = fromBatchJobs;
3999
+ if (Array.isArray(transformedList)) {
4000
+ transformedList = transformedList.map((item) => {
4001
+ return batchJobFromVertex(item);
4002
+ });
4003
+ }
4004
+ setValueByPath(toObject, ['batchJobs'], transformedList);
4005
+ }
4006
+ return toObject;
4007
+ }
4008
+ function deleteResourceJobFromVertex(fromObject) {
4009
+ const toObject = {};
4010
+ const fromName = getValueByPath(fromObject, ['name']);
4011
+ if (fromName != null) {
4012
+ setValueByPath(toObject, ['name'], fromName);
4013
+ }
4014
+ const fromDone = getValueByPath(fromObject, ['done']);
4015
+ if (fromDone != null) {
4016
+ setValueByPath(toObject, ['done'], fromDone);
4017
+ }
4018
+ const fromError = getValueByPath(fromObject, ['error']);
4019
+ if (fromError != null) {
4020
+ setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
4021
+ }
4022
+ return toObject;
4023
+ }
4024
+
4025
+ /**
4026
+ * @license
4027
+ * Copyright 2025 Google LLC
4028
+ * SPDX-License-Identifier: Apache-2.0
4029
+ */
4030
+ /**
4031
+ * Pagers for the GenAI List APIs.
4032
+ */
4033
+ var PagedItem;
4034
+ (function (PagedItem) {
4035
+ PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
4036
+ PagedItem["PAGED_ITEM_MODELS"] = "models";
4037
+ PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
4038
+ PagedItem["PAGED_ITEM_FILES"] = "files";
4039
+ PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
4040
+ })(PagedItem || (PagedItem = {}));
4041
+ /**
4042
+ * Pager class for iterating through paginated results.
4043
+ */
4044
+ class Pager {
4045
+ constructor(name, request, response, params) {
4046
+ this.pageInternal = [];
4047
+ this.paramsInternal = {};
4048
+ this.requestInternal = request;
4049
+ this.init(name, response, params);
4050
+ }
4051
+ init(name, response, params) {
4052
+ var _a, _b;
4053
+ this.nameInternal = name;
4054
+ this.pageInternal = response[this.nameInternal] || [];
4055
+ this.idxInternal = 0;
4056
+ let requestParams = { config: {} };
4057
+ if (!params) {
4058
+ requestParams = { config: {} };
4059
+ }
4060
+ else if (typeof params === 'object') {
4061
+ requestParams = Object.assign({}, params);
4062
+ }
4063
+ else {
4064
+ requestParams = params;
4065
+ }
4066
+ if (requestParams['config']) {
4067
+ requestParams['config']['pageToken'] = response['nextPageToken'];
4068
+ }
4069
+ this.paramsInternal = requestParams;
4070
+ this.pageInternalSize =
4071
+ (_b = (_a = requestParams['config']) === null || _a === void 0 ? void 0 : _a['pageSize']) !== null && _b !== void 0 ? _b : this.pageInternal.length;
4072
+ }
4073
+ initNextPage(response) {
4074
+ this.init(this.nameInternal, response, this.paramsInternal);
4075
+ }
4076
+ /**
4077
+ * Returns the current page, which is a list of items.
4078
+ *
4079
+ * @remarks
4080
+ * The first page is retrieved when the pager is created. The returned list of
4081
+ * items could be a subset of the entire list.
4082
+ */
4083
+ get page() {
4084
+ return this.pageInternal;
4085
+ }
4086
+ /**
4087
+ * Returns the type of paged item (for example, ``batch_jobs``).
4088
+ */
4089
+ get name() {
4090
+ return this.nameInternal;
4091
+ }
4092
+ /**
4093
+ * Returns the length of the page fetched each time by this pager.
4094
+ *
4095
+ * @remarks
4096
+ * The number of items in the page is less than or equal to the page length.
4097
+ */
4098
+ get pageSize() {
4099
+ return this.pageInternalSize;
4100
+ }
4101
+ /**
4102
+ * Returns the parameters when making the API request for the next page.
4103
+ *
4104
+ * @remarks
4105
+ * Parameters contain a set of optional configs that can be
4106
+ * used to customize the API request. For example, the `pageToken` parameter
4107
+ * contains the token to request the next page.
4108
+ */
4109
+ get params() {
4110
+ return this.paramsInternal;
4111
+ }
4112
+ /**
4113
+ * Returns the total number of items in the current page.
4114
+ */
4115
+ get pageLength() {
4116
+ return this.pageInternal.length;
4117
+ }
4118
+ /**
4119
+ * Returns the item at the given index.
4120
+ */
4121
+ getItem(index) {
4122
+ return this.pageInternal[index];
4123
+ }
4124
+ /**
4125
+ * Returns an async iterator that support iterating through all items
4126
+ * retrieved from the API.
4127
+ *
4128
+ * @remarks
4129
+ * The iterator will automatically fetch the next page if there are more items
4130
+ * to fetch from the API.
4131
+ *
4132
+ * @example
4133
+ *
4134
+ * ```ts
4135
+ * const pager = await ai.files.list({config: {pageSize: 10}});
4136
+ * for await (const file of pager) {
4137
+ * console.log(file.name);
4138
+ * }
4139
+ * ```
4140
+ */
4141
+ [Symbol.asyncIterator]() {
4142
+ return {
4143
+ next: async () => {
4144
+ if (this.idxInternal >= this.pageLength) {
4145
+ if (this.hasNextPage()) {
4146
+ await this.nextPage();
4147
+ }
4148
+ else {
4149
+ return { value: undefined, done: true };
4150
+ }
4151
+ }
4152
+ const item = this.getItem(this.idxInternal);
4153
+ this.idxInternal += 1;
4154
+ return { value: item, done: false };
4155
+ },
4156
+ return: async () => {
4157
+ return { value: undefined, done: true };
4158
+ },
4159
+ };
4160
+ }
4161
+ /**
4162
+ * Fetches the next page of items. This makes a new API request.
4163
+ *
4164
+ * @throws {Error} If there are no more pages to fetch.
4165
+ *
4166
+ * @example
4167
+ *
4168
+ * ```ts
4169
+ * const pager = await ai.files.list({config: {pageSize: 10}});
4170
+ * let page = pager.page;
4171
+ * while (true) {
4172
+ * for (const file of page) {
4173
+ * console.log(file.name);
4174
+ * }
4175
+ * if (!pager.hasNextPage()) {
4176
+ * break;
4177
+ * }
4178
+ * page = await pager.nextPage();
4179
+ * }
4180
+ * ```
4181
+ */
4182
+ async nextPage() {
4183
+ if (!this.hasNextPage()) {
4184
+ throw new Error('No more pages to fetch.');
4185
+ }
4186
+ const response = await this.requestInternal(this.params);
4187
+ this.initNextPage(response);
4188
+ return this.page;
4189
+ }
4190
+ /**
4191
+ * Returns true if there are more pages to fetch from the API.
4192
+ */
4193
+ hasNextPage() {
4194
+ var _a;
4195
+ if (((_a = this.params['config']) === null || _a === void 0 ? void 0 : _a['pageToken']) !== undefined) {
4196
+ return true;
4197
+ }
4198
+ return false;
4199
+ }
4200
+ }
4201
+
4202
+ /**
4203
+ * @license
4204
+ * Copyright 2025 Google LLC
4205
+ * SPDX-License-Identifier: Apache-2.0
4206
+ */
4207
+ class Batches extends BaseModule {
4208
+ constructor(apiClient) {
4209
+ super();
4210
+ this.apiClient = apiClient;
4211
+ /**
4212
+ * Create batch job.
4213
+ *
4214
+ * @param params - The parameters for create batch job request.
4215
+ * @return The created batch job.
4216
+ *
4217
+ * @example
4218
+ * ```ts
4219
+ * const response = await ai.batches.create({
4220
+ * model: 'gemini-2.0-flash',
4221
+ * src: {gcsUri: 'gs://bucket/path/to/file.jsonl', format: 'jsonl'},
4222
+ * config: {
4223
+ * dest: {gcsUri: 'gs://bucket/path/output/directory', format: 'jsonl'},
4224
+ * }
4225
+ * });
4226
+ * console.log(response);
4227
+ * ```
4228
+ */
4229
+ this.create = async (params) => {
4230
+ if (this.apiClient.isVertexAI()) {
4231
+ const timestamp = Date.now();
4232
+ const timestampStr = timestamp.toString();
4233
+ if (Array.isArray(params.src)) {
4234
+ throw new Error('InlinedRequest[] is not supported in Vertex AI. Please use ' +
4235
+ 'Google Cloud Storage URI or BigQuery URI instead.');
4236
+ }
4237
+ params.config = params.config || {};
4238
+ if (params.config.displayName === undefined) {
4239
+ params.config.displayName = 'genaiBatchJob_${timestampStr}';
4240
+ }
4241
+ if (params.config.dest === undefined && typeof params.src === 'string') {
4242
+ if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
4243
+ params.config.dest = `${params.src.slice(0, -6)}/dest`;
4244
+ }
4245
+ else if (params.src.startsWith('bq://')) {
4246
+ params.config.dest =
4247
+ `${params.src}_dest_${timestampStr}`;
4248
+ }
4249
+ else {
4250
+ throw new Error('Unsupported source:' + params.src);
4251
+ }
4252
+ }
4253
+ }
4254
+ return await this.createInternal(params);
4255
+ };
4256
+ /**
4257
+ * Lists batch job configurations.
4258
+ *
4259
+ * @param params - The parameters for the list request.
4260
+ * @return The paginated results of the list of batch jobs.
4261
+ *
4262
+ * @example
4263
+ * ```ts
4264
+ * const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
4265
+ * for await (const batchJob of batchJobs) {
4266
+ * console.log(batchJob);
4267
+ * }
4268
+ * ```
4269
+ */
4270
+ this.list = async (params = {}) => {
4271
+ return new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
4272
+ };
4273
+ }
4274
+ /**
4275
+ * Internal method to create batch job.
4276
+ *
4277
+ * @param params - The parameters for create batch job request.
4278
+ * @return The created batch job.
4279
+ *
4280
+ */
4281
+ async createInternal(params) {
4282
+ var _a, _b, _c, _d;
4283
+ let response;
4284
+ let path = '';
4285
+ let queryParams = {};
4286
+ if (this.apiClient.isVertexAI()) {
4287
+ const body = createBatchJobParametersToVertex(this.apiClient, params);
4288
+ path = formatMap('batchPredictionJobs', body['_url']);
4289
+ queryParams = body['_query'];
4290
+ delete body['config'];
4291
+ delete body['_url'];
4292
+ delete body['_query'];
4293
+ response = this.apiClient
4294
+ .request({
4295
+ path: path,
4296
+ queryParams: queryParams,
4297
+ body: JSON.stringify(body),
4298
+ httpMethod: 'POST',
4299
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4300
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4301
+ })
4302
+ .then((httpResponse) => {
4303
+ return httpResponse.json();
4304
+ });
4305
+ return response.then((apiResponse) => {
4306
+ const resp = batchJobFromVertex(apiResponse);
4307
+ return resp;
4308
+ });
4309
+ }
4310
+ else {
4311
+ const body = createBatchJobParametersToMldev(this.apiClient, params);
4312
+ path = formatMap('{model}:batchGenerateContent', body['_url']);
4313
+ queryParams = body['_query'];
4314
+ delete body['config'];
4315
+ delete body['_url'];
4316
+ delete body['_query'];
4317
+ response = this.apiClient
4318
+ .request({
4319
+ path: path,
4320
+ queryParams: queryParams,
4321
+ body: JSON.stringify(body),
4322
+ httpMethod: 'POST',
4323
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4324
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4325
+ })
4326
+ .then((httpResponse) => {
4327
+ return httpResponse.json();
4328
+ });
4329
+ return response.then((apiResponse) => {
4330
+ const resp = batchJobFromMldev(apiResponse);
4331
+ return resp;
4332
+ });
4333
+ }
4334
+ }
4335
+ /**
4336
+ * Gets batch job configurations.
4337
+ *
4338
+ * @param params - The parameters for the get request.
4339
+ * @return The batch job.
4340
+ *
4341
+ * @example
4342
+ * ```ts
4343
+ * await ai.batches.get({name: '...'}); // The server-generated resource name.
4344
+ * ```
4345
+ */
4346
+ async get(params) {
4347
+ var _a, _b, _c, _d;
4348
+ let response;
4349
+ let path = '';
4350
+ let queryParams = {};
4351
+ if (this.apiClient.isVertexAI()) {
4352
+ const body = getBatchJobParametersToVertex(this.apiClient, params);
4353
+ path = formatMap('batchPredictionJobs/{name}', body['_url']);
4354
+ queryParams = body['_query'];
4355
+ delete body['config'];
4356
+ delete body['_url'];
4357
+ delete body['_query'];
4358
+ response = this.apiClient
4359
+ .request({
4360
+ path: path,
4361
+ queryParams: queryParams,
4362
+ body: JSON.stringify(body),
4363
+ httpMethod: 'GET',
4364
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4365
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4366
+ })
4367
+ .then((httpResponse) => {
4368
+ return httpResponse.json();
4369
+ });
4370
+ return response.then((apiResponse) => {
4371
+ const resp = batchJobFromVertex(apiResponse);
4372
+ return resp;
4373
+ });
4374
+ }
4375
+ else {
4376
+ const body = getBatchJobParametersToMldev(this.apiClient, params);
4377
+ path = formatMap('batches/{name}', body['_url']);
4378
+ queryParams = body['_query'];
4379
+ delete body['config'];
4380
+ delete body['_url'];
4381
+ delete body['_query'];
4382
+ response = this.apiClient
4383
+ .request({
4384
+ path: path,
4385
+ queryParams: queryParams,
4386
+ body: JSON.stringify(body),
4387
+ httpMethod: 'GET',
4388
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4389
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4390
+ })
4391
+ .then((httpResponse) => {
4392
+ return httpResponse.json();
4393
+ });
4394
+ return response.then((apiResponse) => {
4395
+ const resp = batchJobFromMldev(apiResponse);
4396
+ return resp;
4397
+ });
4398
+ }
4399
+ }
4400
+ /**
4401
+ * Cancels a batch job.
4402
+ *
4403
+ * @param params - The parameters for the cancel request.
4404
+ * @return The empty response returned by the API.
4405
+ *
4406
+ * @example
4407
+ * ```ts
4408
+ * await ai.batches.cancel({name: '...'}); // The server-generated resource name.
4409
+ * ```
4410
+ */
4411
+ async cancel(params) {
4412
+ var _a, _b, _c, _d;
4413
+ let path = '';
4414
+ let queryParams = {};
4415
+ if (this.apiClient.isVertexAI()) {
4416
+ const body = cancelBatchJobParametersToVertex(this.apiClient, params);
4417
+ path = formatMap('batchPredictionJobs/{name}:cancel', body['_url']);
4418
+ queryParams = body['_query'];
4419
+ delete body['config'];
4420
+ delete body['_url'];
4421
+ delete body['_query'];
4422
+ await this.apiClient.request({
4423
+ path: path,
4424
+ queryParams: queryParams,
4425
+ body: JSON.stringify(body),
4426
+ httpMethod: 'POST',
4427
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4428
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4429
+ });
4430
+ }
4431
+ else {
4432
+ const body = cancelBatchJobParametersToMldev(this.apiClient, params);
4433
+ path = formatMap('batches/{name}:cancel', body['_url']);
4434
+ queryParams = body['_query'];
4435
+ delete body['config'];
4436
+ delete body['_url'];
4437
+ delete body['_query'];
4438
+ await this.apiClient.request({
4439
+ path: path,
4440
+ queryParams: queryParams,
4441
+ body: JSON.stringify(body),
4442
+ httpMethod: 'POST',
4443
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4444
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4445
+ });
4446
+ }
4447
+ }
4448
+ async listInternal(params) {
4449
+ var _a, _b, _c, _d;
4450
+ let response;
4451
+ let path = '';
4452
+ let queryParams = {};
4453
+ if (this.apiClient.isVertexAI()) {
4454
+ const body = listBatchJobsParametersToVertex(params);
4455
+ path = formatMap('batchPredictionJobs', body['_url']);
4456
+ queryParams = body['_query'];
4457
+ delete body['config'];
4458
+ delete body['_url'];
4459
+ delete body['_query'];
4460
+ response = this.apiClient
4461
+ .request({
4462
+ path: path,
4463
+ queryParams: queryParams,
4464
+ body: JSON.stringify(body),
4465
+ httpMethod: 'GET',
4466
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4467
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4468
+ })
4469
+ .then((httpResponse) => {
4470
+ return httpResponse.json();
4471
+ });
4472
+ return response.then((apiResponse) => {
4473
+ const resp = listBatchJobsResponseFromVertex(apiResponse);
4474
+ const typedResp = new ListBatchJobsResponse();
4475
+ Object.assign(typedResp, resp);
4476
+ return typedResp;
4477
+ });
4478
+ }
4479
+ else {
4480
+ const body = listBatchJobsParametersToMldev(params);
4481
+ path = formatMap('batches', body['_url']);
4482
+ queryParams = body['_query'];
4483
+ delete body['config'];
4484
+ delete body['_url'];
4485
+ delete body['_query'];
4486
+ response = this.apiClient
4487
+ .request({
4488
+ path: path,
4489
+ queryParams: queryParams,
4490
+ body: JSON.stringify(body),
4491
+ httpMethod: 'GET',
4492
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4493
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4494
+ })
4495
+ .then((httpResponse) => {
4496
+ return httpResponse.json();
4497
+ });
4498
+ return response.then((apiResponse) => {
4499
+ const resp = listBatchJobsResponseFromMldev(apiResponse);
4500
+ const typedResp = new ListBatchJobsResponse();
4501
+ Object.assign(typedResp, resp);
4502
+ return typedResp;
4503
+ });
4504
+ }
4505
+ }
4506
+ /**
4507
+ * Deletes a batch job.
4508
+ *
4509
+ * @param params - The parameters for the delete request.
4510
+ * @return The empty response returned by the API.
4511
+ *
4512
+ * @example
4513
+ * ```ts
4514
+ * await ai.batches.delete({name: '...'}); // The server-generated resource name.
4515
+ * ```
4516
+ */
4517
+ async delete(params) {
4518
+ var _a, _b, _c, _d;
4519
+ let response;
4520
+ let path = '';
4521
+ let queryParams = {};
4522
+ if (this.apiClient.isVertexAI()) {
4523
+ const body = deleteBatchJobParametersToVertex(this.apiClient, params);
4524
+ path = formatMap('batchPredictionJobs/{name}', body['_url']);
4525
+ queryParams = body['_query'];
4526
+ delete body['config'];
4527
+ delete body['_url'];
4528
+ delete body['_query'];
4529
+ response = this.apiClient
4530
+ .request({
4531
+ path: path,
4532
+ queryParams: queryParams,
4533
+ body: JSON.stringify(body),
4534
+ httpMethod: 'DELETE',
4535
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4536
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4537
+ })
4538
+ .then((httpResponse) => {
4539
+ return httpResponse.json();
4540
+ });
4541
+ return response.then((apiResponse) => {
4542
+ const resp = deleteResourceJobFromVertex(apiResponse);
4543
+ return resp;
4544
+ });
4545
+ }
4546
+ else {
4547
+ const body = deleteBatchJobParametersToMldev(this.apiClient, params);
4548
+ path = formatMap('batches/{name}', body['_url']);
4549
+ queryParams = body['_query'];
4550
+ delete body['config'];
4551
+ delete body['_url'];
4552
+ delete body['_query'];
4553
+ response = this.apiClient
4554
+ .request({
4555
+ path: path,
4556
+ queryParams: queryParams,
4557
+ body: JSON.stringify(body),
4558
+ httpMethod: 'DELETE',
4559
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4560
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4561
+ })
4562
+ .then((httpResponse) => {
4563
+ return httpResponse.json();
4564
+ });
4565
+ return response.then((apiResponse) => {
4566
+ const resp = deleteResourceJobFromMldev(apiResponse);
4567
+ return resp;
4568
+ });
2414
4569
  }
2415
4570
  }
2416
- return filteredSchema;
2417
4571
  }
2418
4572
 
2419
4573
  /**
@@ -2668,6 +4822,10 @@ function toolToMldev$3(fromObject) {
2668
4822
  if (fromCodeExecution != null) {
2669
4823
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2670
4824
  }
4825
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4826
+ if (fromComputerUse != null) {
4827
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
4828
+ }
2671
4829
  return toObject;
2672
4830
  }
2673
4831
  function functionCallingConfigToMldev$1(fromObject) {
@@ -3158,6 +5316,10 @@ function toolToVertex$2(fromObject) {
3158
5316
  if (fromCodeExecution != null) {
3159
5317
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
3160
5318
  }
5319
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5320
+ if (fromComputerUse != null) {
5321
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
5322
+ }
3161
5323
  return toObject;
3162
5324
  }
3163
5325
  function functionCallingConfigToVertex$1(fromObject) {
@@ -3465,183 +5627,6 @@ function listCachedContentsResponseFromVertex(fromObject) {
3465
5627
  return toObject;
3466
5628
  }
3467
5629
 
3468
- /**
3469
- * @license
3470
- * Copyright 2025 Google LLC
3471
- * SPDX-License-Identifier: Apache-2.0
3472
- */
3473
- /**
3474
- * Pagers for the GenAI List APIs.
3475
- */
3476
- var PagedItem;
3477
- (function (PagedItem) {
3478
- PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
3479
- PagedItem["PAGED_ITEM_MODELS"] = "models";
3480
- PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
3481
- PagedItem["PAGED_ITEM_FILES"] = "files";
3482
- PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
3483
- })(PagedItem || (PagedItem = {}));
3484
- /**
3485
- * Pager class for iterating through paginated results.
3486
- */
3487
- class Pager {
3488
- constructor(name, request, response, params) {
3489
- this.pageInternal = [];
3490
- this.paramsInternal = {};
3491
- this.requestInternal = request;
3492
- this.init(name, response, params);
3493
- }
3494
- init(name, response, params) {
3495
- var _a, _b;
3496
- this.nameInternal = name;
3497
- this.pageInternal = response[this.nameInternal] || [];
3498
- this.idxInternal = 0;
3499
- let requestParams = { config: {} };
3500
- if (!params) {
3501
- requestParams = { config: {} };
3502
- }
3503
- else if (typeof params === 'object') {
3504
- requestParams = Object.assign({}, params);
3505
- }
3506
- else {
3507
- requestParams = params;
3508
- }
3509
- if (requestParams['config']) {
3510
- requestParams['config']['pageToken'] = response['nextPageToken'];
3511
- }
3512
- this.paramsInternal = requestParams;
3513
- this.pageInternalSize =
3514
- (_b = (_a = requestParams['config']) === null || _a === void 0 ? void 0 : _a['pageSize']) !== null && _b !== void 0 ? _b : this.pageInternal.length;
3515
- }
3516
- initNextPage(response) {
3517
- this.init(this.nameInternal, response, this.paramsInternal);
3518
- }
3519
- /**
3520
- * Returns the current page, which is a list of items.
3521
- *
3522
- * @remarks
3523
- * The first page is retrieved when the pager is created. The returned list of
3524
- * items could be a subset of the entire list.
3525
- */
3526
- get page() {
3527
- return this.pageInternal;
3528
- }
3529
- /**
3530
- * Returns the type of paged item (for example, ``batch_jobs``).
3531
- */
3532
- get name() {
3533
- return this.nameInternal;
3534
- }
3535
- /**
3536
- * Returns the length of the page fetched each time by this pager.
3537
- *
3538
- * @remarks
3539
- * The number of items in the page is less than or equal to the page length.
3540
- */
3541
- get pageSize() {
3542
- return this.pageInternalSize;
3543
- }
3544
- /**
3545
- * Returns the parameters when making the API request for the next page.
3546
- *
3547
- * @remarks
3548
- * Parameters contain a set of optional configs that can be
3549
- * used to customize the API request. For example, the `pageToken` parameter
3550
- * contains the token to request the next page.
3551
- */
3552
- get params() {
3553
- return this.paramsInternal;
3554
- }
3555
- /**
3556
- * Returns the total number of items in the current page.
3557
- */
3558
- get pageLength() {
3559
- return this.pageInternal.length;
3560
- }
3561
- /**
3562
- * Returns the item at the given index.
3563
- */
3564
- getItem(index) {
3565
- return this.pageInternal[index];
3566
- }
3567
- /**
3568
- * Returns an async iterator that support iterating through all items
3569
- * retrieved from the API.
3570
- *
3571
- * @remarks
3572
- * The iterator will automatically fetch the next page if there are more items
3573
- * to fetch from the API.
3574
- *
3575
- * @example
3576
- *
3577
- * ```ts
3578
- * const pager = await ai.files.list({config: {pageSize: 10}});
3579
- * for await (const file of pager) {
3580
- * console.log(file.name);
3581
- * }
3582
- * ```
3583
- */
3584
- [Symbol.asyncIterator]() {
3585
- return {
3586
- next: async () => {
3587
- if (this.idxInternal >= this.pageLength) {
3588
- if (this.hasNextPage()) {
3589
- await this.nextPage();
3590
- }
3591
- else {
3592
- return { value: undefined, done: true };
3593
- }
3594
- }
3595
- const item = this.getItem(this.idxInternal);
3596
- this.idxInternal += 1;
3597
- return { value: item, done: false };
3598
- },
3599
- return: async () => {
3600
- return { value: undefined, done: true };
3601
- },
3602
- };
3603
- }
3604
- /**
3605
- * Fetches the next page of items. This makes a new API request.
3606
- *
3607
- * @throws {Error} If there are no more pages to fetch.
3608
- *
3609
- * @example
3610
- *
3611
- * ```ts
3612
- * const pager = await ai.files.list({config: {pageSize: 10}});
3613
- * let page = pager.page;
3614
- * while (true) {
3615
- * for (const file of page) {
3616
- * console.log(file.name);
3617
- * }
3618
- * if (!pager.hasNextPage()) {
3619
- * break;
3620
- * }
3621
- * page = await pager.nextPage();
3622
- * }
3623
- * ```
3624
- */
3625
- async nextPage() {
3626
- if (!this.hasNextPage()) {
3627
- throw new Error('No more pages to fetch.');
3628
- }
3629
- const response = await this.requestInternal(this.params);
3630
- this.initNextPage(response);
3631
- return this.page;
3632
- }
3633
- /**
3634
- * Returns true if there are more pages to fetch from the API.
3635
- */
3636
- hasNextPage() {
3637
- var _a;
3638
- if (((_a = this.params['config']) === null || _a === void 0 ? void 0 : _a['pageToken']) !== undefined) {
3639
- return true;
3640
- }
3641
- return false;
3642
- }
3643
- }
3644
-
3645
5630
  /**
3646
5631
  * @license
3647
5632
  * Copyright 2025 Google LLC
@@ -5541,6 +7526,10 @@ function toolToMldev$2(fromObject) {
5541
7526
  if (fromCodeExecution != null) {
5542
7527
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5543
7528
  }
7529
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7530
+ if (fromComputerUse != null) {
7531
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
7532
+ }
5544
7533
  return toObject;
5545
7534
  }
5546
7535
  function toolToVertex$1(fromObject) {
@@ -5591,6 +7580,10 @@ function toolToVertex$1(fromObject) {
5591
7580
  if (fromCodeExecution != null) {
5592
7581
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5593
7582
  }
7583
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7584
+ if (fromComputerUse != null) {
7585
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
7586
+ }
5594
7587
  return toObject;
5595
7588
  }
5596
7589
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -6086,8 +8079,9 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
6086
8079
  if (fromMedia != null) {
6087
8080
  setValueByPath(toObject, ['mediaChunks'], tBlobs(fromMedia));
6088
8081
  }
6089
- if (getValueByPath(fromObject, ['audio']) !== undefined) {
6090
- throw new Error('audio parameter is not supported in Vertex AI.');
8082
+ const fromAudio = getValueByPath(fromObject, ['audio']);
8083
+ if (fromAudio != null) {
8084
+ setValueByPath(toObject, ['audio'], tAudioBlob(fromAudio));
6091
8085
  }
6092
8086
  const fromAudioStreamEnd = getValueByPath(fromObject, [
6093
8087
  'audioStreamEnd',
@@ -6095,11 +8089,13 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
6095
8089
  if (fromAudioStreamEnd != null) {
6096
8090
  setValueByPath(toObject, ['audioStreamEnd'], fromAudioStreamEnd);
6097
8091
  }
6098
- if (getValueByPath(fromObject, ['video']) !== undefined) {
6099
- throw new Error('video parameter is not supported in Vertex AI.');
8092
+ const fromVideo = getValueByPath(fromObject, ['video']);
8093
+ if (fromVideo != null) {
8094
+ setValueByPath(toObject, ['video'], tImageBlob(fromVideo));
6100
8095
  }
6101
- if (getValueByPath(fromObject, ['text']) !== undefined) {
6102
- throw new Error('text parameter is not supported in Vertex AI.');
8096
+ const fromText = getValueByPath(fromObject, ['text']);
8097
+ if (fromText != null) {
8098
+ setValueByPath(toObject, ['text'], fromText);
6103
8099
  }
6104
8100
  const fromActivityStart = getValueByPath(fromObject, [
6105
8101
  'activityStart',
@@ -6255,8 +8251,12 @@ function liveServerSetupCompleteFromMldev() {
6255
8251
  const toObject = {};
6256
8252
  return toObject;
6257
8253
  }
6258
- function liveServerSetupCompleteFromVertex() {
8254
+ function liveServerSetupCompleteFromVertex(fromObject) {
6259
8255
  const toObject = {};
8256
+ const fromSessionId = getValueByPath(fromObject, ['sessionId']);
8257
+ if (fromSessionId != null) {
8258
+ setValueByPath(toObject, ['sessionId'], fromSessionId);
8259
+ }
6260
8260
  return toObject;
6261
8261
  }
6262
8262
  function videoMetadataFromMldev$1(fromObject) {
@@ -7009,7 +9009,7 @@ function liveServerMessageFromVertex(fromObject) {
7009
9009
  'setupComplete',
7010
9010
  ]);
7011
9011
  if (fromSetupComplete != null) {
7012
- setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex());
9012
+ setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex(fromSetupComplete));
7013
9013
  }
7014
9014
  const fromServerContent = getValueByPath(fromObject, [
7015
9015
  'serverContent',
@@ -7577,6 +9577,10 @@ function toolToMldev$1(fromObject) {
7577
9577
  if (fromCodeExecution != null) {
7578
9578
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7579
9579
  }
9580
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
9581
+ if (fromComputerUse != null) {
9582
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
9583
+ }
7580
9584
  return toObject;
7581
9585
  }
7582
9586
  function functionCallingConfigToMldev(fromObject) {
@@ -7789,6 +9793,12 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
7789
9793
  if (fromResponseSchema != null) {
7790
9794
  setValueByPath(toObject, ['responseSchema'], schemaToMldev(tSchema(fromResponseSchema)));
7791
9795
  }
9796
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
9797
+ 'responseJsonSchema',
9798
+ ]);
9799
+ if (fromResponseJsonSchema != null) {
9800
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9801
+ }
7792
9802
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
7793
9803
  throw new Error('routingConfig parameter is not supported in Gemini API.');
7794
9804
  }
@@ -8203,6 +10213,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
8203
10213
  if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
8204
10214
  throw new Error('lastFrame parameter is not supported in Gemini API.');
8205
10215
  }
10216
+ if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
10217
+ throw new Error('compressionQuality parameter is not supported in Gemini API.');
10218
+ }
8206
10219
  return toObject;
8207
10220
  }
8208
10221
  function generateVideosParametersToMldev(apiClient, fromObject) {
@@ -8657,6 +10670,10 @@ function toolToVertex(fromObject) {
8657
10670
  if (fromCodeExecution != null) {
8658
10671
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8659
10672
  }
10673
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10674
+ if (fromComputerUse != null) {
10675
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
10676
+ }
8660
10677
  return toObject;
8661
10678
  }
8662
10679
  function functionCallingConfigToVertex(fromObject) {
@@ -8838,6 +10855,12 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8838
10855
  if (fromResponseSchema != null) {
8839
10856
  setValueByPath(toObject, ['responseSchema'], schemaToVertex(tSchema(fromResponseSchema)));
8840
10857
  }
10858
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
10859
+ 'responseJsonSchema',
10860
+ ]);
10861
+ if (fromResponseJsonSchema != null) {
10862
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
10863
+ }
8841
10864
  const fromRoutingConfig = getValueByPath(fromObject, [
8842
10865
  'routingConfig',
8843
10866
  ]);
@@ -9326,6 +11349,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
9326
11349
  if (parentObject !== undefined && fromOutputCompressionQuality != null) {
9327
11350
  setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
9328
11351
  }
11352
+ const fromEnhanceInputImage = getValueByPath(fromObject, [
11353
+ 'enhanceInputImage',
11354
+ ]);
11355
+ if (parentObject !== undefined && fromEnhanceInputImage != null) {
11356
+ setValueByPath(parentObject, ['parameters', 'upscaleConfig', 'enhanceInputImage'], fromEnhanceInputImage);
11357
+ }
11358
+ const fromImagePreservationFactor = getValueByPath(fromObject, [
11359
+ 'imagePreservationFactor',
11360
+ ]);
11361
+ if (parentObject !== undefined && fromImagePreservationFactor != null) {
11362
+ setValueByPath(parentObject, ['parameters', 'upscaleConfig', 'imagePreservationFactor'], fromImagePreservationFactor);
11363
+ }
9329
11364
  const fromNumberOfImages = getValueByPath(fromObject, [
9330
11365
  'numberOfImages',
9331
11366
  ]);
@@ -9594,6 +11629,12 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
9594
11629
  if (parentObject !== undefined && fromLastFrame != null) {
9595
11630
  setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
9596
11631
  }
11632
+ const fromCompressionQuality = getValueByPath(fromObject, [
11633
+ 'compressionQuality',
11634
+ ]);
11635
+ if (parentObject !== undefined && fromCompressionQuality != null) {
11636
+ setValueByPath(parentObject, ['parameters', 'compressionQuality'], fromCompressionQuality);
11637
+ }
9597
11638
  return toObject;
9598
11639
  }
9599
11640
  function generateVideosParametersToVertex(apiClient, fromObject) {
@@ -10016,7 +12057,7 @@ function modelFromMldev(fromObject) {
10016
12057
  }
10017
12058
  return toObject;
10018
12059
  }
10019
- function listModelsResponseFromMldev(apiClient, fromObject) {
12060
+ function listModelsResponseFromMldev(fromObject) {
10020
12061
  const toObject = {};
10021
12062
  const fromNextPageToken = getValueByPath(fromObject, [
10022
12063
  'nextPageToken',
@@ -10660,7 +12701,7 @@ function modelFromVertex(fromObject) {
10660
12701
  }
10661
12702
  return toObject;
10662
12703
  }
10663
- function listModelsResponseFromVertex(apiClient, fromObject) {
12704
+ function listModelsResponseFromVertex(fromObject) {
10664
12705
  const toObject = {};
10665
12706
  const fromNextPageToken = getValueByPath(fromObject, [
10666
12707
  'nextPageToken',
@@ -10786,7 +12827,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10786
12827
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10787
12828
  const USER_AGENT_HEADER = 'User-Agent';
10788
12829
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10789
- const SDK_VERSION = '1.6.0'; // x-release-please-version
12830
+ const SDK_VERSION = '1.8.0'; // x-release-please-version
10790
12831
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10791
12832
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10792
12833
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -11785,13 +13826,17 @@ const FUNCTION_RESPONSE_REQUIRES_ID = 'FunctionResponse request must have an `id
11785
13826
  */
11786
13827
  async function handleWebSocketMessage(apiClient, onmessage, event) {
11787
13828
  const serverMessage = new LiveServerMessage();
11788
- let data;
13829
+ let jsonData;
11789
13830
  if (event.data instanceof Blob) {
11790
- data = JSON.parse(await event.data.text());
13831
+ jsonData = await event.data.text();
13832
+ }
13833
+ else if (event.data instanceof ArrayBuffer) {
13834
+ jsonData = new TextDecoder().decode(event.data);
11791
13835
  }
11792
13836
  else {
11793
- data = JSON.parse(event.data);
13837
+ jsonData = event.data;
11794
13838
  }
13839
+ const data = JSON.parse(jsonData);
11795
13840
  if (apiClient.isVertexAI()) {
11796
13841
  const resp = liveServerMessageFromVertex(data);
11797
13842
  Object.assign(serverMessage, resp);
@@ -13116,7 +15161,7 @@ class Models extends BaseModule {
13116
15161
  return httpResponse.json();
13117
15162
  });
13118
15163
  return response.then((apiResponse) => {
13119
- const resp = listModelsResponseFromVertex(this.apiClient, apiResponse);
15164
+ const resp = listModelsResponseFromVertex(apiResponse);
13120
15165
  const typedResp = new ListModelsResponse();
13121
15166
  Object.assign(typedResp, resp);
13122
15167
  return typedResp;
@@ -13142,7 +15187,7 @@ class Models extends BaseModule {
13142
15187
  return httpResponse.json();
13143
15188
  });
13144
15189
  return response.then((apiResponse) => {
13145
- const resp = listModelsResponseFromMldev(this.apiClient, apiResponse);
15190
+ const resp = listModelsResponseFromMldev(apiResponse);
13146
15191
  const typedResp = new ListModelsResponse();
13147
15192
  Object.assign(typedResp, resp);
13148
15193
  return typedResp;
@@ -14152,6 +16197,10 @@ function toolToMldev(fromObject) {
14152
16197
  if (fromCodeExecution != null) {
14153
16198
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
14154
16199
  }
16200
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16201
+ if (fromComputerUse != null) {
16202
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
16203
+ }
14155
16204
  return toObject;
14156
16205
  }
14157
16206
  function sessionResumptionConfigToMldev(fromObject) {
@@ -14742,6 +16791,9 @@ function tuningDatasetToMldev(fromObject) {
14742
16791
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
14743
16792
  throw new Error('gcsUri parameter is not supported in Gemini API.');
14744
16793
  }
16794
+ if (getValueByPath(fromObject, ['vertexDatasetResource']) !== undefined) {
16795
+ throw new Error('vertexDatasetResource parameter is not supported in Gemini API.');
16796
+ }
14745
16797
  const fromExamples = getValueByPath(fromObject, ['examples']);
14746
16798
  if (fromExamples != null) {
14747
16799
  let transformedList = fromExamples;
@@ -14855,17 +16907,29 @@ function tuningDatasetToVertex(fromObject, parentObject) {
14855
16907
  if (parentObject !== undefined && fromGcsUri != null) {
14856
16908
  setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
14857
16909
  }
16910
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
16911
+ 'vertexDatasetResource',
16912
+ ]);
16913
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
16914
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
16915
+ }
14858
16916
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
14859
16917
  throw new Error('examples parameter is not supported in Vertex AI.');
14860
16918
  }
14861
16919
  return toObject;
14862
16920
  }
14863
- function tuningValidationDatasetToVertex(fromObject) {
16921
+ function tuningValidationDatasetToVertex(fromObject, parentObject) {
14864
16922
  const toObject = {};
14865
16923
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14866
16924
  if (fromGcsUri != null) {
14867
16925
  setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
14868
16926
  }
16927
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
16928
+ 'vertexDatasetResource',
16929
+ ]);
16930
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
16931
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
16932
+ }
14869
16933
  return toObject;
14870
16934
  }
14871
16935
  function createTuningJobConfigToVertex(fromObject, parentObject) {
@@ -14874,7 +16938,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
14874
16938
  'validationDataset',
14875
16939
  ]);
14876
16940
  if (parentObject !== undefined && fromValidationDataset != null) {
14877
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
16941
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset, toObject));
14878
16942
  }
14879
16943
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
14880
16944
  'tunedModelDisplayName',
@@ -15006,6 +17070,14 @@ function tuningJobFromMldev(fromObject) {
15006
17070
  if (fromPipelineJob != null) {
15007
17071
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
15008
17072
  }
17073
+ const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17074
+ if (fromSatisfiesPzi != null) {
17075
+ setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17076
+ }
17077
+ const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17078
+ if (fromSatisfiesPzs != null) {
17079
+ setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17080
+ }
15009
17081
  const fromServiceAccount = getValueByPath(fromObject, [
15010
17082
  'serviceAccount',
15011
17083
  ]);
@@ -15186,6 +17258,14 @@ function tuningJobFromVertex(fromObject) {
15186
17258
  if (fromPipelineJob != null) {
15187
17259
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
15188
17260
  }
17261
+ const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17262
+ if (fromSatisfiesPzi != null) {
17263
+ setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17264
+ }
17265
+ const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17266
+ if (fromSatisfiesPzs != null) {
17267
+ setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17268
+ }
15189
17269
  const fromServiceAccount = getValueByPath(fromObject, [
15190
17270
  'serviceAccount',
15191
17271
  ]);
@@ -15704,6 +17784,7 @@ class GoogleGenAI {
15704
17784
  });
15705
17785
  this.models = new Models(this.apiClient);
15706
17786
  this.live = new Live(this.apiClient, auth, new BrowserWebSocketFactory());
17787
+ this.batches = new Batches(this.apiClient);
15707
17788
  this.chats = new Chats(this.models, this.apiClient);
15708
17789
  this.caches = new Caches(this.apiClient);
15709
17790
  this.files = new Files(this.apiClient);
@@ -15713,5 +17794,5 @@ class GoogleGenAI {
15713
17794
  }
15714
17795
  }
15715
17796
 
15716
- export { ActivityHandling, AdapterSize, ApiError, AuthType, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
17797
+ 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, 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, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
15717
17798
  //# sourceMappingURL=index.mjs.map