@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.
package/dist/index.mjs CHANGED
@@ -1183,6 +1183,10 @@ var Modality;
1183
1183
  * Indicates the model should return audio.
1184
1184
  */
1185
1185
  Modality["AUDIO"] = "AUDIO";
1186
+ /**
1187
+ * Indicates the model should return video.
1188
+ */
1189
+ Modality["VIDEO"] = "VIDEO";
1186
1190
  })(Modality || (Modality = {}));
1187
1191
  /** The stage of the underlying model. This enum is not supported in Vertex AI. */
1188
1192
  var ModelStage;
@@ -1777,6 +1781,102 @@ var TurnCompleteReason;
1777
1781
  * Needs more input from the user.
1778
1782
  */
1779
1783
  TurnCompleteReason["NEED_MORE_INPUT"] = "NEED_MORE_INPUT";
1784
+ /**
1785
+ * Input content is prohibited.
1786
+ */
1787
+ TurnCompleteReason["PROHIBITED_INPUT_CONTENT"] = "PROHIBITED_INPUT_CONTENT";
1788
+ /**
1789
+ * Input image contains prohibited content.
1790
+ */
1791
+ TurnCompleteReason["IMAGE_PROHIBITED_INPUT_CONTENT"] = "IMAGE_PROHIBITED_INPUT_CONTENT";
1792
+ /**
1793
+ * Input text contains prominent person reference.
1794
+ */
1795
+ TurnCompleteReason["INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED"] = "INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED";
1796
+ /**
1797
+ * Input image contains celebrity.
1798
+ */
1799
+ TurnCompleteReason["INPUT_IMAGE_CELEBRITY"] = "INPUT_IMAGE_CELEBRITY";
1800
+ /**
1801
+ * Input image contains photo realistic child.
1802
+ */
1803
+ TurnCompleteReason["INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED"] = "INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED";
1804
+ /**
1805
+ * Input text contains NCII content.
1806
+ */
1807
+ TurnCompleteReason["INPUT_TEXT_NCII_PROHIBITED"] = "INPUT_TEXT_NCII_PROHIBITED";
1808
+ /**
1809
+ * Other input safety issue.
1810
+ */
1811
+ TurnCompleteReason["INPUT_OTHER"] = "INPUT_OTHER";
1812
+ /**
1813
+ * Input contains IP violation.
1814
+ */
1815
+ TurnCompleteReason["INPUT_IP_PROHIBITED"] = "INPUT_IP_PROHIBITED";
1816
+ /**
1817
+ * Input matched blocklist.
1818
+ */
1819
+ TurnCompleteReason["BLOCKLIST"] = "BLOCKLIST";
1820
+ /**
1821
+ * Input is unsafe for image generation.
1822
+ */
1823
+ TurnCompleteReason["UNSAFE_PROMPT_FOR_IMAGE_GENERATION"] = "UNSAFE_PROMPT_FOR_IMAGE_GENERATION";
1824
+ /**
1825
+ * Generated image failed safety check.
1826
+ */
1827
+ TurnCompleteReason["GENERATED_IMAGE_SAFETY"] = "GENERATED_IMAGE_SAFETY";
1828
+ /**
1829
+ * Generated content failed safety check.
1830
+ */
1831
+ TurnCompleteReason["GENERATED_CONTENT_SAFETY"] = "GENERATED_CONTENT_SAFETY";
1832
+ /**
1833
+ * Generated audio failed safety check.
1834
+ */
1835
+ TurnCompleteReason["GENERATED_AUDIO_SAFETY"] = "GENERATED_AUDIO_SAFETY";
1836
+ /**
1837
+ * Generated video failed safety check.
1838
+ */
1839
+ TurnCompleteReason["GENERATED_VIDEO_SAFETY"] = "GENERATED_VIDEO_SAFETY";
1840
+ /**
1841
+ * Generated content is prohibited.
1842
+ */
1843
+ TurnCompleteReason["GENERATED_CONTENT_PROHIBITED"] = "GENERATED_CONTENT_PROHIBITED";
1844
+ /**
1845
+ * Generated content matched blocklist.
1846
+ */
1847
+ TurnCompleteReason["GENERATED_CONTENT_BLOCKLIST"] = "GENERATED_CONTENT_BLOCKLIST";
1848
+ /**
1849
+ * Generated image is prohibited.
1850
+ */
1851
+ TurnCompleteReason["GENERATED_IMAGE_PROHIBITED"] = "GENERATED_IMAGE_PROHIBITED";
1852
+ /**
1853
+ * Generated image contains celebrity.
1854
+ */
1855
+ TurnCompleteReason["GENERATED_IMAGE_CELEBRITY"] = "GENERATED_IMAGE_CELEBRITY";
1856
+ /**
1857
+ * Generated image contains prominent people detected by rewriter.
1858
+ */
1859
+ TurnCompleteReason["GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER"] = "GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER";
1860
+ /**
1861
+ * Generated image contains identifiable people.
1862
+ */
1863
+ TurnCompleteReason["GENERATED_IMAGE_IDENTIFIABLE_PEOPLE"] = "GENERATED_IMAGE_IDENTIFIABLE_PEOPLE";
1864
+ /**
1865
+ * Generated image contains minors.
1866
+ */
1867
+ TurnCompleteReason["GENERATED_IMAGE_MINORS"] = "GENERATED_IMAGE_MINORS";
1868
+ /**
1869
+ * Generated image contains IP violation.
1870
+ */
1871
+ TurnCompleteReason["OUTPUT_IMAGE_IP_PROHIBITED"] = "OUTPUT_IMAGE_IP_PROHIBITED";
1872
+ /**
1873
+ * Other generated content issue.
1874
+ */
1875
+ TurnCompleteReason["GENERATED_OTHER"] = "GENERATED_OTHER";
1876
+ /**
1877
+ * Max regeneration attempts reached.
1878
+ */
1879
+ TurnCompleteReason["MAX_REGENERATION_REACHED"] = "MAX_REGENERATION_REACHED";
1780
1880
  })(TurnCompleteReason || (TurnCompleteReason = {}));
1781
1881
  /** Server content modalities. */
1782
1882
  var MediaModality;
@@ -4022,6 +4122,12 @@ function createBatchJobConfigToMldev(fromObject, parentObject) {
4022
4122
  if (getValueByPath(fromObject, ['dest']) !== undefined) {
4023
4123
  throw new Error('dest parameter is not supported in Gemini API.');
4024
4124
  }
4125
+ const fromWebhookConfig = getValueByPath(fromObject, [
4126
+ 'webhookConfig',
4127
+ ]);
4128
+ if (parentObject !== undefined && fromWebhookConfig != null) {
4129
+ setValueByPath(parentObject, ['batch', 'webhookConfig'], fromWebhookConfig);
4130
+ }
4025
4131
  return toObject;
4026
4132
  }
4027
4133
  function createBatchJobConfigToVertex(fromObject, parentObject) {
@@ -4034,6 +4140,9 @@ function createBatchJobConfigToVertex(fromObject, parentObject) {
4034
4140
  if (parentObject !== undefined && fromDest != null) {
4035
4141
  setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
4036
4142
  }
4143
+ if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
4144
+ throw new Error('webhookConfig parameter is not supported in Vertex AI.');
4145
+ }
4037
4146
  return toObject;
4038
4147
  }
4039
4148
  function createBatchJobParametersToMldev(apiClient, fromObject) {
@@ -4193,6 +4302,12 @@ function embedContentConfigToMldev$1(fromObject, parentObject) {
4193
4302
  if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
4194
4303
  throw new Error('autoTruncate parameter is not supported in Gemini API.');
4195
4304
  }
4305
+ if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
4306
+ throw new Error('documentOcr parameter is not supported in Gemini API.');
4307
+ }
4308
+ if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
4309
+ throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
4310
+ }
4196
4311
  return toObject;
4197
4312
  }
4198
4313
  function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
@@ -4359,7 +4474,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4359
4474
  let transformedList = fromSafetySettings;
4360
4475
  if (Array.isArray(transformedList)) {
4361
4476
  transformedList = transformedList.map((item) => {
4362
- return safetySettingToMldev$1(item);
4477
+ return safetySettingToMldev$3(item);
4363
4478
  });
4364
4479
  }
4365
4480
  setValueByPath(parentObject, ['safetySettings'], transformedList);
@@ -4766,7 +4881,7 @@ function partToMldev$4(fromObject) {
4766
4881
  }
4767
4882
  return toObject;
4768
4883
  }
4769
- function safetySettingToMldev$1(fromObject) {
4884
+ function safetySettingToMldev$3(fromObject) {
4770
4885
  const toObject = {};
4771
4886
  const fromCategory = getValueByPath(fromObject, ['category']);
4772
4887
  if (fromCategory != null) {
@@ -7427,10 +7542,11 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
7427
7542
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7428
7543
  const USER_AGENT_HEADER = 'User-Agent';
7429
7544
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7430
- const SDK_VERSION = '1.49.0'; // x-release-please-version
7545
+ const SDK_VERSION = '1.50.1'; // x-release-please-version
7431
7546
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7432
7547
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7433
7548
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
7549
+ const MULTI_REGIONAL_LOCATIONS = new Set(['us', 'eu']);
7434
7550
  // Default retry options.
7435
7551
  // The config is based on https://cloud.google.com/storage/docs/retry-strategy.
7436
7552
  const DEFAULT_RETRY_ATTEMPTS = 5; // Including the initial call
@@ -7489,7 +7605,7 @@ class ApiClient {
7489
7605
  }
7490
7606
  else if (this.clientOptions.project &&
7491
7607
  this.clientOptions.location &&
7492
- this.clientOptions.location === 'us') {
7608
+ MULTI_REGIONAL_LOCATIONS.has(this.clientOptions.location)) {
7493
7609
  initHttpOptions.baseUrl = `https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`;
7494
7610
  }
7495
7611
  else if (this.clientOptions.project && this.clientOptions.location) {
@@ -9836,6 +9952,66 @@ BaseInteractions._key = Object.freeze(['interactions']);
9836
9952
  class Interactions extends BaseInteractions {
9837
9953
  }
9838
9954
 
9955
+ /**
9956
+ * @license
9957
+ * Copyright 2025 Google LLC
9958
+ * SPDX-License-Identifier: Apache-2.0
9959
+ */
9960
+ class BaseWebhooks extends APIResource {
9961
+ /**
9962
+ * Creates a new Webhook.
9963
+ */
9964
+ create(params, options) {
9965
+ const { api_version = this._client.apiVersion, webhook_id } = params, body = __rest(params, ["api_version", "webhook_id"]);
9966
+ return this._client.post(path `/${api_version}/webhooks`, Object.assign({ query: { webhook_id }, body }, options));
9967
+ }
9968
+ /**
9969
+ * Updates an existing Webhook.
9970
+ */
9971
+ update(id, params, options) {
9972
+ const { api_version = this._client.apiVersion, update_mask } = params, body = __rest(params, ["api_version", "update_mask"]);
9973
+ return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
9974
+ }
9975
+ /**
9976
+ * Lists all Webhooks.
9977
+ */
9978
+ list(params = {}, options) {
9979
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
9980
+ return this._client.get(path `/${api_version}/webhooks`, Object.assign({ query }, options));
9981
+ }
9982
+ /**
9983
+ * Deletes a Webhook.
9984
+ */
9985
+ delete(id, params = {}, options) {
9986
+ const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
9987
+ return this._client.delete(path `/${api_version}/webhooks/${id}`, options);
9988
+ }
9989
+ /**
9990
+ * Gets a specific Webhook.
9991
+ */
9992
+ get(id, params = {}, options) {
9993
+ const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
9994
+ return this._client.get(path `/${api_version}/webhooks/${id}`, options);
9995
+ }
9996
+ /**
9997
+ * Sends a ping event to a Webhook.
9998
+ */
9999
+ ping(id, params = undefined, options) {
10000
+ const { api_version = this._client.apiVersion, body } = params !== null && params !== void 0 ? params : {};
10001
+ return this._client.post(path `/${api_version}/webhooks/${id}:ping`, Object.assign({ body: body }, options));
10002
+ }
10003
+ /**
10004
+ * Generates a new signing secret for a Webhook.
10005
+ */
10006
+ rotateSigningSecret(id, params = {}, options) {
10007
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
10008
+ return this._client.post(path `/${api_version}/webhooks/${id}:rotateSigningSecret`, Object.assign({ body }, options));
10009
+ }
10010
+ }
10011
+ BaseWebhooks._key = Object.freeze(['webhooks']);
10012
+ class Webhooks extends BaseWebhooks {
10013
+ }
10014
+
9839
10015
  /**
9840
10016
  * @license
9841
10017
  * Copyright 2025 Google LLC
@@ -10577,12 +10753,12 @@ const buildHeaders = (newHeaders) => {
10577
10753
  * Will return undefined if the environment variable doesn't exist or cannot be accessed.
10578
10754
  */
10579
10755
  const readEnv = (env) => {
10580
- var _a, _b, _c, _d, _e, _f;
10756
+ var _a, _b, _c, _d, _e;
10581
10757
  if (typeof globalThis.process !== 'undefined') {
10582
- 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;
10758
+ return ((_b = (_a = globalThis.process.env) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.trim()) || undefined;
10583
10759
  }
10584
10760
  if (typeof globalThis.Deno !== 'undefined') {
10585
- 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();
10761
+ 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;
10586
10762
  }
10587
10763
  return undefined;
10588
10764
  };
@@ -11023,6 +11199,7 @@ class GeminiNextGenAPIClient extends BaseGeminiNextGenAPIClient {
11023
11199
  constructor() {
11024
11200
  super(...arguments);
11025
11201
  this.interactions = new Interactions(this);
11202
+ this.webhooks = new Webhooks(this);
11026
11203
  }
11027
11204
  }
11028
11205
  _a = GeminiNextGenAPIClient;
@@ -11042,6 +11219,7 @@ GeminiNextGenAPIClient.PermissionDeniedError = PermissionDeniedError;
11042
11219
  GeminiNextGenAPIClient.UnprocessableEntityError = UnprocessableEntityError;
11043
11220
  GeminiNextGenAPIClient.toFile = toFile;
11044
11221
  GeminiNextGenAPIClient.Interactions = Interactions;
11222
+ GeminiNextGenAPIClient.Webhooks = Webhooks;
11045
11223
 
11046
11224
  /**
11047
11225
  * @license
@@ -11301,7 +11479,7 @@ function generationConfigToVertex$1(fromObject) {
11301
11479
  }
11302
11480
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
11303
11481
  if (fromSpeechConfig != null) {
11304
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex$1(fromSpeechConfig));
11482
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
11305
11483
  }
11306
11484
  const fromStopSequences = getValueByPath(fromObject, [
11307
11485
  'stopSequences',
@@ -11476,6 +11654,22 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
11476
11654
  if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
11477
11655
  throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
11478
11656
  }
11657
+ const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
11658
+ if (parentObject !== undefined && fromAvatarConfig != null) {
11659
+ setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
11660
+ }
11661
+ const fromSafetySettings = getValueByPath(fromObject, [
11662
+ 'safetySettings',
11663
+ ]);
11664
+ if (parentObject !== undefined && fromSafetySettings != null) {
11665
+ let transformedList = fromSafetySettings;
11666
+ if (Array.isArray(transformedList)) {
11667
+ transformedList = transformedList.map((item) => {
11668
+ return safetySettingToMldev$2(item);
11669
+ });
11670
+ }
11671
+ setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
11672
+ }
11479
11673
  return toObject;
11480
11674
  }
11481
11675
  function liveConnectConfigToVertex(fromObject, parentObject) {
@@ -11522,7 +11716,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
11522
11716
  }
11523
11717
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
11524
11718
  if (parentObject !== undefined && fromSpeechConfig != null) {
11525
- setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToVertex$1(tLiveSpeechConfig(fromSpeechConfig)));
11719
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
11526
11720
  }
11527
11721
  const fromThinkingConfig = getValueByPath(fromObject, [
11528
11722
  'thinkingConfig',
@@ -11592,6 +11786,22 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
11592
11786
  if (parentObject !== undefined && fromExplicitVadSignal != null) {
11593
11787
  setValueByPath(parentObject, ['setup', 'explicitVadSignal'], fromExplicitVadSignal);
11594
11788
  }
11789
+ const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
11790
+ if (parentObject !== undefined && fromAvatarConfig != null) {
11791
+ setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
11792
+ }
11793
+ const fromSafetySettings = getValueByPath(fromObject, [
11794
+ 'safetySettings',
11795
+ ]);
11796
+ if (parentObject !== undefined && fromSafetySettings != null) {
11797
+ let transformedList = fromSafetySettings;
11798
+ if (Array.isArray(transformedList)) {
11799
+ transformedList = transformedList.map((item) => {
11800
+ return item;
11801
+ });
11802
+ }
11803
+ setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
11804
+ }
11595
11805
  return toObject;
11596
11806
  }
11597
11807
  function liveConnectParametersToMldev(apiClient, fromObject) {
@@ -11782,22 +11992,6 @@ function liveServerMessageFromVertex(fromObject) {
11782
11992
  }
11783
11993
  return toObject;
11784
11994
  }
11785
- function multiSpeakerVoiceConfigToVertex$1(fromObject) {
11786
- const toObject = {};
11787
- const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
11788
- 'speakerVoiceConfigs',
11789
- ]);
11790
- if (fromSpeakerVoiceConfigs != null) {
11791
- let transformedList = fromSpeakerVoiceConfigs;
11792
- if (Array.isArray(transformedList)) {
11793
- transformedList = transformedList.map((item) => {
11794
- return speakerVoiceConfigToVertex$1(item);
11795
- });
11796
- }
11797
- setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
11798
- }
11799
- return toObject;
11800
- }
11801
11995
  function partToMldev$2(fromObject) {
11802
11996
  const toObject = {};
11803
11997
  const fromMediaResolution = getValueByPath(fromObject, [
@@ -11939,17 +12133,18 @@ function partToVertex$1(fromObject) {
11939
12133
  }
11940
12134
  return toObject;
11941
12135
  }
11942
- function replicatedVoiceConfigToVertex$1(fromObject) {
12136
+ function safetySettingToMldev$2(fromObject) {
11943
12137
  const toObject = {};
11944
- const fromMimeType = getValueByPath(fromObject, ['mimeType']);
11945
- if (fromMimeType != null) {
11946
- setValueByPath(toObject, ['mimeType'], fromMimeType);
12138
+ const fromCategory = getValueByPath(fromObject, ['category']);
12139
+ if (fromCategory != null) {
12140
+ setValueByPath(toObject, ['category'], fromCategory);
11947
12141
  }
11948
- const fromVoiceSampleAudio = getValueByPath(fromObject, [
11949
- 'voiceSampleAudio',
11950
- ]);
11951
- if (fromVoiceSampleAudio != null) {
11952
- setValueByPath(toObject, ['voiceSampleAudio'], fromVoiceSampleAudio);
12142
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
12143
+ throw new Error('method parameter is not supported in Gemini API.');
12144
+ }
12145
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
12146
+ if (fromThreshold != null) {
12147
+ setValueByPath(toObject, ['threshold'], fromThreshold);
11953
12148
  }
11954
12149
  return toObject;
11955
12150
  }
@@ -11964,36 +12159,6 @@ function sessionResumptionConfigToMldev$1(fromObject) {
11964
12159
  }
11965
12160
  return toObject;
11966
12161
  }
11967
- function speakerVoiceConfigToVertex$1(fromObject) {
11968
- const toObject = {};
11969
- const fromSpeaker = getValueByPath(fromObject, ['speaker']);
11970
- if (fromSpeaker != null) {
11971
- setValueByPath(toObject, ['speaker'], fromSpeaker);
11972
- }
11973
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
11974
- if (fromVoiceConfig != null) {
11975
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex$1(fromVoiceConfig));
11976
- }
11977
- return toObject;
11978
- }
11979
- function speechConfigToVertex$1(fromObject) {
11980
- const toObject = {};
11981
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
11982
- if (fromVoiceConfig != null) {
11983
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex$1(fromVoiceConfig));
11984
- }
11985
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
11986
- if (fromLanguageCode != null) {
11987
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
11988
- }
11989
- const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
11990
- 'multiSpeakerVoiceConfig',
11991
- ]);
11992
- if (fromMultiSpeakerVoiceConfig != null) {
11993
- setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToVertex$1(fromMultiSpeakerVoiceConfig));
11994
- }
11995
- return toObject;
11996
- }
11997
12162
  function toolToMldev$2(fromObject) {
11998
12163
  const toObject = {};
11999
12164
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
@@ -12227,22 +12392,6 @@ function voiceActivityFromVertex(fromObject) {
12227
12392
  }
12228
12393
  return toObject;
12229
12394
  }
12230
- function voiceConfigToVertex$1(fromObject) {
12231
- const toObject = {};
12232
- const fromReplicatedVoiceConfig = getValueByPath(fromObject, [
12233
- 'replicatedVoiceConfig',
12234
- ]);
12235
- if (fromReplicatedVoiceConfig != null) {
12236
- setValueByPath(toObject, ['replicatedVoiceConfig'], replicatedVoiceConfigToVertex$1(fromReplicatedVoiceConfig));
12237
- }
12238
- const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
12239
- 'prebuiltVoiceConfig',
12240
- ]);
12241
- if (fromPrebuiltVoiceConfig != null) {
12242
- setValueByPath(toObject, ['prebuiltVoiceConfig'], fromPrebuiltVoiceConfig);
12243
- }
12244
- return toObject;
12245
- }
12246
12395
 
12247
12396
  /**
12248
12397
  * @license
@@ -12792,6 +12941,12 @@ function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
12792
12941
  if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
12793
12942
  throw new Error('autoTruncate parameter is not supported in Gemini API.');
12794
12943
  }
12944
+ if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
12945
+ throw new Error('documentOcr parameter is not supported in Gemini API.');
12946
+ }
12947
+ if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
12948
+ throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
12949
+ }
12795
12950
  return toObject;
12796
12951
  }
12797
12952
  function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
@@ -12811,7 +12966,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
12811
12966
  else if (discriminatorTaskType === 'EMBED_CONTENT') {
12812
12967
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
12813
12968
  if (parentObject !== undefined && fromTaskType != null) {
12814
- setValueByPath(parentObject, ['taskType'], fromTaskType);
12969
+ setValueByPath(parentObject, ['embedContentConfig', 'taskType'], fromTaskType);
12815
12970
  }
12816
12971
  }
12817
12972
  let discriminatorTitle = getValueByPath(rootObject, [
@@ -12829,7 +12984,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
12829
12984
  else if (discriminatorTitle === 'EMBED_CONTENT') {
12830
12985
  const fromTitle = getValueByPath(fromObject, ['title']);
12831
12986
  if (parentObject !== undefined && fromTitle != null) {
12832
- setValueByPath(parentObject, ['title'], fromTitle);
12987
+ setValueByPath(parentObject, ['embedContentConfig', 'title'], fromTitle);
12833
12988
  }
12834
12989
  }
12835
12990
  let discriminatorOutputDimensionality = getValueByPath(rootObject, [
@@ -12851,7 +13006,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
12851
13006
  'outputDimensionality',
12852
13007
  ]);
12853
13008
  if (parentObject !== undefined && fromOutputDimensionality != null) {
12854
- setValueByPath(parentObject, ['outputDimensionality'], fromOutputDimensionality);
13009
+ setValueByPath(parentObject, ['embedContentConfig', 'outputDimensionality'], fromOutputDimensionality);
12855
13010
  }
12856
13011
  }
12857
13012
  let discriminatorMimeType = getValueByPath(rootObject, [
@@ -12885,7 +13040,33 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
12885
13040
  'autoTruncate',
12886
13041
  ]);
12887
13042
  if (parentObject !== undefined && fromAutoTruncate != null) {
12888
- setValueByPath(parentObject, ['autoTruncate'], fromAutoTruncate);
13043
+ setValueByPath(parentObject, ['embedContentConfig', 'autoTruncate'], fromAutoTruncate);
13044
+ }
13045
+ }
13046
+ let discriminatorDocumentOcr = getValueByPath(rootObject, [
13047
+ 'embeddingApiType',
13048
+ ]);
13049
+ if (discriminatorDocumentOcr === undefined) {
13050
+ discriminatorDocumentOcr = 'PREDICT';
13051
+ }
13052
+ if (discriminatorDocumentOcr === 'EMBED_CONTENT') {
13053
+ const fromDocumentOcr = getValueByPath(fromObject, ['documentOcr']);
13054
+ if (parentObject !== undefined && fromDocumentOcr != null) {
13055
+ setValueByPath(parentObject, ['embedContentConfig', 'documentOcr'], fromDocumentOcr);
13056
+ }
13057
+ }
13058
+ let discriminatorAudioTrackExtraction = getValueByPath(rootObject, [
13059
+ 'embeddingApiType',
13060
+ ]);
13061
+ if (discriminatorAudioTrackExtraction === undefined) {
13062
+ discriminatorAudioTrackExtraction = 'PREDICT';
13063
+ }
13064
+ if (discriminatorAudioTrackExtraction === 'EMBED_CONTENT') {
13065
+ const fromAudioTrackExtraction = getValueByPath(fromObject, [
13066
+ 'audioTrackExtraction',
13067
+ ]);
13068
+ if (parentObject !== undefined && fromAudioTrackExtraction != null) {
13069
+ setValueByPath(parentObject, ['embedContentConfig', 'audioTrackExtraction'], fromAudioTrackExtraction);
12889
13070
  }
12890
13071
  }
12891
13072
  return toObject;
@@ -13230,7 +13411,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootO
13230
13411
  let transformedList = fromSafetySettings;
13231
13412
  if (Array.isArray(transformedList)) {
13232
13413
  transformedList = transformedList.map((item) => {
13233
- return safetySettingToMldev(item);
13414
+ return safetySettingToMldev$1(item);
13234
13415
  });
13235
13416
  }
13236
13417
  setValueByPath(parentObject, ['safetySettings'], transformedList);
@@ -13446,7 +13627,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
13446
13627
  }
13447
13628
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
13448
13629
  if (fromSpeechConfig != null) {
13449
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(tSpeechConfig(fromSpeechConfig)));
13630
+ setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
13450
13631
  }
13451
13632
  const fromAudioTimestamp = getValueByPath(fromObject, [
13452
13633
  'audioTimestamp',
@@ -13954,6 +14135,12 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
13954
14135
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
13955
14136
  throw new Error('labels parameter is not supported in Gemini API.');
13956
14137
  }
14138
+ const fromWebhookConfig = getValueByPath(fromObject, [
14139
+ 'webhookConfig',
14140
+ ]);
14141
+ if (parentObject !== undefined && fromWebhookConfig != null) {
14142
+ setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
14143
+ }
13957
14144
  return toObject;
13958
14145
  }
13959
14146
  function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
@@ -14048,6 +14235,9 @@ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
14048
14235
  if (parentObject !== undefined && fromLabels != null) {
14049
14236
  setValueByPath(parentObject, ['labels'], fromLabels);
14050
14237
  }
14238
+ if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
14239
+ throw new Error('webhookConfig parameter is not supported in Vertex AI.');
14240
+ }
14051
14241
  return toObject;
14052
14242
  }
14053
14243
  function generateVideosOperationFromMldev(fromObject, rootObject) {
@@ -14317,7 +14507,7 @@ function generatedVideoFromVertex(fromObject, rootObject) {
14317
14507
  }
14318
14508
  return toObject;
14319
14509
  }
14320
- function generationConfigToVertex(fromObject, rootObject) {
14510
+ function generationConfigToVertex(fromObject, _rootObject) {
14321
14511
  const toObject = {};
14322
14512
  const fromModelSelectionConfig = getValueByPath(fromObject, [
14323
14513
  'modelSelectionConfig',
@@ -14413,7 +14603,7 @@ function generationConfigToVertex(fromObject, rootObject) {
14413
14603
  }
14414
14604
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
14415
14605
  if (fromSpeechConfig != null) {
14416
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(fromSpeechConfig));
14606
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
14417
14607
  }
14418
14608
  const fromStopSequences = getValueByPath(fromObject, [
14419
14609
  'stopSequences',
@@ -14870,22 +15060,6 @@ function modelFromVertex(fromObject, rootObject) {
14870
15060
  }
14871
15061
  return toObject;
14872
15062
  }
14873
- function multiSpeakerVoiceConfigToVertex(fromObject, rootObject) {
14874
- const toObject = {};
14875
- const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
14876
- 'speakerVoiceConfigs',
14877
- ]);
14878
- if (fromSpeakerVoiceConfigs != null) {
14879
- let transformedList = fromSpeakerVoiceConfigs;
14880
- if (Array.isArray(transformedList)) {
14881
- transformedList = transformedList.map((item) => {
14882
- return speakerVoiceConfigToVertex(item);
14883
- });
14884
- }
14885
- setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
14886
- }
14887
- return toObject;
14888
- }
14889
15063
  function partToMldev$1(fromObject, rootObject) {
14890
15064
  const toObject = {};
14891
15065
  const fromMediaResolution = getValueByPath(fromObject, [
@@ -15195,20 +15369,6 @@ function referenceImageAPIInternalToVertex(fromObject, rootObject) {
15195
15369
  }
15196
15370
  return toObject;
15197
15371
  }
15198
- function replicatedVoiceConfigToVertex(fromObject, _rootObject) {
15199
- const toObject = {};
15200
- const fromMimeType = getValueByPath(fromObject, ['mimeType']);
15201
- if (fromMimeType != null) {
15202
- setValueByPath(toObject, ['mimeType'], fromMimeType);
15203
- }
15204
- const fromVoiceSampleAudio = getValueByPath(fromObject, [
15205
- 'voiceSampleAudio',
15206
- ]);
15207
- if (fromVoiceSampleAudio != null) {
15208
- setValueByPath(toObject, ['voiceSampleAudio'], fromVoiceSampleAudio);
15209
- }
15210
- return toObject;
15211
- }
15212
15372
  function safetyAttributesFromMldev(fromObject, _rootObject) {
15213
15373
  const toObject = {};
15214
15374
  const fromCategories = getValueByPath(fromObject, [
@@ -15253,7 +15413,7 @@ function safetyAttributesFromVertex(fromObject, _rootObject) {
15253
15413
  }
15254
15414
  return toObject;
15255
15415
  }
15256
- function safetySettingToMldev(fromObject, _rootObject) {
15416
+ function safetySettingToMldev$1(fromObject, _rootObject) {
15257
15417
  const toObject = {};
15258
15418
  const fromCategory = getValueByPath(fromObject, ['category']);
15259
15419
  if (fromCategory != null) {
@@ -15358,36 +15518,6 @@ function segmentImageSourceToVertex(fromObject, parentObject, rootObject) {
15358
15518
  }
15359
15519
  return toObject;
15360
15520
  }
15361
- function speakerVoiceConfigToVertex(fromObject, rootObject) {
15362
- const toObject = {};
15363
- const fromSpeaker = getValueByPath(fromObject, ['speaker']);
15364
- if (fromSpeaker != null) {
15365
- setValueByPath(toObject, ['speaker'], fromSpeaker);
15366
- }
15367
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
15368
- if (fromVoiceConfig != null) {
15369
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(fromVoiceConfig));
15370
- }
15371
- return toObject;
15372
- }
15373
- function speechConfigToVertex(fromObject, rootObject) {
15374
- const toObject = {};
15375
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
15376
- if (fromVoiceConfig != null) {
15377
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(fromVoiceConfig));
15378
- }
15379
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
15380
- if (fromLanguageCode != null) {
15381
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
15382
- }
15383
- const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
15384
- 'multiSpeakerVoiceConfig',
15385
- ]);
15386
- if (fromMultiSpeakerVoiceConfig != null) {
15387
- setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToVertex(fromMultiSpeakerVoiceConfig));
15388
- }
15389
- return toObject;
15390
- }
15391
15521
  function toolConfigToMldev(fromObject, rootObject) {
15392
15522
  const toObject = {};
15393
15523
  const fromRetrievalConfig = getValueByPath(fromObject, [
@@ -15870,22 +16000,6 @@ function videoToVertex(fromObject, _rootObject) {
15870
16000
  }
15871
16001
  return toObject;
15872
16002
  }
15873
- function voiceConfigToVertex(fromObject, rootObject) {
15874
- const toObject = {};
15875
- const fromReplicatedVoiceConfig = getValueByPath(fromObject, [
15876
- 'replicatedVoiceConfig',
15877
- ]);
15878
- if (fromReplicatedVoiceConfig != null) {
15879
- setValueByPath(toObject, ['replicatedVoiceConfig'], replicatedVoiceConfigToVertex(fromReplicatedVoiceConfig));
15880
- }
15881
- const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
15882
- 'prebuiltVoiceConfig',
15883
- ]);
15884
- if (fromPrebuiltVoiceConfig != null) {
15885
- setValueByPath(toObject, ['prebuiltVoiceConfig'], fromPrebuiltVoiceConfig);
15886
- }
15887
- return toObject;
15888
- }
15889
16003
 
15890
16004
  /**
15891
16005
  * @license
@@ -16845,6 +16959,10 @@ class Models extends BaseModule {
16845
16959
  */
16846
16960
  this.embedContent = async (params) => {
16847
16961
  if (!this.apiClient.isVertexAI()) {
16962
+ const isGeminiEmbedding2Model = params.model.includes('gemini-embedding-2');
16963
+ if (isGeminiEmbedding2Model) {
16964
+ params.contents = tContents(params.contents);
16965
+ }
16848
16966
  return await this.embedContentInternal(params);
16849
16967
  }
16850
16968
  const isVertexEmbedContentModel = (params.model.includes('gemini') &&
@@ -18824,6 +18942,22 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
18824
18942
  if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
18825
18943
  throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
18826
18944
  }
18945
+ const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
18946
+ if (parentObject !== undefined && fromAvatarConfig != null) {
18947
+ setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
18948
+ }
18949
+ const fromSafetySettings = getValueByPath(fromObject, [
18950
+ 'safetySettings',
18951
+ ]);
18952
+ if (parentObject !== undefined && fromSafetySettings != null) {
18953
+ let transformedList = fromSafetySettings;
18954
+ if (Array.isArray(transformedList)) {
18955
+ transformedList = transformedList.map((item) => {
18956
+ return safetySettingToMldev(item);
18957
+ });
18958
+ }
18959
+ setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
18960
+ }
18827
18961
  return toObject;
18828
18962
  }
18829
18963
  function liveConnectConstraintsToMldev(apiClient, fromObject) {
@@ -18910,6 +19044,21 @@ function partToMldev(fromObject) {
18910
19044
  }
18911
19045
  return toObject;
18912
19046
  }
19047
+ function safetySettingToMldev(fromObject) {
19048
+ const toObject = {};
19049
+ const fromCategory = getValueByPath(fromObject, ['category']);
19050
+ if (fromCategory != null) {
19051
+ setValueByPath(toObject, ['category'], fromCategory);
19052
+ }
19053
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
19054
+ throw new Error('method parameter is not supported in Gemini API.');
19055
+ }
19056
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
19057
+ if (fromThreshold != null) {
19058
+ setValueByPath(toObject, ['threshold'], fromThreshold);
19059
+ }
19060
+ return toObject;
19061
+ }
18913
19062
  function sessionResumptionConfigToMldev(fromObject) {
18914
19063
  const toObject = {};
18915
19064
  const fromHandle = getValueByPath(fromObject, ['handle']);
@@ -20594,29 +20743,41 @@ const LANGUAGE_LABEL_PREFIX = 'gl-node/';
20594
20743
  *
20595
20744
  */
20596
20745
  class GoogleGenAI {
20597
- get interactions() {
20746
+ getNextGenClient() {
20598
20747
  var _a;
20599
- if (this._interactions !== undefined) {
20600
- return this._interactions;
20601
- }
20602
- console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
20603
20748
  const httpOpts = this.httpOptions;
20749
+ if (this._nextGenClient === undefined) {
20750
+ this._nextGenClient = new GeminiNextGenAPIClient({
20751
+ baseURL: this.apiClient.getBaseUrl(),
20752
+ apiKey: this.apiKey,
20753
+ apiVersion: this.apiClient.getApiVersion(),
20754
+ clientAdapter: this.apiClient,
20755
+ defaultHeaders: this.apiClient.getDefaultHeaders(),
20756
+ timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
20757
+ maxRetries: (_a = httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.retryOptions) === null || _a === void 0 ? void 0 : _a.attempts,
20758
+ });
20759
+ }
20604
20760
  // Unsupported Options Warnings
20605
20761
  if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {
20606
20762
  console.warn('GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.');
20607
20763
  }
20608
- const nextGenClient = new GeminiNextGenAPIClient({
20609
- baseURL: this.apiClient.getBaseUrl(),
20610
- apiKey: this.apiKey,
20611
- apiVersion: this.apiClient.getApiVersion(),
20612
- clientAdapter: this.apiClient,
20613
- defaultHeaders: this.apiClient.getDefaultHeaders(),
20614
- timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
20615
- maxRetries: (_a = httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.retryOptions) === null || _a === void 0 ? void 0 : _a.attempts,
20616
- });
20617
- this._interactions = nextGenClient.interactions;
20764
+ return this._nextGenClient;
20765
+ }
20766
+ get interactions() {
20767
+ if (this._interactions !== undefined) {
20768
+ return this._interactions;
20769
+ }
20770
+ console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
20771
+ this._interactions = this.getNextGenClient().interactions;
20618
20772
  return this._interactions;
20619
20773
  }
20774
+ get webhooks() {
20775
+ if (this._webhooks !== undefined) {
20776
+ return this._webhooks;
20777
+ }
20778
+ this._webhooks = this.getNextGenClient().webhooks;
20779
+ return this._webhooks;
20780
+ }
20620
20781
  constructor(options) {
20621
20782
  var _a;
20622
20783
  if (options.apiKey == null) {