@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.
@@ -314,6 +314,22 @@ exports.HarmCategory = void 0;
314
314
  * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
315
315
  */
316
316
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
317
+ /**
318
+ * The harm category is image hate.
319
+ */
320
+ HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
321
+ /**
322
+ * The harm category is image dangerous content.
323
+ */
324
+ HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
325
+ /**
326
+ * The harm category is image harassment.
327
+ */
328
+ HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
329
+ /**
330
+ * The harm category is image sexually explicit content.
331
+ */
332
+ HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
317
333
  })(exports.HarmCategory || (exports.HarmCategory = {}));
318
334
  /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
319
335
  exports.HarmBlockMethod = void 0;
@@ -400,6 +416,50 @@ exports.AuthType = void 0;
400
416
  */
401
417
  AuthType["OIDC_AUTH"] = "OIDC_AUTH";
402
418
  })(exports.AuthType || (exports.AuthType = {}));
419
+ /** The API spec that the external API implements. */
420
+ exports.ApiSpec = void 0;
421
+ (function (ApiSpec) {
422
+ /**
423
+ * Unspecified API spec. This value should not be used.
424
+ */
425
+ ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
426
+ /**
427
+ * Simple search API spec.
428
+ */
429
+ ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
430
+ /**
431
+ * Elastic search API spec.
432
+ */
433
+ ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
434
+ })(exports.ApiSpec || (exports.ApiSpec = {}));
435
+ /** Required. The environment being operated. */
436
+ exports.Environment = void 0;
437
+ (function (Environment) {
438
+ /**
439
+ * Defaults to browser.
440
+ */
441
+ Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
442
+ /**
443
+ * Operates in a web browser.
444
+ */
445
+ Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
446
+ })(exports.Environment || (exports.Environment = {}));
447
+ /** Status of the url retrieval. */
448
+ exports.UrlRetrievalStatus = void 0;
449
+ (function (UrlRetrievalStatus) {
450
+ /**
451
+ * Default value. This value is unused
452
+ */
453
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
454
+ /**
455
+ * Url retrieval is successful.
456
+ */
457
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
458
+ /**
459
+ * Url retrieval is failed due to error.
460
+ */
461
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
462
+ })(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
403
463
  /** Output only. The reason why the model stopped generating tokens.
404
464
 
405
465
  If empty, the model has not stopped generating the tokens.
@@ -530,6 +590,10 @@ exports.BlockedReason = void 0;
530
590
  * Candidates blocked due to prohibited content.
531
591
  */
532
592
  BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
593
+ /**
594
+ * Candidates blocked due to unsafe image generation content.
595
+ */
596
+ BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
533
597
  })(exports.BlockedReason || (exports.BlockedReason = {}));
534
598
  /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
535
599
  exports.TrafficType = void 0;
@@ -587,7 +651,7 @@ exports.MediaResolution = void 0;
587
651
  */
588
652
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
589
653
  })(exports.MediaResolution || (exports.MediaResolution = {}));
590
- /** Output only. The detailed state of the job. */
654
+ /** Job state. */
591
655
  exports.JobState = void 0;
592
656
  (function (JobState) {
593
657
  /**
@@ -631,7 +695,7 @@ exports.JobState = void 0;
631
695
  */
632
696
  JobState["JOB_STATE_EXPIRED"] = "JOB_STATE_EXPIRED";
633
697
  /**
634
- * The job is being updated. Only jobs in the `RUNNING` state can be updated. After updating, the job goes back to the `RUNNING` state.
698
+ * 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.
635
699
  */
636
700
  JobState["JOB_STATE_UPDATING"] = "JOB_STATE_UPDATING";
637
701
  /**
@@ -727,22 +791,6 @@ exports.FunctionCallingConfigMode = void 0;
727
791
  */
728
792
  FunctionCallingConfigMode["NONE"] = "NONE";
729
793
  })(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
730
- /** Status of the url retrieval. */
731
- exports.UrlRetrievalStatus = void 0;
732
- (function (UrlRetrievalStatus) {
733
- /**
734
- * Default value. This value is unused
735
- */
736
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
737
- /**
738
- * Url retrieval is successful.
739
- */
740
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
741
- /**
742
- * Url retrieval is failed due to error.
743
- */
744
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
745
- })(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
746
794
  /** Enum that controls the safety filter level for objectionable content. */
747
795
  exports.SafetyFilterLevel = void 0;
748
796
  (function (SafetyFilterLevel) {
@@ -754,8 +802,17 @@ exports.SafetyFilterLevel = void 0;
754
802
  /** Enum that controls the generation of people. */
755
803
  exports.PersonGeneration = void 0;
756
804
  (function (PersonGeneration) {
805
+ /**
806
+ * Block generation of images of people.
807
+ */
757
808
  PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
809
+ /**
810
+ * Generate images of adults, but not children.
811
+ */
758
812
  PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
813
+ /**
814
+ * Generate images that include adults and children.
815
+ */
759
816
  PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
760
817
  })(exports.PersonGeneration || (exports.PersonGeneration = {}));
761
818
  /** Enum that specifies the language of the text in the prompt. */
@@ -804,6 +861,20 @@ exports.EditMode = void 0;
804
861
  EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
805
862
  EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
806
863
  })(exports.EditMode || (exports.EditMode = {}));
864
+ /** Enum that controls the compression quality of the generated videos. */
865
+ exports.VideoCompressionQuality = void 0;
866
+ (function (VideoCompressionQuality) {
867
+ /**
868
+ * Optimized video compression quality. This will produce videos
869
+ with a compressed, smaller file size.
870
+ */
871
+ VideoCompressionQuality["OPTIMIZED"] = "OPTIMIZED";
872
+ /**
873
+ * Lossless video compression quality. This will produce videos
874
+ with a larger file size.
875
+ */
876
+ VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
877
+ })(exports.VideoCompressionQuality || (exports.VideoCompressionQuality = {}));
807
878
  /** State for the lifecycle of a File. */
808
879
  exports.FileState = void 0;
809
880
  (function (FileState) {
@@ -1440,6 +1511,12 @@ class CreateFileResponse {
1440
1511
  /** Response for the delete file method. */
1441
1512
  class DeleteFileResponse {
1442
1513
  }
1514
+ /** Config for `inlined_responses` parameter. */
1515
+ class InlinedResponse {
1516
+ }
1517
+ /** Config for batches.list return value. */
1518
+ class ListBatchJobsResponse {
1519
+ }
1443
1520
  /** Represents a single response in a replay. */
1444
1521
  class ReplayResponse {
1445
1522
  }
@@ -2436,11 +2513,2088 @@ function filterToJsonSchema(schema) {
2436
2513
  ? typeValue
2437
2514
  : exports.Type.TYPE_UNSPECIFIED;
2438
2515
  }
2439
- else if (supportedJsonSchemaFields.has(fieldName)) {
2440
- filteredSchema[fieldName] = fieldValue;
2516
+ else if (supportedJsonSchemaFields.has(fieldName)) {
2517
+ filteredSchema[fieldName] = fieldValue;
2518
+ }
2519
+ }
2520
+ return filteredSchema;
2521
+ }
2522
+ // Transforms a source input into a BatchJobSource object with validation.
2523
+ function tBatchJobSource(apiClient, src) {
2524
+ if (typeof src !== 'string' && !Array.isArray(src)) {
2525
+ if (apiClient && apiClient.isVertexAI()) {
2526
+ if (src.gcsUri && src.bigqueryUri) {
2527
+ throw new Error('Only one of `gcsUri` or `bigqueryUri` can be set.');
2528
+ }
2529
+ else if (!src.gcsUri && !src.bigqueryUri) {
2530
+ throw new Error('One of `gcsUri` or `bigqueryUri` must be set.');
2531
+ }
2532
+ }
2533
+ else {
2534
+ // Logic for non-Vertex AI client (inlined_requests, file_name)
2535
+ if (src.inlinedRequests && src.fileName) {
2536
+ throw new Error('Only one of `inlinedRequests` or `fileName` can be set.');
2537
+ }
2538
+ else if (!src.inlinedRequests && !src.fileName) {
2539
+ throw new Error('One of `inlinedRequests` or `fileName` must be set.');
2540
+ }
2541
+ }
2542
+ return src;
2543
+ }
2544
+ // If src is an array (list in Python)
2545
+ else if (Array.isArray(src)) {
2546
+ return { inlinedRequests: src };
2547
+ }
2548
+ else if (typeof src === 'string') {
2549
+ if (src.startsWith('gs://')) {
2550
+ return {
2551
+ format: 'jsonl',
2552
+ gcsUri: [src], // GCS URI is expected as an array
2553
+ };
2554
+ }
2555
+ else if (src.startsWith('bq://')) {
2556
+ return {
2557
+ format: 'bigquery',
2558
+ bigqueryUri: src,
2559
+ };
2560
+ }
2561
+ else if (src.startsWith('files/')) {
2562
+ return {
2563
+ fileName: src,
2564
+ };
2565
+ }
2566
+ }
2567
+ throw new Error(`Unsupported source: ${src}`);
2568
+ }
2569
+ function tBatchJobDestination(dest) {
2570
+ const destString = dest;
2571
+ if (destString.startsWith('gs://')) {
2572
+ return {
2573
+ format: 'jsonl',
2574
+ gcsUri: destString,
2575
+ };
2576
+ }
2577
+ else if (destString.startsWith('bq://')) {
2578
+ return {
2579
+ format: 'bigquery',
2580
+ bigqueryUri: destString,
2581
+ };
2582
+ }
2583
+ else {
2584
+ throw new Error(`Unsupported destination: ${destString}`);
2585
+ }
2586
+ }
2587
+ function tBatchJobName(apiClient, name) {
2588
+ const nameString = name;
2589
+ if (!apiClient.isVertexAI()) {
2590
+ const mldevPattern = /batches\/[^/]+$/;
2591
+ if (mldevPattern.test(nameString)) {
2592
+ return nameString.split('/').pop();
2593
+ }
2594
+ else {
2595
+ throw new Error(`Invalid batch job name: ${nameString}.`);
2596
+ }
2597
+ }
2598
+ const vertexPattern = /^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/;
2599
+ if (vertexPattern.test(nameString)) {
2600
+ return nameString.split('/').pop();
2601
+ }
2602
+ else if (/^\d+$/.test(nameString)) {
2603
+ return nameString;
2604
+ }
2605
+ else {
2606
+ throw new Error(`Invalid batch job name: ${nameString}.`);
2607
+ }
2608
+ }
2609
+ function tJobState(state) {
2610
+ const stateString = state;
2611
+ if (stateString === 'BATCH_STATE_UNSPECIFIED') {
2612
+ return 'JOB_STATE_UNSPECIFIED';
2613
+ }
2614
+ else if (stateString === 'BATCH_STATE_PENDING') {
2615
+ return 'JOB_STATE_PENDING';
2616
+ }
2617
+ else if (stateString === 'BATCH_STATE_SUCCEEDED') {
2618
+ return 'JOB_STATE_SUCCEEDED';
2619
+ }
2620
+ else if (stateString === 'BATCH_STATE_FAILED') {
2621
+ return 'JOB_STATE_FAILED';
2622
+ }
2623
+ else if (stateString === 'BATCH_STATE_CANCELLED') {
2624
+ return 'JOB_STATE_CANCELLED';
2625
+ }
2626
+ else {
2627
+ return stateString;
2628
+ }
2629
+ }
2630
+
2631
+ /**
2632
+ * @license
2633
+ * Copyright 2025 Google LLC
2634
+ * SPDX-License-Identifier: Apache-2.0
2635
+ */
2636
+ function videoMetadataToMldev$4(fromObject) {
2637
+ const toObject = {};
2638
+ const fromFps = getValueByPath(fromObject, ['fps']);
2639
+ if (fromFps != null) {
2640
+ setValueByPath(toObject, ['fps'], fromFps);
2641
+ }
2642
+ const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
2643
+ if (fromEndOffset != null) {
2644
+ setValueByPath(toObject, ['endOffset'], fromEndOffset);
2645
+ }
2646
+ const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
2647
+ if (fromStartOffset != null) {
2648
+ setValueByPath(toObject, ['startOffset'], fromStartOffset);
2649
+ }
2650
+ return toObject;
2651
+ }
2652
+ function blobToMldev$4(fromObject) {
2653
+ const toObject = {};
2654
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2655
+ throw new Error('displayName parameter is not supported in Gemini API.');
2656
+ }
2657
+ const fromData = getValueByPath(fromObject, ['data']);
2658
+ if (fromData != null) {
2659
+ setValueByPath(toObject, ['data'], fromData);
2660
+ }
2661
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2662
+ if (fromMimeType != null) {
2663
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2664
+ }
2665
+ return toObject;
2666
+ }
2667
+ function fileDataToMldev$4(fromObject) {
2668
+ const toObject = {};
2669
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2670
+ throw new Error('displayName parameter is not supported in Gemini API.');
2671
+ }
2672
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
2673
+ if (fromFileUri != null) {
2674
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
2675
+ }
2676
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
2677
+ if (fromMimeType != null) {
2678
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
2679
+ }
2680
+ return toObject;
2681
+ }
2682
+ function partToMldev$4(fromObject) {
2683
+ const toObject = {};
2684
+ const fromVideoMetadata = getValueByPath(fromObject, [
2685
+ 'videoMetadata',
2686
+ ]);
2687
+ if (fromVideoMetadata != null) {
2688
+ setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$4(fromVideoMetadata));
2689
+ }
2690
+ const fromThought = getValueByPath(fromObject, ['thought']);
2691
+ if (fromThought != null) {
2692
+ setValueByPath(toObject, ['thought'], fromThought);
2693
+ }
2694
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
2695
+ if (fromInlineData != null) {
2696
+ setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
2697
+ }
2698
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
2699
+ if (fromFileData != null) {
2700
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
2701
+ }
2702
+ const fromThoughtSignature = getValueByPath(fromObject, [
2703
+ 'thoughtSignature',
2704
+ ]);
2705
+ if (fromThoughtSignature != null) {
2706
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
2707
+ }
2708
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
2709
+ 'codeExecutionResult',
2710
+ ]);
2711
+ if (fromCodeExecutionResult != null) {
2712
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
2713
+ }
2714
+ const fromExecutableCode = getValueByPath(fromObject, [
2715
+ 'executableCode',
2716
+ ]);
2717
+ if (fromExecutableCode != null) {
2718
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
2719
+ }
2720
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
2721
+ if (fromFunctionCall != null) {
2722
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
2723
+ }
2724
+ const fromFunctionResponse = getValueByPath(fromObject, [
2725
+ 'functionResponse',
2726
+ ]);
2727
+ if (fromFunctionResponse != null) {
2728
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
2729
+ }
2730
+ const fromText = getValueByPath(fromObject, ['text']);
2731
+ if (fromText != null) {
2732
+ setValueByPath(toObject, ['text'], fromText);
2733
+ }
2734
+ return toObject;
2735
+ }
2736
+ function contentToMldev$4(fromObject) {
2737
+ const toObject = {};
2738
+ const fromParts = getValueByPath(fromObject, ['parts']);
2739
+ if (fromParts != null) {
2740
+ let transformedList = fromParts;
2741
+ if (Array.isArray(transformedList)) {
2742
+ transformedList = transformedList.map((item) => {
2743
+ return partToMldev$4(item);
2744
+ });
2745
+ }
2746
+ setValueByPath(toObject, ['parts'], transformedList);
2747
+ }
2748
+ const fromRole = getValueByPath(fromObject, ['role']);
2749
+ if (fromRole != null) {
2750
+ setValueByPath(toObject, ['role'], fromRole);
2751
+ }
2752
+ return toObject;
2753
+ }
2754
+ function schemaToMldev$1(fromObject) {
2755
+ const toObject = {};
2756
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
2757
+ if (fromAnyOf != null) {
2758
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
2759
+ }
2760
+ const fromDefault = getValueByPath(fromObject, ['default']);
2761
+ if (fromDefault != null) {
2762
+ setValueByPath(toObject, ['default'], fromDefault);
2763
+ }
2764
+ const fromDescription = getValueByPath(fromObject, ['description']);
2765
+ if (fromDescription != null) {
2766
+ setValueByPath(toObject, ['description'], fromDescription);
2767
+ }
2768
+ const fromEnum = getValueByPath(fromObject, ['enum']);
2769
+ if (fromEnum != null) {
2770
+ setValueByPath(toObject, ['enum'], fromEnum);
2771
+ }
2772
+ const fromExample = getValueByPath(fromObject, ['example']);
2773
+ if (fromExample != null) {
2774
+ setValueByPath(toObject, ['example'], fromExample);
2775
+ }
2776
+ const fromFormat = getValueByPath(fromObject, ['format']);
2777
+ if (fromFormat != null) {
2778
+ setValueByPath(toObject, ['format'], fromFormat);
2779
+ }
2780
+ const fromItems = getValueByPath(fromObject, ['items']);
2781
+ if (fromItems != null) {
2782
+ setValueByPath(toObject, ['items'], fromItems);
2783
+ }
2784
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
2785
+ if (fromMaxItems != null) {
2786
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
2787
+ }
2788
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
2789
+ if (fromMaxLength != null) {
2790
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
2791
+ }
2792
+ const fromMaxProperties = getValueByPath(fromObject, [
2793
+ 'maxProperties',
2794
+ ]);
2795
+ if (fromMaxProperties != null) {
2796
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
2797
+ }
2798
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
2799
+ if (fromMaximum != null) {
2800
+ setValueByPath(toObject, ['maximum'], fromMaximum);
2801
+ }
2802
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
2803
+ if (fromMinItems != null) {
2804
+ setValueByPath(toObject, ['minItems'], fromMinItems);
2805
+ }
2806
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
2807
+ if (fromMinLength != null) {
2808
+ setValueByPath(toObject, ['minLength'], fromMinLength);
2809
+ }
2810
+ const fromMinProperties = getValueByPath(fromObject, [
2811
+ 'minProperties',
2812
+ ]);
2813
+ if (fromMinProperties != null) {
2814
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
2815
+ }
2816
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
2817
+ if (fromMinimum != null) {
2818
+ setValueByPath(toObject, ['minimum'], fromMinimum);
2819
+ }
2820
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
2821
+ if (fromNullable != null) {
2822
+ setValueByPath(toObject, ['nullable'], fromNullable);
2823
+ }
2824
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
2825
+ if (fromPattern != null) {
2826
+ setValueByPath(toObject, ['pattern'], fromPattern);
2827
+ }
2828
+ const fromProperties = getValueByPath(fromObject, ['properties']);
2829
+ if (fromProperties != null) {
2830
+ setValueByPath(toObject, ['properties'], fromProperties);
2831
+ }
2832
+ const fromPropertyOrdering = getValueByPath(fromObject, [
2833
+ 'propertyOrdering',
2834
+ ]);
2835
+ if (fromPropertyOrdering != null) {
2836
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
2837
+ }
2838
+ const fromRequired = getValueByPath(fromObject, ['required']);
2839
+ if (fromRequired != null) {
2840
+ setValueByPath(toObject, ['required'], fromRequired);
2841
+ }
2842
+ const fromTitle = getValueByPath(fromObject, ['title']);
2843
+ if (fromTitle != null) {
2844
+ setValueByPath(toObject, ['title'], fromTitle);
2845
+ }
2846
+ const fromType = getValueByPath(fromObject, ['type']);
2847
+ if (fromType != null) {
2848
+ setValueByPath(toObject, ['type'], fromType);
2849
+ }
2850
+ return toObject;
2851
+ }
2852
+ function safetySettingToMldev$1(fromObject) {
2853
+ const toObject = {};
2854
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
2855
+ throw new Error('method parameter is not supported in Gemini API.');
2856
+ }
2857
+ const fromCategory = getValueByPath(fromObject, ['category']);
2858
+ if (fromCategory != null) {
2859
+ setValueByPath(toObject, ['category'], fromCategory);
2860
+ }
2861
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
2862
+ if (fromThreshold != null) {
2863
+ setValueByPath(toObject, ['threshold'], fromThreshold);
2864
+ }
2865
+ return toObject;
2866
+ }
2867
+ function functionDeclarationToMldev$4(fromObject) {
2868
+ const toObject = {};
2869
+ const fromBehavior = getValueByPath(fromObject, ['behavior']);
2870
+ if (fromBehavior != null) {
2871
+ setValueByPath(toObject, ['behavior'], fromBehavior);
2872
+ }
2873
+ const fromDescription = getValueByPath(fromObject, ['description']);
2874
+ if (fromDescription != null) {
2875
+ setValueByPath(toObject, ['description'], fromDescription);
2876
+ }
2877
+ const fromName = getValueByPath(fromObject, ['name']);
2878
+ if (fromName != null) {
2879
+ setValueByPath(toObject, ['name'], fromName);
2880
+ }
2881
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
2882
+ if (fromParameters != null) {
2883
+ setValueByPath(toObject, ['parameters'], fromParameters);
2884
+ }
2885
+ const fromParametersJsonSchema = getValueByPath(fromObject, [
2886
+ 'parametersJsonSchema',
2887
+ ]);
2888
+ if (fromParametersJsonSchema != null) {
2889
+ setValueByPath(toObject, ['parametersJsonSchema'], fromParametersJsonSchema);
2890
+ }
2891
+ const fromResponse = getValueByPath(fromObject, ['response']);
2892
+ if (fromResponse != null) {
2893
+ setValueByPath(toObject, ['response'], fromResponse);
2894
+ }
2895
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
2896
+ 'responseJsonSchema',
2897
+ ]);
2898
+ if (fromResponseJsonSchema != null) {
2899
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
2900
+ }
2901
+ return toObject;
2902
+ }
2903
+ function intervalToMldev$4(fromObject) {
2904
+ const toObject = {};
2905
+ const fromStartTime = getValueByPath(fromObject, ['startTime']);
2906
+ if (fromStartTime != null) {
2907
+ setValueByPath(toObject, ['startTime'], fromStartTime);
2908
+ }
2909
+ const fromEndTime = getValueByPath(fromObject, ['endTime']);
2910
+ if (fromEndTime != null) {
2911
+ setValueByPath(toObject, ['endTime'], fromEndTime);
2912
+ }
2913
+ return toObject;
2914
+ }
2915
+ function googleSearchToMldev$4(fromObject) {
2916
+ const toObject = {};
2917
+ const fromTimeRangeFilter = getValueByPath(fromObject, [
2918
+ 'timeRangeFilter',
2919
+ ]);
2920
+ if (fromTimeRangeFilter != null) {
2921
+ setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
2922
+ }
2923
+ return toObject;
2924
+ }
2925
+ function dynamicRetrievalConfigToMldev$4(fromObject) {
2926
+ const toObject = {};
2927
+ const fromMode = getValueByPath(fromObject, ['mode']);
2928
+ if (fromMode != null) {
2929
+ setValueByPath(toObject, ['mode'], fromMode);
2930
+ }
2931
+ const fromDynamicThreshold = getValueByPath(fromObject, [
2932
+ 'dynamicThreshold',
2933
+ ]);
2934
+ if (fromDynamicThreshold != null) {
2935
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
2936
+ }
2937
+ return toObject;
2938
+ }
2939
+ function googleSearchRetrievalToMldev$4(fromObject) {
2940
+ const toObject = {};
2941
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
2942
+ 'dynamicRetrievalConfig',
2943
+ ]);
2944
+ if (fromDynamicRetrievalConfig != null) {
2945
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$4(fromDynamicRetrievalConfig));
2946
+ }
2947
+ return toObject;
2948
+ }
2949
+ function urlContextToMldev$4() {
2950
+ const toObject = {};
2951
+ return toObject;
2952
+ }
2953
+ function toolToMldev$4(fromObject) {
2954
+ const toObject = {};
2955
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
2956
+ 'functionDeclarations',
2957
+ ]);
2958
+ if (fromFunctionDeclarations != null) {
2959
+ let transformedList = fromFunctionDeclarations;
2960
+ if (Array.isArray(transformedList)) {
2961
+ transformedList = transformedList.map((item) => {
2962
+ return functionDeclarationToMldev$4(item);
2963
+ });
2964
+ }
2965
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
2966
+ }
2967
+ if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
2968
+ throw new Error('retrieval parameter is not supported in Gemini API.');
2969
+ }
2970
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
2971
+ if (fromGoogleSearch != null) {
2972
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
2973
+ }
2974
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
2975
+ 'googleSearchRetrieval',
2976
+ ]);
2977
+ if (fromGoogleSearchRetrieval != null) {
2978
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$4(fromGoogleSearchRetrieval));
2979
+ }
2980
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
2981
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
2982
+ }
2983
+ if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
2984
+ throw new Error('googleMaps parameter is not supported in Gemini API.');
2985
+ }
2986
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
2987
+ if (fromUrlContext != null) {
2988
+ setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
2989
+ }
2990
+ const fromCodeExecution = getValueByPath(fromObject, [
2991
+ 'codeExecution',
2992
+ ]);
2993
+ if (fromCodeExecution != null) {
2994
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2995
+ }
2996
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2997
+ if (fromComputerUse != null) {
2998
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
2999
+ }
3000
+ return toObject;
3001
+ }
3002
+ function functionCallingConfigToMldev$2(fromObject) {
3003
+ const toObject = {};
3004
+ const fromMode = getValueByPath(fromObject, ['mode']);
3005
+ if (fromMode != null) {
3006
+ setValueByPath(toObject, ['mode'], fromMode);
3007
+ }
3008
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
3009
+ 'allowedFunctionNames',
3010
+ ]);
3011
+ if (fromAllowedFunctionNames != null) {
3012
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
3013
+ }
3014
+ return toObject;
3015
+ }
3016
+ function latLngToMldev$2(fromObject) {
3017
+ const toObject = {};
3018
+ const fromLatitude = getValueByPath(fromObject, ['latitude']);
3019
+ if (fromLatitude != null) {
3020
+ setValueByPath(toObject, ['latitude'], fromLatitude);
3021
+ }
3022
+ const fromLongitude = getValueByPath(fromObject, ['longitude']);
3023
+ if (fromLongitude != null) {
3024
+ setValueByPath(toObject, ['longitude'], fromLongitude);
3025
+ }
3026
+ return toObject;
3027
+ }
3028
+ function retrievalConfigToMldev$2(fromObject) {
3029
+ const toObject = {};
3030
+ const fromLatLng = getValueByPath(fromObject, ['latLng']);
3031
+ if (fromLatLng != null) {
3032
+ setValueByPath(toObject, ['latLng'], latLngToMldev$2(fromLatLng));
3033
+ }
3034
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
3035
+ if (fromLanguageCode != null) {
3036
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
3037
+ }
3038
+ return toObject;
3039
+ }
3040
+ function toolConfigToMldev$2(fromObject) {
3041
+ const toObject = {};
3042
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
3043
+ 'functionCallingConfig',
3044
+ ]);
3045
+ if (fromFunctionCallingConfig != null) {
3046
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
3047
+ }
3048
+ const fromRetrievalConfig = getValueByPath(fromObject, [
3049
+ 'retrievalConfig',
3050
+ ]);
3051
+ if (fromRetrievalConfig != null) {
3052
+ setValueByPath(toObject, ['retrievalConfig'], retrievalConfigToMldev$2(fromRetrievalConfig));
3053
+ }
3054
+ return toObject;
3055
+ }
3056
+ function prebuiltVoiceConfigToMldev$3(fromObject) {
3057
+ const toObject = {};
3058
+ const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
3059
+ if (fromVoiceName != null) {
3060
+ setValueByPath(toObject, ['voiceName'], fromVoiceName);
3061
+ }
3062
+ return toObject;
3063
+ }
3064
+ function voiceConfigToMldev$3(fromObject) {
3065
+ const toObject = {};
3066
+ const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
3067
+ 'prebuiltVoiceConfig',
3068
+ ]);
3069
+ if (fromPrebuiltVoiceConfig != null) {
3070
+ setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$3(fromPrebuiltVoiceConfig));
3071
+ }
3072
+ return toObject;
3073
+ }
3074
+ function speakerVoiceConfigToMldev$3(fromObject) {
3075
+ const toObject = {};
3076
+ const fromSpeaker = getValueByPath(fromObject, ['speaker']);
3077
+ if (fromSpeaker != null) {
3078
+ setValueByPath(toObject, ['speaker'], fromSpeaker);
3079
+ }
3080
+ const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
3081
+ if (fromVoiceConfig != null) {
3082
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$3(fromVoiceConfig));
3083
+ }
3084
+ return toObject;
3085
+ }
3086
+ function multiSpeakerVoiceConfigToMldev$3(fromObject) {
3087
+ const toObject = {};
3088
+ const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
3089
+ 'speakerVoiceConfigs',
3090
+ ]);
3091
+ if (fromSpeakerVoiceConfigs != null) {
3092
+ let transformedList = fromSpeakerVoiceConfigs;
3093
+ if (Array.isArray(transformedList)) {
3094
+ transformedList = transformedList.map((item) => {
3095
+ return speakerVoiceConfigToMldev$3(item);
3096
+ });
3097
+ }
3098
+ setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
3099
+ }
3100
+ return toObject;
3101
+ }
3102
+ function speechConfigToMldev$3(fromObject) {
3103
+ const toObject = {};
3104
+ const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
3105
+ if (fromVoiceConfig != null) {
3106
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$3(fromVoiceConfig));
3107
+ }
3108
+ const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
3109
+ 'multiSpeakerVoiceConfig',
3110
+ ]);
3111
+ if (fromMultiSpeakerVoiceConfig != null) {
3112
+ setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$3(fromMultiSpeakerVoiceConfig));
3113
+ }
3114
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
3115
+ if (fromLanguageCode != null) {
3116
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
3117
+ }
3118
+ return toObject;
3119
+ }
3120
+ function thinkingConfigToMldev$1(fromObject) {
3121
+ const toObject = {};
3122
+ const fromIncludeThoughts = getValueByPath(fromObject, [
3123
+ 'includeThoughts',
3124
+ ]);
3125
+ if (fromIncludeThoughts != null) {
3126
+ setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
3127
+ }
3128
+ const fromThinkingBudget = getValueByPath(fromObject, [
3129
+ 'thinkingBudget',
3130
+ ]);
3131
+ if (fromThinkingBudget != null) {
3132
+ setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
3133
+ }
3134
+ return toObject;
3135
+ }
3136
+ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3137
+ const toObject = {};
3138
+ const fromSystemInstruction = getValueByPath(fromObject, [
3139
+ 'systemInstruction',
3140
+ ]);
3141
+ if (parentObject !== undefined && fromSystemInstruction != null) {
3142
+ setValueByPath(parentObject, ['systemInstruction'], contentToMldev$4(tContent(fromSystemInstruction)));
3143
+ }
3144
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
3145
+ if (fromTemperature != null) {
3146
+ setValueByPath(toObject, ['temperature'], fromTemperature);
3147
+ }
3148
+ const fromTopP = getValueByPath(fromObject, ['topP']);
3149
+ if (fromTopP != null) {
3150
+ setValueByPath(toObject, ['topP'], fromTopP);
3151
+ }
3152
+ const fromTopK = getValueByPath(fromObject, ['topK']);
3153
+ if (fromTopK != null) {
3154
+ setValueByPath(toObject, ['topK'], fromTopK);
3155
+ }
3156
+ const fromCandidateCount = getValueByPath(fromObject, [
3157
+ 'candidateCount',
3158
+ ]);
3159
+ if (fromCandidateCount != null) {
3160
+ setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
3161
+ }
3162
+ const fromMaxOutputTokens = getValueByPath(fromObject, [
3163
+ 'maxOutputTokens',
3164
+ ]);
3165
+ if (fromMaxOutputTokens != null) {
3166
+ setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
3167
+ }
3168
+ const fromStopSequences = getValueByPath(fromObject, [
3169
+ 'stopSequences',
3170
+ ]);
3171
+ if (fromStopSequences != null) {
3172
+ setValueByPath(toObject, ['stopSequences'], fromStopSequences);
3173
+ }
3174
+ const fromResponseLogprobs = getValueByPath(fromObject, [
3175
+ 'responseLogprobs',
3176
+ ]);
3177
+ if (fromResponseLogprobs != null) {
3178
+ setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
3179
+ }
3180
+ const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
3181
+ if (fromLogprobs != null) {
3182
+ setValueByPath(toObject, ['logprobs'], fromLogprobs);
3183
+ }
3184
+ const fromPresencePenalty = getValueByPath(fromObject, [
3185
+ 'presencePenalty',
3186
+ ]);
3187
+ if (fromPresencePenalty != null) {
3188
+ setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
3189
+ }
3190
+ const fromFrequencyPenalty = getValueByPath(fromObject, [
3191
+ 'frequencyPenalty',
3192
+ ]);
3193
+ if (fromFrequencyPenalty != null) {
3194
+ setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
3195
+ }
3196
+ const fromSeed = getValueByPath(fromObject, ['seed']);
3197
+ if (fromSeed != null) {
3198
+ setValueByPath(toObject, ['seed'], fromSeed);
3199
+ }
3200
+ const fromResponseMimeType = getValueByPath(fromObject, [
3201
+ 'responseMimeType',
3202
+ ]);
3203
+ if (fromResponseMimeType != null) {
3204
+ setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
3205
+ }
3206
+ const fromResponseSchema = getValueByPath(fromObject, [
3207
+ 'responseSchema',
3208
+ ]);
3209
+ if (fromResponseSchema != null) {
3210
+ setValueByPath(toObject, ['responseSchema'], schemaToMldev$1(tSchema(fromResponseSchema)));
3211
+ }
3212
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
3213
+ 'responseJsonSchema',
3214
+ ]);
3215
+ if (fromResponseJsonSchema != null) {
3216
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
3217
+ }
3218
+ if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
3219
+ throw new Error('routingConfig parameter is not supported in Gemini API.');
3220
+ }
3221
+ if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
3222
+ throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
3223
+ }
3224
+ const fromSafetySettings = getValueByPath(fromObject, [
3225
+ 'safetySettings',
3226
+ ]);
3227
+ if (parentObject !== undefined && fromSafetySettings != null) {
3228
+ let transformedList = fromSafetySettings;
3229
+ if (Array.isArray(transformedList)) {
3230
+ transformedList = transformedList.map((item) => {
3231
+ return safetySettingToMldev$1(item);
3232
+ });
3233
+ }
3234
+ setValueByPath(parentObject, ['safetySettings'], transformedList);
3235
+ }
3236
+ const fromTools = getValueByPath(fromObject, ['tools']);
3237
+ if (parentObject !== undefined && fromTools != null) {
3238
+ let transformedList = tTools(fromTools);
3239
+ if (Array.isArray(transformedList)) {
3240
+ transformedList = transformedList.map((item) => {
3241
+ return toolToMldev$4(tTool(item));
3242
+ });
3243
+ }
3244
+ setValueByPath(parentObject, ['tools'], transformedList);
3245
+ }
3246
+ const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
3247
+ if (parentObject !== undefined && fromToolConfig != null) {
3248
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
3249
+ }
3250
+ if (getValueByPath(fromObject, ['labels']) !== undefined) {
3251
+ throw new Error('labels parameter is not supported in Gemini API.');
3252
+ }
3253
+ const fromCachedContent = getValueByPath(fromObject, [
3254
+ 'cachedContent',
3255
+ ]);
3256
+ if (parentObject !== undefined && fromCachedContent != null) {
3257
+ setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
3258
+ }
3259
+ const fromResponseModalities = getValueByPath(fromObject, [
3260
+ 'responseModalities',
3261
+ ]);
3262
+ if (fromResponseModalities != null) {
3263
+ setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
3264
+ }
3265
+ const fromMediaResolution = getValueByPath(fromObject, [
3266
+ 'mediaResolution',
3267
+ ]);
3268
+ if (fromMediaResolution != null) {
3269
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
3270
+ }
3271
+ const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
3272
+ if (fromSpeechConfig != null) {
3273
+ setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$3(tSpeechConfig(fromSpeechConfig)));
3274
+ }
3275
+ if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
3276
+ throw new Error('audioTimestamp parameter is not supported in Gemini API.');
3277
+ }
3278
+ const fromThinkingConfig = getValueByPath(fromObject, [
3279
+ 'thinkingConfig',
3280
+ ]);
3281
+ if (fromThinkingConfig != null) {
3282
+ setValueByPath(toObject, ['thinkingConfig'], thinkingConfigToMldev$1(fromThinkingConfig));
3283
+ }
3284
+ return toObject;
3285
+ }
3286
+ function inlinedRequestToMldev(apiClient, fromObject) {
3287
+ const toObject = {};
3288
+ const fromModel = getValueByPath(fromObject, ['model']);
3289
+ if (fromModel != null) {
3290
+ setValueByPath(toObject, ['request', 'model'], tModel(apiClient, fromModel));
3291
+ }
3292
+ const fromContents = getValueByPath(fromObject, ['contents']);
3293
+ if (fromContents != null) {
3294
+ let transformedList = tContents(fromContents);
3295
+ if (Array.isArray(transformedList)) {
3296
+ transformedList = transformedList.map((item) => {
3297
+ return contentToMldev$4(item);
3298
+ });
3299
+ }
3300
+ setValueByPath(toObject, ['request', 'contents'], transformedList);
3301
+ }
3302
+ const fromConfig = getValueByPath(fromObject, ['config']);
3303
+ if (fromConfig != null) {
3304
+ setValueByPath(toObject, ['request', 'generationConfig'], generateContentConfigToMldev$1(apiClient, fromConfig, toObject));
3305
+ }
3306
+ return toObject;
3307
+ }
3308
+ function batchJobSourceToMldev(apiClient, fromObject) {
3309
+ const toObject = {};
3310
+ if (getValueByPath(fromObject, ['format']) !== undefined) {
3311
+ throw new Error('format parameter is not supported in Gemini API.');
3312
+ }
3313
+ if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
3314
+ throw new Error('gcsUri parameter is not supported in Gemini API.');
3315
+ }
3316
+ if (getValueByPath(fromObject, ['bigqueryUri']) !== undefined) {
3317
+ throw new Error('bigqueryUri parameter is not supported in Gemini API.');
3318
+ }
3319
+ const fromFileName = getValueByPath(fromObject, ['fileName']);
3320
+ if (fromFileName != null) {
3321
+ setValueByPath(toObject, ['fileName'], fromFileName);
3322
+ }
3323
+ const fromInlinedRequests = getValueByPath(fromObject, [
3324
+ 'inlinedRequests',
3325
+ ]);
3326
+ if (fromInlinedRequests != null) {
3327
+ let transformedList = fromInlinedRequests;
3328
+ if (Array.isArray(transformedList)) {
3329
+ transformedList = transformedList.map((item) => {
3330
+ return inlinedRequestToMldev(apiClient, item);
3331
+ });
3332
+ }
3333
+ setValueByPath(toObject, ['requests', 'requests'], transformedList);
3334
+ }
3335
+ return toObject;
3336
+ }
3337
+ function createBatchJobConfigToMldev(fromObject, parentObject) {
3338
+ const toObject = {};
3339
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
3340
+ if (parentObject !== undefined && fromDisplayName != null) {
3341
+ setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
3342
+ }
3343
+ if (getValueByPath(fromObject, ['dest']) !== undefined) {
3344
+ throw new Error('dest parameter is not supported in Gemini API.');
3345
+ }
3346
+ return toObject;
3347
+ }
3348
+ function createBatchJobParametersToMldev(apiClient, fromObject) {
3349
+ const toObject = {};
3350
+ const fromModel = getValueByPath(fromObject, ['model']);
3351
+ if (fromModel != null) {
3352
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
3353
+ }
3354
+ const fromSrc = getValueByPath(fromObject, ['src']);
3355
+ if (fromSrc != null) {
3356
+ setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
3357
+ }
3358
+ const fromConfig = getValueByPath(fromObject, ['config']);
3359
+ if (fromConfig != null) {
3360
+ setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
3361
+ }
3362
+ return toObject;
3363
+ }
3364
+ function getBatchJobParametersToMldev(apiClient, fromObject) {
3365
+ const toObject = {};
3366
+ const fromName = getValueByPath(fromObject, ['name']);
3367
+ if (fromName != null) {
3368
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3369
+ }
3370
+ const fromConfig = getValueByPath(fromObject, ['config']);
3371
+ if (fromConfig != null) {
3372
+ setValueByPath(toObject, ['config'], fromConfig);
3373
+ }
3374
+ return toObject;
3375
+ }
3376
+ function cancelBatchJobParametersToMldev(apiClient, fromObject) {
3377
+ const toObject = {};
3378
+ const fromName = getValueByPath(fromObject, ['name']);
3379
+ if (fromName != null) {
3380
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3381
+ }
3382
+ const fromConfig = getValueByPath(fromObject, ['config']);
3383
+ if (fromConfig != null) {
3384
+ setValueByPath(toObject, ['config'], fromConfig);
3385
+ }
3386
+ return toObject;
3387
+ }
3388
+ function listBatchJobsConfigToMldev(fromObject, parentObject) {
3389
+ const toObject = {};
3390
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
3391
+ if (parentObject !== undefined && fromPageSize != null) {
3392
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
3393
+ }
3394
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
3395
+ if (parentObject !== undefined && fromPageToken != null) {
3396
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
3397
+ }
3398
+ if (getValueByPath(fromObject, ['filter']) !== undefined) {
3399
+ throw new Error('filter parameter is not supported in Gemini API.');
3400
+ }
3401
+ return toObject;
3402
+ }
3403
+ function listBatchJobsParametersToMldev(fromObject) {
3404
+ const toObject = {};
3405
+ const fromConfig = getValueByPath(fromObject, ['config']);
3406
+ if (fromConfig != null) {
3407
+ setValueByPath(toObject, ['config'], listBatchJobsConfigToMldev(fromConfig, toObject));
3408
+ }
3409
+ return toObject;
3410
+ }
3411
+ function deleteBatchJobParametersToMldev(apiClient, fromObject) {
3412
+ const toObject = {};
3413
+ const fromName = getValueByPath(fromObject, ['name']);
3414
+ if (fromName != null) {
3415
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3416
+ }
3417
+ const fromConfig = getValueByPath(fromObject, ['config']);
3418
+ if (fromConfig != null) {
3419
+ setValueByPath(toObject, ['config'], fromConfig);
3420
+ }
3421
+ return toObject;
3422
+ }
3423
+ function batchJobSourceToVertex(fromObject) {
3424
+ const toObject = {};
3425
+ const fromFormat = getValueByPath(fromObject, ['format']);
3426
+ if (fromFormat != null) {
3427
+ setValueByPath(toObject, ['instancesFormat'], fromFormat);
3428
+ }
3429
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
3430
+ if (fromGcsUri != null) {
3431
+ setValueByPath(toObject, ['gcsSource', 'uris'], fromGcsUri);
3432
+ }
3433
+ const fromBigqueryUri = getValueByPath(fromObject, ['bigqueryUri']);
3434
+ if (fromBigqueryUri != null) {
3435
+ setValueByPath(toObject, ['bigquerySource', 'inputUri'], fromBigqueryUri);
3436
+ }
3437
+ if (getValueByPath(fromObject, ['fileName']) !== undefined) {
3438
+ throw new Error('fileName parameter is not supported in Vertex AI.');
3439
+ }
3440
+ if (getValueByPath(fromObject, ['inlinedRequests']) !== undefined) {
3441
+ throw new Error('inlinedRequests parameter is not supported in Vertex AI.');
3442
+ }
3443
+ return toObject;
3444
+ }
3445
+ function batchJobDestinationToVertex(fromObject) {
3446
+ const toObject = {};
3447
+ const fromFormat = getValueByPath(fromObject, ['format']);
3448
+ if (fromFormat != null) {
3449
+ setValueByPath(toObject, ['predictionsFormat'], fromFormat);
3450
+ }
3451
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
3452
+ if (fromGcsUri != null) {
3453
+ setValueByPath(toObject, ['gcsDestination', 'outputUriPrefix'], fromGcsUri);
3454
+ }
3455
+ const fromBigqueryUri = getValueByPath(fromObject, ['bigqueryUri']);
3456
+ if (fromBigqueryUri != null) {
3457
+ setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryUri);
3458
+ }
3459
+ if (getValueByPath(fromObject, ['fileName']) !== undefined) {
3460
+ throw new Error('fileName parameter is not supported in Vertex AI.');
3461
+ }
3462
+ if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
3463
+ throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
3464
+ }
3465
+ return toObject;
3466
+ }
3467
+ function createBatchJobConfigToVertex(fromObject, parentObject) {
3468
+ const toObject = {};
3469
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
3470
+ if (parentObject !== undefined && fromDisplayName != null) {
3471
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
3472
+ }
3473
+ const fromDest = getValueByPath(fromObject, ['dest']);
3474
+ if (parentObject !== undefined && fromDest != null) {
3475
+ setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
3476
+ }
3477
+ return toObject;
3478
+ }
3479
+ function createBatchJobParametersToVertex(apiClient, fromObject) {
3480
+ const toObject = {};
3481
+ const fromModel = getValueByPath(fromObject, ['model']);
3482
+ if (fromModel != null) {
3483
+ setValueByPath(toObject, ['model'], tModel(apiClient, fromModel));
3484
+ }
3485
+ const fromSrc = getValueByPath(fromObject, ['src']);
3486
+ if (fromSrc != null) {
3487
+ setValueByPath(toObject, ['inputConfig'], batchJobSourceToVertex(tBatchJobSource(apiClient, fromSrc)));
3488
+ }
3489
+ const fromConfig = getValueByPath(fromObject, ['config']);
3490
+ if (fromConfig != null) {
3491
+ setValueByPath(toObject, ['config'], createBatchJobConfigToVertex(fromConfig, toObject));
3492
+ }
3493
+ return toObject;
3494
+ }
3495
+ function getBatchJobParametersToVertex(apiClient, fromObject) {
3496
+ const toObject = {};
3497
+ const fromName = getValueByPath(fromObject, ['name']);
3498
+ if (fromName != null) {
3499
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3500
+ }
3501
+ const fromConfig = getValueByPath(fromObject, ['config']);
3502
+ if (fromConfig != null) {
3503
+ setValueByPath(toObject, ['config'], fromConfig);
3504
+ }
3505
+ return toObject;
3506
+ }
3507
+ function cancelBatchJobParametersToVertex(apiClient, fromObject) {
3508
+ const toObject = {};
3509
+ const fromName = getValueByPath(fromObject, ['name']);
3510
+ if (fromName != null) {
3511
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3512
+ }
3513
+ const fromConfig = getValueByPath(fromObject, ['config']);
3514
+ if (fromConfig != null) {
3515
+ setValueByPath(toObject, ['config'], fromConfig);
3516
+ }
3517
+ return toObject;
3518
+ }
3519
+ function listBatchJobsConfigToVertex(fromObject, parentObject) {
3520
+ const toObject = {};
3521
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
3522
+ if (parentObject !== undefined && fromPageSize != null) {
3523
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
3524
+ }
3525
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
3526
+ if (parentObject !== undefined && fromPageToken != null) {
3527
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
3528
+ }
3529
+ const fromFilter = getValueByPath(fromObject, ['filter']);
3530
+ if (parentObject !== undefined && fromFilter != null) {
3531
+ setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
3532
+ }
3533
+ return toObject;
3534
+ }
3535
+ function listBatchJobsParametersToVertex(fromObject) {
3536
+ const toObject = {};
3537
+ const fromConfig = getValueByPath(fromObject, ['config']);
3538
+ if (fromConfig != null) {
3539
+ setValueByPath(toObject, ['config'], listBatchJobsConfigToVertex(fromConfig, toObject));
3540
+ }
3541
+ return toObject;
3542
+ }
3543
+ function deleteBatchJobParametersToVertex(apiClient, fromObject) {
3544
+ const toObject = {};
3545
+ const fromName = getValueByPath(fromObject, ['name']);
3546
+ if (fromName != null) {
3547
+ setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
3548
+ }
3549
+ const fromConfig = getValueByPath(fromObject, ['config']);
3550
+ if (fromConfig != null) {
3551
+ setValueByPath(toObject, ['config'], fromConfig);
3552
+ }
3553
+ return toObject;
3554
+ }
3555
+ function jobErrorFromMldev() {
3556
+ const toObject = {};
3557
+ return toObject;
3558
+ }
3559
+ function videoMetadataFromMldev$2(fromObject) {
3560
+ const toObject = {};
3561
+ const fromFps = getValueByPath(fromObject, ['fps']);
3562
+ if (fromFps != null) {
3563
+ setValueByPath(toObject, ['fps'], fromFps);
3564
+ }
3565
+ const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
3566
+ if (fromEndOffset != null) {
3567
+ setValueByPath(toObject, ['endOffset'], fromEndOffset);
3568
+ }
3569
+ const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
3570
+ if (fromStartOffset != null) {
3571
+ setValueByPath(toObject, ['startOffset'], fromStartOffset);
3572
+ }
3573
+ return toObject;
3574
+ }
3575
+ function blobFromMldev$2(fromObject) {
3576
+ const toObject = {};
3577
+ const fromData = getValueByPath(fromObject, ['data']);
3578
+ if (fromData != null) {
3579
+ setValueByPath(toObject, ['data'], fromData);
3580
+ }
3581
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
3582
+ if (fromMimeType != null) {
3583
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
3584
+ }
3585
+ return toObject;
3586
+ }
3587
+ function fileDataFromMldev$2(fromObject) {
3588
+ const toObject = {};
3589
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
3590
+ if (fromFileUri != null) {
3591
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
3592
+ }
3593
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
3594
+ if (fromMimeType != null) {
3595
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
3596
+ }
3597
+ return toObject;
3598
+ }
3599
+ function partFromMldev$2(fromObject) {
3600
+ const toObject = {};
3601
+ const fromVideoMetadata = getValueByPath(fromObject, [
3602
+ 'videoMetadata',
3603
+ ]);
3604
+ if (fromVideoMetadata != null) {
3605
+ setValueByPath(toObject, ['videoMetadata'], videoMetadataFromMldev$2(fromVideoMetadata));
3606
+ }
3607
+ const fromThought = getValueByPath(fromObject, ['thought']);
3608
+ if (fromThought != null) {
3609
+ setValueByPath(toObject, ['thought'], fromThought);
3610
+ }
3611
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
3612
+ if (fromInlineData != null) {
3613
+ setValueByPath(toObject, ['inlineData'], blobFromMldev$2(fromInlineData));
3614
+ }
3615
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
3616
+ if (fromFileData != null) {
3617
+ setValueByPath(toObject, ['fileData'], fileDataFromMldev$2(fromFileData));
3618
+ }
3619
+ const fromThoughtSignature = getValueByPath(fromObject, [
3620
+ 'thoughtSignature',
3621
+ ]);
3622
+ if (fromThoughtSignature != null) {
3623
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
3624
+ }
3625
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
3626
+ 'codeExecutionResult',
3627
+ ]);
3628
+ if (fromCodeExecutionResult != null) {
3629
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
3630
+ }
3631
+ const fromExecutableCode = getValueByPath(fromObject, [
3632
+ 'executableCode',
3633
+ ]);
3634
+ if (fromExecutableCode != null) {
3635
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
3636
+ }
3637
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
3638
+ if (fromFunctionCall != null) {
3639
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
3640
+ }
3641
+ const fromFunctionResponse = getValueByPath(fromObject, [
3642
+ 'functionResponse',
3643
+ ]);
3644
+ if (fromFunctionResponse != null) {
3645
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
3646
+ }
3647
+ const fromText = getValueByPath(fromObject, ['text']);
3648
+ if (fromText != null) {
3649
+ setValueByPath(toObject, ['text'], fromText);
3650
+ }
3651
+ return toObject;
3652
+ }
3653
+ function contentFromMldev$2(fromObject) {
3654
+ const toObject = {};
3655
+ const fromParts = getValueByPath(fromObject, ['parts']);
3656
+ if (fromParts != null) {
3657
+ let transformedList = fromParts;
3658
+ if (Array.isArray(transformedList)) {
3659
+ transformedList = transformedList.map((item) => {
3660
+ return partFromMldev$2(item);
3661
+ });
3662
+ }
3663
+ setValueByPath(toObject, ['parts'], transformedList);
3664
+ }
3665
+ const fromRole = getValueByPath(fromObject, ['role']);
3666
+ if (fromRole != null) {
3667
+ setValueByPath(toObject, ['role'], fromRole);
3668
+ }
3669
+ return toObject;
3670
+ }
3671
+ function citationMetadataFromMldev$1(fromObject) {
3672
+ const toObject = {};
3673
+ const fromCitations = getValueByPath(fromObject, ['citationSources']);
3674
+ if (fromCitations != null) {
3675
+ setValueByPath(toObject, ['citations'], fromCitations);
3676
+ }
3677
+ return toObject;
3678
+ }
3679
+ function urlMetadataFromMldev$2(fromObject) {
3680
+ const toObject = {};
3681
+ const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
3682
+ if (fromRetrievedUrl != null) {
3683
+ setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
3684
+ }
3685
+ const fromUrlRetrievalStatus = getValueByPath(fromObject, [
3686
+ 'urlRetrievalStatus',
3687
+ ]);
3688
+ if (fromUrlRetrievalStatus != null) {
3689
+ setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
3690
+ }
3691
+ return toObject;
3692
+ }
3693
+ function urlContextMetadataFromMldev$2(fromObject) {
3694
+ const toObject = {};
3695
+ const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
3696
+ if (fromUrlMetadata != null) {
3697
+ let transformedList = fromUrlMetadata;
3698
+ if (Array.isArray(transformedList)) {
3699
+ transformedList = transformedList.map((item) => {
3700
+ return urlMetadataFromMldev$2(item);
3701
+ });
3702
+ }
3703
+ setValueByPath(toObject, ['urlMetadata'], transformedList);
3704
+ }
3705
+ return toObject;
3706
+ }
3707
+ function candidateFromMldev$1(fromObject) {
3708
+ const toObject = {};
3709
+ const fromContent = getValueByPath(fromObject, ['content']);
3710
+ if (fromContent != null) {
3711
+ setValueByPath(toObject, ['content'], contentFromMldev$2(fromContent));
3712
+ }
3713
+ const fromCitationMetadata = getValueByPath(fromObject, [
3714
+ 'citationMetadata',
3715
+ ]);
3716
+ if (fromCitationMetadata != null) {
3717
+ setValueByPath(toObject, ['citationMetadata'], citationMetadataFromMldev$1(fromCitationMetadata));
3718
+ }
3719
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
3720
+ if (fromTokenCount != null) {
3721
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
3722
+ }
3723
+ const fromFinishReason = getValueByPath(fromObject, ['finishReason']);
3724
+ if (fromFinishReason != null) {
3725
+ setValueByPath(toObject, ['finishReason'], fromFinishReason);
3726
+ }
3727
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
3728
+ 'urlContextMetadata',
3729
+ ]);
3730
+ if (fromUrlContextMetadata != null) {
3731
+ setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromMldev$2(fromUrlContextMetadata));
3732
+ }
3733
+ const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
3734
+ if (fromAvgLogprobs != null) {
3735
+ setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
3736
+ }
3737
+ const fromGroundingMetadata = getValueByPath(fromObject, [
3738
+ 'groundingMetadata',
3739
+ ]);
3740
+ if (fromGroundingMetadata != null) {
3741
+ setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
3742
+ }
3743
+ const fromIndex = getValueByPath(fromObject, ['index']);
3744
+ if (fromIndex != null) {
3745
+ setValueByPath(toObject, ['index'], fromIndex);
3746
+ }
3747
+ const fromLogprobsResult = getValueByPath(fromObject, [
3748
+ 'logprobsResult',
3749
+ ]);
3750
+ if (fromLogprobsResult != null) {
3751
+ setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
3752
+ }
3753
+ const fromSafetyRatings = getValueByPath(fromObject, [
3754
+ 'safetyRatings',
3755
+ ]);
3756
+ if (fromSafetyRatings != null) {
3757
+ setValueByPath(toObject, ['safetyRatings'], fromSafetyRatings);
3758
+ }
3759
+ return toObject;
3760
+ }
3761
+ function generateContentResponseFromMldev$1(fromObject) {
3762
+ const toObject = {};
3763
+ const fromCandidates = getValueByPath(fromObject, ['candidates']);
3764
+ if (fromCandidates != null) {
3765
+ let transformedList = fromCandidates;
3766
+ if (Array.isArray(transformedList)) {
3767
+ transformedList = transformedList.map((item) => {
3768
+ return candidateFromMldev$1(item);
3769
+ });
3770
+ }
3771
+ setValueByPath(toObject, ['candidates'], transformedList);
3772
+ }
3773
+ const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
3774
+ if (fromModelVersion != null) {
3775
+ setValueByPath(toObject, ['modelVersion'], fromModelVersion);
3776
+ }
3777
+ const fromPromptFeedback = getValueByPath(fromObject, [
3778
+ 'promptFeedback',
3779
+ ]);
3780
+ if (fromPromptFeedback != null) {
3781
+ setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
3782
+ }
3783
+ const fromUsageMetadata = getValueByPath(fromObject, [
3784
+ 'usageMetadata',
3785
+ ]);
3786
+ if (fromUsageMetadata != null) {
3787
+ setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
3788
+ }
3789
+ return toObject;
3790
+ }
3791
+ function inlinedResponseFromMldev(fromObject) {
3792
+ const toObject = {};
3793
+ const fromResponse = getValueByPath(fromObject, ['response']);
3794
+ if (fromResponse != null) {
3795
+ setValueByPath(toObject, ['response'], generateContentResponseFromMldev$1(fromResponse));
3796
+ }
3797
+ const fromError = getValueByPath(fromObject, ['error']);
3798
+ if (fromError != null) {
3799
+ setValueByPath(toObject, ['error'], jobErrorFromMldev());
3800
+ }
3801
+ return toObject;
3802
+ }
3803
+ function batchJobDestinationFromMldev(fromObject) {
3804
+ const toObject = {};
3805
+ const fromFileName = getValueByPath(fromObject, ['responsesFile']);
3806
+ if (fromFileName != null) {
3807
+ setValueByPath(toObject, ['fileName'], fromFileName);
3808
+ }
3809
+ const fromInlinedResponses = getValueByPath(fromObject, [
3810
+ 'inlinedResponses',
3811
+ 'inlinedResponses',
3812
+ ]);
3813
+ if (fromInlinedResponses != null) {
3814
+ let transformedList = fromInlinedResponses;
3815
+ if (Array.isArray(transformedList)) {
3816
+ transformedList = transformedList.map((item) => {
3817
+ return inlinedResponseFromMldev(item);
3818
+ });
3819
+ }
3820
+ setValueByPath(toObject, ['inlinedResponses'], transformedList);
3821
+ }
3822
+ return toObject;
3823
+ }
3824
+ function batchJobFromMldev(fromObject) {
3825
+ const toObject = {};
3826
+ const fromName = getValueByPath(fromObject, ['name']);
3827
+ if (fromName != null) {
3828
+ setValueByPath(toObject, ['name'], fromName);
3829
+ }
3830
+ const fromDisplayName = getValueByPath(fromObject, [
3831
+ 'metadata',
3832
+ 'displayName',
3833
+ ]);
3834
+ if (fromDisplayName != null) {
3835
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
3836
+ }
3837
+ const fromState = getValueByPath(fromObject, ['metadata', 'state']);
3838
+ if (fromState != null) {
3839
+ setValueByPath(toObject, ['state'], tJobState(fromState));
3840
+ }
3841
+ const fromCreateTime = getValueByPath(fromObject, [
3842
+ 'metadata',
3843
+ 'createTime',
3844
+ ]);
3845
+ if (fromCreateTime != null) {
3846
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
3847
+ }
3848
+ const fromEndTime = getValueByPath(fromObject, [
3849
+ 'metadata',
3850
+ 'endTime',
3851
+ ]);
3852
+ if (fromEndTime != null) {
3853
+ setValueByPath(toObject, ['endTime'], fromEndTime);
3854
+ }
3855
+ const fromUpdateTime = getValueByPath(fromObject, [
3856
+ 'metadata',
3857
+ 'updateTime',
3858
+ ]);
3859
+ if (fromUpdateTime != null) {
3860
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
3861
+ }
3862
+ const fromModel = getValueByPath(fromObject, ['metadata', 'model']);
3863
+ if (fromModel != null) {
3864
+ setValueByPath(toObject, ['model'], fromModel);
3865
+ }
3866
+ const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
3867
+ if (fromDest != null) {
3868
+ setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
3869
+ }
3870
+ return toObject;
3871
+ }
3872
+ function listBatchJobsResponseFromMldev(fromObject) {
3873
+ const toObject = {};
3874
+ const fromNextPageToken = getValueByPath(fromObject, [
3875
+ 'nextPageToken',
3876
+ ]);
3877
+ if (fromNextPageToken != null) {
3878
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
3879
+ }
3880
+ const fromBatchJobs = getValueByPath(fromObject, ['operations']);
3881
+ if (fromBatchJobs != null) {
3882
+ let transformedList = fromBatchJobs;
3883
+ if (Array.isArray(transformedList)) {
3884
+ transformedList = transformedList.map((item) => {
3885
+ return batchJobFromMldev(item);
3886
+ });
3887
+ }
3888
+ setValueByPath(toObject, ['batchJobs'], transformedList);
3889
+ }
3890
+ return toObject;
3891
+ }
3892
+ function deleteResourceJobFromMldev(fromObject) {
3893
+ const toObject = {};
3894
+ const fromName = getValueByPath(fromObject, ['name']);
3895
+ if (fromName != null) {
3896
+ setValueByPath(toObject, ['name'], fromName);
3897
+ }
3898
+ const fromDone = getValueByPath(fromObject, ['done']);
3899
+ if (fromDone != null) {
3900
+ setValueByPath(toObject, ['done'], fromDone);
3901
+ }
3902
+ const fromError = getValueByPath(fromObject, ['error']);
3903
+ if (fromError != null) {
3904
+ setValueByPath(toObject, ['error'], jobErrorFromMldev());
3905
+ }
3906
+ return toObject;
3907
+ }
3908
+ function jobErrorFromVertex(fromObject) {
3909
+ const toObject = {};
3910
+ const fromDetails = getValueByPath(fromObject, ['details']);
3911
+ if (fromDetails != null) {
3912
+ setValueByPath(toObject, ['details'], fromDetails);
3913
+ }
3914
+ const fromCode = getValueByPath(fromObject, ['code']);
3915
+ if (fromCode != null) {
3916
+ setValueByPath(toObject, ['code'], fromCode);
3917
+ }
3918
+ const fromMessage = getValueByPath(fromObject, ['message']);
3919
+ if (fromMessage != null) {
3920
+ setValueByPath(toObject, ['message'], fromMessage);
3921
+ }
3922
+ return toObject;
3923
+ }
3924
+ function batchJobSourceFromVertex(fromObject) {
3925
+ const toObject = {};
3926
+ const fromFormat = getValueByPath(fromObject, ['instancesFormat']);
3927
+ if (fromFormat != null) {
3928
+ setValueByPath(toObject, ['format'], fromFormat);
3929
+ }
3930
+ const fromGcsUri = getValueByPath(fromObject, ['gcsSource', 'uris']);
3931
+ if (fromGcsUri != null) {
3932
+ setValueByPath(toObject, ['gcsUri'], fromGcsUri);
3933
+ }
3934
+ const fromBigqueryUri = getValueByPath(fromObject, [
3935
+ 'bigquerySource',
3936
+ 'inputUri',
3937
+ ]);
3938
+ if (fromBigqueryUri != null) {
3939
+ setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
3940
+ }
3941
+ return toObject;
3942
+ }
3943
+ function batchJobDestinationFromVertex(fromObject) {
3944
+ const toObject = {};
3945
+ const fromFormat = getValueByPath(fromObject, ['predictionsFormat']);
3946
+ if (fromFormat != null) {
3947
+ setValueByPath(toObject, ['format'], fromFormat);
3948
+ }
3949
+ const fromGcsUri = getValueByPath(fromObject, [
3950
+ 'gcsDestination',
3951
+ 'outputUriPrefix',
3952
+ ]);
3953
+ if (fromGcsUri != null) {
3954
+ setValueByPath(toObject, ['gcsUri'], fromGcsUri);
3955
+ }
3956
+ const fromBigqueryUri = getValueByPath(fromObject, [
3957
+ 'bigqueryDestination',
3958
+ 'outputUri',
3959
+ ]);
3960
+ if (fromBigqueryUri != null) {
3961
+ setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
3962
+ }
3963
+ return toObject;
3964
+ }
3965
+ function batchJobFromVertex(fromObject) {
3966
+ const toObject = {};
3967
+ const fromName = getValueByPath(fromObject, ['name']);
3968
+ if (fromName != null) {
3969
+ setValueByPath(toObject, ['name'], fromName);
3970
+ }
3971
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
3972
+ if (fromDisplayName != null) {
3973
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
3974
+ }
3975
+ const fromState = getValueByPath(fromObject, ['state']);
3976
+ if (fromState != null) {
3977
+ setValueByPath(toObject, ['state'], tJobState(fromState));
3978
+ }
3979
+ const fromError = getValueByPath(fromObject, ['error']);
3980
+ if (fromError != null) {
3981
+ setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
3982
+ }
3983
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
3984
+ if (fromCreateTime != null) {
3985
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
3986
+ }
3987
+ const fromStartTime = getValueByPath(fromObject, ['startTime']);
3988
+ if (fromStartTime != null) {
3989
+ setValueByPath(toObject, ['startTime'], fromStartTime);
3990
+ }
3991
+ const fromEndTime = getValueByPath(fromObject, ['endTime']);
3992
+ if (fromEndTime != null) {
3993
+ setValueByPath(toObject, ['endTime'], fromEndTime);
3994
+ }
3995
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
3996
+ if (fromUpdateTime != null) {
3997
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
3998
+ }
3999
+ const fromModel = getValueByPath(fromObject, ['model']);
4000
+ if (fromModel != null) {
4001
+ setValueByPath(toObject, ['model'], fromModel);
4002
+ }
4003
+ const fromSrc = getValueByPath(fromObject, ['inputConfig']);
4004
+ if (fromSrc != null) {
4005
+ setValueByPath(toObject, ['src'], batchJobSourceFromVertex(fromSrc));
4006
+ }
4007
+ const fromDest = getValueByPath(fromObject, ['outputConfig']);
4008
+ if (fromDest != null) {
4009
+ setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
4010
+ }
4011
+ return toObject;
4012
+ }
4013
+ function listBatchJobsResponseFromVertex(fromObject) {
4014
+ const toObject = {};
4015
+ const fromNextPageToken = getValueByPath(fromObject, [
4016
+ 'nextPageToken',
4017
+ ]);
4018
+ if (fromNextPageToken != null) {
4019
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
4020
+ }
4021
+ const fromBatchJobs = getValueByPath(fromObject, [
4022
+ 'batchPredictionJobs',
4023
+ ]);
4024
+ if (fromBatchJobs != null) {
4025
+ let transformedList = fromBatchJobs;
4026
+ if (Array.isArray(transformedList)) {
4027
+ transformedList = transformedList.map((item) => {
4028
+ return batchJobFromVertex(item);
4029
+ });
4030
+ }
4031
+ setValueByPath(toObject, ['batchJobs'], transformedList);
4032
+ }
4033
+ return toObject;
4034
+ }
4035
+ function deleteResourceJobFromVertex(fromObject) {
4036
+ const toObject = {};
4037
+ const fromName = getValueByPath(fromObject, ['name']);
4038
+ if (fromName != null) {
4039
+ setValueByPath(toObject, ['name'], fromName);
4040
+ }
4041
+ const fromDone = getValueByPath(fromObject, ['done']);
4042
+ if (fromDone != null) {
4043
+ setValueByPath(toObject, ['done'], fromDone);
4044
+ }
4045
+ const fromError = getValueByPath(fromObject, ['error']);
4046
+ if (fromError != null) {
4047
+ setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
4048
+ }
4049
+ return toObject;
4050
+ }
4051
+
4052
+ /**
4053
+ * @license
4054
+ * Copyright 2025 Google LLC
4055
+ * SPDX-License-Identifier: Apache-2.0
4056
+ */
4057
+ /**
4058
+ * Pagers for the GenAI List APIs.
4059
+ */
4060
+ exports.PagedItem = void 0;
4061
+ (function (PagedItem) {
4062
+ PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
4063
+ PagedItem["PAGED_ITEM_MODELS"] = "models";
4064
+ PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
4065
+ PagedItem["PAGED_ITEM_FILES"] = "files";
4066
+ PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
4067
+ })(exports.PagedItem || (exports.PagedItem = {}));
4068
+ /**
4069
+ * Pager class for iterating through paginated results.
4070
+ */
4071
+ class Pager {
4072
+ constructor(name, request, response, params) {
4073
+ this.pageInternal = [];
4074
+ this.paramsInternal = {};
4075
+ this.requestInternal = request;
4076
+ this.init(name, response, params);
4077
+ }
4078
+ init(name, response, params) {
4079
+ var _a, _b;
4080
+ this.nameInternal = name;
4081
+ this.pageInternal = response[this.nameInternal] || [];
4082
+ this.idxInternal = 0;
4083
+ let requestParams = { config: {} };
4084
+ if (!params) {
4085
+ requestParams = { config: {} };
4086
+ }
4087
+ else if (typeof params === 'object') {
4088
+ requestParams = Object.assign({}, params);
4089
+ }
4090
+ else {
4091
+ requestParams = params;
4092
+ }
4093
+ if (requestParams['config']) {
4094
+ requestParams['config']['pageToken'] = response['nextPageToken'];
4095
+ }
4096
+ this.paramsInternal = requestParams;
4097
+ this.pageInternalSize =
4098
+ (_b = (_a = requestParams['config']) === null || _a === void 0 ? void 0 : _a['pageSize']) !== null && _b !== void 0 ? _b : this.pageInternal.length;
4099
+ }
4100
+ initNextPage(response) {
4101
+ this.init(this.nameInternal, response, this.paramsInternal);
4102
+ }
4103
+ /**
4104
+ * Returns the current page, which is a list of items.
4105
+ *
4106
+ * @remarks
4107
+ * The first page is retrieved when the pager is created. The returned list of
4108
+ * items could be a subset of the entire list.
4109
+ */
4110
+ get page() {
4111
+ return this.pageInternal;
4112
+ }
4113
+ /**
4114
+ * Returns the type of paged item (for example, ``batch_jobs``).
4115
+ */
4116
+ get name() {
4117
+ return this.nameInternal;
4118
+ }
4119
+ /**
4120
+ * Returns the length of the page fetched each time by this pager.
4121
+ *
4122
+ * @remarks
4123
+ * The number of items in the page is less than or equal to the page length.
4124
+ */
4125
+ get pageSize() {
4126
+ return this.pageInternalSize;
4127
+ }
4128
+ /**
4129
+ * Returns the parameters when making the API request for the next page.
4130
+ *
4131
+ * @remarks
4132
+ * Parameters contain a set of optional configs that can be
4133
+ * used to customize the API request. For example, the `pageToken` parameter
4134
+ * contains the token to request the next page.
4135
+ */
4136
+ get params() {
4137
+ return this.paramsInternal;
4138
+ }
4139
+ /**
4140
+ * Returns the total number of items in the current page.
4141
+ */
4142
+ get pageLength() {
4143
+ return this.pageInternal.length;
4144
+ }
4145
+ /**
4146
+ * Returns the item at the given index.
4147
+ */
4148
+ getItem(index) {
4149
+ return this.pageInternal[index];
4150
+ }
4151
+ /**
4152
+ * Returns an async iterator that support iterating through all items
4153
+ * retrieved from the API.
4154
+ *
4155
+ * @remarks
4156
+ * The iterator will automatically fetch the next page if there are more items
4157
+ * to fetch from the API.
4158
+ *
4159
+ * @example
4160
+ *
4161
+ * ```ts
4162
+ * const pager = await ai.files.list({config: {pageSize: 10}});
4163
+ * for await (const file of pager) {
4164
+ * console.log(file.name);
4165
+ * }
4166
+ * ```
4167
+ */
4168
+ [Symbol.asyncIterator]() {
4169
+ return {
4170
+ next: async () => {
4171
+ if (this.idxInternal >= this.pageLength) {
4172
+ if (this.hasNextPage()) {
4173
+ await this.nextPage();
4174
+ }
4175
+ else {
4176
+ return { value: undefined, done: true };
4177
+ }
4178
+ }
4179
+ const item = this.getItem(this.idxInternal);
4180
+ this.idxInternal += 1;
4181
+ return { value: item, done: false };
4182
+ },
4183
+ return: async () => {
4184
+ return { value: undefined, done: true };
4185
+ },
4186
+ };
4187
+ }
4188
+ /**
4189
+ * Fetches the next page of items. This makes a new API request.
4190
+ *
4191
+ * @throws {Error} If there are no more pages to fetch.
4192
+ *
4193
+ * @example
4194
+ *
4195
+ * ```ts
4196
+ * const pager = await ai.files.list({config: {pageSize: 10}});
4197
+ * let page = pager.page;
4198
+ * while (true) {
4199
+ * for (const file of page) {
4200
+ * console.log(file.name);
4201
+ * }
4202
+ * if (!pager.hasNextPage()) {
4203
+ * break;
4204
+ * }
4205
+ * page = await pager.nextPage();
4206
+ * }
4207
+ * ```
4208
+ */
4209
+ async nextPage() {
4210
+ if (!this.hasNextPage()) {
4211
+ throw new Error('No more pages to fetch.');
4212
+ }
4213
+ const response = await this.requestInternal(this.params);
4214
+ this.initNextPage(response);
4215
+ return this.page;
4216
+ }
4217
+ /**
4218
+ * Returns true if there are more pages to fetch from the API.
4219
+ */
4220
+ hasNextPage() {
4221
+ var _a;
4222
+ if (((_a = this.params['config']) === null || _a === void 0 ? void 0 : _a['pageToken']) !== undefined) {
4223
+ return true;
4224
+ }
4225
+ return false;
4226
+ }
4227
+ }
4228
+
4229
+ /**
4230
+ * @license
4231
+ * Copyright 2025 Google LLC
4232
+ * SPDX-License-Identifier: Apache-2.0
4233
+ */
4234
+ class Batches extends BaseModule {
4235
+ constructor(apiClient) {
4236
+ super();
4237
+ this.apiClient = apiClient;
4238
+ /**
4239
+ * Create batch job.
4240
+ *
4241
+ * @param params - The parameters for create batch job request.
4242
+ * @return The created batch job.
4243
+ *
4244
+ * @example
4245
+ * ```ts
4246
+ * const response = await ai.batches.create({
4247
+ * model: 'gemini-2.0-flash',
4248
+ * src: {gcsUri: 'gs://bucket/path/to/file.jsonl', format: 'jsonl'},
4249
+ * config: {
4250
+ * dest: {gcsUri: 'gs://bucket/path/output/directory', format: 'jsonl'},
4251
+ * }
4252
+ * });
4253
+ * console.log(response);
4254
+ * ```
4255
+ */
4256
+ this.create = async (params) => {
4257
+ if (this.apiClient.isVertexAI()) {
4258
+ const timestamp = Date.now();
4259
+ const timestampStr = timestamp.toString();
4260
+ if (Array.isArray(params.src)) {
4261
+ throw new Error('InlinedRequest[] is not supported in Vertex AI. Please use ' +
4262
+ 'Google Cloud Storage URI or BigQuery URI instead.');
4263
+ }
4264
+ params.config = params.config || {};
4265
+ if (params.config.displayName === undefined) {
4266
+ params.config.displayName = 'genaiBatchJob_${timestampStr}';
4267
+ }
4268
+ if (params.config.dest === undefined && typeof params.src === 'string') {
4269
+ if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
4270
+ params.config.dest = `${params.src.slice(0, -6)}/dest`;
4271
+ }
4272
+ else if (params.src.startsWith('bq://')) {
4273
+ params.config.dest =
4274
+ `${params.src}_dest_${timestampStr}`;
4275
+ }
4276
+ else {
4277
+ throw new Error('Unsupported source:' + params.src);
4278
+ }
4279
+ }
4280
+ }
4281
+ return await this.createInternal(params);
4282
+ };
4283
+ /**
4284
+ * Lists batch job configurations.
4285
+ *
4286
+ * @param params - The parameters for the list request.
4287
+ * @return The paginated results of the list of batch jobs.
4288
+ *
4289
+ * @example
4290
+ * ```ts
4291
+ * const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
4292
+ * for await (const batchJob of batchJobs) {
4293
+ * console.log(batchJob);
4294
+ * }
4295
+ * ```
4296
+ */
4297
+ this.list = async (params = {}) => {
4298
+ return new Pager(exports.PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
4299
+ };
4300
+ }
4301
+ /**
4302
+ * Internal method to create batch job.
4303
+ *
4304
+ * @param params - The parameters for create batch job request.
4305
+ * @return The created batch job.
4306
+ *
4307
+ */
4308
+ async createInternal(params) {
4309
+ var _a, _b, _c, _d;
4310
+ let response;
4311
+ let path = '';
4312
+ let queryParams = {};
4313
+ if (this.apiClient.isVertexAI()) {
4314
+ const body = createBatchJobParametersToVertex(this.apiClient, params);
4315
+ path = formatMap('batchPredictionJobs', body['_url']);
4316
+ queryParams = body['_query'];
4317
+ delete body['config'];
4318
+ delete body['_url'];
4319
+ delete body['_query'];
4320
+ response = this.apiClient
4321
+ .request({
4322
+ path: path,
4323
+ queryParams: queryParams,
4324
+ body: JSON.stringify(body),
4325
+ httpMethod: 'POST',
4326
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4327
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4328
+ })
4329
+ .then((httpResponse) => {
4330
+ return httpResponse.json();
4331
+ });
4332
+ return response.then((apiResponse) => {
4333
+ const resp = batchJobFromVertex(apiResponse);
4334
+ return resp;
4335
+ });
4336
+ }
4337
+ else {
4338
+ const body = createBatchJobParametersToMldev(this.apiClient, params);
4339
+ path = formatMap('{model}:batchGenerateContent', body['_url']);
4340
+ queryParams = body['_query'];
4341
+ delete body['config'];
4342
+ delete body['_url'];
4343
+ delete body['_query'];
4344
+ response = this.apiClient
4345
+ .request({
4346
+ path: path,
4347
+ queryParams: queryParams,
4348
+ body: JSON.stringify(body),
4349
+ httpMethod: 'POST',
4350
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4351
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4352
+ })
4353
+ .then((httpResponse) => {
4354
+ return httpResponse.json();
4355
+ });
4356
+ return response.then((apiResponse) => {
4357
+ const resp = batchJobFromMldev(apiResponse);
4358
+ return resp;
4359
+ });
4360
+ }
4361
+ }
4362
+ /**
4363
+ * Gets batch job configurations.
4364
+ *
4365
+ * @param params - The parameters for the get request.
4366
+ * @return The batch job.
4367
+ *
4368
+ * @example
4369
+ * ```ts
4370
+ * await ai.batches.get({name: '...'}); // The server-generated resource name.
4371
+ * ```
4372
+ */
4373
+ async get(params) {
4374
+ var _a, _b, _c, _d;
4375
+ let response;
4376
+ let path = '';
4377
+ let queryParams = {};
4378
+ if (this.apiClient.isVertexAI()) {
4379
+ const body = getBatchJobParametersToVertex(this.apiClient, params);
4380
+ path = formatMap('batchPredictionJobs/{name}', body['_url']);
4381
+ queryParams = body['_query'];
4382
+ delete body['config'];
4383
+ delete body['_url'];
4384
+ delete body['_query'];
4385
+ response = this.apiClient
4386
+ .request({
4387
+ path: path,
4388
+ queryParams: queryParams,
4389
+ body: JSON.stringify(body),
4390
+ httpMethod: 'GET',
4391
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4392
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4393
+ })
4394
+ .then((httpResponse) => {
4395
+ return httpResponse.json();
4396
+ });
4397
+ return response.then((apiResponse) => {
4398
+ const resp = batchJobFromVertex(apiResponse);
4399
+ return resp;
4400
+ });
4401
+ }
4402
+ else {
4403
+ const body = getBatchJobParametersToMldev(this.apiClient, params);
4404
+ path = formatMap('batches/{name}', body['_url']);
4405
+ queryParams = body['_query'];
4406
+ delete body['config'];
4407
+ delete body['_url'];
4408
+ delete body['_query'];
4409
+ response = this.apiClient
4410
+ .request({
4411
+ path: path,
4412
+ queryParams: queryParams,
4413
+ body: JSON.stringify(body),
4414
+ httpMethod: 'GET',
4415
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4416
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4417
+ })
4418
+ .then((httpResponse) => {
4419
+ return httpResponse.json();
4420
+ });
4421
+ return response.then((apiResponse) => {
4422
+ const resp = batchJobFromMldev(apiResponse);
4423
+ return resp;
4424
+ });
4425
+ }
4426
+ }
4427
+ /**
4428
+ * Cancels a batch job.
4429
+ *
4430
+ * @param params - The parameters for the cancel request.
4431
+ * @return The empty response returned by the API.
4432
+ *
4433
+ * @example
4434
+ * ```ts
4435
+ * await ai.batches.cancel({name: '...'}); // The server-generated resource name.
4436
+ * ```
4437
+ */
4438
+ async cancel(params) {
4439
+ var _a, _b, _c, _d;
4440
+ let path = '';
4441
+ let queryParams = {};
4442
+ if (this.apiClient.isVertexAI()) {
4443
+ const body = cancelBatchJobParametersToVertex(this.apiClient, params);
4444
+ path = formatMap('batchPredictionJobs/{name}:cancel', body['_url']);
4445
+ queryParams = body['_query'];
4446
+ delete body['config'];
4447
+ delete body['_url'];
4448
+ delete body['_query'];
4449
+ await this.apiClient.request({
4450
+ path: path,
4451
+ queryParams: queryParams,
4452
+ body: JSON.stringify(body),
4453
+ httpMethod: 'POST',
4454
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4455
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4456
+ });
4457
+ }
4458
+ else {
4459
+ const body = cancelBatchJobParametersToMldev(this.apiClient, params);
4460
+ path = formatMap('batches/{name}:cancel', body['_url']);
4461
+ queryParams = body['_query'];
4462
+ delete body['config'];
4463
+ delete body['_url'];
4464
+ delete body['_query'];
4465
+ await this.apiClient.request({
4466
+ path: path,
4467
+ queryParams: queryParams,
4468
+ body: JSON.stringify(body),
4469
+ httpMethod: 'POST',
4470
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4471
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4472
+ });
4473
+ }
4474
+ }
4475
+ async listInternal(params) {
4476
+ var _a, _b, _c, _d;
4477
+ let response;
4478
+ let path = '';
4479
+ let queryParams = {};
4480
+ if (this.apiClient.isVertexAI()) {
4481
+ const body = listBatchJobsParametersToVertex(params);
4482
+ path = formatMap('batchPredictionJobs', body['_url']);
4483
+ queryParams = body['_query'];
4484
+ delete body['config'];
4485
+ delete body['_url'];
4486
+ delete body['_query'];
4487
+ response = this.apiClient
4488
+ .request({
4489
+ path: path,
4490
+ queryParams: queryParams,
4491
+ body: JSON.stringify(body),
4492
+ httpMethod: 'GET',
4493
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4494
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4495
+ })
4496
+ .then((httpResponse) => {
4497
+ return httpResponse.json();
4498
+ });
4499
+ return response.then((apiResponse) => {
4500
+ const resp = listBatchJobsResponseFromVertex(apiResponse);
4501
+ const typedResp = new ListBatchJobsResponse();
4502
+ Object.assign(typedResp, resp);
4503
+ return typedResp;
4504
+ });
4505
+ }
4506
+ else {
4507
+ const body = listBatchJobsParametersToMldev(params);
4508
+ path = formatMap('batches', body['_url']);
4509
+ queryParams = body['_query'];
4510
+ delete body['config'];
4511
+ delete body['_url'];
4512
+ delete body['_query'];
4513
+ response = this.apiClient
4514
+ .request({
4515
+ path: path,
4516
+ queryParams: queryParams,
4517
+ body: JSON.stringify(body),
4518
+ httpMethod: 'GET',
4519
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4520
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4521
+ })
4522
+ .then((httpResponse) => {
4523
+ return httpResponse.json();
4524
+ });
4525
+ return response.then((apiResponse) => {
4526
+ const resp = listBatchJobsResponseFromMldev(apiResponse);
4527
+ const typedResp = new ListBatchJobsResponse();
4528
+ Object.assign(typedResp, resp);
4529
+ return typedResp;
4530
+ });
4531
+ }
4532
+ }
4533
+ /**
4534
+ * Deletes a batch job.
4535
+ *
4536
+ * @param params - The parameters for the delete request.
4537
+ * @return The empty response returned by the API.
4538
+ *
4539
+ * @example
4540
+ * ```ts
4541
+ * await ai.batches.delete({name: '...'}); // The server-generated resource name.
4542
+ * ```
4543
+ */
4544
+ async delete(params) {
4545
+ var _a, _b, _c, _d;
4546
+ let response;
4547
+ let path = '';
4548
+ let queryParams = {};
4549
+ if (this.apiClient.isVertexAI()) {
4550
+ const body = deleteBatchJobParametersToVertex(this.apiClient, params);
4551
+ path = formatMap('batchPredictionJobs/{name}', body['_url']);
4552
+ queryParams = body['_query'];
4553
+ delete body['config'];
4554
+ delete body['_url'];
4555
+ delete body['_query'];
4556
+ response = this.apiClient
4557
+ .request({
4558
+ path: path,
4559
+ queryParams: queryParams,
4560
+ body: JSON.stringify(body),
4561
+ httpMethod: 'DELETE',
4562
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4563
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4564
+ })
4565
+ .then((httpResponse) => {
4566
+ return httpResponse.json();
4567
+ });
4568
+ return response.then((apiResponse) => {
4569
+ const resp = deleteResourceJobFromVertex(apiResponse);
4570
+ return resp;
4571
+ });
4572
+ }
4573
+ else {
4574
+ const body = deleteBatchJobParametersToMldev(this.apiClient, params);
4575
+ path = formatMap('batches/{name}', body['_url']);
4576
+ queryParams = body['_query'];
4577
+ delete body['config'];
4578
+ delete body['_url'];
4579
+ delete body['_query'];
4580
+ response = this.apiClient
4581
+ .request({
4582
+ path: path,
4583
+ queryParams: queryParams,
4584
+ body: JSON.stringify(body),
4585
+ httpMethod: 'DELETE',
4586
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
4587
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4588
+ })
4589
+ .then((httpResponse) => {
4590
+ return httpResponse.json();
4591
+ });
4592
+ return response.then((apiResponse) => {
4593
+ const resp = deleteResourceJobFromMldev(apiResponse);
4594
+ return resp;
4595
+ });
2441
4596
  }
2442
4597
  }
2443
- return filteredSchema;
2444
4598
  }
2445
4599
 
2446
4600
  /**
@@ -2695,6 +4849,10 @@ function toolToMldev$3(fromObject) {
2695
4849
  if (fromCodeExecution != null) {
2696
4850
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2697
4851
  }
4852
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4853
+ if (fromComputerUse != null) {
4854
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
4855
+ }
2698
4856
  return toObject;
2699
4857
  }
2700
4858
  function functionCallingConfigToMldev$1(fromObject) {
@@ -3185,6 +5343,10 @@ function toolToVertex$2(fromObject) {
3185
5343
  if (fromCodeExecution != null) {
3186
5344
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
3187
5345
  }
5346
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5347
+ if (fromComputerUse != null) {
5348
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
5349
+ }
3188
5350
  return toObject;
3189
5351
  }
3190
5352
  function functionCallingConfigToVertex$1(fromObject) {
@@ -3492,183 +5654,6 @@ function listCachedContentsResponseFromVertex(fromObject) {
3492
5654
  return toObject;
3493
5655
  }
3494
5656
 
3495
- /**
3496
- * @license
3497
- * Copyright 2025 Google LLC
3498
- * SPDX-License-Identifier: Apache-2.0
3499
- */
3500
- /**
3501
- * Pagers for the GenAI List APIs.
3502
- */
3503
- exports.PagedItem = void 0;
3504
- (function (PagedItem) {
3505
- PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
3506
- PagedItem["PAGED_ITEM_MODELS"] = "models";
3507
- PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
3508
- PagedItem["PAGED_ITEM_FILES"] = "files";
3509
- PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
3510
- })(exports.PagedItem || (exports.PagedItem = {}));
3511
- /**
3512
- * Pager class for iterating through paginated results.
3513
- */
3514
- class Pager {
3515
- constructor(name, request, response, params) {
3516
- this.pageInternal = [];
3517
- this.paramsInternal = {};
3518
- this.requestInternal = request;
3519
- this.init(name, response, params);
3520
- }
3521
- init(name, response, params) {
3522
- var _a, _b;
3523
- this.nameInternal = name;
3524
- this.pageInternal = response[this.nameInternal] || [];
3525
- this.idxInternal = 0;
3526
- let requestParams = { config: {} };
3527
- if (!params) {
3528
- requestParams = { config: {} };
3529
- }
3530
- else if (typeof params === 'object') {
3531
- requestParams = Object.assign({}, params);
3532
- }
3533
- else {
3534
- requestParams = params;
3535
- }
3536
- if (requestParams['config']) {
3537
- requestParams['config']['pageToken'] = response['nextPageToken'];
3538
- }
3539
- this.paramsInternal = requestParams;
3540
- this.pageInternalSize =
3541
- (_b = (_a = requestParams['config']) === null || _a === void 0 ? void 0 : _a['pageSize']) !== null && _b !== void 0 ? _b : this.pageInternal.length;
3542
- }
3543
- initNextPage(response) {
3544
- this.init(this.nameInternal, response, this.paramsInternal);
3545
- }
3546
- /**
3547
- * Returns the current page, which is a list of items.
3548
- *
3549
- * @remarks
3550
- * The first page is retrieved when the pager is created. The returned list of
3551
- * items could be a subset of the entire list.
3552
- */
3553
- get page() {
3554
- return this.pageInternal;
3555
- }
3556
- /**
3557
- * Returns the type of paged item (for example, ``batch_jobs``).
3558
- */
3559
- get name() {
3560
- return this.nameInternal;
3561
- }
3562
- /**
3563
- * Returns the length of the page fetched each time by this pager.
3564
- *
3565
- * @remarks
3566
- * The number of items in the page is less than or equal to the page length.
3567
- */
3568
- get pageSize() {
3569
- return this.pageInternalSize;
3570
- }
3571
- /**
3572
- * Returns the parameters when making the API request for the next page.
3573
- *
3574
- * @remarks
3575
- * Parameters contain a set of optional configs that can be
3576
- * used to customize the API request. For example, the `pageToken` parameter
3577
- * contains the token to request the next page.
3578
- */
3579
- get params() {
3580
- return this.paramsInternal;
3581
- }
3582
- /**
3583
- * Returns the total number of items in the current page.
3584
- */
3585
- get pageLength() {
3586
- return this.pageInternal.length;
3587
- }
3588
- /**
3589
- * Returns the item at the given index.
3590
- */
3591
- getItem(index) {
3592
- return this.pageInternal[index];
3593
- }
3594
- /**
3595
- * Returns an async iterator that support iterating through all items
3596
- * retrieved from the API.
3597
- *
3598
- * @remarks
3599
- * The iterator will automatically fetch the next page if there are more items
3600
- * to fetch from the API.
3601
- *
3602
- * @example
3603
- *
3604
- * ```ts
3605
- * const pager = await ai.files.list({config: {pageSize: 10}});
3606
- * for await (const file of pager) {
3607
- * console.log(file.name);
3608
- * }
3609
- * ```
3610
- */
3611
- [Symbol.asyncIterator]() {
3612
- return {
3613
- next: async () => {
3614
- if (this.idxInternal >= this.pageLength) {
3615
- if (this.hasNextPage()) {
3616
- await this.nextPage();
3617
- }
3618
- else {
3619
- return { value: undefined, done: true };
3620
- }
3621
- }
3622
- const item = this.getItem(this.idxInternal);
3623
- this.idxInternal += 1;
3624
- return { value: item, done: false };
3625
- },
3626
- return: async () => {
3627
- return { value: undefined, done: true };
3628
- },
3629
- };
3630
- }
3631
- /**
3632
- * Fetches the next page of items. This makes a new API request.
3633
- *
3634
- * @throws {Error} If there are no more pages to fetch.
3635
- *
3636
- * @example
3637
- *
3638
- * ```ts
3639
- * const pager = await ai.files.list({config: {pageSize: 10}});
3640
- * let page = pager.page;
3641
- * while (true) {
3642
- * for (const file of page) {
3643
- * console.log(file.name);
3644
- * }
3645
- * if (!pager.hasNextPage()) {
3646
- * break;
3647
- * }
3648
- * page = await pager.nextPage();
3649
- * }
3650
- * ```
3651
- */
3652
- async nextPage() {
3653
- if (!this.hasNextPage()) {
3654
- throw new Error('No more pages to fetch.');
3655
- }
3656
- const response = await this.requestInternal(this.params);
3657
- this.initNextPage(response);
3658
- return this.page;
3659
- }
3660
- /**
3661
- * Returns true if there are more pages to fetch from the API.
3662
- */
3663
- hasNextPage() {
3664
- var _a;
3665
- if (((_a = this.params['config']) === null || _a === void 0 ? void 0 : _a['pageToken']) !== undefined) {
3666
- return true;
3667
- }
3668
- return false;
3669
- }
3670
- }
3671
-
3672
5657
  /**
3673
5658
  * @license
3674
5659
  * Copyright 2025 Google LLC
@@ -5568,6 +7553,10 @@ function toolToMldev$2(fromObject) {
5568
7553
  if (fromCodeExecution != null) {
5569
7554
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5570
7555
  }
7556
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7557
+ if (fromComputerUse != null) {
7558
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
7559
+ }
5571
7560
  return toObject;
5572
7561
  }
5573
7562
  function toolToVertex$1(fromObject) {
@@ -5618,6 +7607,10 @@ function toolToVertex$1(fromObject) {
5618
7607
  if (fromCodeExecution != null) {
5619
7608
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5620
7609
  }
7610
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7611
+ if (fromComputerUse != null) {
7612
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
7613
+ }
5621
7614
  return toObject;
5622
7615
  }
5623
7616
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -6113,8 +8106,9 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
6113
8106
  if (fromMedia != null) {
6114
8107
  setValueByPath(toObject, ['mediaChunks'], tBlobs(fromMedia));
6115
8108
  }
6116
- if (getValueByPath(fromObject, ['audio']) !== undefined) {
6117
- throw new Error('audio parameter is not supported in Vertex AI.');
8109
+ const fromAudio = getValueByPath(fromObject, ['audio']);
8110
+ if (fromAudio != null) {
8111
+ setValueByPath(toObject, ['audio'], tAudioBlob(fromAudio));
6118
8112
  }
6119
8113
  const fromAudioStreamEnd = getValueByPath(fromObject, [
6120
8114
  'audioStreamEnd',
@@ -6122,11 +8116,13 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
6122
8116
  if (fromAudioStreamEnd != null) {
6123
8117
  setValueByPath(toObject, ['audioStreamEnd'], fromAudioStreamEnd);
6124
8118
  }
6125
- if (getValueByPath(fromObject, ['video']) !== undefined) {
6126
- throw new Error('video parameter is not supported in Vertex AI.');
8119
+ const fromVideo = getValueByPath(fromObject, ['video']);
8120
+ if (fromVideo != null) {
8121
+ setValueByPath(toObject, ['video'], tImageBlob(fromVideo));
6127
8122
  }
6128
- if (getValueByPath(fromObject, ['text']) !== undefined) {
6129
- throw new Error('text parameter is not supported in Vertex AI.');
8123
+ const fromText = getValueByPath(fromObject, ['text']);
8124
+ if (fromText != null) {
8125
+ setValueByPath(toObject, ['text'], fromText);
6130
8126
  }
6131
8127
  const fromActivityStart = getValueByPath(fromObject, [
6132
8128
  'activityStart',
@@ -6282,8 +8278,12 @@ function liveServerSetupCompleteFromMldev() {
6282
8278
  const toObject = {};
6283
8279
  return toObject;
6284
8280
  }
6285
- function liveServerSetupCompleteFromVertex() {
8281
+ function liveServerSetupCompleteFromVertex(fromObject) {
6286
8282
  const toObject = {};
8283
+ const fromSessionId = getValueByPath(fromObject, ['sessionId']);
8284
+ if (fromSessionId != null) {
8285
+ setValueByPath(toObject, ['sessionId'], fromSessionId);
8286
+ }
6287
8287
  return toObject;
6288
8288
  }
6289
8289
  function videoMetadataFromMldev$1(fromObject) {
@@ -7036,7 +9036,7 @@ function liveServerMessageFromVertex(fromObject) {
7036
9036
  'setupComplete',
7037
9037
  ]);
7038
9038
  if (fromSetupComplete != null) {
7039
- setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex());
9039
+ setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex(fromSetupComplete));
7040
9040
  }
7041
9041
  const fromServerContent = getValueByPath(fromObject, [
7042
9042
  'serverContent',
@@ -7604,6 +9604,10 @@ function toolToMldev$1(fromObject) {
7604
9604
  if (fromCodeExecution != null) {
7605
9605
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7606
9606
  }
9607
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
9608
+ if (fromComputerUse != null) {
9609
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
9610
+ }
7607
9611
  return toObject;
7608
9612
  }
7609
9613
  function functionCallingConfigToMldev(fromObject) {
@@ -7816,6 +9820,12 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
7816
9820
  if (fromResponseSchema != null) {
7817
9821
  setValueByPath(toObject, ['responseSchema'], schemaToMldev(tSchema(fromResponseSchema)));
7818
9822
  }
9823
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
9824
+ 'responseJsonSchema',
9825
+ ]);
9826
+ if (fromResponseJsonSchema != null) {
9827
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9828
+ }
7819
9829
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
7820
9830
  throw new Error('routingConfig parameter is not supported in Gemini API.');
7821
9831
  }
@@ -8230,6 +10240,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
8230
10240
  if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
8231
10241
  throw new Error('lastFrame parameter is not supported in Gemini API.');
8232
10242
  }
10243
+ if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
10244
+ throw new Error('compressionQuality parameter is not supported in Gemini API.');
10245
+ }
8233
10246
  return toObject;
8234
10247
  }
8235
10248
  function generateVideosParametersToMldev(apiClient, fromObject) {
@@ -8684,6 +10697,10 @@ function toolToVertex(fromObject) {
8684
10697
  if (fromCodeExecution != null) {
8685
10698
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8686
10699
  }
10700
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10701
+ if (fromComputerUse != null) {
10702
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
10703
+ }
8687
10704
  return toObject;
8688
10705
  }
8689
10706
  function functionCallingConfigToVertex(fromObject) {
@@ -8865,6 +10882,12 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8865
10882
  if (fromResponseSchema != null) {
8866
10883
  setValueByPath(toObject, ['responseSchema'], schemaToVertex(tSchema(fromResponseSchema)));
8867
10884
  }
10885
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
10886
+ 'responseJsonSchema',
10887
+ ]);
10888
+ if (fromResponseJsonSchema != null) {
10889
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
10890
+ }
8868
10891
  const fromRoutingConfig = getValueByPath(fromObject, [
8869
10892
  'routingConfig',
8870
10893
  ]);
@@ -9353,6 +11376,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
9353
11376
  if (parentObject !== undefined && fromOutputCompressionQuality != null) {
9354
11377
  setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
9355
11378
  }
11379
+ const fromEnhanceInputImage = getValueByPath(fromObject, [
11380
+ 'enhanceInputImage',
11381
+ ]);
11382
+ if (parentObject !== undefined && fromEnhanceInputImage != null) {
11383
+ setValueByPath(parentObject, ['parameters', 'upscaleConfig', 'enhanceInputImage'], fromEnhanceInputImage);
11384
+ }
11385
+ const fromImagePreservationFactor = getValueByPath(fromObject, [
11386
+ 'imagePreservationFactor',
11387
+ ]);
11388
+ if (parentObject !== undefined && fromImagePreservationFactor != null) {
11389
+ setValueByPath(parentObject, ['parameters', 'upscaleConfig', 'imagePreservationFactor'], fromImagePreservationFactor);
11390
+ }
9356
11391
  const fromNumberOfImages = getValueByPath(fromObject, [
9357
11392
  'numberOfImages',
9358
11393
  ]);
@@ -9621,6 +11656,12 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
9621
11656
  if (parentObject !== undefined && fromLastFrame != null) {
9622
11657
  setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
9623
11658
  }
11659
+ const fromCompressionQuality = getValueByPath(fromObject, [
11660
+ 'compressionQuality',
11661
+ ]);
11662
+ if (parentObject !== undefined && fromCompressionQuality != null) {
11663
+ setValueByPath(parentObject, ['parameters', 'compressionQuality'], fromCompressionQuality);
11664
+ }
9624
11665
  return toObject;
9625
11666
  }
9626
11667
  function generateVideosParametersToVertex(apiClient, fromObject) {
@@ -10043,7 +12084,7 @@ function modelFromMldev(fromObject) {
10043
12084
  }
10044
12085
  return toObject;
10045
12086
  }
10046
- function listModelsResponseFromMldev(apiClient, fromObject) {
12087
+ function listModelsResponseFromMldev(fromObject) {
10047
12088
  const toObject = {};
10048
12089
  const fromNextPageToken = getValueByPath(fromObject, [
10049
12090
  'nextPageToken',
@@ -10687,7 +12728,7 @@ function modelFromVertex(fromObject) {
10687
12728
  }
10688
12729
  return toObject;
10689
12730
  }
10690
- function listModelsResponseFromVertex(apiClient, fromObject) {
12731
+ function listModelsResponseFromVertex(fromObject) {
10691
12732
  const toObject = {};
10692
12733
  const fromNextPageToken = getValueByPath(fromObject, [
10693
12734
  'nextPageToken',
@@ -10813,7 +12854,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10813
12854
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10814
12855
  const USER_AGENT_HEADER = 'User-Agent';
10815
12856
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10816
- const SDK_VERSION = '1.6.0'; // x-release-please-version
12857
+ const SDK_VERSION = '1.8.0'; // x-release-please-version
10817
12858
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10818
12859
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10819
12860
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -11812,13 +13853,17 @@ const FUNCTION_RESPONSE_REQUIRES_ID = 'FunctionResponse request must have an `id
11812
13853
  */
11813
13854
  async function handleWebSocketMessage(apiClient, onmessage, event) {
11814
13855
  const serverMessage = new LiveServerMessage();
11815
- let data;
13856
+ let jsonData;
11816
13857
  if (event.data instanceof Blob) {
11817
- data = JSON.parse(await event.data.text());
13858
+ jsonData = await event.data.text();
13859
+ }
13860
+ else if (event.data instanceof ArrayBuffer) {
13861
+ jsonData = new TextDecoder().decode(event.data);
11818
13862
  }
11819
13863
  else {
11820
- data = JSON.parse(event.data);
13864
+ jsonData = event.data;
11821
13865
  }
13866
+ const data = JSON.parse(jsonData);
11822
13867
  if (apiClient.isVertexAI()) {
11823
13868
  const resp = liveServerMessageFromVertex(data);
11824
13869
  Object.assign(serverMessage, resp);
@@ -13143,7 +15188,7 @@ class Models extends BaseModule {
13143
15188
  return httpResponse.json();
13144
15189
  });
13145
15190
  return response.then((apiResponse) => {
13146
- const resp = listModelsResponseFromVertex(this.apiClient, apiResponse);
15191
+ const resp = listModelsResponseFromVertex(apiResponse);
13147
15192
  const typedResp = new ListModelsResponse();
13148
15193
  Object.assign(typedResp, resp);
13149
15194
  return typedResp;
@@ -13169,7 +15214,7 @@ class Models extends BaseModule {
13169
15214
  return httpResponse.json();
13170
15215
  });
13171
15216
  return response.then((apiResponse) => {
13172
- const resp = listModelsResponseFromMldev(this.apiClient, apiResponse);
15217
+ const resp = listModelsResponseFromMldev(apiResponse);
13173
15218
  const typedResp = new ListModelsResponse();
13174
15219
  Object.assign(typedResp, resp);
13175
15220
  return typedResp;
@@ -14179,6 +16224,10 @@ function toolToMldev(fromObject) {
14179
16224
  if (fromCodeExecution != null) {
14180
16225
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
14181
16226
  }
16227
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16228
+ if (fromComputerUse != null) {
16229
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
16230
+ }
14182
16231
  return toObject;
14183
16232
  }
14184
16233
  function sessionResumptionConfigToMldev(fromObject) {
@@ -14943,6 +16992,9 @@ function tuningDatasetToMldev(fromObject) {
14943
16992
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
14944
16993
  throw new Error('gcsUri parameter is not supported in Gemini API.');
14945
16994
  }
16995
+ if (getValueByPath(fromObject, ['vertexDatasetResource']) !== undefined) {
16996
+ throw new Error('vertexDatasetResource parameter is not supported in Gemini API.');
16997
+ }
14946
16998
  const fromExamples = getValueByPath(fromObject, ['examples']);
14947
16999
  if (fromExamples != null) {
14948
17000
  let transformedList = fromExamples;
@@ -15056,17 +17108,29 @@ function tuningDatasetToVertex(fromObject, parentObject) {
15056
17108
  if (parentObject !== undefined && fromGcsUri != null) {
15057
17109
  setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
15058
17110
  }
17111
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
17112
+ 'vertexDatasetResource',
17113
+ ]);
17114
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
17115
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
17116
+ }
15059
17117
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
15060
17118
  throw new Error('examples parameter is not supported in Vertex AI.');
15061
17119
  }
15062
17120
  return toObject;
15063
17121
  }
15064
- function tuningValidationDatasetToVertex(fromObject) {
17122
+ function tuningValidationDatasetToVertex(fromObject, parentObject) {
15065
17123
  const toObject = {};
15066
17124
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
15067
17125
  if (fromGcsUri != null) {
15068
17126
  setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
15069
17127
  }
17128
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
17129
+ 'vertexDatasetResource',
17130
+ ]);
17131
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
17132
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
17133
+ }
15070
17134
  return toObject;
15071
17135
  }
15072
17136
  function createTuningJobConfigToVertex(fromObject, parentObject) {
@@ -15075,7 +17139,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
15075
17139
  'validationDataset',
15076
17140
  ]);
15077
17141
  if (parentObject !== undefined && fromValidationDataset != null) {
15078
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
17142
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset, toObject));
15079
17143
  }
15080
17144
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
15081
17145
  'tunedModelDisplayName',
@@ -15207,6 +17271,14 @@ function tuningJobFromMldev(fromObject) {
15207
17271
  if (fromPipelineJob != null) {
15208
17272
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
15209
17273
  }
17274
+ const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17275
+ if (fromSatisfiesPzi != null) {
17276
+ setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17277
+ }
17278
+ const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17279
+ if (fromSatisfiesPzs != null) {
17280
+ setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17281
+ }
15210
17282
  const fromServiceAccount = getValueByPath(fromObject, [
15211
17283
  'serviceAccount',
15212
17284
  ]);
@@ -15387,6 +17459,14 @@ function tuningJobFromVertex(fromObject) {
15387
17459
  if (fromPipelineJob != null) {
15388
17460
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
15389
17461
  }
17462
+ const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17463
+ if (fromSatisfiesPzi != null) {
17464
+ setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17465
+ }
17466
+ const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17467
+ if (fromSatisfiesPzs != null) {
17468
+ setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17469
+ }
15390
17470
  const fromServiceAccount = getValueByPath(fromObject, [
15391
17471
  'serviceAccount',
15392
17472
  ]);
@@ -16042,6 +18122,7 @@ class GoogleGenAI {
16042
18122
  });
16043
18123
  this.models = new Models(this.apiClient);
16044
18124
  this.live = new Live(this.apiClient, auth, new NodeWebSocketFactory());
18125
+ this.batches = new Batches(this.apiClient);
16045
18126
  this.chats = new Chats(this.models, this.apiClient);
16046
18127
  this.caches = new Caches(this.apiClient);
16047
18128
  this.files = new Files(this.apiClient);
@@ -16073,6 +18154,7 @@ function getApiKeyFromEnv() {
16073
18154
  }
16074
18155
 
16075
18156
  exports.ApiError = ApiError;
18157
+ exports.Batches = Batches;
16076
18158
  exports.Caches = Caches;
16077
18159
  exports.Chat = Chat;
16078
18160
  exports.Chats = Chats;
@@ -16094,6 +18176,8 @@ exports.GenerateImagesResponse = GenerateImagesResponse;
16094
18176
  exports.GenerateVideosResponse = GenerateVideosResponse;
16095
18177
  exports.GoogleGenAI = GoogleGenAI;
16096
18178
  exports.HttpResponse = HttpResponse;
18179
+ exports.InlinedResponse = InlinedResponse;
18180
+ exports.ListBatchJobsResponse = ListBatchJobsResponse;
16097
18181
  exports.ListCachedContentsResponse = ListCachedContentsResponse;
16098
18182
  exports.ListFilesResponse = ListFilesResponse;
16099
18183
  exports.ListModelsResponse = ListModelsResponse;