@google/genai 1.49.0 → 1.50.1

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.
@@ -1213,6 +1213,10 @@ var Modality;
1213
1213
  * Indicates the model should return audio.
1214
1214
  */
1215
1215
  Modality["AUDIO"] = "AUDIO";
1216
+ /**
1217
+ * Indicates the model should return video.
1218
+ */
1219
+ Modality["VIDEO"] = "VIDEO";
1216
1220
  })(Modality || (Modality = {}));
1217
1221
  /** The stage of the underlying model. This enum is not supported in Vertex AI. */
1218
1222
  var ModelStage;
@@ -1807,6 +1811,102 @@ var TurnCompleteReason;
1807
1811
  * Needs more input from the user.
1808
1812
  */
1809
1813
  TurnCompleteReason["NEED_MORE_INPUT"] = "NEED_MORE_INPUT";
1814
+ /**
1815
+ * Input content is prohibited.
1816
+ */
1817
+ TurnCompleteReason["PROHIBITED_INPUT_CONTENT"] = "PROHIBITED_INPUT_CONTENT";
1818
+ /**
1819
+ * Input image contains prohibited content.
1820
+ */
1821
+ TurnCompleteReason["IMAGE_PROHIBITED_INPUT_CONTENT"] = "IMAGE_PROHIBITED_INPUT_CONTENT";
1822
+ /**
1823
+ * Input text contains prominent person reference.
1824
+ */
1825
+ TurnCompleteReason["INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED"] = "INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED";
1826
+ /**
1827
+ * Input image contains celebrity.
1828
+ */
1829
+ TurnCompleteReason["INPUT_IMAGE_CELEBRITY"] = "INPUT_IMAGE_CELEBRITY";
1830
+ /**
1831
+ * Input image contains photo realistic child.
1832
+ */
1833
+ TurnCompleteReason["INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED"] = "INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED";
1834
+ /**
1835
+ * Input text contains NCII content.
1836
+ */
1837
+ TurnCompleteReason["INPUT_TEXT_NCII_PROHIBITED"] = "INPUT_TEXT_NCII_PROHIBITED";
1838
+ /**
1839
+ * Other input safety issue.
1840
+ */
1841
+ TurnCompleteReason["INPUT_OTHER"] = "INPUT_OTHER";
1842
+ /**
1843
+ * Input contains IP violation.
1844
+ */
1845
+ TurnCompleteReason["INPUT_IP_PROHIBITED"] = "INPUT_IP_PROHIBITED";
1846
+ /**
1847
+ * Input matched blocklist.
1848
+ */
1849
+ TurnCompleteReason["BLOCKLIST"] = "BLOCKLIST";
1850
+ /**
1851
+ * Input is unsafe for image generation.
1852
+ */
1853
+ TurnCompleteReason["UNSAFE_PROMPT_FOR_IMAGE_GENERATION"] = "UNSAFE_PROMPT_FOR_IMAGE_GENERATION";
1854
+ /**
1855
+ * Generated image failed safety check.
1856
+ */
1857
+ TurnCompleteReason["GENERATED_IMAGE_SAFETY"] = "GENERATED_IMAGE_SAFETY";
1858
+ /**
1859
+ * Generated content failed safety check.
1860
+ */
1861
+ TurnCompleteReason["GENERATED_CONTENT_SAFETY"] = "GENERATED_CONTENT_SAFETY";
1862
+ /**
1863
+ * Generated audio failed safety check.
1864
+ */
1865
+ TurnCompleteReason["GENERATED_AUDIO_SAFETY"] = "GENERATED_AUDIO_SAFETY";
1866
+ /**
1867
+ * Generated video failed safety check.
1868
+ */
1869
+ TurnCompleteReason["GENERATED_VIDEO_SAFETY"] = "GENERATED_VIDEO_SAFETY";
1870
+ /**
1871
+ * Generated content is prohibited.
1872
+ */
1873
+ TurnCompleteReason["GENERATED_CONTENT_PROHIBITED"] = "GENERATED_CONTENT_PROHIBITED";
1874
+ /**
1875
+ * Generated content matched blocklist.
1876
+ */
1877
+ TurnCompleteReason["GENERATED_CONTENT_BLOCKLIST"] = "GENERATED_CONTENT_BLOCKLIST";
1878
+ /**
1879
+ * Generated image is prohibited.
1880
+ */
1881
+ TurnCompleteReason["GENERATED_IMAGE_PROHIBITED"] = "GENERATED_IMAGE_PROHIBITED";
1882
+ /**
1883
+ * Generated image contains celebrity.
1884
+ */
1885
+ TurnCompleteReason["GENERATED_IMAGE_CELEBRITY"] = "GENERATED_IMAGE_CELEBRITY";
1886
+ /**
1887
+ * Generated image contains prominent people detected by rewriter.
1888
+ */
1889
+ TurnCompleteReason["GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER"] = "GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER";
1890
+ /**
1891
+ * Generated image contains identifiable people.
1892
+ */
1893
+ TurnCompleteReason["GENERATED_IMAGE_IDENTIFIABLE_PEOPLE"] = "GENERATED_IMAGE_IDENTIFIABLE_PEOPLE";
1894
+ /**
1895
+ * Generated image contains minors.
1896
+ */
1897
+ TurnCompleteReason["GENERATED_IMAGE_MINORS"] = "GENERATED_IMAGE_MINORS";
1898
+ /**
1899
+ * Generated image contains IP violation.
1900
+ */
1901
+ TurnCompleteReason["OUTPUT_IMAGE_IP_PROHIBITED"] = "OUTPUT_IMAGE_IP_PROHIBITED";
1902
+ /**
1903
+ * Other generated content issue.
1904
+ */
1905
+ TurnCompleteReason["GENERATED_OTHER"] = "GENERATED_OTHER";
1906
+ /**
1907
+ * Max regeneration attempts reached.
1908
+ */
1909
+ TurnCompleteReason["MAX_REGENERATION_REACHED"] = "MAX_REGENERATION_REACHED";
1810
1910
  })(TurnCompleteReason || (TurnCompleteReason = {}));
1811
1911
  /** Server content modalities. */
1812
1912
  var MediaModality;
@@ -4052,6 +4152,12 @@ function createBatchJobConfigToMldev(fromObject, parentObject) {
4052
4152
  if (getValueByPath(fromObject, ['dest']) !== undefined) {
4053
4153
  throw new Error('dest parameter is not supported in Gemini API.');
4054
4154
  }
4155
+ const fromWebhookConfig = getValueByPath(fromObject, [
4156
+ 'webhookConfig',
4157
+ ]);
4158
+ if (parentObject !== undefined && fromWebhookConfig != null) {
4159
+ setValueByPath(parentObject, ['batch', 'webhookConfig'], fromWebhookConfig);
4160
+ }
4055
4161
  return toObject;
4056
4162
  }
4057
4163
  function createBatchJobConfigToVertex(fromObject, parentObject) {
@@ -4064,6 +4170,9 @@ function createBatchJobConfigToVertex(fromObject, parentObject) {
4064
4170
  if (parentObject !== undefined && fromDest != null) {
4065
4171
  setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
4066
4172
  }
4173
+ if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
4174
+ throw new Error('webhookConfig parameter is not supported in Vertex AI.');
4175
+ }
4067
4176
  return toObject;
4068
4177
  }
4069
4178
  function createBatchJobParametersToMldev(apiClient, fromObject) {
@@ -4223,6 +4332,12 @@ function embedContentConfigToMldev$1(fromObject, parentObject) {
4223
4332
  if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
4224
4333
  throw new Error('autoTruncate parameter is not supported in Gemini API.');
4225
4334
  }
4335
+ if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
4336
+ throw new Error('documentOcr parameter is not supported in Gemini API.');
4337
+ }
4338
+ if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
4339
+ throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
4340
+ }
4226
4341
  return toObject;
4227
4342
  }
4228
4343
  function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
@@ -4389,7 +4504,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4389
4504
  let transformedList = fromSafetySettings;
4390
4505
  if (Array.isArray(transformedList)) {
4391
4506
  transformedList = transformedList.map((item) => {
4392
- return safetySettingToMldev$1(item);
4507
+ return safetySettingToMldev$3(item);
4393
4508
  });
4394
4509
  }
4395
4510
  setValueByPath(parentObject, ['safetySettings'], transformedList);
@@ -4796,7 +4911,7 @@ function partToMldev$4(fromObject) {
4796
4911
  }
4797
4912
  return toObject;
4798
4913
  }
4799
- function safetySettingToMldev$1(fromObject) {
4914
+ function safetySettingToMldev$3(fromObject) {
4800
4915
  const toObject = {};
4801
4916
  const fromCategory = getValueByPath(fromObject, ['category']);
4802
4917
  if (fromCategory != null) {
@@ -7914,7 +8029,7 @@ function generationConfigToVertex$1(fromObject) {
7914
8029
  }
7915
8030
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
7916
8031
  if (fromSpeechConfig != null) {
7917
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex$1(fromSpeechConfig));
8032
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
7918
8033
  }
7919
8034
  const fromStopSequences = getValueByPath(fromObject, [
7920
8035
  'stopSequences',
@@ -8089,6 +8204,22 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
8089
8204
  if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
8090
8205
  throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
8091
8206
  }
8207
+ const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
8208
+ if (parentObject !== undefined && fromAvatarConfig != null) {
8209
+ setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
8210
+ }
8211
+ const fromSafetySettings = getValueByPath(fromObject, [
8212
+ 'safetySettings',
8213
+ ]);
8214
+ if (parentObject !== undefined && fromSafetySettings != null) {
8215
+ let transformedList = fromSafetySettings;
8216
+ if (Array.isArray(transformedList)) {
8217
+ transformedList = transformedList.map((item) => {
8218
+ return safetySettingToMldev$2(item);
8219
+ });
8220
+ }
8221
+ setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
8222
+ }
8092
8223
  return toObject;
8093
8224
  }
8094
8225
  function liveConnectConfigToVertex(fromObject, parentObject) {
@@ -8135,7 +8266,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
8135
8266
  }
8136
8267
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
8137
8268
  if (parentObject !== undefined && fromSpeechConfig != null) {
8138
- setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToVertex$1(tLiveSpeechConfig(fromSpeechConfig)));
8269
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
8139
8270
  }
8140
8271
  const fromThinkingConfig = getValueByPath(fromObject, [
8141
8272
  'thinkingConfig',
@@ -8205,6 +8336,22 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
8205
8336
  if (parentObject !== undefined && fromExplicitVadSignal != null) {
8206
8337
  setValueByPath(parentObject, ['setup', 'explicitVadSignal'], fromExplicitVadSignal);
8207
8338
  }
8339
+ const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
8340
+ if (parentObject !== undefined && fromAvatarConfig != null) {
8341
+ setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
8342
+ }
8343
+ const fromSafetySettings = getValueByPath(fromObject, [
8344
+ 'safetySettings',
8345
+ ]);
8346
+ if (parentObject !== undefined && fromSafetySettings != null) {
8347
+ let transformedList = fromSafetySettings;
8348
+ if (Array.isArray(transformedList)) {
8349
+ transformedList = transformedList.map((item) => {
8350
+ return item;
8351
+ });
8352
+ }
8353
+ setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
8354
+ }
8208
8355
  return toObject;
8209
8356
  }
8210
8357
  function liveConnectParametersToMldev(apiClient, fromObject) {
@@ -8395,22 +8542,6 @@ function liveServerMessageFromVertex(fromObject) {
8395
8542
  }
8396
8543
  return toObject;
8397
8544
  }
8398
- function multiSpeakerVoiceConfigToVertex$1(fromObject) {
8399
- const toObject = {};
8400
- const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
8401
- 'speakerVoiceConfigs',
8402
- ]);
8403
- if (fromSpeakerVoiceConfigs != null) {
8404
- let transformedList = fromSpeakerVoiceConfigs;
8405
- if (Array.isArray(transformedList)) {
8406
- transformedList = transformedList.map((item) => {
8407
- return speakerVoiceConfigToVertex$1(item);
8408
- });
8409
- }
8410
- setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
8411
- }
8412
- return toObject;
8413
- }
8414
8545
  function partToMldev$2(fromObject) {
8415
8546
  const toObject = {};
8416
8547
  const fromMediaResolution = getValueByPath(fromObject, [
@@ -8552,17 +8683,18 @@ function partToVertex$1(fromObject) {
8552
8683
  }
8553
8684
  return toObject;
8554
8685
  }
8555
- function replicatedVoiceConfigToVertex$1(fromObject) {
8686
+ function safetySettingToMldev$2(fromObject) {
8556
8687
  const toObject = {};
8557
- const fromMimeType = getValueByPath(fromObject, ['mimeType']);
8558
- if (fromMimeType != null) {
8559
- setValueByPath(toObject, ['mimeType'], fromMimeType);
8688
+ const fromCategory = getValueByPath(fromObject, ['category']);
8689
+ if (fromCategory != null) {
8690
+ setValueByPath(toObject, ['category'], fromCategory);
8560
8691
  }
8561
- const fromVoiceSampleAudio = getValueByPath(fromObject, [
8562
- 'voiceSampleAudio',
8563
- ]);
8564
- if (fromVoiceSampleAudio != null) {
8565
- setValueByPath(toObject, ['voiceSampleAudio'], fromVoiceSampleAudio);
8692
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
8693
+ throw new Error('method parameter is not supported in Gemini API.');
8694
+ }
8695
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
8696
+ if (fromThreshold != null) {
8697
+ setValueByPath(toObject, ['threshold'], fromThreshold);
8566
8698
  }
8567
8699
  return toObject;
8568
8700
  }
@@ -8577,36 +8709,6 @@ function sessionResumptionConfigToMldev$1(fromObject) {
8577
8709
  }
8578
8710
  return toObject;
8579
8711
  }
8580
- function speakerVoiceConfigToVertex$1(fromObject) {
8581
- const toObject = {};
8582
- const fromSpeaker = getValueByPath(fromObject, ['speaker']);
8583
- if (fromSpeaker != null) {
8584
- setValueByPath(toObject, ['speaker'], fromSpeaker);
8585
- }
8586
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
8587
- if (fromVoiceConfig != null) {
8588
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex$1(fromVoiceConfig));
8589
- }
8590
- return toObject;
8591
- }
8592
- function speechConfigToVertex$1(fromObject) {
8593
- const toObject = {};
8594
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
8595
- if (fromVoiceConfig != null) {
8596
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex$1(fromVoiceConfig));
8597
- }
8598
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
8599
- if (fromLanguageCode != null) {
8600
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
8601
- }
8602
- const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
8603
- 'multiSpeakerVoiceConfig',
8604
- ]);
8605
- if (fromMultiSpeakerVoiceConfig != null) {
8606
- setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToVertex$1(fromMultiSpeakerVoiceConfig));
8607
- }
8608
- return toObject;
8609
- }
8610
8712
  function toolToMldev$2(fromObject) {
8611
8713
  const toObject = {};
8612
8714
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
@@ -8840,22 +8942,6 @@ function voiceActivityFromVertex(fromObject) {
8840
8942
  }
8841
8943
  return toObject;
8842
8944
  }
8843
- function voiceConfigToVertex$1(fromObject) {
8844
- const toObject = {};
8845
- const fromReplicatedVoiceConfig = getValueByPath(fromObject, [
8846
- 'replicatedVoiceConfig',
8847
- ]);
8848
- if (fromReplicatedVoiceConfig != null) {
8849
- setValueByPath(toObject, ['replicatedVoiceConfig'], replicatedVoiceConfigToVertex$1(fromReplicatedVoiceConfig));
8850
- }
8851
- const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
8852
- 'prebuiltVoiceConfig',
8853
- ]);
8854
- if (fromPrebuiltVoiceConfig != null) {
8855
- setValueByPath(toObject, ['prebuiltVoiceConfig'], fromPrebuiltVoiceConfig);
8856
- }
8857
- return toObject;
8858
- }
8859
8945
 
8860
8946
  /**
8861
8947
  * @license
@@ -9405,6 +9491,12 @@ function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
9405
9491
  if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
9406
9492
  throw new Error('autoTruncate parameter is not supported in Gemini API.');
9407
9493
  }
9494
+ if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
9495
+ throw new Error('documentOcr parameter is not supported in Gemini API.');
9496
+ }
9497
+ if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
9498
+ throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
9499
+ }
9408
9500
  return toObject;
9409
9501
  }
9410
9502
  function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
@@ -9424,7 +9516,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
9424
9516
  else if (discriminatorTaskType === 'EMBED_CONTENT') {
9425
9517
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
9426
9518
  if (parentObject !== undefined && fromTaskType != null) {
9427
- setValueByPath(parentObject, ['taskType'], fromTaskType);
9519
+ setValueByPath(parentObject, ['embedContentConfig', 'taskType'], fromTaskType);
9428
9520
  }
9429
9521
  }
9430
9522
  let discriminatorTitle = getValueByPath(rootObject, [
@@ -9442,7 +9534,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
9442
9534
  else if (discriminatorTitle === 'EMBED_CONTENT') {
9443
9535
  const fromTitle = getValueByPath(fromObject, ['title']);
9444
9536
  if (parentObject !== undefined && fromTitle != null) {
9445
- setValueByPath(parentObject, ['title'], fromTitle);
9537
+ setValueByPath(parentObject, ['embedContentConfig', 'title'], fromTitle);
9446
9538
  }
9447
9539
  }
9448
9540
  let discriminatorOutputDimensionality = getValueByPath(rootObject, [
@@ -9464,7 +9556,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
9464
9556
  'outputDimensionality',
9465
9557
  ]);
9466
9558
  if (parentObject !== undefined && fromOutputDimensionality != null) {
9467
- setValueByPath(parentObject, ['outputDimensionality'], fromOutputDimensionality);
9559
+ setValueByPath(parentObject, ['embedContentConfig', 'outputDimensionality'], fromOutputDimensionality);
9468
9560
  }
9469
9561
  }
9470
9562
  let discriminatorMimeType = getValueByPath(rootObject, [
@@ -9498,7 +9590,33 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
9498
9590
  'autoTruncate',
9499
9591
  ]);
9500
9592
  if (parentObject !== undefined && fromAutoTruncate != null) {
9501
- setValueByPath(parentObject, ['autoTruncate'], fromAutoTruncate);
9593
+ setValueByPath(parentObject, ['embedContentConfig', 'autoTruncate'], fromAutoTruncate);
9594
+ }
9595
+ }
9596
+ let discriminatorDocumentOcr = getValueByPath(rootObject, [
9597
+ 'embeddingApiType',
9598
+ ]);
9599
+ if (discriminatorDocumentOcr === undefined) {
9600
+ discriminatorDocumentOcr = 'PREDICT';
9601
+ }
9602
+ if (discriminatorDocumentOcr === 'EMBED_CONTENT') {
9603
+ const fromDocumentOcr = getValueByPath(fromObject, ['documentOcr']);
9604
+ if (parentObject !== undefined && fromDocumentOcr != null) {
9605
+ setValueByPath(parentObject, ['embedContentConfig', 'documentOcr'], fromDocumentOcr);
9606
+ }
9607
+ }
9608
+ let discriminatorAudioTrackExtraction = getValueByPath(rootObject, [
9609
+ 'embeddingApiType',
9610
+ ]);
9611
+ if (discriminatorAudioTrackExtraction === undefined) {
9612
+ discriminatorAudioTrackExtraction = 'PREDICT';
9613
+ }
9614
+ if (discriminatorAudioTrackExtraction === 'EMBED_CONTENT') {
9615
+ const fromAudioTrackExtraction = getValueByPath(fromObject, [
9616
+ 'audioTrackExtraction',
9617
+ ]);
9618
+ if (parentObject !== undefined && fromAudioTrackExtraction != null) {
9619
+ setValueByPath(parentObject, ['embedContentConfig', 'audioTrackExtraction'], fromAudioTrackExtraction);
9502
9620
  }
9503
9621
  }
9504
9622
  return toObject;
@@ -9843,7 +9961,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootO
9843
9961
  let transformedList = fromSafetySettings;
9844
9962
  if (Array.isArray(transformedList)) {
9845
9963
  transformedList = transformedList.map((item) => {
9846
- return safetySettingToMldev(item);
9964
+ return safetySettingToMldev$1(item);
9847
9965
  });
9848
9966
  }
9849
9967
  setValueByPath(parentObject, ['safetySettings'], transformedList);
@@ -10059,7 +10177,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
10059
10177
  }
10060
10178
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
10061
10179
  if (fromSpeechConfig != null) {
10062
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(tSpeechConfig(fromSpeechConfig)));
10180
+ setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
10063
10181
  }
10064
10182
  const fromAudioTimestamp = getValueByPath(fromObject, [
10065
10183
  'audioTimestamp',
@@ -10567,6 +10685,12 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
10567
10685
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
10568
10686
  throw new Error('labels parameter is not supported in Gemini API.');
10569
10687
  }
10688
+ const fromWebhookConfig = getValueByPath(fromObject, [
10689
+ 'webhookConfig',
10690
+ ]);
10691
+ if (parentObject !== undefined && fromWebhookConfig != null) {
10692
+ setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
10693
+ }
10570
10694
  return toObject;
10571
10695
  }
10572
10696
  function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
@@ -10661,6 +10785,9 @@ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
10661
10785
  if (parentObject !== undefined && fromLabels != null) {
10662
10786
  setValueByPath(parentObject, ['labels'], fromLabels);
10663
10787
  }
10788
+ if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
10789
+ throw new Error('webhookConfig parameter is not supported in Vertex AI.');
10790
+ }
10664
10791
  return toObject;
10665
10792
  }
10666
10793
  function generateVideosOperationFromMldev(fromObject, rootObject) {
@@ -10930,7 +11057,7 @@ function generatedVideoFromVertex(fromObject, rootObject) {
10930
11057
  }
10931
11058
  return toObject;
10932
11059
  }
10933
- function generationConfigToVertex(fromObject, rootObject) {
11060
+ function generationConfigToVertex(fromObject, _rootObject) {
10934
11061
  const toObject = {};
10935
11062
  const fromModelSelectionConfig = getValueByPath(fromObject, [
10936
11063
  'modelSelectionConfig',
@@ -11026,7 +11153,7 @@ function generationConfigToVertex(fromObject, rootObject) {
11026
11153
  }
11027
11154
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
11028
11155
  if (fromSpeechConfig != null) {
11029
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(fromSpeechConfig));
11156
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
11030
11157
  }
11031
11158
  const fromStopSequences = getValueByPath(fromObject, [
11032
11159
  'stopSequences',
@@ -11483,22 +11610,6 @@ function modelFromVertex(fromObject, rootObject) {
11483
11610
  }
11484
11611
  return toObject;
11485
11612
  }
11486
- function multiSpeakerVoiceConfigToVertex(fromObject, rootObject) {
11487
- const toObject = {};
11488
- const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
11489
- 'speakerVoiceConfigs',
11490
- ]);
11491
- if (fromSpeakerVoiceConfigs != null) {
11492
- let transformedList = fromSpeakerVoiceConfigs;
11493
- if (Array.isArray(transformedList)) {
11494
- transformedList = transformedList.map((item) => {
11495
- return speakerVoiceConfigToVertex(item);
11496
- });
11497
- }
11498
- setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
11499
- }
11500
- return toObject;
11501
- }
11502
11613
  function partToMldev$1(fromObject, rootObject) {
11503
11614
  const toObject = {};
11504
11615
  const fromMediaResolution = getValueByPath(fromObject, [
@@ -11808,20 +11919,6 @@ function referenceImageAPIInternalToVertex(fromObject, rootObject) {
11808
11919
  }
11809
11920
  return toObject;
11810
11921
  }
11811
- function replicatedVoiceConfigToVertex(fromObject, _rootObject) {
11812
- const toObject = {};
11813
- const fromMimeType = getValueByPath(fromObject, ['mimeType']);
11814
- if (fromMimeType != null) {
11815
- setValueByPath(toObject, ['mimeType'], fromMimeType);
11816
- }
11817
- const fromVoiceSampleAudio = getValueByPath(fromObject, [
11818
- 'voiceSampleAudio',
11819
- ]);
11820
- if (fromVoiceSampleAudio != null) {
11821
- setValueByPath(toObject, ['voiceSampleAudio'], fromVoiceSampleAudio);
11822
- }
11823
- return toObject;
11824
- }
11825
11922
  function safetyAttributesFromMldev(fromObject, _rootObject) {
11826
11923
  const toObject = {};
11827
11924
  const fromCategories = getValueByPath(fromObject, [
@@ -11866,7 +11963,7 @@ function safetyAttributesFromVertex(fromObject, _rootObject) {
11866
11963
  }
11867
11964
  return toObject;
11868
11965
  }
11869
- function safetySettingToMldev(fromObject, _rootObject) {
11966
+ function safetySettingToMldev$1(fromObject, _rootObject) {
11870
11967
  const toObject = {};
11871
11968
  const fromCategory = getValueByPath(fromObject, ['category']);
11872
11969
  if (fromCategory != null) {
@@ -11971,36 +12068,6 @@ function segmentImageSourceToVertex(fromObject, parentObject, rootObject) {
11971
12068
  }
11972
12069
  return toObject;
11973
12070
  }
11974
- function speakerVoiceConfigToVertex(fromObject, rootObject) {
11975
- const toObject = {};
11976
- const fromSpeaker = getValueByPath(fromObject, ['speaker']);
11977
- if (fromSpeaker != null) {
11978
- setValueByPath(toObject, ['speaker'], fromSpeaker);
11979
- }
11980
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
11981
- if (fromVoiceConfig != null) {
11982
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(fromVoiceConfig));
11983
- }
11984
- return toObject;
11985
- }
11986
- function speechConfigToVertex(fromObject, rootObject) {
11987
- const toObject = {};
11988
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
11989
- if (fromVoiceConfig != null) {
11990
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(fromVoiceConfig));
11991
- }
11992
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
11993
- if (fromLanguageCode != null) {
11994
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
11995
- }
11996
- const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
11997
- 'multiSpeakerVoiceConfig',
11998
- ]);
11999
- if (fromMultiSpeakerVoiceConfig != null) {
12000
- setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToVertex(fromMultiSpeakerVoiceConfig));
12001
- }
12002
- return toObject;
12003
- }
12004
12071
  function toolConfigToMldev(fromObject, rootObject) {
12005
12072
  const toObject = {};
12006
12073
  const fromRetrievalConfig = getValueByPath(fromObject, [
@@ -12483,22 +12550,6 @@ function videoToVertex(fromObject, _rootObject) {
12483
12550
  }
12484
12551
  return toObject;
12485
12552
  }
12486
- function voiceConfigToVertex(fromObject, rootObject) {
12487
- const toObject = {};
12488
- const fromReplicatedVoiceConfig = getValueByPath(fromObject, [
12489
- 'replicatedVoiceConfig',
12490
- ]);
12491
- if (fromReplicatedVoiceConfig != null) {
12492
- setValueByPath(toObject, ['replicatedVoiceConfig'], replicatedVoiceConfigToVertex(fromReplicatedVoiceConfig));
12493
- }
12494
- const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
12495
- 'prebuiltVoiceConfig',
12496
- ]);
12497
- if (fromPrebuiltVoiceConfig != null) {
12498
- setValueByPath(toObject, ['prebuiltVoiceConfig'], fromPrebuiltVoiceConfig);
12499
- }
12500
- return toObject;
12501
- }
12502
12553
 
12503
12554
  /**
12504
12555
  * @license
@@ -12744,10 +12795,11 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
12744
12795
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
12745
12796
  const USER_AGENT_HEADER = 'User-Agent';
12746
12797
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
12747
- const SDK_VERSION = '1.49.0'; // x-release-please-version
12798
+ const SDK_VERSION = '1.50.1'; // x-release-please-version
12748
12799
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
12749
12800
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
12750
12801
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
12802
+ const MULTI_REGIONAL_LOCATIONS = new Set(['us', 'eu']);
12751
12803
  // Default retry options.
12752
12804
  // The config is based on https://cloud.google.com/storage/docs/retry-strategy.
12753
12805
  const DEFAULT_RETRY_ATTEMPTS = 5; // Including the initial call
@@ -12806,7 +12858,7 @@ class ApiClient {
12806
12858
  }
12807
12859
  else if (this.clientOptions.project &&
12808
12860
  this.clientOptions.location &&
12809
- this.clientOptions.location === 'us') {
12861
+ MULTI_REGIONAL_LOCATIONS.has(this.clientOptions.location)) {
12810
12862
  initHttpOptions.baseUrl = `https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`;
12811
12863
  }
12812
12864
  else if (this.clientOptions.project && this.clientOptions.location) {
@@ -14373,6 +14425,10 @@ class Models extends BaseModule {
14373
14425
  */
14374
14426
  this.embedContent = async (params) => {
14375
14427
  if (!this.apiClient.isVertexAI()) {
14428
+ const isGeminiEmbedding2Model = params.model.includes('gemini-embedding-2');
14429
+ if (isGeminiEmbedding2Model) {
14430
+ params.contents = tContents(params.contents);
14431
+ }
14376
14432
  return await this.embedContentInternal(params);
14377
14433
  }
14378
14434
  const isVertexEmbedContentModel = (params.model.includes('gemini') &&
@@ -16352,6 +16408,22 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
16352
16408
  if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
16353
16409
  throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
16354
16410
  }
16411
+ const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
16412
+ if (parentObject !== undefined && fromAvatarConfig != null) {
16413
+ setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
16414
+ }
16415
+ const fromSafetySettings = getValueByPath(fromObject, [
16416
+ 'safetySettings',
16417
+ ]);
16418
+ if (parentObject !== undefined && fromSafetySettings != null) {
16419
+ let transformedList = fromSafetySettings;
16420
+ if (Array.isArray(transformedList)) {
16421
+ transformedList = transformedList.map((item) => {
16422
+ return safetySettingToMldev(item);
16423
+ });
16424
+ }
16425
+ setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
16426
+ }
16355
16427
  return toObject;
16356
16428
  }
16357
16429
  function liveConnectConstraintsToMldev(apiClient, fromObject) {
@@ -16438,6 +16510,21 @@ function partToMldev(fromObject) {
16438
16510
  }
16439
16511
  return toObject;
16440
16512
  }
16513
+ function safetySettingToMldev(fromObject) {
16514
+ const toObject = {};
16515
+ const fromCategory = getValueByPath(fromObject, ['category']);
16516
+ if (fromCategory != null) {
16517
+ setValueByPath(toObject, ['category'], fromCategory);
16518
+ }
16519
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
16520
+ throw new Error('method parameter is not supported in Gemini API.');
16521
+ }
16522
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
16523
+ if (fromThreshold != null) {
16524
+ setValueByPath(toObject, ['threshold'], fromThreshold);
16525
+ }
16526
+ return toObject;
16527
+ }
16441
16528
  function sessionResumptionConfigToMldev(fromObject) {
16442
16529
  const toObject = {};
16443
16530
  const fromHandle = getValueByPath(fromObject, ['handle']);
@@ -17931,6 +18018,66 @@ BaseInteractions._key = Object.freeze(['interactions']);
17931
18018
  class Interactions extends BaseInteractions {
17932
18019
  }
17933
18020
 
18021
+ /**
18022
+ * @license
18023
+ * Copyright 2025 Google LLC
18024
+ * SPDX-License-Identifier: Apache-2.0
18025
+ */
18026
+ class BaseWebhooks extends APIResource {
18027
+ /**
18028
+ * Creates a new Webhook.
18029
+ */
18030
+ create(params, options) {
18031
+ const { api_version = this._client.apiVersion, webhook_id } = params, body = __rest(params, ["api_version", "webhook_id"]);
18032
+ return this._client.post(path `/${api_version}/webhooks`, Object.assign({ query: { webhook_id }, body }, options));
18033
+ }
18034
+ /**
18035
+ * Updates an existing Webhook.
18036
+ */
18037
+ update(id, params, options) {
18038
+ const { api_version = this._client.apiVersion, update_mask } = params, body = __rest(params, ["api_version", "update_mask"]);
18039
+ return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
18040
+ }
18041
+ /**
18042
+ * Lists all Webhooks.
18043
+ */
18044
+ list(params = {}, options) {
18045
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
18046
+ return this._client.get(path `/${api_version}/webhooks`, Object.assign({ query }, options));
18047
+ }
18048
+ /**
18049
+ * Deletes a Webhook.
18050
+ */
18051
+ delete(id, params = {}, options) {
18052
+ const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18053
+ return this._client.delete(path `/${api_version}/webhooks/${id}`, options);
18054
+ }
18055
+ /**
18056
+ * Gets a specific Webhook.
18057
+ */
18058
+ get(id, params = {}, options) {
18059
+ const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18060
+ return this._client.get(path `/${api_version}/webhooks/${id}`, options);
18061
+ }
18062
+ /**
18063
+ * Sends a ping event to a Webhook.
18064
+ */
18065
+ ping(id, params = undefined, options) {
18066
+ const { api_version = this._client.apiVersion, body } = params !== null && params !== void 0 ? params : {};
18067
+ return this._client.post(path `/${api_version}/webhooks/${id}:ping`, Object.assign({ body: body }, options));
18068
+ }
18069
+ /**
18070
+ * Generates a new signing secret for a Webhook.
18071
+ */
18072
+ rotateSigningSecret(id, params = {}, options) {
18073
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
18074
+ return this._client.post(path `/${api_version}/webhooks/${id}:rotateSigningSecret`, Object.assign({ body }, options));
18075
+ }
18076
+ }
18077
+ BaseWebhooks._key = Object.freeze(['webhooks']);
18078
+ class Webhooks extends BaseWebhooks {
18079
+ }
18080
+
17934
18081
  /**
17935
18082
  * @license
17936
18083
  * Copyright 2025 Google LLC
@@ -18672,12 +18819,12 @@ const buildHeaders = (newHeaders) => {
18672
18819
  * Will return undefined if the environment variable doesn't exist or cannot be accessed.
18673
18820
  */
18674
18821
  const readEnv = (env) => {
18675
- var _a, _b, _c, _d, _e, _f;
18822
+ var _a, _b, _c, _d, _e;
18676
18823
  if (typeof globalThis.process !== 'undefined') {
18677
- return (_c = (_b = (_a = globalThis.process.env) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : undefined;
18824
+ return ((_b = (_a = globalThis.process.env) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.trim()) || undefined;
18678
18825
  }
18679
18826
  if (typeof globalThis.Deno !== 'undefined') {
18680
- return (_f = (_e = (_d = globalThis.Deno.env) === null || _d === void 0 ? void 0 : _d.get) === null || _e === void 0 ? void 0 : _e.call(_d, env)) === null || _f === void 0 ? void 0 : _f.trim();
18827
+ return ((_e = (_d = (_c = globalThis.Deno.env) === null || _c === void 0 ? void 0 : _c.get) === null || _d === void 0 ? void 0 : _d.call(_c, env)) === null || _e === void 0 ? void 0 : _e.trim()) || undefined;
18681
18828
  }
18682
18829
  return undefined;
18683
18830
  };
@@ -19118,6 +19265,7 @@ class GeminiNextGenAPIClient extends BaseGeminiNextGenAPIClient {
19118
19265
  constructor() {
19119
19266
  super(...arguments);
19120
19267
  this.interactions = new Interactions(this);
19268
+ this.webhooks = new Webhooks(this);
19121
19269
  }
19122
19270
  }
19123
19271
  _a = GeminiNextGenAPIClient;
@@ -19137,6 +19285,7 @@ GeminiNextGenAPIClient.PermissionDeniedError = PermissionDeniedError;
19137
19285
  GeminiNextGenAPIClient.UnprocessableEntityError = UnprocessableEntityError;
19138
19286
  GeminiNextGenAPIClient.toFile = toFile;
19139
19287
  GeminiNextGenAPIClient.Interactions = Interactions;
19288
+ GeminiNextGenAPIClient.Webhooks = Webhooks;
19140
19289
 
19141
19290
  /**
19142
19291
  * @license
@@ -20637,29 +20786,42 @@ const LANGUAGE_LABEL_PREFIX = 'gl-node/';
20637
20786
  *
20638
20787
  */
20639
20788
  class GoogleGenAI {
20640
- get interactions() {
20789
+ getNextGenClient() {
20641
20790
  var _a;
20642
- if (this._interactions !== undefined) {
20643
- return this._interactions;
20644
- }
20645
- console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
20646
20791
  const httpOpts = this.httpOptions;
20792
+ if (this._nextGenClient === undefined) {
20793
+ const httpOpts = this.httpOptions;
20794
+ this._nextGenClient = new GeminiNextGenAPIClient({
20795
+ baseURL: this.apiClient.getBaseUrl(),
20796
+ apiKey: this.apiKey,
20797
+ apiVersion: this.apiClient.getApiVersion(),
20798
+ clientAdapter: this.apiClient,
20799
+ defaultHeaders: this.apiClient.getDefaultHeaders(),
20800
+ timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
20801
+ maxRetries: (_a = httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.retryOptions) === null || _a === void 0 ? void 0 : _a.attempts,
20802
+ });
20803
+ }
20647
20804
  // Unsupported Options Warnings
20648
20805
  if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {
20649
20806
  console.warn('GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.');
20650
20807
  }
20651
- const nextGenClient = new GeminiNextGenAPIClient({
20652
- baseURL: this.apiClient.getBaseUrl(),
20653
- apiKey: this.apiKey,
20654
- apiVersion: this.apiClient.getApiVersion(),
20655
- clientAdapter: this.apiClient,
20656
- defaultHeaders: this.apiClient.getDefaultHeaders(),
20657
- timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
20658
- maxRetries: (_a = httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.retryOptions) === null || _a === void 0 ? void 0 : _a.attempts,
20659
- });
20660
- this._interactions = nextGenClient.interactions;
20808
+ return this._nextGenClient;
20809
+ }
20810
+ get interactions() {
20811
+ if (this._interactions !== undefined) {
20812
+ return this._interactions;
20813
+ }
20814
+ console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
20815
+ this._interactions = this.getNextGenClient().interactions;
20661
20816
  return this._interactions;
20662
20817
  }
20818
+ get webhooks() {
20819
+ if (this._webhooks !== undefined) {
20820
+ return this._webhooks;
20821
+ }
20822
+ this._webhooks = this.getNextGenClient().webhooks;
20823
+ return this._webhooks;
20824
+ }
20663
20825
  constructor(options) {
20664
20826
  var _a;
20665
20827
  if (options.apiKey == null) {