@google/genai 1.1.0 → 1.3.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.
@@ -219,7 +219,6 @@ function getValueByPath(data, keys) {
219
219
  * Copyright 2025 Google LLC
220
220
  * SPDX-License-Identifier: Apache-2.0
221
221
  */
222
- // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
223
222
  /** Required. Outcome of the code execution. */
224
223
  exports.Outcome = void 0;
225
224
  (function (Outcome) {
@@ -455,6 +454,10 @@ exports.FinishReason = void 0;
455
454
  * Token generation stopped because generated images have safety violations.
456
455
  */
457
456
  FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
457
+ /**
458
+ * The tool call generated by the model is invalid.
459
+ */
460
+ FinishReason["UNEXPECTED_TOOL_CALL"] = "UNEXPECTED_TOOL_CALL";
458
461
  })(exports.FinishReason || (exports.FinishReason = {}));
459
462
  /** Output only. Harm probability levels in the content. */
460
463
  exports.HarmProbability = void 0;
@@ -560,7 +563,7 @@ exports.Modality = void 0;
560
563
  */
561
564
  Modality["IMAGE"] = "IMAGE";
562
565
  /**
563
- * Indicates the model should return images.
566
+ * Indicates the model should return audio.
564
567
  */
565
568
  Modality["AUDIO"] = "AUDIO";
566
569
  })(exports.Modality || (exports.Modality = {}));
@@ -984,24 +987,6 @@ exports.Scale = void 0;
984
987
  */
985
988
  Scale["B_MAJOR_A_FLAT_MINOR"] = "B_MAJOR_A_FLAT_MINOR";
986
989
  })(exports.Scale || (exports.Scale = {}));
987
- /** The mode of music generation. */
988
- exports.MusicGenerationMode = void 0;
989
- (function (MusicGenerationMode) {
990
- /**
991
- * This value is unused.
992
- */
993
- MusicGenerationMode["MUSIC_GENERATION_MODE_UNSPECIFIED"] = "MUSIC_GENERATION_MODE_UNSPECIFIED";
994
- /**
995
- * Steer text prompts to regions of latent space with higher quality
996
- music.
997
- */
998
- MusicGenerationMode["QUALITY"] = "QUALITY";
999
- /**
1000
- * Steer text prompts to regions of latent space with a larger diversity
1001
- of music.
1002
- */
1003
- MusicGenerationMode["DIVERSITY"] = "DIVERSITY";
1004
- })(exports.MusicGenerationMode || (exports.MusicGenerationMode = {}));
1005
990
  /** The playback control signal to apply to the music generation. */
1006
991
  exports.LiveMusicPlaybackControl = void 0;
1007
992
  (function (LiveMusicPlaybackControl) {
@@ -1466,7 +1451,6 @@ class ReplayResponse {
1466
1451
  */
1467
1452
  class RawReferenceImage {
1468
1453
  /** Internal method to convert to ReferenceImageAPIInternal. */
1469
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1470
1454
  toReferenceImageAPI() {
1471
1455
  const referenceImageAPI = {
1472
1456
  referenceType: 'REFERENCE_TYPE_RAW',
@@ -1488,7 +1472,6 @@ class RawReferenceImage {
1488
1472
  */
1489
1473
  class MaskReferenceImage {
1490
1474
  /** Internal method to convert to ReferenceImageAPIInternal. */
1491
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1492
1475
  toReferenceImageAPI() {
1493
1476
  const referenceImageAPI = {
1494
1477
  referenceType: 'REFERENCE_TYPE_MASK',
@@ -1511,7 +1494,6 @@ class MaskReferenceImage {
1511
1494
  */
1512
1495
  class ControlReferenceImage {
1513
1496
  /** Internal method to convert to ReferenceImageAPIInternal. */
1514
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1515
1497
  toReferenceImageAPI() {
1516
1498
  const referenceImageAPI = {
1517
1499
  referenceType: 'REFERENCE_TYPE_CONTROL',
@@ -1532,7 +1514,6 @@ class ControlReferenceImage {
1532
1514
  */
1533
1515
  class StyleReferenceImage {
1534
1516
  /** Internal method to convert to ReferenceImageAPIInternal. */
1535
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1536
1517
  toReferenceImageAPI() {
1537
1518
  const referenceImageAPI = {
1538
1519
  referenceType: 'REFERENCE_TYPE_STYLE',
@@ -1553,7 +1534,6 @@ class StyleReferenceImage {
1553
1534
  */
1554
1535
  class SubjectReferenceImage {
1555
1536
  /* Internal method to convert to ReferenceImageAPIInternal. */
1556
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1557
1537
  toReferenceImageAPI() {
1558
1538
  const referenceImageAPI = {
1559
1539
  referenceType: 'REFERENCE_TYPE_SUBJECT',
@@ -2468,7 +2448,7 @@ function filterToJsonSchema(schema) {
2468
2448
  * Copyright 2025 Google LLC
2469
2449
  * SPDX-License-Identifier: Apache-2.0
2470
2450
  */
2471
- function videoMetadataToMldev$2(apiClient, fromObject) {
2451
+ function videoMetadataToMldev$3(apiClient, fromObject) {
2472
2452
  const toObject = {};
2473
2453
  const fromFps = getValueByPath(fromObject, ['fps']);
2474
2454
  if (fromFps != null) {
@@ -2484,7 +2464,7 @@ function videoMetadataToMldev$2(apiClient, fromObject) {
2484
2464
  }
2485
2465
  return toObject;
2486
2466
  }
2487
- function blobToMldev$2(apiClient, fromObject) {
2467
+ function blobToMldev$3(apiClient, fromObject) {
2488
2468
  const toObject = {};
2489
2469
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2490
2470
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -2499,7 +2479,7 @@ function blobToMldev$2(apiClient, fromObject) {
2499
2479
  }
2500
2480
  return toObject;
2501
2481
  }
2502
- function fileDataToMldev$2(apiClient, fromObject) {
2482
+ function fileDataToMldev$3(apiClient, fromObject) {
2503
2483
  const toObject = {};
2504
2484
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
2505
2485
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -2514,13 +2494,13 @@ function fileDataToMldev$2(apiClient, fromObject) {
2514
2494
  }
2515
2495
  return toObject;
2516
2496
  }
2517
- function partToMldev$2(apiClient, fromObject) {
2497
+ function partToMldev$3(apiClient, fromObject) {
2518
2498
  const toObject = {};
2519
2499
  const fromVideoMetadata = getValueByPath(fromObject, [
2520
2500
  'videoMetadata',
2521
2501
  ]);
2522
2502
  if (fromVideoMetadata != null) {
2523
- setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$2(apiClient, fromVideoMetadata));
2503
+ setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$3(apiClient, fromVideoMetadata));
2524
2504
  }
2525
2505
  const fromThought = getValueByPath(fromObject, ['thought']);
2526
2506
  if (fromThought != null) {
@@ -2528,11 +2508,17 @@ function partToMldev$2(apiClient, fromObject) {
2528
2508
  }
2529
2509
  const fromInlineData = getValueByPath(fromObject, ['inlineData']);
2530
2510
  if (fromInlineData != null) {
2531
- setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
2511
+ setValueByPath(toObject, ['inlineData'], blobToMldev$3(apiClient, fromInlineData));
2532
2512
  }
2533
2513
  const fromFileData = getValueByPath(fromObject, ['fileData']);
2534
2514
  if (fromFileData != null) {
2535
- setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
2515
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$3(apiClient, fromFileData));
2516
+ }
2517
+ const fromThoughtSignature = getValueByPath(fromObject, [
2518
+ 'thoughtSignature',
2519
+ ]);
2520
+ if (fromThoughtSignature != null) {
2521
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
2536
2522
  }
2537
2523
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2538
2524
  'codeExecutionResult',
@@ -2562,14 +2548,14 @@ function partToMldev$2(apiClient, fromObject) {
2562
2548
  }
2563
2549
  return toObject;
2564
2550
  }
2565
- function contentToMldev$2(apiClient, fromObject) {
2551
+ function contentToMldev$3(apiClient, fromObject) {
2566
2552
  const toObject = {};
2567
2553
  const fromParts = getValueByPath(fromObject, ['parts']);
2568
2554
  if (fromParts != null) {
2569
2555
  let transformedList = fromParts;
2570
2556
  if (Array.isArray(transformedList)) {
2571
2557
  transformedList = transformedList.map((item) => {
2572
- return partToMldev$2(apiClient, item);
2558
+ return partToMldev$3(apiClient, item);
2573
2559
  });
2574
2560
  }
2575
2561
  setValueByPath(toObject, ['parts'], transformedList);
@@ -2580,7 +2566,7 @@ function contentToMldev$2(apiClient, fromObject) {
2580
2566
  }
2581
2567
  return toObject;
2582
2568
  }
2583
- function functionDeclarationToMldev$2(apiClient, fromObject) {
2569
+ function functionDeclarationToMldev$3(apiClient, fromObject) {
2584
2570
  const toObject = {};
2585
2571
  const fromBehavior = getValueByPath(fromObject, ['behavior']);
2586
2572
  if (fromBehavior != null) {
@@ -2604,7 +2590,7 @@ function functionDeclarationToMldev$2(apiClient, fromObject) {
2604
2590
  }
2605
2591
  return toObject;
2606
2592
  }
2607
- function intervalToMldev$2(apiClient, fromObject) {
2593
+ function intervalToMldev$3(apiClient, fromObject) {
2608
2594
  const toObject = {};
2609
2595
  const fromStartTime = getValueByPath(fromObject, ['startTime']);
2610
2596
  if (fromStartTime != null) {
@@ -2616,17 +2602,17 @@ function intervalToMldev$2(apiClient, fromObject) {
2616
2602
  }
2617
2603
  return toObject;
2618
2604
  }
2619
- function googleSearchToMldev$2(apiClient, fromObject) {
2605
+ function googleSearchToMldev$3(apiClient, fromObject) {
2620
2606
  const toObject = {};
2621
2607
  const fromTimeRangeFilter = getValueByPath(fromObject, [
2622
2608
  'timeRangeFilter',
2623
2609
  ]);
2624
2610
  if (fromTimeRangeFilter != null) {
2625
- setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(apiClient, fromTimeRangeFilter));
2611
+ setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(apiClient, fromTimeRangeFilter));
2626
2612
  }
2627
2613
  return toObject;
2628
2614
  }
2629
- function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
2615
+ function dynamicRetrievalConfigToMldev$3(apiClient, fromObject) {
2630
2616
  const toObject = {};
2631
2617
  const fromMode = getValueByPath(fromObject, ['mode']);
2632
2618
  if (fromMode != null) {
@@ -2640,21 +2626,21 @@ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
2640
2626
  }
2641
2627
  return toObject;
2642
2628
  }
2643
- function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
2629
+ function googleSearchRetrievalToMldev$3(apiClient, fromObject) {
2644
2630
  const toObject = {};
2645
2631
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
2646
2632
  'dynamicRetrievalConfig',
2647
2633
  ]);
2648
2634
  if (fromDynamicRetrievalConfig != null) {
2649
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
2635
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$3(apiClient, fromDynamicRetrievalConfig));
2650
2636
  }
2651
2637
  return toObject;
2652
2638
  }
2653
- function urlContextToMldev$2() {
2639
+ function urlContextToMldev$3() {
2654
2640
  const toObject = {};
2655
2641
  return toObject;
2656
2642
  }
2657
- function toolToMldev$2(apiClient, fromObject) {
2643
+ function toolToMldev$3(apiClient, fromObject) {
2658
2644
  const toObject = {};
2659
2645
  const fromFunctionDeclarations = getValueByPath(fromObject, [
2660
2646
  'functionDeclarations',
@@ -2663,7 +2649,7 @@ function toolToMldev$2(apiClient, fromObject) {
2663
2649
  let transformedList = fromFunctionDeclarations;
2664
2650
  if (Array.isArray(transformedList)) {
2665
2651
  transformedList = transformedList.map((item) => {
2666
- return functionDeclarationToMldev$2(apiClient, item);
2652
+ return functionDeclarationToMldev$3(apiClient, item);
2667
2653
  });
2668
2654
  }
2669
2655
  setValueByPath(toObject, ['functionDeclarations'], transformedList);
@@ -2673,13 +2659,13 @@ function toolToMldev$2(apiClient, fromObject) {
2673
2659
  }
2674
2660
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
2675
2661
  if (fromGoogleSearch != null) {
2676
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(apiClient, fromGoogleSearch));
2662
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(apiClient, fromGoogleSearch));
2677
2663
  }
2678
2664
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
2679
2665
  'googleSearchRetrieval',
2680
2666
  ]);
2681
2667
  if (fromGoogleSearchRetrieval != null) {
2682
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
2668
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$3(apiClient, fromGoogleSearchRetrieval));
2683
2669
  }
2684
2670
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
2685
2671
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
@@ -2689,7 +2675,7 @@ function toolToMldev$2(apiClient, fromObject) {
2689
2675
  }
2690
2676
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
2691
2677
  if (fromUrlContext != null) {
2692
- setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
2678
+ setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
2693
2679
  }
2694
2680
  const fromCodeExecution = getValueByPath(fromObject, [
2695
2681
  'codeExecution',
@@ -2772,7 +2758,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
2772
2758
  let transformedList = tContents(apiClient, fromContents);
2773
2759
  if (Array.isArray(transformedList)) {
2774
2760
  transformedList = transformedList.map((item) => {
2775
- return contentToMldev$2(apiClient, item);
2761
+ return contentToMldev$3(apiClient, item);
2776
2762
  });
2777
2763
  }
2778
2764
  setValueByPath(parentObject, ['contents'], transformedList);
@@ -2781,14 +2767,14 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
2781
2767
  'systemInstruction',
2782
2768
  ]);
2783
2769
  if (parentObject !== undefined && fromSystemInstruction != null) {
2784
- setValueByPath(parentObject, ['systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
2770
+ setValueByPath(parentObject, ['systemInstruction'], contentToMldev$3(apiClient, tContent(apiClient, fromSystemInstruction)));
2785
2771
  }
2786
2772
  const fromTools = getValueByPath(fromObject, ['tools']);
2787
2773
  if (parentObject !== undefined && fromTools != null) {
2788
2774
  let transformedList = fromTools;
2789
2775
  if (Array.isArray(transformedList)) {
2790
2776
  transformedList = transformedList.map((item) => {
2791
- return toolToMldev$2(apiClient, item);
2777
+ return toolToMldev$3(apiClient, item);
2792
2778
  });
2793
2779
  }
2794
2780
  setValueByPath(parentObject, ['tools'], transformedList);
@@ -2950,6 +2936,12 @@ function partToVertex$2(apiClient, fromObject) {
2950
2936
  if (fromFileData != null) {
2951
2937
  setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
2952
2938
  }
2939
+ const fromThoughtSignature = getValueByPath(fromObject, [
2940
+ 'thoughtSignature',
2941
+ ]);
2942
+ if (fromThoughtSignature != null) {
2943
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
2944
+ }
2953
2945
  const fromCodeExecutionResult = getValueByPath(fromObject, [
2954
2946
  'codeExecutionResult',
2955
2947
  ]);
@@ -4928,7 +4920,7 @@ class Files extends BaseModule {
4928
4920
  * Copyright 2025 Google LLC
4929
4921
  * SPDX-License-Identifier: Apache-2.0
4930
4922
  */
4931
- function prebuiltVoiceConfigToMldev$1(apiClient, fromObject) {
4923
+ function prebuiltVoiceConfigToMldev$2(apiClient, fromObject) {
4932
4924
  const toObject = {};
4933
4925
  const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
4934
4926
  if (fromVoiceName != null) {
@@ -4944,13 +4936,13 @@ function prebuiltVoiceConfigToVertex$1(apiClient, fromObject) {
4944
4936
  }
4945
4937
  return toObject;
4946
4938
  }
4947
- function voiceConfigToMldev$1(apiClient, fromObject) {
4939
+ function voiceConfigToMldev$2(apiClient, fromObject) {
4948
4940
  const toObject = {};
4949
4941
  const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
4950
4942
  'prebuiltVoiceConfig',
4951
4943
  ]);
4952
4944
  if (fromPrebuiltVoiceConfig != null) {
4953
- setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$1(apiClient, fromPrebuiltVoiceConfig));
4945
+ setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$2(apiClient, fromPrebuiltVoiceConfig));
4954
4946
  }
4955
4947
  return toObject;
4956
4948
  }
@@ -4964,7 +4956,7 @@ function voiceConfigToVertex$1(apiClient, fromObject) {
4964
4956
  }
4965
4957
  return toObject;
4966
4958
  }
4967
- function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
4959
+ function speakerVoiceConfigToMldev$2(apiClient, fromObject) {
4968
4960
  const toObject = {};
4969
4961
  const fromSpeaker = getValueByPath(fromObject, ['speaker']);
4970
4962
  if (fromSpeaker != null) {
@@ -4972,11 +4964,11 @@ function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
4972
4964
  }
4973
4965
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
4974
4966
  if (fromVoiceConfig != null) {
4975
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
4967
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
4976
4968
  }
4977
4969
  return toObject;
4978
4970
  }
4979
- function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
4971
+ function multiSpeakerVoiceConfigToMldev$2(apiClient, fromObject) {
4980
4972
  const toObject = {};
4981
4973
  const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
4982
4974
  'speakerVoiceConfigs',
@@ -4985,24 +4977,24 @@ function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
4985
4977
  let transformedList = fromSpeakerVoiceConfigs;
4986
4978
  if (Array.isArray(transformedList)) {
4987
4979
  transformedList = transformedList.map((item) => {
4988
- return speakerVoiceConfigToMldev$1(apiClient, item);
4980
+ return speakerVoiceConfigToMldev$2(apiClient, item);
4989
4981
  });
4990
4982
  }
4991
4983
  setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
4992
4984
  }
4993
4985
  return toObject;
4994
4986
  }
4995
- function speechConfigToMldev$1(apiClient, fromObject) {
4987
+ function speechConfigToMldev$2(apiClient, fromObject) {
4996
4988
  const toObject = {};
4997
4989
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
4998
4990
  if (fromVoiceConfig != null) {
4999
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
4991
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
5000
4992
  }
5001
4993
  const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
5002
4994
  'multiSpeakerVoiceConfig',
5003
4995
  ]);
5004
4996
  if (fromMultiSpeakerVoiceConfig != null) {
5005
- setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$1(apiClient, fromMultiSpeakerVoiceConfig));
4997
+ setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$2(apiClient, fromMultiSpeakerVoiceConfig));
5006
4998
  }
5007
4999
  const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
5008
5000
  if (fromLanguageCode != null) {
@@ -5025,7 +5017,7 @@ function speechConfigToVertex$1(apiClient, fromObject) {
5025
5017
  }
5026
5018
  return toObject;
5027
5019
  }
5028
- function videoMetadataToMldev$1(apiClient, fromObject) {
5020
+ function videoMetadataToMldev$2(apiClient, fromObject) {
5029
5021
  const toObject = {};
5030
5022
  const fromFps = getValueByPath(fromObject, ['fps']);
5031
5023
  if (fromFps != null) {
@@ -5057,7 +5049,7 @@ function videoMetadataToVertex$1(apiClient, fromObject) {
5057
5049
  }
5058
5050
  return toObject;
5059
5051
  }
5060
- function blobToMldev$1(apiClient, fromObject) {
5052
+ function blobToMldev$2(apiClient, fromObject) {
5061
5053
  const toObject = {};
5062
5054
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
5063
5055
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -5088,7 +5080,7 @@ function blobToVertex$1(apiClient, fromObject) {
5088
5080
  }
5089
5081
  return toObject;
5090
5082
  }
5091
- function fileDataToMldev$1(apiClient, fromObject) {
5083
+ function fileDataToMldev$2(apiClient, fromObject) {
5092
5084
  const toObject = {};
5093
5085
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
5094
5086
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -5119,13 +5111,13 @@ function fileDataToVertex$1(apiClient, fromObject) {
5119
5111
  }
5120
5112
  return toObject;
5121
5113
  }
5122
- function partToMldev$1(apiClient, fromObject) {
5114
+ function partToMldev$2(apiClient, fromObject) {
5123
5115
  const toObject = {};
5124
5116
  const fromVideoMetadata = getValueByPath(fromObject, [
5125
5117
  'videoMetadata',
5126
5118
  ]);
5127
5119
  if (fromVideoMetadata != null) {
5128
- setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$1(apiClient, fromVideoMetadata));
5120
+ setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$2(apiClient, fromVideoMetadata));
5129
5121
  }
5130
5122
  const fromThought = getValueByPath(fromObject, ['thought']);
5131
5123
  if (fromThought != null) {
@@ -5133,11 +5125,17 @@ function partToMldev$1(apiClient, fromObject) {
5133
5125
  }
5134
5126
  const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5135
5127
  if (fromInlineData != null) {
5136
- setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
5128
+ setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
5137
5129
  }
5138
5130
  const fromFileData = getValueByPath(fromObject, ['fileData']);
5139
5131
  if (fromFileData != null) {
5140
- setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
5132
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
5133
+ }
5134
+ const fromThoughtSignature = getValueByPath(fromObject, [
5135
+ 'thoughtSignature',
5136
+ ]);
5137
+ if (fromThoughtSignature != null) {
5138
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5141
5139
  }
5142
5140
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5143
5141
  'codeExecutionResult',
@@ -5187,6 +5185,12 @@ function partToVertex$1(apiClient, fromObject) {
5187
5185
  if (fromFileData != null) {
5188
5186
  setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
5189
5187
  }
5188
+ const fromThoughtSignature = getValueByPath(fromObject, [
5189
+ 'thoughtSignature',
5190
+ ]);
5191
+ if (fromThoughtSignature != null) {
5192
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5193
+ }
5190
5194
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5191
5195
  'codeExecutionResult',
5192
5196
  ]);
@@ -5215,14 +5219,14 @@ function partToVertex$1(apiClient, fromObject) {
5215
5219
  }
5216
5220
  return toObject;
5217
5221
  }
5218
- function contentToMldev$1(apiClient, fromObject) {
5222
+ function contentToMldev$2(apiClient, fromObject) {
5219
5223
  const toObject = {};
5220
5224
  const fromParts = getValueByPath(fromObject, ['parts']);
5221
5225
  if (fromParts != null) {
5222
5226
  let transformedList = fromParts;
5223
5227
  if (Array.isArray(transformedList)) {
5224
5228
  transformedList = transformedList.map((item) => {
5225
- return partToMldev$1(apiClient, item);
5229
+ return partToMldev$2(apiClient, item);
5226
5230
  });
5227
5231
  }
5228
5232
  setValueByPath(toObject, ['parts'], transformedList);
@@ -5251,7 +5255,7 @@ function contentToVertex$1(apiClient, fromObject) {
5251
5255
  }
5252
5256
  return toObject;
5253
5257
  }
5254
- function functionDeclarationToMldev$1(apiClient, fromObject) {
5258
+ function functionDeclarationToMldev$2(apiClient, fromObject) {
5255
5259
  const toObject = {};
5256
5260
  const fromBehavior = getValueByPath(fromObject, ['behavior']);
5257
5261
  if (fromBehavior != null) {
@@ -5298,7 +5302,7 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
5298
5302
  }
5299
5303
  return toObject;
5300
5304
  }
5301
- function intervalToMldev$1(apiClient, fromObject) {
5305
+ function intervalToMldev$2(apiClient, fromObject) {
5302
5306
  const toObject = {};
5303
5307
  const fromStartTime = getValueByPath(fromObject, ['startTime']);
5304
5308
  if (fromStartTime != null) {
@@ -5322,13 +5326,13 @@ function intervalToVertex$1(apiClient, fromObject) {
5322
5326
  }
5323
5327
  return toObject;
5324
5328
  }
5325
- function googleSearchToMldev$1(apiClient, fromObject) {
5329
+ function googleSearchToMldev$2(apiClient, fromObject) {
5326
5330
  const toObject = {};
5327
5331
  const fromTimeRangeFilter = getValueByPath(fromObject, [
5328
5332
  'timeRangeFilter',
5329
5333
  ]);
5330
5334
  if (fromTimeRangeFilter != null) {
5331
- setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(apiClient, fromTimeRangeFilter));
5335
+ setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(apiClient, fromTimeRangeFilter));
5332
5336
  }
5333
5337
  return toObject;
5334
5338
  }
@@ -5342,7 +5346,7 @@ function googleSearchToVertex$1(apiClient, fromObject) {
5342
5346
  }
5343
5347
  return toObject;
5344
5348
  }
5345
- function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
5349
+ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
5346
5350
  const toObject = {};
5347
5351
  const fromMode = getValueByPath(fromObject, ['mode']);
5348
5352
  if (fromMode != null) {
@@ -5370,13 +5374,13 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
5370
5374
  }
5371
5375
  return toObject;
5372
5376
  }
5373
- function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
5377
+ function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
5374
5378
  const toObject = {};
5375
5379
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
5376
5380
  'dynamicRetrievalConfig',
5377
5381
  ]);
5378
5382
  if (fromDynamicRetrievalConfig != null) {
5379
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
5383
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
5380
5384
  }
5381
5385
  return toObject;
5382
5386
  }
@@ -5442,11 +5446,11 @@ function googleMapsToVertex$1(apiClient, fromObject) {
5442
5446
  }
5443
5447
  return toObject;
5444
5448
  }
5445
- function urlContextToMldev$1() {
5449
+ function urlContextToMldev$2() {
5446
5450
  const toObject = {};
5447
5451
  return toObject;
5448
5452
  }
5449
- function toolToMldev$1(apiClient, fromObject) {
5453
+ function toolToMldev$2(apiClient, fromObject) {
5450
5454
  const toObject = {};
5451
5455
  const fromFunctionDeclarations = getValueByPath(fromObject, [
5452
5456
  'functionDeclarations',
@@ -5455,7 +5459,7 @@ function toolToMldev$1(apiClient, fromObject) {
5455
5459
  let transformedList = fromFunctionDeclarations;
5456
5460
  if (Array.isArray(transformedList)) {
5457
5461
  transformedList = transformedList.map((item) => {
5458
- return functionDeclarationToMldev$1(apiClient, item);
5462
+ return functionDeclarationToMldev$2(apiClient, item);
5459
5463
  });
5460
5464
  }
5461
5465
  setValueByPath(toObject, ['functionDeclarations'], transformedList);
@@ -5465,13 +5469,13 @@ function toolToMldev$1(apiClient, fromObject) {
5465
5469
  }
5466
5470
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5467
5471
  if (fromGoogleSearch != null) {
5468
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(apiClient, fromGoogleSearch));
5472
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(apiClient, fromGoogleSearch));
5469
5473
  }
5470
5474
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5471
5475
  'googleSearchRetrieval',
5472
5476
  ]);
5473
5477
  if (fromGoogleSearchRetrieval != null) {
5474
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
5478
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
5475
5479
  }
5476
5480
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5477
5481
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
@@ -5481,7 +5485,7 @@ function toolToMldev$1(apiClient, fromObject) {
5481
5485
  }
5482
5486
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5483
5487
  if (fromUrlContext != null) {
5484
- setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
5488
+ setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
5485
5489
  }
5486
5490
  const fromCodeExecution = getValueByPath(fromObject, [
5487
5491
  'codeExecution',
@@ -5540,7 +5544,7 @@ function toolToVertex$1(apiClient, fromObject) {
5540
5544
  }
5541
5545
  return toObject;
5542
5546
  }
5543
- function sessionResumptionConfigToMldev(apiClient, fromObject) {
5547
+ function sessionResumptionConfigToMldev$1(apiClient, fromObject) {
5544
5548
  const toObject = {};
5545
5549
  const fromHandle = getValueByPath(fromObject, ['handle']);
5546
5550
  if (fromHandle != null) {
@@ -5563,7 +5567,7 @@ function sessionResumptionConfigToVertex(apiClient, fromObject) {
5563
5567
  }
5564
5568
  return toObject;
5565
5569
  }
5566
- function audioTranscriptionConfigToMldev() {
5570
+ function audioTranscriptionConfigToMldev$1() {
5567
5571
  const toObject = {};
5568
5572
  return toObject;
5569
5573
  }
@@ -5571,7 +5575,7 @@ function audioTranscriptionConfigToVertex() {
5571
5575
  const toObject = {};
5572
5576
  return toObject;
5573
5577
  }
5574
- function automaticActivityDetectionToMldev(apiClient, fromObject) {
5578
+ function automaticActivityDetectionToMldev$1(apiClient, fromObject) {
5575
5579
  const toObject = {};
5576
5580
  const fromDisabled = getValueByPath(fromObject, ['disabled']);
5577
5581
  if (fromDisabled != null) {
@@ -5635,13 +5639,13 @@ function automaticActivityDetectionToVertex(apiClient, fromObject) {
5635
5639
  }
5636
5640
  return toObject;
5637
5641
  }
5638
- function realtimeInputConfigToMldev(apiClient, fromObject) {
5642
+ function realtimeInputConfigToMldev$1(apiClient, fromObject) {
5639
5643
  const toObject = {};
5640
5644
  const fromAutomaticActivityDetection = getValueByPath(fromObject, [
5641
5645
  'automaticActivityDetection',
5642
5646
  ]);
5643
5647
  if (fromAutomaticActivityDetection != null) {
5644
- setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
5648
+ setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev$1(apiClient, fromAutomaticActivityDetection));
5645
5649
  }
5646
5650
  const fromActivityHandling = getValueByPath(fromObject, [
5647
5651
  'activityHandling',
@@ -5675,7 +5679,7 @@ function realtimeInputConfigToVertex(apiClient, fromObject) {
5675
5679
  }
5676
5680
  return toObject;
5677
5681
  }
5678
- function slidingWindowToMldev(apiClient, fromObject) {
5682
+ function slidingWindowToMldev$1(apiClient, fromObject) {
5679
5683
  const toObject = {};
5680
5684
  const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
5681
5685
  if (fromTargetTokens != null) {
@@ -5691,7 +5695,7 @@ function slidingWindowToVertex(apiClient, fromObject) {
5691
5695
  }
5692
5696
  return toObject;
5693
5697
  }
5694
- function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
5698
+ function contextWindowCompressionConfigToMldev$1(apiClient, fromObject) {
5695
5699
  const toObject = {};
5696
5700
  const fromTriggerTokens = getValueByPath(fromObject, [
5697
5701
  'triggerTokens',
@@ -5703,7 +5707,7 @@ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
5703
5707
  'slidingWindow',
5704
5708
  ]);
5705
5709
  if (fromSlidingWindow != null) {
5706
- setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
5710
+ setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev$1(apiClient, fromSlidingWindow));
5707
5711
  }
5708
5712
  return toObject;
5709
5713
  }
@@ -5723,7 +5727,7 @@ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
5723
5727
  }
5724
5728
  return toObject;
5725
5729
  }
5726
- function proactivityConfigToMldev(apiClient, fromObject) {
5730
+ function proactivityConfigToMldev$1(apiClient, fromObject) {
5727
5731
  const toObject = {};
5728
5732
  const fromProactiveAudio = getValueByPath(fromObject, [
5729
5733
  'proactiveAudio',
@@ -5743,7 +5747,7 @@ function proactivityConfigToVertex(apiClient, fromObject) {
5743
5747
  }
5744
5748
  return toObject;
5745
5749
  }
5746
- function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
5750
+ function liveConnectConfigToMldev$1(apiClient, fromObject, parentObject) {
5747
5751
  const toObject = {};
5748
5752
  const fromGenerationConfig = getValueByPath(fromObject, [
5749
5753
  'generationConfig',
@@ -5787,7 +5791,7 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
5787
5791
  }
5788
5792
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
5789
5793
  if (parentObject !== undefined && fromSpeechConfig != null) {
5790
- setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$1(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
5794
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$2(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
5791
5795
  }
5792
5796
  const fromEnableAffectiveDialog = getValueByPath(fromObject, [
5793
5797
  'enableAffectiveDialog',
@@ -5799,14 +5803,14 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
5799
5803
  'systemInstruction',
5800
5804
  ]);
5801
5805
  if (parentObject !== undefined && fromSystemInstruction != null) {
5802
- setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
5806
+ setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
5803
5807
  }
5804
5808
  const fromTools = getValueByPath(fromObject, ['tools']);
5805
5809
  if (parentObject !== undefined && fromTools != null) {
5806
5810
  let transformedList = tTools(apiClient, fromTools);
5807
5811
  if (Array.isArray(transformedList)) {
5808
5812
  transformedList = transformedList.map((item) => {
5809
- return toolToMldev$1(apiClient, tTool(apiClient, item));
5813
+ return toolToMldev$2(apiClient, tTool(apiClient, item));
5810
5814
  });
5811
5815
  }
5812
5816
  setValueByPath(parentObject, ['setup', 'tools'], transformedList);
@@ -5815,35 +5819,35 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
5815
5819
  'sessionResumption',
5816
5820
  ]);
5817
5821
  if (parentObject !== undefined && fromSessionResumption != null) {
5818
- setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
5822
+ setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev$1(apiClient, fromSessionResumption));
5819
5823
  }
5820
5824
  const fromInputAudioTranscription = getValueByPath(fromObject, [
5821
5825
  'inputAudioTranscription',
5822
5826
  ]);
5823
5827
  if (parentObject !== undefined && fromInputAudioTranscription != null) {
5824
- setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
5828
+ setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1());
5825
5829
  }
5826
5830
  const fromOutputAudioTranscription = getValueByPath(fromObject, [
5827
5831
  'outputAudioTranscription',
5828
5832
  ]);
5829
5833
  if (parentObject !== undefined && fromOutputAudioTranscription != null) {
5830
- setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
5834
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1());
5831
5835
  }
5832
5836
  const fromRealtimeInputConfig = getValueByPath(fromObject, [
5833
5837
  'realtimeInputConfig',
5834
5838
  ]);
5835
5839
  if (parentObject !== undefined && fromRealtimeInputConfig != null) {
5836
- setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
5840
+ setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev$1(apiClient, fromRealtimeInputConfig));
5837
5841
  }
5838
5842
  const fromContextWindowCompression = getValueByPath(fromObject, [
5839
5843
  'contextWindowCompression',
5840
5844
  ]);
5841
5845
  if (parentObject !== undefined && fromContextWindowCompression != null) {
5842
- setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
5846
+ setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev$1(apiClient, fromContextWindowCompression));
5843
5847
  }
5844
5848
  const fromProactivity = getValueByPath(fromObject, ['proactivity']);
5845
5849
  if (parentObject !== undefined && fromProactivity != null) {
5846
- setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
5850
+ setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev$1(apiClient, fromProactivity));
5847
5851
  }
5848
5852
  return toObject;
5849
5853
  }
@@ -5959,7 +5963,7 @@ function liveConnectParametersToMldev(apiClient, fromObject) {
5959
5963
  }
5960
5964
  const fromConfig = getValueByPath(fromObject, ['config']);
5961
5965
  if (fromConfig != null) {
5962
- setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
5966
+ setValueByPath(toObject, ['config'], liveConnectConfigToMldev$1(apiClient, fromConfig, toObject));
5963
5967
  }
5964
5968
  return toObject;
5965
5969
  }
@@ -6136,12 +6140,6 @@ function liveMusicGenerationConfigToMldev(apiClient, fromObject) {
6136
6140
  if (fromOnlyBassAndDrums != null) {
6137
6141
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
6138
6142
  }
6139
- const fromMusicGenerationMode = getValueByPath(fromObject, [
6140
- 'musicGenerationMode',
6141
- ]);
6142
- if (fromMusicGenerationMode != null) {
6143
- setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
6144
- }
6145
6143
  return toObject;
6146
6144
  }
6147
6145
  function liveMusicSetConfigParametersToMldev(apiClient, fromObject) {
@@ -6320,6 +6318,12 @@ function partFromMldev$1(apiClient, fromObject) {
6320
6318
  if (fromFileData != null) {
6321
6319
  setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
6322
6320
  }
6321
+ const fromThoughtSignature = getValueByPath(fromObject, [
6322
+ 'thoughtSignature',
6323
+ ]);
6324
+ if (fromThoughtSignature != null) {
6325
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
6326
+ }
6323
6327
  const fromCodeExecutionResult = getValueByPath(fromObject, [
6324
6328
  'codeExecutionResult',
6325
6329
  ]);
@@ -6368,6 +6372,12 @@ function partFromVertex$1(apiClient, fromObject) {
6368
6372
  if (fromFileData != null) {
6369
6373
  setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
6370
6374
  }
6375
+ const fromThoughtSignature = getValueByPath(fromObject, [
6376
+ 'thoughtSignature',
6377
+ ]);
6378
+ if (fromThoughtSignature != null) {
6379
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
6380
+ }
6371
6381
  const fromCodeExecutionResult = getValueByPath(fromObject, [
6372
6382
  'codeExecutionResult',
6373
6383
  ]);
@@ -7066,12 +7076,6 @@ function liveMusicGenerationConfigFromMldev(apiClient, fromObject) {
7066
7076
  if (fromOnlyBassAndDrums != null) {
7067
7077
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
7068
7078
  }
7069
- const fromMusicGenerationMode = getValueByPath(fromObject, [
7070
- 'musicGenerationMode',
7071
- ]);
7072
- if (fromMusicGenerationMode != null) {
7073
- setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
7074
- }
7075
7079
  return toObject;
7076
7080
  }
7077
7081
  function liveMusicSourceMetadataFromMldev(apiClient, fromObject) {
@@ -7164,7 +7168,7 @@ function liveMusicServerMessageFromMldev(apiClient, fromObject) {
7164
7168
  * Copyright 2025 Google LLC
7165
7169
  * SPDX-License-Identifier: Apache-2.0
7166
7170
  */
7167
- function videoMetadataToMldev(apiClient, fromObject) {
7171
+ function videoMetadataToMldev$1(apiClient, fromObject) {
7168
7172
  const toObject = {};
7169
7173
  const fromFps = getValueByPath(fromObject, ['fps']);
7170
7174
  if (fromFps != null) {
@@ -7180,7 +7184,7 @@ function videoMetadataToMldev(apiClient, fromObject) {
7180
7184
  }
7181
7185
  return toObject;
7182
7186
  }
7183
- function blobToMldev(apiClient, fromObject) {
7187
+ function blobToMldev$1(apiClient, fromObject) {
7184
7188
  const toObject = {};
7185
7189
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7186
7190
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -7195,7 +7199,7 @@ function blobToMldev(apiClient, fromObject) {
7195
7199
  }
7196
7200
  return toObject;
7197
7201
  }
7198
- function fileDataToMldev(apiClient, fromObject) {
7202
+ function fileDataToMldev$1(apiClient, fromObject) {
7199
7203
  const toObject = {};
7200
7204
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7201
7205
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -7210,13 +7214,13 @@ function fileDataToMldev(apiClient, fromObject) {
7210
7214
  }
7211
7215
  return toObject;
7212
7216
  }
7213
- function partToMldev(apiClient, fromObject) {
7217
+ function partToMldev$1(apiClient, fromObject) {
7214
7218
  const toObject = {};
7215
7219
  const fromVideoMetadata = getValueByPath(fromObject, [
7216
7220
  'videoMetadata',
7217
7221
  ]);
7218
7222
  if (fromVideoMetadata != null) {
7219
- setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
7223
+ setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$1(apiClient, fromVideoMetadata));
7220
7224
  }
7221
7225
  const fromThought = getValueByPath(fromObject, ['thought']);
7222
7226
  if (fromThought != null) {
@@ -7224,11 +7228,17 @@ function partToMldev(apiClient, fromObject) {
7224
7228
  }
7225
7229
  const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7226
7230
  if (fromInlineData != null) {
7227
- setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
7231
+ setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
7228
7232
  }
7229
7233
  const fromFileData = getValueByPath(fromObject, ['fileData']);
7230
7234
  if (fromFileData != null) {
7231
- setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
7235
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
7236
+ }
7237
+ const fromThoughtSignature = getValueByPath(fromObject, [
7238
+ 'thoughtSignature',
7239
+ ]);
7240
+ if (fromThoughtSignature != null) {
7241
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7232
7242
  }
7233
7243
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7234
7244
  'codeExecutionResult',
@@ -7258,14 +7268,14 @@ function partToMldev(apiClient, fromObject) {
7258
7268
  }
7259
7269
  return toObject;
7260
7270
  }
7261
- function contentToMldev(apiClient, fromObject) {
7271
+ function contentToMldev$1(apiClient, fromObject) {
7262
7272
  const toObject = {};
7263
7273
  const fromParts = getValueByPath(fromObject, ['parts']);
7264
7274
  if (fromParts != null) {
7265
7275
  let transformedList = fromParts;
7266
7276
  if (Array.isArray(transformedList)) {
7267
7277
  transformedList = transformedList.map((item) => {
7268
- return partToMldev(apiClient, item);
7278
+ return partToMldev$1(apiClient, item);
7269
7279
  });
7270
7280
  }
7271
7281
  setValueByPath(toObject, ['parts'], transformedList);
@@ -7389,7 +7399,7 @@ function safetySettingToMldev(apiClient, fromObject) {
7389
7399
  }
7390
7400
  return toObject;
7391
7401
  }
7392
- function functionDeclarationToMldev(apiClient, fromObject) {
7402
+ function functionDeclarationToMldev$1(apiClient, fromObject) {
7393
7403
  const toObject = {};
7394
7404
  const fromBehavior = getValueByPath(fromObject, ['behavior']);
7395
7405
  if (fromBehavior != null) {
@@ -7413,7 +7423,7 @@ function functionDeclarationToMldev(apiClient, fromObject) {
7413
7423
  }
7414
7424
  return toObject;
7415
7425
  }
7416
- function intervalToMldev(apiClient, fromObject) {
7426
+ function intervalToMldev$1(apiClient, fromObject) {
7417
7427
  const toObject = {};
7418
7428
  const fromStartTime = getValueByPath(fromObject, ['startTime']);
7419
7429
  if (fromStartTime != null) {
@@ -7425,17 +7435,17 @@ function intervalToMldev(apiClient, fromObject) {
7425
7435
  }
7426
7436
  return toObject;
7427
7437
  }
7428
- function googleSearchToMldev(apiClient, fromObject) {
7438
+ function googleSearchToMldev$1(apiClient, fromObject) {
7429
7439
  const toObject = {};
7430
7440
  const fromTimeRangeFilter = getValueByPath(fromObject, [
7431
7441
  'timeRangeFilter',
7432
7442
  ]);
7433
7443
  if (fromTimeRangeFilter != null) {
7434
- setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
7444
+ setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(apiClient, fromTimeRangeFilter));
7435
7445
  }
7436
7446
  return toObject;
7437
7447
  }
7438
- function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
7448
+ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
7439
7449
  const toObject = {};
7440
7450
  const fromMode = getValueByPath(fromObject, ['mode']);
7441
7451
  if (fromMode != null) {
@@ -7449,21 +7459,21 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
7449
7459
  }
7450
7460
  return toObject;
7451
7461
  }
7452
- function googleSearchRetrievalToMldev(apiClient, fromObject) {
7462
+ function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
7453
7463
  const toObject = {};
7454
7464
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
7455
7465
  'dynamicRetrievalConfig',
7456
7466
  ]);
7457
7467
  if (fromDynamicRetrievalConfig != null) {
7458
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
7468
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
7459
7469
  }
7460
7470
  return toObject;
7461
7471
  }
7462
- function urlContextToMldev() {
7472
+ function urlContextToMldev$1() {
7463
7473
  const toObject = {};
7464
7474
  return toObject;
7465
7475
  }
7466
- function toolToMldev(apiClient, fromObject) {
7476
+ function toolToMldev$1(apiClient, fromObject) {
7467
7477
  const toObject = {};
7468
7478
  const fromFunctionDeclarations = getValueByPath(fromObject, [
7469
7479
  'functionDeclarations',
@@ -7472,7 +7482,7 @@ function toolToMldev(apiClient, fromObject) {
7472
7482
  let transformedList = fromFunctionDeclarations;
7473
7483
  if (Array.isArray(transformedList)) {
7474
7484
  transformedList = transformedList.map((item) => {
7475
- return functionDeclarationToMldev(apiClient, item);
7485
+ return functionDeclarationToMldev$1(apiClient, item);
7476
7486
  });
7477
7487
  }
7478
7488
  setValueByPath(toObject, ['functionDeclarations'], transformedList);
@@ -7482,13 +7492,13 @@ function toolToMldev(apiClient, fromObject) {
7482
7492
  }
7483
7493
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7484
7494
  if (fromGoogleSearch != null) {
7485
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
7495
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(apiClient, fromGoogleSearch));
7486
7496
  }
7487
7497
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7488
7498
  'googleSearchRetrieval',
7489
7499
  ]);
7490
7500
  if (fromGoogleSearchRetrieval != null) {
7491
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
7501
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
7492
7502
  }
7493
7503
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7494
7504
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
@@ -7498,7 +7508,7 @@ function toolToMldev(apiClient, fromObject) {
7498
7508
  }
7499
7509
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7500
7510
  if (fromUrlContext != null) {
7501
- setValueByPath(toObject, ['urlContext'], urlContextToMldev());
7511
+ setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
7502
7512
  }
7503
7513
  const fromCodeExecution = getValueByPath(fromObject, [
7504
7514
  'codeExecution',
@@ -7562,7 +7572,7 @@ function toolConfigToMldev(apiClient, fromObject) {
7562
7572
  }
7563
7573
  return toObject;
7564
7574
  }
7565
- function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
7575
+ function prebuiltVoiceConfigToMldev$1(apiClient, fromObject) {
7566
7576
  const toObject = {};
7567
7577
  const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
7568
7578
  if (fromVoiceName != null) {
@@ -7570,17 +7580,17 @@ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
7570
7580
  }
7571
7581
  return toObject;
7572
7582
  }
7573
- function voiceConfigToMldev(apiClient, fromObject) {
7583
+ function voiceConfigToMldev$1(apiClient, fromObject) {
7574
7584
  const toObject = {};
7575
7585
  const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
7576
7586
  'prebuiltVoiceConfig',
7577
7587
  ]);
7578
7588
  if (fromPrebuiltVoiceConfig != null) {
7579
- setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
7589
+ setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$1(apiClient, fromPrebuiltVoiceConfig));
7580
7590
  }
7581
7591
  return toObject;
7582
7592
  }
7583
- function speakerVoiceConfigToMldev(apiClient, fromObject) {
7593
+ function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
7584
7594
  const toObject = {};
7585
7595
  const fromSpeaker = getValueByPath(fromObject, ['speaker']);
7586
7596
  if (fromSpeaker != null) {
@@ -7588,11 +7598,11 @@ function speakerVoiceConfigToMldev(apiClient, fromObject) {
7588
7598
  }
7589
7599
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
7590
7600
  if (fromVoiceConfig != null) {
7591
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
7601
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
7592
7602
  }
7593
7603
  return toObject;
7594
7604
  }
7595
- function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
7605
+ function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
7596
7606
  const toObject = {};
7597
7607
  const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
7598
7608
  'speakerVoiceConfigs',
@@ -7601,24 +7611,24 @@ function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
7601
7611
  let transformedList = fromSpeakerVoiceConfigs;
7602
7612
  if (Array.isArray(transformedList)) {
7603
7613
  transformedList = transformedList.map((item) => {
7604
- return speakerVoiceConfigToMldev(apiClient, item);
7614
+ return speakerVoiceConfigToMldev$1(apiClient, item);
7605
7615
  });
7606
7616
  }
7607
7617
  setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
7608
7618
  }
7609
7619
  return toObject;
7610
7620
  }
7611
- function speechConfigToMldev(apiClient, fromObject) {
7621
+ function speechConfigToMldev$1(apiClient, fromObject) {
7612
7622
  const toObject = {};
7613
7623
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
7614
7624
  if (fromVoiceConfig != null) {
7615
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
7625
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
7616
7626
  }
7617
7627
  const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
7618
7628
  'multiSpeakerVoiceConfig',
7619
7629
  ]);
7620
7630
  if (fromMultiSpeakerVoiceConfig != null) {
7621
- setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
7631
+ setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$1(apiClient, fromMultiSpeakerVoiceConfig));
7622
7632
  }
7623
7633
  const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7624
7634
  if (fromLanguageCode != null) {
@@ -7648,7 +7658,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
7648
7658
  'systemInstruction',
7649
7659
  ]);
7650
7660
  if (parentObject !== undefined && fromSystemInstruction != null) {
7651
- setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
7661
+ setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
7652
7662
  }
7653
7663
  const fromTemperature = getValueByPath(fromObject, ['temperature']);
7654
7664
  if (fromTemperature != null) {
@@ -7741,7 +7751,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
7741
7751
  let transformedList = tTools(apiClient, fromTools);
7742
7752
  if (Array.isArray(transformedList)) {
7743
7753
  transformedList = transformedList.map((item) => {
7744
- return toolToMldev(apiClient, tTool(apiClient, item));
7754
+ return toolToMldev$1(apiClient, tTool(apiClient, item));
7745
7755
  });
7746
7756
  }
7747
7757
  setValueByPath(parentObject, ['tools'], transformedList);
@@ -7773,7 +7783,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
7773
7783
  }
7774
7784
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
7775
7785
  if (fromSpeechConfig != null) {
7776
- setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
7786
+ setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$1(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
7777
7787
  }
7778
7788
  if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
7779
7789
  throw new Error('audioTimestamp parameter is not supported in Gemini API.');
@@ -7797,7 +7807,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
7797
7807
  let transformedList = tContents(apiClient, fromContents);
7798
7808
  if (Array.isArray(transformedList)) {
7799
7809
  transformedList = transformedList.map((item) => {
7800
- return contentToMldev(apiClient, item);
7810
+ return contentToMldev$1(apiClient, item);
7801
7811
  });
7802
7812
  }
7803
7813
  setValueByPath(toObject, ['contents'], transformedList);
@@ -8049,7 +8059,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
8049
8059
  let transformedList = tContents(apiClient, fromContents);
8050
8060
  if (Array.isArray(transformedList)) {
8051
8061
  transformedList = transformedList.map((item) => {
8052
- return contentToMldev(apiClient, item);
8062
+ return contentToMldev$1(apiClient, item);
8053
8063
  });
8054
8064
  }
8055
8065
  setValueByPath(toObject, ['contents'], transformedList);
@@ -8123,6 +8133,9 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
8123
8133
  if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
8124
8134
  throw new Error('enhancePrompt parameter is not supported in Gemini API.');
8125
8135
  }
8136
+ if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
8137
+ throw new Error('generateAudio parameter is not supported in Gemini API.');
8138
+ }
8126
8139
  return toObject;
8127
8140
  }
8128
8141
  function generateVideosParametersToMldev(apiClient, fromObject) {
@@ -8213,6 +8226,12 @@ function partToVertex(apiClient, fromObject) {
8213
8226
  if (fromFileData != null) {
8214
8227
  setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
8215
8228
  }
8229
+ const fromThoughtSignature = getValueByPath(fromObject, [
8230
+ 'thoughtSignature',
8231
+ ]);
8232
+ if (fromThoughtSignature != null) {
8233
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
8234
+ }
8216
8235
  const fromCodeExecutionResult = getValueByPath(fromObject, [
8217
8236
  'codeExecutionResult',
8218
8237
  ]);
@@ -9462,6 +9481,12 @@ function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
9462
9481
  if (parentObject !== undefined && fromEnhancePrompt != null) {
9463
9482
  setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
9464
9483
  }
9484
+ const fromGenerateAudio = getValueByPath(fromObject, [
9485
+ 'generateAudio',
9486
+ ]);
9487
+ if (parentObject !== undefined && fromGenerateAudio != null) {
9488
+ setValueByPath(parentObject, ['parameters', 'generateAudio'], fromGenerateAudio);
9489
+ }
9465
9490
  return toObject;
9466
9491
  }
9467
9492
  function generateVideosParametersToVertex(apiClient, fromObject) {
@@ -9544,6 +9569,12 @@ function partFromMldev(apiClient, fromObject) {
9544
9569
  if (fromFileData != null) {
9545
9570
  setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
9546
9571
  }
9572
+ const fromThoughtSignature = getValueByPath(fromObject, [
9573
+ 'thoughtSignature',
9574
+ ]);
9575
+ if (fromThoughtSignature != null) {
9576
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
9577
+ }
9547
9578
  const fromCodeExecutionResult = getValueByPath(fromObject, [
9548
9579
  'codeExecutionResult',
9549
9580
  ]);
@@ -10062,6 +10093,12 @@ function partFromVertex(apiClient, fromObject) {
10062
10093
  if (fromFileData != null) {
10063
10094
  setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
10064
10095
  }
10096
+ const fromThoughtSignature = getValueByPath(fromObject, [
10097
+ 'thoughtSignature',
10098
+ ]);
10099
+ if (fromThoughtSignature != null) {
10100
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
10101
+ }
10065
10102
  const fromCodeExecutionResult = getValueByPath(fromObject, [
10066
10103
  'codeExecutionResult',
10067
10104
  ]);
@@ -10604,7 +10641,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10604
10641
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10605
10642
  const USER_AGENT_HEADER = 'User-Agent';
10606
10643
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10607
- const SDK_VERSION = '1.1.0'; // x-release-please-version
10644
+ const SDK_VERSION = '1.3.0'; // x-release-please-version
10608
10645
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10609
10646
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10610
10647
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -11140,9 +11177,6 @@ function hasMcpToolUsage(tools) {
11140
11177
  function setMcpUsageHeader(headers) {
11141
11178
  var _a;
11142
11179
  const existingHeader = (_a = headers[GOOGLE_API_CLIENT_HEADER]) !== null && _a !== void 0 ? _a : '';
11143
- if (existingHeader.includes(MCP_LABEL)) {
11144
- return;
11145
- }
11146
11180
  headers[GOOGLE_API_CLIENT_HEADER] = (existingHeader + ` ${MCP_LABEL}`).trimStart();
11147
11181
  }
11148
11182
  // Checks whether the list of tools contains any MCP clients. Will return true
@@ -11159,11 +11193,9 @@ function hasNonMcpTools(params) {
11159
11193
  }
11160
11194
  // Returns true if the object is a MCP CallableTool, otherwise false.
11161
11195
  function isMcpCallableTool(object) {
11162
- // TODO: b/418266406 - Add a more robust check for the MCP CallableTool.
11163
11196
  return (object !== null &&
11164
11197
  typeof object === 'object' &&
11165
- 'tool' in object &&
11166
- 'callTool' in object);
11198
+ object instanceof McpCallableTool);
11167
11199
  }
11168
11200
  // List all tools from the MCP client.
11169
11201
  function listAllTools(mcpClient, maxTools = 100) {
@@ -11643,7 +11675,14 @@ class Live {
11643
11675
  }
11644
11676
  else {
11645
11677
  const apiKey = this.apiClient.getApiKey();
11646
- url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.BidiGenerateContent?key=${apiKey}`;
11678
+ let method = 'BidiGenerateContent';
11679
+ let keyName = 'key';
11680
+ if (apiKey === null || apiKey === void 0 ? void 0 : apiKey.startsWith('auth_tokens/')) {
11681
+ console.warn('Warning: Ephemeral token support is experimental and may change in future versions.');
11682
+ method = 'BidiGenerateContentConstrained';
11683
+ keyName = 'access_token';
11684
+ }
11685
+ url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.${method}?${keyName}=${apiKey}`;
11647
11686
  }
11648
11687
  let onopenResolve = () => { };
11649
11688
  const onopenPromise = new Promise((resolve) => {
@@ -11749,7 +11788,7 @@ class Session {
11749
11788
  contents = contents.map((item) => contentToVertex(apiClient, item));
11750
11789
  }
11751
11790
  else {
11752
- contents = contents.map((item) => contentToMldev(apiClient, item));
11791
+ contents = contents.map((item) => contentToMldev$1(apiClient, item));
11753
11792
  }
11754
11793
  }
11755
11794
  catch (_a) {
@@ -12047,7 +12086,6 @@ class Models extends BaseModule {
12047
12086
  if (!hasMcpClientTools(params) || shouldDisableAfc(params.config)) {
12048
12087
  return await this.generateContentInternal(transformedParams);
12049
12088
  }
12050
- // TODO: b/418266406 - Improve the check for CallableTools and Tools.
12051
12089
  if (hasNonMcpTools(params)) {
12052
12090
  throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
12053
12091
  }
@@ -13602,19 +13640,857 @@ class Operations extends BaseModule {
13602
13640
  * Copyright 2025 Google LLC
13603
13641
  * SPDX-License-Identifier: Apache-2.0
13604
13642
  */
13605
- const GOOGLE_API_KEY_HEADER = 'x-goog-api-key';
13606
- const REQUIRED_VERTEX_AI_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
13607
- class NodeAuth {
13608
- constructor(opts) {
13609
- if (opts.apiKey !== undefined) {
13610
- this.apiKey = opts.apiKey;
13611
- return;
13643
+ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
13644
+ const toObject = {};
13645
+ const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
13646
+ if (fromVoiceName != null) {
13647
+ setValueByPath(toObject, ['voiceName'], fromVoiceName);
13648
+ }
13649
+ return toObject;
13650
+ }
13651
+ function voiceConfigToMldev(apiClient, fromObject) {
13652
+ const toObject = {};
13653
+ const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
13654
+ 'prebuiltVoiceConfig',
13655
+ ]);
13656
+ if (fromPrebuiltVoiceConfig != null) {
13657
+ setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
13658
+ }
13659
+ return toObject;
13660
+ }
13661
+ function speakerVoiceConfigToMldev(apiClient, fromObject) {
13662
+ const toObject = {};
13663
+ const fromSpeaker = getValueByPath(fromObject, ['speaker']);
13664
+ if (fromSpeaker != null) {
13665
+ setValueByPath(toObject, ['speaker'], fromSpeaker);
13666
+ }
13667
+ const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
13668
+ if (fromVoiceConfig != null) {
13669
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
13670
+ }
13671
+ return toObject;
13672
+ }
13673
+ function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
13674
+ const toObject = {};
13675
+ const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
13676
+ 'speakerVoiceConfigs',
13677
+ ]);
13678
+ if (fromSpeakerVoiceConfigs != null) {
13679
+ let transformedList = fromSpeakerVoiceConfigs;
13680
+ if (Array.isArray(transformedList)) {
13681
+ transformedList = transformedList.map((item) => {
13682
+ return speakerVoiceConfigToMldev(apiClient, item);
13683
+ });
13612
13684
  }
13613
- const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
13614
- this.googleAuth = new googleAuthLibrary.GoogleAuth(vertexAuthOptions);
13685
+ setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
13615
13686
  }
13616
- async addAuthHeaders(headers) {
13617
- if (this.apiKey !== undefined) {
13687
+ return toObject;
13688
+ }
13689
+ function speechConfigToMldev(apiClient, fromObject) {
13690
+ const toObject = {};
13691
+ const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
13692
+ if (fromVoiceConfig != null) {
13693
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
13694
+ }
13695
+ const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
13696
+ 'multiSpeakerVoiceConfig',
13697
+ ]);
13698
+ if (fromMultiSpeakerVoiceConfig != null) {
13699
+ setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
13700
+ }
13701
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
13702
+ if (fromLanguageCode != null) {
13703
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
13704
+ }
13705
+ return toObject;
13706
+ }
13707
+ function videoMetadataToMldev(apiClient, fromObject) {
13708
+ const toObject = {};
13709
+ const fromFps = getValueByPath(fromObject, ['fps']);
13710
+ if (fromFps != null) {
13711
+ setValueByPath(toObject, ['fps'], fromFps);
13712
+ }
13713
+ const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
13714
+ if (fromEndOffset != null) {
13715
+ setValueByPath(toObject, ['endOffset'], fromEndOffset);
13716
+ }
13717
+ const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
13718
+ if (fromStartOffset != null) {
13719
+ setValueByPath(toObject, ['startOffset'], fromStartOffset);
13720
+ }
13721
+ return toObject;
13722
+ }
13723
+ function blobToMldev(apiClient, fromObject) {
13724
+ const toObject = {};
13725
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
13726
+ throw new Error('displayName parameter is not supported in Gemini API.');
13727
+ }
13728
+ const fromData = getValueByPath(fromObject, ['data']);
13729
+ if (fromData != null) {
13730
+ setValueByPath(toObject, ['data'], fromData);
13731
+ }
13732
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
13733
+ if (fromMimeType != null) {
13734
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
13735
+ }
13736
+ return toObject;
13737
+ }
13738
+ function fileDataToMldev(apiClient, fromObject) {
13739
+ const toObject = {};
13740
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
13741
+ throw new Error('displayName parameter is not supported in Gemini API.');
13742
+ }
13743
+ const fromFileUri = getValueByPath(fromObject, ['fileUri']);
13744
+ if (fromFileUri != null) {
13745
+ setValueByPath(toObject, ['fileUri'], fromFileUri);
13746
+ }
13747
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
13748
+ if (fromMimeType != null) {
13749
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
13750
+ }
13751
+ return toObject;
13752
+ }
13753
+ function partToMldev(apiClient, fromObject) {
13754
+ const toObject = {};
13755
+ const fromVideoMetadata = getValueByPath(fromObject, [
13756
+ 'videoMetadata',
13757
+ ]);
13758
+ if (fromVideoMetadata != null) {
13759
+ setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
13760
+ }
13761
+ const fromThought = getValueByPath(fromObject, ['thought']);
13762
+ if (fromThought != null) {
13763
+ setValueByPath(toObject, ['thought'], fromThought);
13764
+ }
13765
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
13766
+ if (fromInlineData != null) {
13767
+ setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
13768
+ }
13769
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
13770
+ if (fromFileData != null) {
13771
+ setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
13772
+ }
13773
+ const fromThoughtSignature = getValueByPath(fromObject, [
13774
+ 'thoughtSignature',
13775
+ ]);
13776
+ if (fromThoughtSignature != null) {
13777
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
13778
+ }
13779
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
13780
+ 'codeExecutionResult',
13781
+ ]);
13782
+ if (fromCodeExecutionResult != null) {
13783
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
13784
+ }
13785
+ const fromExecutableCode = getValueByPath(fromObject, [
13786
+ 'executableCode',
13787
+ ]);
13788
+ if (fromExecutableCode != null) {
13789
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
13790
+ }
13791
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
13792
+ if (fromFunctionCall != null) {
13793
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
13794
+ }
13795
+ const fromFunctionResponse = getValueByPath(fromObject, [
13796
+ 'functionResponse',
13797
+ ]);
13798
+ if (fromFunctionResponse != null) {
13799
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
13800
+ }
13801
+ const fromText = getValueByPath(fromObject, ['text']);
13802
+ if (fromText != null) {
13803
+ setValueByPath(toObject, ['text'], fromText);
13804
+ }
13805
+ return toObject;
13806
+ }
13807
+ function contentToMldev(apiClient, fromObject) {
13808
+ const toObject = {};
13809
+ const fromParts = getValueByPath(fromObject, ['parts']);
13810
+ if (fromParts != null) {
13811
+ let transformedList = fromParts;
13812
+ if (Array.isArray(transformedList)) {
13813
+ transformedList = transformedList.map((item) => {
13814
+ return partToMldev(apiClient, item);
13815
+ });
13816
+ }
13817
+ setValueByPath(toObject, ['parts'], transformedList);
13818
+ }
13819
+ const fromRole = getValueByPath(fromObject, ['role']);
13820
+ if (fromRole != null) {
13821
+ setValueByPath(toObject, ['role'], fromRole);
13822
+ }
13823
+ return toObject;
13824
+ }
13825
+ function functionDeclarationToMldev(apiClient, fromObject) {
13826
+ const toObject = {};
13827
+ const fromBehavior = getValueByPath(fromObject, ['behavior']);
13828
+ if (fromBehavior != null) {
13829
+ setValueByPath(toObject, ['behavior'], fromBehavior);
13830
+ }
13831
+ const fromDescription = getValueByPath(fromObject, ['description']);
13832
+ if (fromDescription != null) {
13833
+ setValueByPath(toObject, ['description'], fromDescription);
13834
+ }
13835
+ const fromName = getValueByPath(fromObject, ['name']);
13836
+ if (fromName != null) {
13837
+ setValueByPath(toObject, ['name'], fromName);
13838
+ }
13839
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
13840
+ if (fromParameters != null) {
13841
+ setValueByPath(toObject, ['parameters'], fromParameters);
13842
+ }
13843
+ const fromResponse = getValueByPath(fromObject, ['response']);
13844
+ if (fromResponse != null) {
13845
+ setValueByPath(toObject, ['response'], fromResponse);
13846
+ }
13847
+ return toObject;
13848
+ }
13849
+ function intervalToMldev(apiClient, fromObject) {
13850
+ const toObject = {};
13851
+ const fromStartTime = getValueByPath(fromObject, ['startTime']);
13852
+ if (fromStartTime != null) {
13853
+ setValueByPath(toObject, ['startTime'], fromStartTime);
13854
+ }
13855
+ const fromEndTime = getValueByPath(fromObject, ['endTime']);
13856
+ if (fromEndTime != null) {
13857
+ setValueByPath(toObject, ['endTime'], fromEndTime);
13858
+ }
13859
+ return toObject;
13860
+ }
13861
+ function googleSearchToMldev(apiClient, fromObject) {
13862
+ const toObject = {};
13863
+ const fromTimeRangeFilter = getValueByPath(fromObject, [
13864
+ 'timeRangeFilter',
13865
+ ]);
13866
+ if (fromTimeRangeFilter != null) {
13867
+ setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
13868
+ }
13869
+ return toObject;
13870
+ }
13871
+ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
13872
+ const toObject = {};
13873
+ const fromMode = getValueByPath(fromObject, ['mode']);
13874
+ if (fromMode != null) {
13875
+ setValueByPath(toObject, ['mode'], fromMode);
13876
+ }
13877
+ const fromDynamicThreshold = getValueByPath(fromObject, [
13878
+ 'dynamicThreshold',
13879
+ ]);
13880
+ if (fromDynamicThreshold != null) {
13881
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
13882
+ }
13883
+ return toObject;
13884
+ }
13885
+ function googleSearchRetrievalToMldev(apiClient, fromObject) {
13886
+ const toObject = {};
13887
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
13888
+ 'dynamicRetrievalConfig',
13889
+ ]);
13890
+ if (fromDynamicRetrievalConfig != null) {
13891
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
13892
+ }
13893
+ return toObject;
13894
+ }
13895
+ function urlContextToMldev() {
13896
+ const toObject = {};
13897
+ return toObject;
13898
+ }
13899
+ function toolToMldev(apiClient, fromObject) {
13900
+ const toObject = {};
13901
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
13902
+ 'functionDeclarations',
13903
+ ]);
13904
+ if (fromFunctionDeclarations != null) {
13905
+ let transformedList = fromFunctionDeclarations;
13906
+ if (Array.isArray(transformedList)) {
13907
+ transformedList = transformedList.map((item) => {
13908
+ return functionDeclarationToMldev(apiClient, item);
13909
+ });
13910
+ }
13911
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
13912
+ }
13913
+ if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
13914
+ throw new Error('retrieval parameter is not supported in Gemini API.');
13915
+ }
13916
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
13917
+ if (fromGoogleSearch != null) {
13918
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
13919
+ }
13920
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
13921
+ 'googleSearchRetrieval',
13922
+ ]);
13923
+ if (fromGoogleSearchRetrieval != null) {
13924
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
13925
+ }
13926
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
13927
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
13928
+ }
13929
+ if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
13930
+ throw new Error('googleMaps parameter is not supported in Gemini API.');
13931
+ }
13932
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
13933
+ if (fromUrlContext != null) {
13934
+ setValueByPath(toObject, ['urlContext'], urlContextToMldev());
13935
+ }
13936
+ const fromCodeExecution = getValueByPath(fromObject, [
13937
+ 'codeExecution',
13938
+ ]);
13939
+ if (fromCodeExecution != null) {
13940
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
13941
+ }
13942
+ return toObject;
13943
+ }
13944
+ function sessionResumptionConfigToMldev(apiClient, fromObject) {
13945
+ const toObject = {};
13946
+ const fromHandle = getValueByPath(fromObject, ['handle']);
13947
+ if (fromHandle != null) {
13948
+ setValueByPath(toObject, ['handle'], fromHandle);
13949
+ }
13950
+ if (getValueByPath(fromObject, ['transparent']) !== undefined) {
13951
+ throw new Error('transparent parameter is not supported in Gemini API.');
13952
+ }
13953
+ return toObject;
13954
+ }
13955
+ function audioTranscriptionConfigToMldev() {
13956
+ const toObject = {};
13957
+ return toObject;
13958
+ }
13959
+ function automaticActivityDetectionToMldev(apiClient, fromObject) {
13960
+ const toObject = {};
13961
+ const fromDisabled = getValueByPath(fromObject, ['disabled']);
13962
+ if (fromDisabled != null) {
13963
+ setValueByPath(toObject, ['disabled'], fromDisabled);
13964
+ }
13965
+ const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
13966
+ 'startOfSpeechSensitivity',
13967
+ ]);
13968
+ if (fromStartOfSpeechSensitivity != null) {
13969
+ setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
13970
+ }
13971
+ const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
13972
+ 'endOfSpeechSensitivity',
13973
+ ]);
13974
+ if (fromEndOfSpeechSensitivity != null) {
13975
+ setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
13976
+ }
13977
+ const fromPrefixPaddingMs = getValueByPath(fromObject, [
13978
+ 'prefixPaddingMs',
13979
+ ]);
13980
+ if (fromPrefixPaddingMs != null) {
13981
+ setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
13982
+ }
13983
+ const fromSilenceDurationMs = getValueByPath(fromObject, [
13984
+ 'silenceDurationMs',
13985
+ ]);
13986
+ if (fromSilenceDurationMs != null) {
13987
+ setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
13988
+ }
13989
+ return toObject;
13990
+ }
13991
+ function realtimeInputConfigToMldev(apiClient, fromObject) {
13992
+ const toObject = {};
13993
+ const fromAutomaticActivityDetection = getValueByPath(fromObject, [
13994
+ 'automaticActivityDetection',
13995
+ ]);
13996
+ if (fromAutomaticActivityDetection != null) {
13997
+ setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
13998
+ }
13999
+ const fromActivityHandling = getValueByPath(fromObject, [
14000
+ 'activityHandling',
14001
+ ]);
14002
+ if (fromActivityHandling != null) {
14003
+ setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
14004
+ }
14005
+ const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
14006
+ if (fromTurnCoverage != null) {
14007
+ setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
14008
+ }
14009
+ return toObject;
14010
+ }
14011
+ function slidingWindowToMldev(apiClient, fromObject) {
14012
+ const toObject = {};
14013
+ const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
14014
+ if (fromTargetTokens != null) {
14015
+ setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
14016
+ }
14017
+ return toObject;
14018
+ }
14019
+ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
14020
+ const toObject = {};
14021
+ const fromTriggerTokens = getValueByPath(fromObject, [
14022
+ 'triggerTokens',
14023
+ ]);
14024
+ if (fromTriggerTokens != null) {
14025
+ setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
14026
+ }
14027
+ const fromSlidingWindow = getValueByPath(fromObject, [
14028
+ 'slidingWindow',
14029
+ ]);
14030
+ if (fromSlidingWindow != null) {
14031
+ setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
14032
+ }
14033
+ return toObject;
14034
+ }
14035
+ function proactivityConfigToMldev(apiClient, fromObject) {
14036
+ const toObject = {};
14037
+ const fromProactiveAudio = getValueByPath(fromObject, [
14038
+ 'proactiveAudio',
14039
+ ]);
14040
+ if (fromProactiveAudio != null) {
14041
+ setValueByPath(toObject, ['proactiveAudio'], fromProactiveAudio);
14042
+ }
14043
+ return toObject;
14044
+ }
14045
+ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
14046
+ const toObject = {};
14047
+ const fromGenerationConfig = getValueByPath(fromObject, [
14048
+ 'generationConfig',
14049
+ ]);
14050
+ if (parentObject !== undefined && fromGenerationConfig != null) {
14051
+ setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
14052
+ }
14053
+ const fromResponseModalities = getValueByPath(fromObject, [
14054
+ 'responseModalities',
14055
+ ]);
14056
+ if (parentObject !== undefined && fromResponseModalities != null) {
14057
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
14058
+ }
14059
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
14060
+ if (parentObject !== undefined && fromTemperature != null) {
14061
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
14062
+ }
14063
+ const fromTopP = getValueByPath(fromObject, ['topP']);
14064
+ if (parentObject !== undefined && fromTopP != null) {
14065
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
14066
+ }
14067
+ const fromTopK = getValueByPath(fromObject, ['topK']);
14068
+ if (parentObject !== undefined && fromTopK != null) {
14069
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
14070
+ }
14071
+ const fromMaxOutputTokens = getValueByPath(fromObject, [
14072
+ 'maxOutputTokens',
14073
+ ]);
14074
+ if (parentObject !== undefined && fromMaxOutputTokens != null) {
14075
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
14076
+ }
14077
+ const fromMediaResolution = getValueByPath(fromObject, [
14078
+ 'mediaResolution',
14079
+ ]);
14080
+ if (parentObject !== undefined && fromMediaResolution != null) {
14081
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
14082
+ }
14083
+ const fromSeed = getValueByPath(fromObject, ['seed']);
14084
+ if (parentObject !== undefined && fromSeed != null) {
14085
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
14086
+ }
14087
+ const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
14088
+ if (parentObject !== undefined && fromSpeechConfig != null) {
14089
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
14090
+ }
14091
+ const fromEnableAffectiveDialog = getValueByPath(fromObject, [
14092
+ 'enableAffectiveDialog',
14093
+ ]);
14094
+ if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
14095
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
14096
+ }
14097
+ const fromSystemInstruction = getValueByPath(fromObject, [
14098
+ 'systemInstruction',
14099
+ ]);
14100
+ if (parentObject !== undefined && fromSystemInstruction != null) {
14101
+ setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
14102
+ }
14103
+ const fromTools = getValueByPath(fromObject, ['tools']);
14104
+ if (parentObject !== undefined && fromTools != null) {
14105
+ let transformedList = tTools(apiClient, fromTools);
14106
+ if (Array.isArray(transformedList)) {
14107
+ transformedList = transformedList.map((item) => {
14108
+ return toolToMldev(apiClient, tTool(apiClient, item));
14109
+ });
14110
+ }
14111
+ setValueByPath(parentObject, ['setup', 'tools'], transformedList);
14112
+ }
14113
+ const fromSessionResumption = getValueByPath(fromObject, [
14114
+ 'sessionResumption',
14115
+ ]);
14116
+ if (parentObject !== undefined && fromSessionResumption != null) {
14117
+ setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
14118
+ }
14119
+ const fromInputAudioTranscription = getValueByPath(fromObject, [
14120
+ 'inputAudioTranscription',
14121
+ ]);
14122
+ if (parentObject !== undefined && fromInputAudioTranscription != null) {
14123
+ setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
14124
+ }
14125
+ const fromOutputAudioTranscription = getValueByPath(fromObject, [
14126
+ 'outputAudioTranscription',
14127
+ ]);
14128
+ if (parentObject !== undefined && fromOutputAudioTranscription != null) {
14129
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
14130
+ }
14131
+ const fromRealtimeInputConfig = getValueByPath(fromObject, [
14132
+ 'realtimeInputConfig',
14133
+ ]);
14134
+ if (parentObject !== undefined && fromRealtimeInputConfig != null) {
14135
+ setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
14136
+ }
14137
+ const fromContextWindowCompression = getValueByPath(fromObject, [
14138
+ 'contextWindowCompression',
14139
+ ]);
14140
+ if (parentObject !== undefined && fromContextWindowCompression != null) {
14141
+ setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
14142
+ }
14143
+ const fromProactivity = getValueByPath(fromObject, ['proactivity']);
14144
+ if (parentObject !== undefined && fromProactivity != null) {
14145
+ setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
14146
+ }
14147
+ return toObject;
14148
+ }
14149
+ function liveConnectConstraintsToMldev(apiClient, fromObject) {
14150
+ const toObject = {};
14151
+ const fromModel = getValueByPath(fromObject, ['model']);
14152
+ if (fromModel != null) {
14153
+ setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
14154
+ }
14155
+ const fromConfig = getValueByPath(fromObject, ['config']);
14156
+ if (fromConfig != null) {
14157
+ setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
14158
+ }
14159
+ return toObject;
14160
+ }
14161
+ function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
14162
+ const toObject = {};
14163
+ const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
14164
+ if (parentObject !== undefined && fromExpireTime != null) {
14165
+ setValueByPath(parentObject, ['expireTime'], fromExpireTime);
14166
+ }
14167
+ const fromNewSessionExpireTime = getValueByPath(fromObject, [
14168
+ 'newSessionExpireTime',
14169
+ ]);
14170
+ if (parentObject !== undefined && fromNewSessionExpireTime != null) {
14171
+ setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
14172
+ }
14173
+ const fromUses = getValueByPath(fromObject, ['uses']);
14174
+ if (parentObject !== undefined && fromUses != null) {
14175
+ setValueByPath(parentObject, ['uses'], fromUses);
14176
+ }
14177
+ const fromLiveConnectConstraints = getValueByPath(fromObject, [
14178
+ 'liveConnectConstraints',
14179
+ ]);
14180
+ if (parentObject !== undefined && fromLiveConnectConstraints != null) {
14181
+ setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
14182
+ }
14183
+ const fromLockAdditionalFields = getValueByPath(fromObject, [
14184
+ 'lockAdditionalFields',
14185
+ ]);
14186
+ if (parentObject !== undefined && fromLockAdditionalFields != null) {
14187
+ setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
14188
+ }
14189
+ return toObject;
14190
+ }
14191
+ function createAuthTokenParametersToMldev(apiClient, fromObject) {
14192
+ const toObject = {};
14193
+ const fromConfig = getValueByPath(fromObject, ['config']);
14194
+ if (fromConfig != null) {
14195
+ setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
14196
+ }
14197
+ return toObject;
14198
+ }
14199
+ function authTokenFromMldev(apiClient, fromObject) {
14200
+ const toObject = {};
14201
+ const fromName = getValueByPath(fromObject, ['name']);
14202
+ if (fromName != null) {
14203
+ setValueByPath(toObject, ['name'], fromName);
14204
+ }
14205
+ return toObject;
14206
+ }
14207
+
14208
+ /**
14209
+ * @license
14210
+ * Copyright 2025 Google LLC
14211
+ * SPDX-License-Identifier: Apache-2.0
14212
+ */
14213
+ /**
14214
+ * Returns a comma-separated list of field masks from a given object.
14215
+ *
14216
+ * @param setup The object to extract field masks from.
14217
+ * @return A comma-separated list of field masks.
14218
+ */
14219
+ function getFieldMasks(setup) {
14220
+ const fields = [];
14221
+ for (const key in setup) {
14222
+ if (Object.prototype.hasOwnProperty.call(setup, key)) {
14223
+ const value = setup[key];
14224
+ // 2nd layer, recursively get field masks see TODO(b/418290100)
14225
+ if (typeof value === 'object' &&
14226
+ value != null &&
14227
+ Object.keys(value).length > 0) {
14228
+ const field = Object.keys(value).map((kk) => `${key}.${kk}`);
14229
+ fields.push(...field);
14230
+ }
14231
+ else {
14232
+ fields.push(key); // 1st layer
14233
+ }
14234
+ }
14235
+ }
14236
+ return fields.join(',');
14237
+ }
14238
+ /**
14239
+ * Converts bidiGenerateContentSetup.
14240
+ * @param requestDict - The request dictionary.
14241
+ * @param config - The configuration object.
14242
+ * @return - The modified request dictionary.
14243
+ */
14244
+ function convertBidiSetupToTokenSetup(requestDict, config) {
14245
+ // Convert bidiGenerateContentSetup from bidiGenerateContentSetup.setup.
14246
+ let setupForMaskGeneration = null;
14247
+ const bidiGenerateContentSetupValue = requestDict['bidiGenerateContentSetup'];
14248
+ if (typeof bidiGenerateContentSetupValue === 'object' &&
14249
+ bidiGenerateContentSetupValue !== null &&
14250
+ 'setup' in bidiGenerateContentSetupValue) {
14251
+ // Now we know bidiGenerateContentSetupValue is an object and has a 'setup'
14252
+ // property.
14253
+ const innerSetup = bidiGenerateContentSetupValue
14254
+ .setup;
14255
+ if (typeof innerSetup === 'object' && innerSetup !== null) {
14256
+ // Valid inner setup found.
14257
+ requestDict['bidiGenerateContentSetup'] = innerSetup;
14258
+ setupForMaskGeneration = innerSetup;
14259
+ }
14260
+ else {
14261
+ // `bidiGenerateContentSetupValue.setup` is not a valid object; treat as
14262
+ // if bidiGenerateContentSetup is invalid.
14263
+ delete requestDict['bidiGenerateContentSetup'];
14264
+ }
14265
+ }
14266
+ else if (bidiGenerateContentSetupValue !== undefined) {
14267
+ // `bidiGenerateContentSetup` exists but not in the expected
14268
+ // shape {setup: {...}}; treat as invalid.
14269
+ delete requestDict['bidiGenerateContentSetup'];
14270
+ }
14271
+ const preExistingFieldMask = requestDict['fieldMask'];
14272
+ // Handle mask generation setup.
14273
+ if (setupForMaskGeneration) {
14274
+ const generatedMaskFromBidi = getFieldMasks(setupForMaskGeneration);
14275
+ if (Array.isArray(config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
14276
+ (config === null || config === void 0 ? void 0 : config.lockAdditionalFields.length) === 0) {
14277
+ // Case 1: lockAdditionalFields is an empty array. Lock only fields from
14278
+ // bidi setup.
14279
+ if (generatedMaskFromBidi) {
14280
+ // Only assign if mask is not empty
14281
+ requestDict['fieldMask'] = generatedMaskFromBidi;
14282
+ }
14283
+ else {
14284
+ delete requestDict['fieldMask']; // If mask is empty, effectively no
14285
+ // specific fields locked by bidi
14286
+ }
14287
+ }
14288
+ else if ((config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
14289
+ config.lockAdditionalFields.length > 0 &&
14290
+ preExistingFieldMask !== null &&
14291
+ Array.isArray(preExistingFieldMask) &&
14292
+ preExistingFieldMask.length > 0) {
14293
+ // Case 2: Lock fields from bidi setup + additional fields
14294
+ // (preExistingFieldMask).
14295
+ const generationConfigFields = [
14296
+ 'temperature',
14297
+ 'topK',
14298
+ 'topP',
14299
+ 'maxOutputTokens',
14300
+ 'responseModalities',
14301
+ 'seed',
14302
+ 'speechConfig',
14303
+ ];
14304
+ let mappedFieldsFromPreExisting = [];
14305
+ if (preExistingFieldMask.length > 0) {
14306
+ mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
14307
+ if (generationConfigFields.includes(field)) {
14308
+ return `generationConfig.${field}`;
14309
+ }
14310
+ return field; // Keep original field name if not in
14311
+ // generationConfigFields
14312
+ });
14313
+ }
14314
+ const finalMaskParts = [];
14315
+ if (generatedMaskFromBidi) {
14316
+ finalMaskParts.push(generatedMaskFromBidi);
14317
+ }
14318
+ if (mappedFieldsFromPreExisting.length > 0) {
14319
+ finalMaskParts.push(...mappedFieldsFromPreExisting);
14320
+ }
14321
+ if (finalMaskParts.length > 0) {
14322
+ requestDict['fieldMask'] = finalMaskParts.join(',');
14323
+ }
14324
+ else {
14325
+ // If no fields from bidi and no valid additional fields from
14326
+ // pre-existing mask.
14327
+ delete requestDict['fieldMask'];
14328
+ }
14329
+ }
14330
+ else {
14331
+ // Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
14332
+ // defaults apply or all are mutable). This is hit if:
14333
+ // - `config.lockAdditionalFields` is undefined.
14334
+ // - `config.lockAdditionalFields` is non-empty, BUT
14335
+ // `preExistingFieldMask` is null, not a string, or an empty string.
14336
+ delete requestDict['fieldMask'];
14337
+ }
14338
+ }
14339
+ else {
14340
+ // No valid `bidiGenerateContentSetup` was found or extracted.
14341
+ // "Lock additional null fields if any".
14342
+ if (preExistingFieldMask !== null &&
14343
+ Array.isArray(preExistingFieldMask) &&
14344
+ preExistingFieldMask.length > 0) {
14345
+ // If there's a pre-existing field mask, it's a string, and it's not
14346
+ // empty, then we should lock all fields.
14347
+ requestDict['fieldMask'] = preExistingFieldMask.join(',');
14348
+ }
14349
+ else {
14350
+ delete requestDict['fieldMask'];
14351
+ }
14352
+ }
14353
+ return requestDict;
14354
+ }
14355
+ class Tokens extends BaseModule {
14356
+ constructor(apiClient) {
14357
+ super();
14358
+ this.apiClient = apiClient;
14359
+ }
14360
+ /**
14361
+ * Creates an ephemeral auth token resource.
14362
+ *
14363
+ * @experimental
14364
+ *
14365
+ * @remarks
14366
+ * Ephermeral auth tokens is only supported in the Gemini Developer API.
14367
+ * It can be used for the session connection to the Live constrained API.
14368
+ *
14369
+ * @param params - The parameters for the create request.
14370
+ * @return The created auth token.
14371
+ *
14372
+ * @example
14373
+ * ```ts
14374
+ * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
14375
+ * // when using the token in Live API sessions. Each session connection can
14376
+ * // use a different configuration.
14377
+ * const config: CreateAuthTokenConfig = {
14378
+ * uses: 3,
14379
+ * expireTime: '2025-05-01T00:00:00Z',
14380
+ * }
14381
+ * const token = await ai.tokens.create(config);
14382
+ *
14383
+ * // Case 2: If LiveEphemeralParameters is set, lock all fields in
14384
+ * // LiveConnectConfig when using the token in Live API sessions. For
14385
+ * // example, changing `outputAudioTranscription` in the Live API
14386
+ * // connection will be ignored by the API.
14387
+ * const config: CreateAuthTokenConfig =
14388
+ * uses: 3,
14389
+ * expireTime: '2025-05-01T00:00:00Z',
14390
+ * LiveEphemeralParameters: {
14391
+ * model: 'gemini-2.0-flash-001',
14392
+ * config: {
14393
+ * 'responseModalities': ['AUDIO'],
14394
+ * 'systemInstruction': 'Always answer in English.',
14395
+ * }
14396
+ * }
14397
+ * }
14398
+ * const token = await ai.tokens.create(config);
14399
+ *
14400
+ * // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
14401
+ * // set, lock LiveConnectConfig with set and additional fields (e.g.
14402
+ * // responseModalities, systemInstruction, temperature in this example) when
14403
+ * // using the token in Live API sessions.
14404
+ * const config: CreateAuthTokenConfig =
14405
+ * uses: 3,
14406
+ * expireTime: '2025-05-01T00:00:00Z',
14407
+ * LiveEphemeralParameters: {
14408
+ * model: 'gemini-2.0-flash-001',
14409
+ * config: {
14410
+ * 'responseModalities': ['AUDIO'],
14411
+ * 'systemInstruction': 'Always answer in English.',
14412
+ * }
14413
+ * },
14414
+ * lockAdditionalFields: ['temperature'],
14415
+ * }
14416
+ * const token = await ai.tokens.create(config);
14417
+ *
14418
+ * // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
14419
+ * // empty array, lock LiveConnectConfig with set fields (e.g.
14420
+ * // responseModalities, systemInstruction in this example) when using the
14421
+ * // token in Live API sessions.
14422
+ * const config: CreateAuthTokenConfig =
14423
+ * uses: 3,
14424
+ * expireTime: '2025-05-01T00:00:00Z',
14425
+ * LiveEphemeralParameters: {
14426
+ * model: 'gemini-2.0-flash-001',
14427
+ * config: {
14428
+ * 'responseModalities': ['AUDIO'],
14429
+ * 'systemInstruction': 'Always answer in English.',
14430
+ * }
14431
+ * },
14432
+ * lockAdditionalFields: [],
14433
+ * }
14434
+ * const token = await ai.tokens.create(config);
14435
+ * ```
14436
+ */
14437
+ async create(params) {
14438
+ var _a, _b;
14439
+ let response;
14440
+ let path = '';
14441
+ let queryParams = {};
14442
+ if (this.apiClient.isVertexAI()) {
14443
+ throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
14444
+ }
14445
+ else {
14446
+ const body = createAuthTokenParametersToMldev(this.apiClient, params);
14447
+ path = formatMap('auth_tokens', body['_url']);
14448
+ queryParams = body['_query'];
14449
+ delete body['config'];
14450
+ delete body['_url'];
14451
+ delete body['_query'];
14452
+ const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
14453
+ response = this.apiClient
14454
+ .request({
14455
+ path: path,
14456
+ queryParams: queryParams,
14457
+ body: JSON.stringify(transformedBody),
14458
+ httpMethod: 'POST',
14459
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
14460
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
14461
+ })
14462
+ .then((httpResponse) => {
14463
+ return httpResponse.json();
14464
+ });
14465
+ return response.then((apiResponse) => {
14466
+ const resp = authTokenFromMldev(this.apiClient, apiResponse);
14467
+ return resp;
14468
+ });
14469
+ }
14470
+ }
14471
+ }
14472
+
14473
+ /**
14474
+ * @license
14475
+ * Copyright 2025 Google LLC
14476
+ * SPDX-License-Identifier: Apache-2.0
14477
+ */
14478
+ const GOOGLE_API_KEY_HEADER = 'x-goog-api-key';
14479
+ const REQUIRED_VERTEX_AI_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
14480
+ class NodeAuth {
14481
+ constructor(opts) {
14482
+ if (opts.apiKey !== undefined) {
14483
+ this.apiKey = opts.apiKey;
14484
+ return;
14485
+ }
14486
+ const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
14487
+ this.googleAuth = new googleAuthLibrary.GoogleAuth(vertexAuthOptions);
14488
+ }
14489
+ async addAuthHeaders(headers) {
14490
+ if (this.apiKey !== undefined) {
14491
+ if (this.apiKey.startsWith('auth_tokens/')) {
14492
+ throw new Error('Ephemeral tokens are only supported by the live API.');
14493
+ }
13618
14494
  this.addKeyHeader(headers);
13619
14495
  return;
13620
14496
  }
@@ -14923,6 +15799,7 @@ class GoogleGenAI {
14923
15799
  this.caches = new Caches(this.apiClient);
14924
15800
  this.files = new Files(this.apiClient);
14925
15801
  this.operations = new Operations(this.apiClient);
15802
+ this.authTokens = new Tokens(this.apiClient);
14926
15803
  this.tunings = new Tunings(this.apiClient);
14927
15804
  }
14928
15805
  }
@@ -14979,6 +15856,7 @@ exports.ReplayResponse = ReplayResponse;
14979
15856
  exports.Session = Session;
14980
15857
  exports.StyleReferenceImage = StyleReferenceImage;
14981
15858
  exports.SubjectReferenceImage = SubjectReferenceImage;
15859
+ exports.Tokens = Tokens;
14982
15860
  exports.UpscaleImageResponse = UpscaleImageResponse;
14983
15861
  exports.createModelContent = createModelContent;
14984
15862
  exports.createPartFromBase64 = createPartFromBase64;