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