@google/genai 1.37.0 → 1.39.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
@@ -1296,6 +1296,18 @@ exports.PartMediaResolutionLevel = void 0;
1296
1296
  */
1297
1297
  PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
1298
1298
  })(exports.PartMediaResolutionLevel || (exports.PartMediaResolutionLevel = {}));
1299
+ /** Resource scope. */
1300
+ exports.ResourceScope = void 0;
1301
+ (function (ResourceScope) {
1302
+ /**
1303
+ * When setting base_url, this value configures resource scope to be the collection.
1304
+ The resource name will not include api version, project, or location.
1305
+ For example, if base_url is set to "https://aiplatform.googleapis.com",
1306
+ then the resource name for a Model would be
1307
+ "https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
1308
+ */
1309
+ ResourceScope["COLLECTION"] = "COLLECTION";
1310
+ })(exports.ResourceScope || (exports.ResourceScope = {}));
1299
1311
  /** Options for feature selection preference. */
1300
1312
  exports.FeatureSelectionPreference = void 0;
1301
1313
  (function (FeatureSelectionPreference) {
@@ -1489,6 +1501,10 @@ exports.TuningMethod = void 0;
1489
1501
  * Preference optimization tuning.
1490
1502
  */
1491
1503
  TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
1504
+ /**
1505
+ * Distillation tuning.
1506
+ */
1507
+ TuningMethod["DISTILLATION"] = "DISTILLATION";
1492
1508
  })(exports.TuningMethod || (exports.TuningMethod = {}));
1493
1509
  /** State for the lifecycle of a Document. */
1494
1510
  exports.DocumentState = void 0;
@@ -2280,6 +2296,9 @@ class CreateFileResponse {
2280
2296
  /** Response for the delete file method. */
2281
2297
  class DeleteFileResponse {
2282
2298
  }
2299
+ /** Response for the _register file method. */
2300
+ class RegisterFilesResponse {
2301
+ }
2283
2302
  /** Config for `inlined_responses` parameter. */
2284
2303
  class InlinedResponse {
2285
2304
  }
@@ -4132,6 +4151,9 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4132
4151
  if (fromEnableEnhancedCivicAnswers != null) {
4133
4152
  setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
4134
4153
  }
4154
+ if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
4155
+ throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
4156
+ }
4135
4157
  return toObject;
4136
4158
  }
4137
4159
  function generateContentResponseFromMldev$1(fromObject) {
@@ -4271,6 +4293,10 @@ function inlinedResponseFromMldev(fromObject) {
4271
4293
  if (fromResponse != null) {
4272
4294
  setValueByPath(toObject, ['response'], generateContentResponseFromMldev$1(fromResponse));
4273
4295
  }
4296
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
4297
+ if (fromMetadata != null) {
4298
+ setValueByPath(toObject, ['metadata'], fromMetadata);
4299
+ }
4274
4300
  const fromError = getValueByPath(fromObject, ['error']);
4275
4301
  if (fromError != null) {
4276
4302
  setValueByPath(toObject, ['error'], fromError);
@@ -6905,7 +6931,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6905
6931
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6906
6932
  const USER_AGENT_HEADER = 'User-Agent';
6907
6933
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6908
- const SDK_VERSION = '1.37.0'; // x-release-please-version
6934
+ const SDK_VERSION = '1.39.0'; // x-release-please-version
6909
6935
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6910
6936
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6911
6937
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6915,19 +6941,57 @@ const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
6915
6941
  */
6916
6942
  class ApiClient {
6917
6943
  constructor(opts) {
6918
- var _a, _b;
6919
- this.clientOptions = Object.assign(Object.assign({}, opts), { project: opts.project, location: opts.location, apiKey: opts.apiKey, vertexai: opts.vertexai });
6944
+ var _a, _b, _c;
6945
+ this.clientOptions = Object.assign({}, opts);
6946
+ this.customBaseUrl = (_a = opts.httpOptions) === null || _a === void 0 ? void 0 : _a.baseUrl;
6947
+ if (this.clientOptions.vertexai) {
6948
+ if (this.clientOptions.project && this.clientOptions.location) {
6949
+ this.clientOptions.apiKey = undefined;
6950
+ }
6951
+ else if (this.clientOptions.apiKey) {
6952
+ this.clientOptions.project = undefined;
6953
+ this.clientOptions.location = undefined;
6954
+ }
6955
+ }
6920
6956
  const initHttpOptions = {};
6921
6957
  if (this.clientOptions.vertexai) {
6958
+ if (!this.clientOptions.location &&
6959
+ !this.clientOptions.apiKey &&
6960
+ !this.customBaseUrl) {
6961
+ this.clientOptions.location = 'global';
6962
+ }
6963
+ const hasSufficientAuth = (this.clientOptions.project && this.clientOptions.location) ||
6964
+ this.clientOptions.apiKey;
6965
+ if (!hasSufficientAuth && !this.customBaseUrl) {
6966
+ throw new Error('Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.');
6967
+ }
6968
+ const hasConstructorAuth = (opts.project && opts.location) || !!opts.apiKey;
6969
+ if (this.customBaseUrl && !hasConstructorAuth) {
6970
+ initHttpOptions.baseUrl = this.customBaseUrl;
6971
+ this.clientOptions.project = undefined;
6972
+ this.clientOptions.location = undefined;
6973
+ }
6974
+ else if (this.clientOptions.apiKey ||
6975
+ this.clientOptions.location === 'global') {
6976
+ // Vertex Express or global endpoint case.
6977
+ initHttpOptions.baseUrl = 'https://aiplatform.googleapis.com/';
6978
+ }
6979
+ else if (this.clientOptions.project && this.clientOptions.location) {
6980
+ initHttpOptions.baseUrl = `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
6981
+ }
6922
6982
  initHttpOptions.apiVersion =
6923
- (_a = this.clientOptions.apiVersion) !== null && _a !== void 0 ? _a : VERTEX_AI_API_DEFAULT_VERSION;
6924
- initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
6925
- this.normalizeAuthParameters();
6983
+ (_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : VERTEX_AI_API_DEFAULT_VERSION;
6926
6984
  }
6927
6985
  else {
6928
6986
  // Gemini API
6987
+ if (!this.clientOptions.apiKey) {
6988
+ throw new ApiError({
6989
+ message: 'API key must be set when using the Gemini API.',
6990
+ status: 403,
6991
+ });
6992
+ }
6929
6993
  initHttpOptions.apiVersion =
6930
- (_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : GOOGLE_AI_API_DEFAULT_VERSION;
6994
+ (_c = this.clientOptions.apiVersion) !== null && _c !== void 0 ? _c : GOOGLE_AI_API_DEFAULT_VERSION;
6931
6995
  initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
6932
6996
  }
6933
6997
  initHttpOptions.headers = this.getDefaultHeaders();
@@ -6936,39 +7000,6 @@ class ApiClient {
6936
7000
  this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
6937
7001
  }
6938
7002
  }
6939
- /**
6940
- * Determines the base URL for Vertex AI based on project and location.
6941
- * Uses the global endpoint if location is 'global' or if project/location
6942
- * are not specified (implying API key usage).
6943
- * @private
6944
- */
6945
- baseUrlFromProjectLocation() {
6946
- if (this.clientOptions.project &&
6947
- this.clientOptions.location &&
6948
- this.clientOptions.location !== 'global') {
6949
- // Regional endpoint
6950
- return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
6951
- }
6952
- // Global endpoint (covers 'global' location and API key usage)
6953
- return `https://aiplatform.googleapis.com/`;
6954
- }
6955
- /**
6956
- * Normalizes authentication parameters for Vertex AI.
6957
- * If project and location are provided, API key is cleared.
6958
- * If project and location are not provided (implying API key usage),
6959
- * project and location are cleared.
6960
- * @private
6961
- */
6962
- normalizeAuthParameters() {
6963
- if (this.clientOptions.project && this.clientOptions.location) {
6964
- // Using project/location for auth, clear potential API key
6965
- this.clientOptions.apiKey = undefined;
6966
- return;
6967
- }
6968
- // Using API key for auth (or no auth provided yet), clear project/location
6969
- this.clientOptions.project = undefined;
6970
- this.clientOptions.location = undefined;
6971
- }
6972
7003
  isVertexAI() {
6973
7004
  var _a;
6974
7005
  return (_a = this.clientOptions.vertexai) !== null && _a !== void 0 ? _a : false;
@@ -6979,6 +7010,9 @@ class ApiClient {
6979
7010
  getLocation() {
6980
7011
  return this.clientOptions.location;
6981
7012
  }
7013
+ getCustomBaseUrl() {
7014
+ return this.customBaseUrl;
7015
+ }
6982
7016
  async getAuthHeaders() {
6983
7017
  const headers = new Headers();
6984
7018
  await this.clientOptions.auth.addAuthHeaders(headers);
@@ -7056,7 +7090,11 @@ class ApiClient {
7056
7090
  const url = new URL(`${urlElement.join('/')}`);
7057
7091
  return url;
7058
7092
  }
7059
- shouldPrependVertexProjectPath(request) {
7093
+ shouldPrependVertexProjectPath(request, httpOptions) {
7094
+ if (httpOptions.baseUrl &&
7095
+ httpOptions.baseUrlResourceScope === exports.ResourceScope.COLLECTION) {
7096
+ return false;
7097
+ }
7060
7098
  if (this.clientOptions.apiKey) {
7061
7099
  return false;
7062
7100
  }
@@ -7082,7 +7120,7 @@ class ApiClient {
7082
7120
  if (request.httpOptions) {
7083
7121
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
7084
7122
  }
7085
- const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
7123
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request, patchedHttpOptions);
7086
7124
  const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
7087
7125
  if (request.queryParams) {
7088
7126
  for (const [key, value] of Object.entries(request.queryParams)) {
@@ -7125,7 +7163,7 @@ class ApiClient {
7125
7163
  if (request.httpOptions) {
7126
7164
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
7127
7165
  }
7128
- const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
7166
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request, patchedHttpOptions);
7129
7167
  const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
7130
7168
  if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
7131
7169
  url.searchParams.set('alt', 'sse');
@@ -7728,6 +7766,14 @@ function getFileParametersToMldev(fromObject) {
7728
7766
  }
7729
7767
  return toObject;
7730
7768
  }
7769
+ function internalRegisterFilesParametersToMldev(fromObject) {
7770
+ const toObject = {};
7771
+ const fromUris = getValueByPath(fromObject, ['uris']);
7772
+ if (fromUris != null) {
7773
+ setValueByPath(toObject, ['uris'], fromUris);
7774
+ }
7775
+ return toObject;
7776
+ }
7731
7777
  function listFilesConfigToMldev(fromObject, parentObject) {
7732
7778
  const toObject = {};
7733
7779
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
@@ -7774,6 +7820,26 @@ function listFilesResponseFromMldev(fromObject) {
7774
7820
  }
7775
7821
  return toObject;
7776
7822
  }
7823
+ function registerFilesResponseFromMldev(fromObject) {
7824
+ const toObject = {};
7825
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
7826
+ 'sdkHttpResponse',
7827
+ ]);
7828
+ if (fromSdkHttpResponse != null) {
7829
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
7830
+ }
7831
+ const fromFiles = getValueByPath(fromObject, ['files']);
7832
+ if (fromFiles != null) {
7833
+ let transformedList = fromFiles;
7834
+ if (Array.isArray(transformedList)) {
7835
+ transformedList = transformedList.map((item) => {
7836
+ return item;
7837
+ });
7838
+ }
7839
+ setValueByPath(toObject, ['files'], transformedList);
7840
+ }
7841
+ return toObject;
7842
+ }
7777
7843
 
7778
7844
  /**
7779
7845
  * @license
@@ -7874,6 +7940,16 @@ class Files extends BaseModule {
7874
7940
  async download(params) {
7875
7941
  await this.apiClient.downloadFile(params);
7876
7942
  }
7943
+ /**
7944
+ * Registers Google Cloud Storage files for use with the API.
7945
+ * This method is only available in Node.js environments.
7946
+ */
7947
+ async registerFiles(params) {
7948
+ throw new Error('registerFiles is only supported in Node.js environments.');
7949
+ }
7950
+ async _registerFiles(params) {
7951
+ return this.registerFilesInternal(params);
7952
+ }
7877
7953
  async listInternal(params) {
7878
7954
  var _a, _b;
7879
7955
  let response;
@@ -8047,6 +8123,40 @@ class Files extends BaseModule {
8047
8123
  });
8048
8124
  }
8049
8125
  }
8126
+ async registerFilesInternal(params) {
8127
+ var _a, _b;
8128
+ let response;
8129
+ let path = '';
8130
+ let queryParams = {};
8131
+ if (this.apiClient.isVertexAI()) {
8132
+ throw new Error('This method is only supported by the Gemini Developer API.');
8133
+ }
8134
+ else {
8135
+ const body = internalRegisterFilesParametersToMldev(params);
8136
+ path = formatMap('files:register', body['_url']);
8137
+ queryParams = body['_query'];
8138
+ delete body['_url'];
8139
+ delete body['_query'];
8140
+ response = this.apiClient
8141
+ .request({
8142
+ path: path,
8143
+ queryParams: queryParams,
8144
+ body: JSON.stringify(body),
8145
+ httpMethod: 'POST',
8146
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8147
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
8148
+ })
8149
+ .then((httpResponse) => {
8150
+ return httpResponse.json();
8151
+ });
8152
+ return response.then((apiResponse) => {
8153
+ const resp = registerFilesResponseFromMldev(apiResponse);
8154
+ const typedResp = new RegisterFilesResponse();
8155
+ Object.assign(typedResp, resp);
8156
+ return typedResp;
8157
+ });
8158
+ }
8159
+ }
8050
8160
  }
8051
8161
 
8052
8162
  /**
@@ -9285,7 +9395,9 @@ class BaseInteractions extends APIResource {
9285
9395
  *
9286
9396
  * @example
9287
9397
  * ```ts
9288
- * const interaction = await client.interactions.delete('id');
9398
+ * const interaction = await client.interactions.delete('id', {
9399
+ * api_version: 'api_version',
9400
+ * });
9289
9401
  * ```
9290
9402
  */
9291
9403
  delete(id, params = {}, options) {
@@ -9297,7 +9409,9 @@ class BaseInteractions extends APIResource {
9297
9409
  *
9298
9410
  * @example
9299
9411
  * ```ts
9300
- * const interaction = await client.interactions.cancel('id');
9412
+ * const interaction = await client.interactions.cancel('id', {
9413
+ * api_version: 'api_version',
9414
+ * });
9301
9415
  * ```
9302
9416
  */
9303
9417
  cancel(id, params = {}, options) {
@@ -11508,7 +11622,7 @@ function voiceActivityFromVertex(fromObject) {
11508
11622
  * Copyright 2025 Google LLC
11509
11623
  * SPDX-License-Identifier: Apache-2.0
11510
11624
  */
11511
- function blobToMldev$1(fromObject) {
11625
+ function blobToMldev$1(fromObject, _rootObject) {
11512
11626
  const toObject = {};
11513
11627
  const fromData = getValueByPath(fromObject, ['data']);
11514
11628
  if (fromData != null) {
@@ -11523,7 +11637,7 @@ function blobToMldev$1(fromObject) {
11523
11637
  }
11524
11638
  return toObject;
11525
11639
  }
11526
- function candidateFromMldev(fromObject) {
11640
+ function candidateFromMldev(fromObject, rootObject) {
11527
11641
  const toObject = {};
11528
11642
  const fromContent = getValueByPath(fromObject, ['content']);
11529
11643
  if (fromContent != null) {
@@ -11583,7 +11697,7 @@ function candidateFromMldev(fromObject) {
11583
11697
  }
11584
11698
  return toObject;
11585
11699
  }
11586
- function citationMetadataFromMldev(fromObject) {
11700
+ function citationMetadataFromMldev(fromObject, _rootObject) {
11587
11701
  const toObject = {};
11588
11702
  const fromCitations = getValueByPath(fromObject, ['citationSources']);
11589
11703
  if (fromCitations != null) {
@@ -11597,7 +11711,7 @@ function citationMetadataFromMldev(fromObject) {
11597
11711
  }
11598
11712
  return toObject;
11599
11713
  }
11600
- function computeTokensParametersToVertex(apiClient, fromObject) {
11714
+ function computeTokensParametersToVertex(apiClient, fromObject, _rootObject) {
11601
11715
  const toObject = {};
11602
11716
  const fromModel = getValueByPath(fromObject, ['model']);
11603
11717
  if (fromModel != null) {
@@ -11615,7 +11729,7 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
11615
11729
  }
11616
11730
  return toObject;
11617
11731
  }
11618
- function computeTokensResponseFromVertex(fromObject) {
11732
+ function computeTokensResponseFromVertex(fromObject, _rootObject) {
11619
11733
  const toObject = {};
11620
11734
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11621
11735
  'sdkHttpResponse',
@@ -11635,7 +11749,7 @@ function computeTokensResponseFromVertex(fromObject) {
11635
11749
  }
11636
11750
  return toObject;
11637
11751
  }
11638
- function contentEmbeddingFromVertex(fromObject) {
11752
+ function contentEmbeddingFromVertex(fromObject, rootObject) {
11639
11753
  const toObject = {};
11640
11754
  const fromValues = getValueByPath(fromObject, ['values']);
11641
11755
  if (fromValues != null) {
@@ -11647,7 +11761,7 @@ function contentEmbeddingFromVertex(fromObject) {
11647
11761
  }
11648
11762
  return toObject;
11649
11763
  }
11650
- function contentEmbeddingStatisticsFromVertex(fromObject) {
11764
+ function contentEmbeddingStatisticsFromVertex(fromObject, _rootObject) {
11651
11765
  const toObject = {};
11652
11766
  const fromTruncated = getValueByPath(fromObject, ['truncated']);
11653
11767
  if (fromTruncated != null) {
@@ -11659,7 +11773,7 @@ function contentEmbeddingStatisticsFromVertex(fromObject) {
11659
11773
  }
11660
11774
  return toObject;
11661
11775
  }
11662
- function contentToMldev$1(fromObject) {
11776
+ function contentToMldev$1(fromObject, rootObject) {
11663
11777
  const toObject = {};
11664
11778
  const fromParts = getValueByPath(fromObject, ['parts']);
11665
11779
  if (fromParts != null) {
@@ -11677,7 +11791,7 @@ function contentToMldev$1(fromObject) {
11677
11791
  }
11678
11792
  return toObject;
11679
11793
  }
11680
- function controlReferenceConfigToVertex(fromObject) {
11794
+ function controlReferenceConfigToVertex(fromObject, _rootObject) {
11681
11795
  const toObject = {};
11682
11796
  const fromControlType = getValueByPath(fromObject, ['controlType']);
11683
11797
  if (fromControlType != null) {
@@ -11691,7 +11805,7 @@ function controlReferenceConfigToVertex(fromObject) {
11691
11805
  }
11692
11806
  return toObject;
11693
11807
  }
11694
- function countTokensConfigToMldev(fromObject) {
11808
+ function countTokensConfigToMldev(fromObject, _rootObject) {
11695
11809
  const toObject = {};
11696
11810
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
11697
11811
  throw new Error('systemInstruction parameter is not supported in Gemini API.');
@@ -11704,7 +11818,7 @@ function countTokensConfigToMldev(fromObject) {
11704
11818
  }
11705
11819
  return toObject;
11706
11820
  }
11707
- function countTokensConfigToVertex(fromObject, parentObject) {
11821
+ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
11708
11822
  const toObject = {};
11709
11823
  const fromSystemInstruction = getValueByPath(fromObject, [
11710
11824
  'systemInstruction',
@@ -11730,7 +11844,7 @@ function countTokensConfigToVertex(fromObject, parentObject) {
11730
11844
  }
11731
11845
  return toObject;
11732
11846
  }
11733
- function countTokensParametersToMldev(apiClient, fromObject) {
11847
+ function countTokensParametersToMldev(apiClient, fromObject, rootObject) {
11734
11848
  const toObject = {};
11735
11849
  const fromModel = getValueByPath(fromObject, ['model']);
11736
11850
  if (fromModel != null) {
@@ -11752,7 +11866,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
11752
11866
  }
11753
11867
  return toObject;
11754
11868
  }
11755
- function countTokensParametersToVertex(apiClient, fromObject) {
11869
+ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
11756
11870
  const toObject = {};
11757
11871
  const fromModel = getValueByPath(fromObject, ['model']);
11758
11872
  if (fromModel != null) {
@@ -11774,7 +11888,7 @@ function countTokensParametersToVertex(apiClient, fromObject) {
11774
11888
  }
11775
11889
  return toObject;
11776
11890
  }
11777
- function countTokensResponseFromMldev(fromObject) {
11891
+ function countTokensResponseFromMldev(fromObject, _rootObject) {
11778
11892
  const toObject = {};
11779
11893
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11780
11894
  'sdkHttpResponse',
@@ -11794,7 +11908,7 @@ function countTokensResponseFromMldev(fromObject) {
11794
11908
  }
11795
11909
  return toObject;
11796
11910
  }
11797
- function countTokensResponseFromVertex(fromObject) {
11911
+ function countTokensResponseFromVertex(fromObject, _rootObject) {
11798
11912
  const toObject = {};
11799
11913
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11800
11914
  'sdkHttpResponse',
@@ -11808,7 +11922,7 @@ function countTokensResponseFromVertex(fromObject) {
11808
11922
  }
11809
11923
  return toObject;
11810
11924
  }
11811
- function deleteModelParametersToMldev(apiClient, fromObject) {
11925
+ function deleteModelParametersToMldev(apiClient, fromObject, _rootObject) {
11812
11926
  const toObject = {};
11813
11927
  const fromModel = getValueByPath(fromObject, ['model']);
11814
11928
  if (fromModel != null) {
@@ -11816,7 +11930,7 @@ function deleteModelParametersToMldev(apiClient, fromObject) {
11816
11930
  }
11817
11931
  return toObject;
11818
11932
  }
11819
- function deleteModelParametersToVertex(apiClient, fromObject) {
11933
+ function deleteModelParametersToVertex(apiClient, fromObject, _rootObject) {
11820
11934
  const toObject = {};
11821
11935
  const fromModel = getValueByPath(fromObject, ['model']);
11822
11936
  if (fromModel != null) {
@@ -11824,7 +11938,7 @@ function deleteModelParametersToVertex(apiClient, fromObject) {
11824
11938
  }
11825
11939
  return toObject;
11826
11940
  }
11827
- function deleteModelResponseFromMldev(fromObject) {
11941
+ function deleteModelResponseFromMldev(fromObject, _rootObject) {
11828
11942
  const toObject = {};
11829
11943
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11830
11944
  'sdkHttpResponse',
@@ -11834,7 +11948,7 @@ function deleteModelResponseFromMldev(fromObject) {
11834
11948
  }
11835
11949
  return toObject;
11836
11950
  }
11837
- function deleteModelResponseFromVertex(fromObject) {
11951
+ function deleteModelResponseFromVertex(fromObject, _rootObject) {
11838
11952
  const toObject = {};
11839
11953
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11840
11954
  'sdkHttpResponse',
@@ -11844,7 +11958,7 @@ function deleteModelResponseFromVertex(fromObject) {
11844
11958
  }
11845
11959
  return toObject;
11846
11960
  }
11847
- function editImageConfigToVertex(fromObject, parentObject) {
11961
+ function editImageConfigToVertex(fromObject, parentObject, _rootObject) {
11848
11962
  const toObject = {};
11849
11963
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
11850
11964
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -11934,7 +12048,7 @@ function editImageConfigToVertex(fromObject, parentObject) {
11934
12048
  }
11935
12049
  return toObject;
11936
12050
  }
11937
- function editImageParametersInternalToVertex(apiClient, fromObject) {
12051
+ function editImageParametersInternalToVertex(apiClient, fromObject, rootObject) {
11938
12052
  const toObject = {};
11939
12053
  const fromModel = getValueByPath(fromObject, ['model']);
11940
12054
  if (fromModel != null) {
@@ -11962,7 +12076,7 @@ function editImageParametersInternalToVertex(apiClient, fromObject) {
11962
12076
  }
11963
12077
  return toObject;
11964
12078
  }
11965
- function editImageResponseFromVertex(fromObject) {
12079
+ function editImageResponseFromVertex(fromObject, rootObject) {
11966
12080
  const toObject = {};
11967
12081
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11968
12082
  'sdkHttpResponse',
@@ -11984,7 +12098,7 @@ function editImageResponseFromVertex(fromObject) {
11984
12098
  }
11985
12099
  return toObject;
11986
12100
  }
11987
- function embedContentConfigToMldev(fromObject, parentObject) {
12101
+ function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
11988
12102
  const toObject = {};
11989
12103
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
11990
12104
  if (parentObject !== undefined && fromTaskType != null) {
@@ -12008,7 +12122,7 @@ function embedContentConfigToMldev(fromObject, parentObject) {
12008
12122
  }
12009
12123
  return toObject;
12010
12124
  }
12011
- function embedContentConfigToVertex(fromObject, parentObject) {
12125
+ function embedContentConfigToVertex(fromObject, parentObject, _rootObject) {
12012
12126
  const toObject = {};
12013
12127
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
12014
12128
  if (parentObject !== undefined && fromTaskType != null) {
@@ -12034,7 +12148,7 @@ function embedContentConfigToVertex(fromObject, parentObject) {
12034
12148
  }
12035
12149
  return toObject;
12036
12150
  }
12037
- function embedContentParametersToMldev(apiClient, fromObject) {
12151
+ function embedContentParametersToMldev(apiClient, fromObject, rootObject) {
12038
12152
  const toObject = {};
12039
12153
  const fromModel = getValueByPath(fromObject, ['model']);
12040
12154
  if (fromModel != null) {
@@ -12060,7 +12174,7 @@ function embedContentParametersToMldev(apiClient, fromObject) {
12060
12174
  }
12061
12175
  return toObject;
12062
12176
  }
12063
- function embedContentParametersToVertex(apiClient, fromObject) {
12177
+ function embedContentParametersToVertex(apiClient, fromObject, rootObject) {
12064
12178
  const toObject = {};
12065
12179
  const fromModel = getValueByPath(fromObject, ['model']);
12066
12180
  if (fromModel != null) {
@@ -12082,7 +12196,7 @@ function embedContentParametersToVertex(apiClient, fromObject) {
12082
12196
  }
12083
12197
  return toObject;
12084
12198
  }
12085
- function embedContentResponseFromMldev(fromObject) {
12199
+ function embedContentResponseFromMldev(fromObject, _rootObject) {
12086
12200
  const toObject = {};
12087
12201
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12088
12202
  'sdkHttpResponse',
@@ -12106,7 +12220,7 @@ function embedContentResponseFromMldev(fromObject) {
12106
12220
  }
12107
12221
  return toObject;
12108
12222
  }
12109
- function embedContentResponseFromVertex(fromObject) {
12223
+ function embedContentResponseFromVertex(fromObject, rootObject) {
12110
12224
  const toObject = {};
12111
12225
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12112
12226
  'sdkHttpResponse',
@@ -12133,7 +12247,7 @@ function embedContentResponseFromVertex(fromObject) {
12133
12247
  }
12134
12248
  return toObject;
12135
12249
  }
12136
- function endpointFromVertex(fromObject) {
12250
+ function endpointFromVertex(fromObject, _rootObject) {
12137
12251
  const toObject = {};
12138
12252
  const fromName = getValueByPath(fromObject, ['endpoint']);
12139
12253
  if (fromName != null) {
@@ -12147,7 +12261,7 @@ function endpointFromVertex(fromObject) {
12147
12261
  }
12148
12262
  return toObject;
12149
12263
  }
12150
- function fileDataToMldev$1(fromObject) {
12264
+ function fileDataToMldev$1(fromObject, _rootObject) {
12151
12265
  const toObject = {};
12152
12266
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
12153
12267
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -12162,7 +12276,7 @@ function fileDataToMldev$1(fromObject) {
12162
12276
  }
12163
12277
  return toObject;
12164
12278
  }
12165
- function functionCallToMldev$1(fromObject) {
12279
+ function functionCallToMldev$1(fromObject, _rootObject) {
12166
12280
  const toObject = {};
12167
12281
  const fromId = getValueByPath(fromObject, ['id']);
12168
12282
  if (fromId != null) {
@@ -12184,7 +12298,7 @@ function functionCallToMldev$1(fromObject) {
12184
12298
  }
12185
12299
  return toObject;
12186
12300
  }
12187
- function functionCallingConfigToMldev(fromObject) {
12301
+ function functionCallingConfigToMldev(fromObject, _rootObject) {
12188
12302
  const toObject = {};
12189
12303
  const fromAllowedFunctionNames = getValueByPath(fromObject, [
12190
12304
  'allowedFunctionNames',
@@ -12202,7 +12316,7 @@ function functionCallingConfigToMldev(fromObject) {
12202
12316
  }
12203
12317
  return toObject;
12204
12318
  }
12205
- function functionDeclarationToVertex(fromObject) {
12319
+ function functionDeclarationToVertex(fromObject, _rootObject) {
12206
12320
  const toObject = {};
12207
12321
  const fromDescription = getValueByPath(fromObject, ['description']);
12208
12322
  if (fromDescription != null) {
@@ -12237,7 +12351,7 @@ function functionDeclarationToVertex(fromObject) {
12237
12351
  }
12238
12352
  return toObject;
12239
12353
  }
12240
- function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
12354
+ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootObject) {
12241
12355
  const toObject = {};
12242
12356
  const fromSystemInstruction = getValueByPath(fromObject, [
12243
12357
  'systemInstruction',
@@ -12395,9 +12509,12 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
12395
12509
  if (fromEnableEnhancedCivicAnswers != null) {
12396
12510
  setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
12397
12511
  }
12512
+ if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
12513
+ throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
12514
+ }
12398
12515
  return toObject;
12399
12516
  }
12400
- function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
12517
+ function generateContentConfigToVertex(apiClient, fromObject, parentObject, rootObject) {
12401
12518
  const toObject = {};
12402
12519
  const fromSystemInstruction = getValueByPath(fromObject, [
12403
12520
  'systemInstruction',
@@ -12563,9 +12680,15 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
12563
12680
  undefined) {
12564
12681
  throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
12565
12682
  }
12683
+ const fromModelArmorConfig = getValueByPath(fromObject, [
12684
+ 'modelArmorConfig',
12685
+ ]);
12686
+ if (parentObject !== undefined && fromModelArmorConfig != null) {
12687
+ setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
12688
+ }
12566
12689
  return toObject;
12567
12690
  }
12568
- function generateContentParametersToMldev(apiClient, fromObject) {
12691
+ function generateContentParametersToMldev(apiClient, fromObject, rootObject) {
12569
12692
  const toObject = {};
12570
12693
  const fromModel = getValueByPath(fromObject, ['model']);
12571
12694
  if (fromModel != null) {
@@ -12587,7 +12710,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
12587
12710
  }
12588
12711
  return toObject;
12589
12712
  }
12590
- function generateContentParametersToVertex(apiClient, fromObject) {
12713
+ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
12591
12714
  const toObject = {};
12592
12715
  const fromModel = getValueByPath(fromObject, ['model']);
12593
12716
  if (fromModel != null) {
@@ -12609,7 +12732,7 @@ function generateContentParametersToVertex(apiClient, fromObject) {
12609
12732
  }
12610
12733
  return toObject;
12611
12734
  }
12612
- function generateContentResponseFromMldev(fromObject) {
12735
+ function generateContentResponseFromMldev(fromObject, rootObject) {
12613
12736
  const toObject = {};
12614
12737
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12615
12738
  'sdkHttpResponse',
@@ -12649,7 +12772,7 @@ function generateContentResponseFromMldev(fromObject) {
12649
12772
  }
12650
12773
  return toObject;
12651
12774
  }
12652
- function generateContentResponseFromVertex(fromObject) {
12775
+ function generateContentResponseFromVertex(fromObject, _rootObject) {
12653
12776
  const toObject = {};
12654
12777
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12655
12778
  'sdkHttpResponse',
@@ -12693,7 +12816,7 @@ function generateContentResponseFromVertex(fromObject) {
12693
12816
  }
12694
12817
  return toObject;
12695
12818
  }
12696
- function generateImagesConfigToMldev(fromObject, parentObject) {
12819
+ function generateImagesConfigToMldev(fromObject, parentObject, _rootObject) {
12697
12820
  const toObject = {};
12698
12821
  if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
12699
12822
  throw new Error('outputGcsUri parameter is not supported in Gemini API.');
@@ -12775,7 +12898,7 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
12775
12898
  }
12776
12899
  return toObject;
12777
12900
  }
12778
- function generateImagesConfigToVertex(fromObject, parentObject) {
12901
+ function generateImagesConfigToVertex(fromObject, parentObject, _rootObject) {
12779
12902
  const toObject = {};
12780
12903
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
12781
12904
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -12867,7 +12990,7 @@ function generateImagesConfigToVertex(fromObject, parentObject) {
12867
12990
  }
12868
12991
  return toObject;
12869
12992
  }
12870
- function generateImagesParametersToMldev(apiClient, fromObject) {
12993
+ function generateImagesParametersToMldev(apiClient, fromObject, rootObject) {
12871
12994
  const toObject = {};
12872
12995
  const fromModel = getValueByPath(fromObject, ['model']);
12873
12996
  if (fromModel != null) {
@@ -12883,7 +13006,7 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
12883
13006
  }
12884
13007
  return toObject;
12885
13008
  }
12886
- function generateImagesParametersToVertex(apiClient, fromObject) {
13009
+ function generateImagesParametersToVertex(apiClient, fromObject, rootObject) {
12887
13010
  const toObject = {};
12888
13011
  const fromModel = getValueByPath(fromObject, ['model']);
12889
13012
  if (fromModel != null) {
@@ -12899,7 +13022,7 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
12899
13022
  }
12900
13023
  return toObject;
12901
13024
  }
12902
- function generateImagesResponseFromMldev(fromObject) {
13025
+ function generateImagesResponseFromMldev(fromObject, rootObject) {
12903
13026
  const toObject = {};
12904
13027
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12905
13028
  'sdkHttpResponse',
@@ -12927,7 +13050,7 @@ function generateImagesResponseFromMldev(fromObject) {
12927
13050
  }
12928
13051
  return toObject;
12929
13052
  }
12930
- function generateImagesResponseFromVertex(fromObject) {
13053
+ function generateImagesResponseFromVertex(fromObject, rootObject) {
12931
13054
  const toObject = {};
12932
13055
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12933
13056
  'sdkHttpResponse',
@@ -12955,7 +13078,7 @@ function generateImagesResponseFromVertex(fromObject) {
12955
13078
  }
12956
13079
  return toObject;
12957
13080
  }
12958
- function generateVideosConfigToMldev(fromObject, parentObject) {
13081
+ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
12959
13082
  const toObject = {};
12960
13083
  const fromNumberOfVideos = getValueByPath(fromObject, [
12961
13084
  'numberOfVideos',
@@ -13034,7 +13157,7 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
13034
13157
  }
13035
13158
  return toObject;
13036
13159
  }
13037
- function generateVideosConfigToVertex(fromObject, parentObject) {
13160
+ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
13038
13161
  const toObject = {};
13039
13162
  const fromNumberOfVideos = getValueByPath(fromObject, [
13040
13163
  'numberOfVideos',
@@ -13124,7 +13247,7 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
13124
13247
  }
13125
13248
  return toObject;
13126
13249
  }
13127
- function generateVideosOperationFromMldev(fromObject) {
13250
+ function generateVideosOperationFromMldev(fromObject, rootObject) {
13128
13251
  const toObject = {};
13129
13252
  const fromName = getValueByPath(fromObject, ['name']);
13130
13253
  if (fromName != null) {
@@ -13151,7 +13274,7 @@ function generateVideosOperationFromMldev(fromObject) {
13151
13274
  }
13152
13275
  return toObject;
13153
13276
  }
13154
- function generateVideosOperationFromVertex(fromObject) {
13277
+ function generateVideosOperationFromVertex(fromObject, rootObject) {
13155
13278
  const toObject = {};
13156
13279
  const fromName = getValueByPath(fromObject, ['name']);
13157
13280
  if (fromName != null) {
@@ -13175,7 +13298,7 @@ function generateVideosOperationFromVertex(fromObject) {
13175
13298
  }
13176
13299
  return toObject;
13177
13300
  }
13178
- function generateVideosParametersToMldev(apiClient, fromObject) {
13301
+ function generateVideosParametersToMldev(apiClient, fromObject, rootObject) {
13179
13302
  const toObject = {};
13180
13303
  const fromModel = getValueByPath(fromObject, ['model']);
13181
13304
  if (fromModel != null) {
@@ -13203,7 +13326,7 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
13203
13326
  }
13204
13327
  return toObject;
13205
13328
  }
13206
- function generateVideosParametersToVertex(apiClient, fromObject) {
13329
+ function generateVideosParametersToVertex(apiClient, fromObject, rootObject) {
13207
13330
  const toObject = {};
13208
13331
  const fromModel = getValueByPath(fromObject, ['model']);
13209
13332
  if (fromModel != null) {
@@ -13231,7 +13354,7 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
13231
13354
  }
13232
13355
  return toObject;
13233
13356
  }
13234
- function generateVideosResponseFromMldev(fromObject) {
13357
+ function generateVideosResponseFromMldev(fromObject, rootObject) {
13235
13358
  const toObject = {};
13236
13359
  const fromGeneratedVideos = getValueByPath(fromObject, [
13237
13360
  'generatedSamples',
@@ -13259,7 +13382,7 @@ function generateVideosResponseFromMldev(fromObject) {
13259
13382
  }
13260
13383
  return toObject;
13261
13384
  }
13262
- function generateVideosResponseFromVertex(fromObject) {
13385
+ function generateVideosResponseFromVertex(fromObject, rootObject) {
13263
13386
  const toObject = {};
13264
13387
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
13265
13388
  if (fromGeneratedVideos != null) {
@@ -13285,7 +13408,7 @@ function generateVideosResponseFromVertex(fromObject) {
13285
13408
  }
13286
13409
  return toObject;
13287
13410
  }
13288
- function generateVideosSourceToMldev(fromObject, parentObject) {
13411
+ function generateVideosSourceToMldev(fromObject, parentObject, rootObject) {
13289
13412
  const toObject = {};
13290
13413
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
13291
13414
  if (parentObject !== undefined && fromPrompt != null) {
@@ -13301,7 +13424,7 @@ function generateVideosSourceToMldev(fromObject, parentObject) {
13301
13424
  }
13302
13425
  return toObject;
13303
13426
  }
13304
- function generateVideosSourceToVertex(fromObject, parentObject) {
13427
+ function generateVideosSourceToVertex(fromObject, parentObject, rootObject) {
13305
13428
  const toObject = {};
13306
13429
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
13307
13430
  if (parentObject !== undefined && fromPrompt != null) {
@@ -13317,7 +13440,7 @@ function generateVideosSourceToVertex(fromObject, parentObject) {
13317
13440
  }
13318
13441
  return toObject;
13319
13442
  }
13320
- function generatedImageFromMldev(fromObject) {
13443
+ function generatedImageFromMldev(fromObject, rootObject) {
13321
13444
  const toObject = {};
13322
13445
  const fromImage = getValueByPath(fromObject, ['_self']);
13323
13446
  if (fromImage != null) {
@@ -13335,7 +13458,7 @@ function generatedImageFromMldev(fromObject) {
13335
13458
  }
13336
13459
  return toObject;
13337
13460
  }
13338
- function generatedImageFromVertex(fromObject) {
13461
+ function generatedImageFromVertex(fromObject, rootObject) {
13339
13462
  const toObject = {};
13340
13463
  const fromImage = getValueByPath(fromObject, ['_self']);
13341
13464
  if (fromImage != null) {
@@ -13357,7 +13480,7 @@ function generatedImageFromVertex(fromObject) {
13357
13480
  }
13358
13481
  return toObject;
13359
13482
  }
13360
- function generatedImageMaskFromVertex(fromObject) {
13483
+ function generatedImageMaskFromVertex(fromObject, rootObject) {
13361
13484
  const toObject = {};
13362
13485
  const fromMask = getValueByPath(fromObject, ['_self']);
13363
13486
  if (fromMask != null) {
@@ -13375,7 +13498,7 @@ function generatedImageMaskFromVertex(fromObject) {
13375
13498
  }
13376
13499
  return toObject;
13377
13500
  }
13378
- function generatedVideoFromMldev(fromObject) {
13501
+ function generatedVideoFromMldev(fromObject, rootObject) {
13379
13502
  const toObject = {};
13380
13503
  const fromVideo = getValueByPath(fromObject, ['video']);
13381
13504
  if (fromVideo != null) {
@@ -13383,7 +13506,7 @@ function generatedVideoFromMldev(fromObject) {
13383
13506
  }
13384
13507
  return toObject;
13385
13508
  }
13386
- function generatedVideoFromVertex(fromObject) {
13509
+ function generatedVideoFromVertex(fromObject, rootObject) {
13387
13510
  const toObject = {};
13388
13511
  const fromVideo = getValueByPath(fromObject, ['_self']);
13389
13512
  if (fromVideo != null) {
@@ -13391,7 +13514,7 @@ function generatedVideoFromVertex(fromObject) {
13391
13514
  }
13392
13515
  return toObject;
13393
13516
  }
13394
- function generationConfigToVertex(fromObject) {
13517
+ function generationConfigToVertex(fromObject, _rootObject) {
13395
13518
  const toObject = {};
13396
13519
  const fromModelSelectionConfig = getValueByPath(fromObject, [
13397
13520
  'modelSelectionConfig',
@@ -13519,7 +13642,7 @@ function generationConfigToVertex(fromObject) {
13519
13642
  }
13520
13643
  return toObject;
13521
13644
  }
13522
- function getModelParametersToMldev(apiClient, fromObject) {
13645
+ function getModelParametersToMldev(apiClient, fromObject, _rootObject) {
13523
13646
  const toObject = {};
13524
13647
  const fromModel = getValueByPath(fromObject, ['model']);
13525
13648
  if (fromModel != null) {
@@ -13527,7 +13650,7 @@ function getModelParametersToMldev(apiClient, fromObject) {
13527
13650
  }
13528
13651
  return toObject;
13529
13652
  }
13530
- function getModelParametersToVertex(apiClient, fromObject) {
13653
+ function getModelParametersToVertex(apiClient, fromObject, _rootObject) {
13531
13654
  const toObject = {};
13532
13655
  const fromModel = getValueByPath(fromObject, ['model']);
13533
13656
  if (fromModel != null) {
@@ -13535,7 +13658,7 @@ function getModelParametersToVertex(apiClient, fromObject) {
13535
13658
  }
13536
13659
  return toObject;
13537
13660
  }
13538
- function googleMapsToMldev$1(fromObject) {
13661
+ function googleMapsToMldev$1(fromObject, _rootObject) {
13539
13662
  const toObject = {};
13540
13663
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
13541
13664
  throw new Error('authConfig parameter is not supported in Gemini API.');
@@ -13546,7 +13669,7 @@ function googleMapsToMldev$1(fromObject) {
13546
13669
  }
13547
13670
  return toObject;
13548
13671
  }
13549
- function googleSearchToMldev$1(fromObject) {
13672
+ function googleSearchToMldev$1(fromObject, _rootObject) {
13550
13673
  const toObject = {};
13551
13674
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13552
13675
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
@@ -13562,7 +13685,7 @@ function googleSearchToMldev$1(fromObject) {
13562
13685
  }
13563
13686
  return toObject;
13564
13687
  }
13565
- function imageConfigToMldev(fromObject) {
13688
+ function imageConfigToMldev(fromObject, _rootObject) {
13566
13689
  const toObject = {};
13567
13690
  const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
13568
13691
  if (fromAspectRatio != null) {
@@ -13584,7 +13707,7 @@ function imageConfigToMldev(fromObject) {
13584
13707
  }
13585
13708
  return toObject;
13586
13709
  }
13587
- function imageConfigToVertex(fromObject) {
13710
+ function imageConfigToVertex(fromObject, _rootObject) {
13588
13711
  const toObject = {};
13589
13712
  const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
13590
13713
  if (fromAspectRatio != null) {
@@ -13614,7 +13737,7 @@ function imageConfigToVertex(fromObject) {
13614
13737
  }
13615
13738
  return toObject;
13616
13739
  }
13617
- function imageFromMldev(fromObject) {
13740
+ function imageFromMldev(fromObject, _rootObject) {
13618
13741
  const toObject = {};
13619
13742
  const fromImageBytes = getValueByPath(fromObject, [
13620
13743
  'bytesBase64Encoded',
@@ -13628,7 +13751,7 @@ function imageFromMldev(fromObject) {
13628
13751
  }
13629
13752
  return toObject;
13630
13753
  }
13631
- function imageFromVertex(fromObject) {
13754
+ function imageFromVertex(fromObject, _rootObject) {
13632
13755
  const toObject = {};
13633
13756
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
13634
13757
  if (fromGcsUri != null) {
@@ -13646,7 +13769,7 @@ function imageFromVertex(fromObject) {
13646
13769
  }
13647
13770
  return toObject;
13648
13771
  }
13649
- function imageToMldev(fromObject) {
13772
+ function imageToMldev(fromObject, _rootObject) {
13650
13773
  const toObject = {};
13651
13774
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
13652
13775
  throw new Error('gcsUri parameter is not supported in Gemini API.');
@@ -13661,7 +13784,7 @@ function imageToMldev(fromObject) {
13661
13784
  }
13662
13785
  return toObject;
13663
13786
  }
13664
- function imageToVertex(fromObject) {
13787
+ function imageToVertex(fromObject, _rootObject) {
13665
13788
  const toObject = {};
13666
13789
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
13667
13790
  if (fromGcsUri != null) {
@@ -13677,7 +13800,7 @@ function imageToVertex(fromObject) {
13677
13800
  }
13678
13801
  return toObject;
13679
13802
  }
13680
- function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
13803
+ function listModelsConfigToMldev(apiClient, fromObject, parentObject, _rootObject) {
13681
13804
  const toObject = {};
13682
13805
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
13683
13806
  if (parentObject !== undefined && fromPageSize != null) {
@@ -13697,7 +13820,7 @@ function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
13697
13820
  }
13698
13821
  return toObject;
13699
13822
  }
13700
- function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
13823
+ function listModelsConfigToVertex(apiClient, fromObject, parentObject, _rootObject) {
13701
13824
  const toObject = {};
13702
13825
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
13703
13826
  if (parentObject !== undefined && fromPageSize != null) {
@@ -13717,7 +13840,7 @@ function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
13717
13840
  }
13718
13841
  return toObject;
13719
13842
  }
13720
- function listModelsParametersToMldev(apiClient, fromObject) {
13843
+ function listModelsParametersToMldev(apiClient, fromObject, rootObject) {
13721
13844
  const toObject = {};
13722
13845
  const fromConfig = getValueByPath(fromObject, ['config']);
13723
13846
  if (fromConfig != null) {
@@ -13725,7 +13848,7 @@ function listModelsParametersToMldev(apiClient, fromObject) {
13725
13848
  }
13726
13849
  return toObject;
13727
13850
  }
13728
- function listModelsParametersToVertex(apiClient, fromObject) {
13851
+ function listModelsParametersToVertex(apiClient, fromObject, rootObject) {
13729
13852
  const toObject = {};
13730
13853
  const fromConfig = getValueByPath(fromObject, ['config']);
13731
13854
  if (fromConfig != null) {
@@ -13733,7 +13856,7 @@ function listModelsParametersToVertex(apiClient, fromObject) {
13733
13856
  }
13734
13857
  return toObject;
13735
13858
  }
13736
- function listModelsResponseFromMldev(fromObject) {
13859
+ function listModelsResponseFromMldev(fromObject, rootObject) {
13737
13860
  const toObject = {};
13738
13861
  const fromSdkHttpResponse = getValueByPath(fromObject, [
13739
13862
  'sdkHttpResponse',
@@ -13759,7 +13882,7 @@ function listModelsResponseFromMldev(fromObject) {
13759
13882
  }
13760
13883
  return toObject;
13761
13884
  }
13762
- function listModelsResponseFromVertex(fromObject) {
13885
+ function listModelsResponseFromVertex(fromObject, rootObject) {
13763
13886
  const toObject = {};
13764
13887
  const fromSdkHttpResponse = getValueByPath(fromObject, [
13765
13888
  'sdkHttpResponse',
@@ -13785,7 +13908,7 @@ function listModelsResponseFromVertex(fromObject) {
13785
13908
  }
13786
13909
  return toObject;
13787
13910
  }
13788
- function maskReferenceConfigToVertex(fromObject) {
13911
+ function maskReferenceConfigToVertex(fromObject, _rootObject) {
13789
13912
  const toObject = {};
13790
13913
  const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
13791
13914
  if (fromMaskMode != null) {
@@ -13803,7 +13926,7 @@ function maskReferenceConfigToVertex(fromObject) {
13803
13926
  }
13804
13927
  return toObject;
13805
13928
  }
13806
- function modelFromMldev(fromObject) {
13929
+ function modelFromMldev(fromObject, rootObject) {
13807
13930
  const toObject = {};
13808
13931
  const fromName = getValueByPath(fromObject, ['name']);
13809
13932
  if (fromName != null) {
@@ -13867,7 +13990,7 @@ function modelFromMldev(fromObject) {
13867
13990
  }
13868
13991
  return toObject;
13869
13992
  }
13870
- function modelFromVertex(fromObject) {
13993
+ function modelFromVertex(fromObject, rootObject) {
13871
13994
  const toObject = {};
13872
13995
  const fromName = getValueByPath(fromObject, ['name']);
13873
13996
  if (fromName != null) {
@@ -13921,7 +14044,7 @@ function modelFromVertex(fromObject) {
13921
14044
  }
13922
14045
  return toObject;
13923
14046
  }
13924
- function partToMldev$1(fromObject) {
14047
+ function partToMldev$1(fromObject, rootObject) {
13925
14048
  const toObject = {};
13926
14049
  const fromMediaResolution = getValueByPath(fromObject, [
13927
14050
  'mediaResolution',
@@ -13981,7 +14104,7 @@ function partToMldev$1(fromObject) {
13981
14104
  }
13982
14105
  return toObject;
13983
14106
  }
13984
- function productImageToVertex(fromObject) {
14107
+ function productImageToVertex(fromObject, rootObject) {
13985
14108
  const toObject = {};
13986
14109
  const fromProductImage = getValueByPath(fromObject, ['productImage']);
13987
14110
  if (fromProductImage != null) {
@@ -13989,7 +14112,7 @@ function productImageToVertex(fromObject) {
13989
14112
  }
13990
14113
  return toObject;
13991
14114
  }
13992
- function recontextImageConfigToVertex(fromObject, parentObject) {
14115
+ function recontextImageConfigToVertex(fromObject, parentObject, _rootObject) {
13993
14116
  const toObject = {};
13994
14117
  const fromNumberOfImages = getValueByPath(fromObject, [
13995
14118
  'numberOfImages',
@@ -14049,7 +14172,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
14049
14172
  }
14050
14173
  return toObject;
14051
14174
  }
14052
- function recontextImageParametersToVertex(apiClient, fromObject) {
14175
+ function recontextImageParametersToVertex(apiClient, fromObject, rootObject) {
14053
14176
  const toObject = {};
14054
14177
  const fromModel = getValueByPath(fromObject, ['model']);
14055
14178
  if (fromModel != null) {
@@ -14065,7 +14188,7 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
14065
14188
  }
14066
14189
  return toObject;
14067
14190
  }
14068
- function recontextImageResponseFromVertex(fromObject) {
14191
+ function recontextImageResponseFromVertex(fromObject, rootObject) {
14069
14192
  const toObject = {};
14070
14193
  const fromGeneratedImages = getValueByPath(fromObject, [
14071
14194
  'predictions',
@@ -14081,7 +14204,7 @@ function recontextImageResponseFromVertex(fromObject) {
14081
14204
  }
14082
14205
  return toObject;
14083
14206
  }
14084
- function recontextImageSourceToVertex(fromObject, parentObject) {
14207
+ function recontextImageSourceToVertex(fromObject, parentObject, rootObject) {
14085
14208
  const toObject = {};
14086
14209
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
14087
14210
  if (parentObject !== undefined && fromPrompt != null) {
@@ -14105,7 +14228,7 @@ function recontextImageSourceToVertex(fromObject, parentObject) {
14105
14228
  }
14106
14229
  return toObject;
14107
14230
  }
14108
- function referenceImageAPIInternalToVertex(fromObject) {
14231
+ function referenceImageAPIInternalToVertex(fromObject, rootObject) {
14109
14232
  const toObject = {};
14110
14233
  const fromReferenceImage = getValueByPath(fromObject, [
14111
14234
  'referenceImage',
@@ -14149,7 +14272,7 @@ function referenceImageAPIInternalToVertex(fromObject) {
14149
14272
  }
14150
14273
  return toObject;
14151
14274
  }
14152
- function safetyAttributesFromMldev(fromObject) {
14275
+ function safetyAttributesFromMldev(fromObject, _rootObject) {
14153
14276
  const toObject = {};
14154
14277
  const fromCategories = getValueByPath(fromObject, [
14155
14278
  'safetyAttributes',
@@ -14171,7 +14294,7 @@ function safetyAttributesFromMldev(fromObject) {
14171
14294
  }
14172
14295
  return toObject;
14173
14296
  }
14174
- function safetyAttributesFromVertex(fromObject) {
14297
+ function safetyAttributesFromVertex(fromObject, _rootObject) {
14175
14298
  const toObject = {};
14176
14299
  const fromCategories = getValueByPath(fromObject, [
14177
14300
  'safetyAttributes',
@@ -14193,7 +14316,7 @@ function safetyAttributesFromVertex(fromObject) {
14193
14316
  }
14194
14317
  return toObject;
14195
14318
  }
14196
- function safetySettingToMldev(fromObject) {
14319
+ function safetySettingToMldev(fromObject, _rootObject) {
14197
14320
  const toObject = {};
14198
14321
  const fromCategory = getValueByPath(fromObject, ['category']);
14199
14322
  if (fromCategory != null) {
@@ -14208,7 +14331,7 @@ function safetySettingToMldev(fromObject) {
14208
14331
  }
14209
14332
  return toObject;
14210
14333
  }
14211
- function scribbleImageToVertex(fromObject) {
14334
+ function scribbleImageToVertex(fromObject, rootObject) {
14212
14335
  const toObject = {};
14213
14336
  const fromImage = getValueByPath(fromObject, ['image']);
14214
14337
  if (fromImage != null) {
@@ -14216,7 +14339,7 @@ function scribbleImageToVertex(fromObject) {
14216
14339
  }
14217
14340
  return toObject;
14218
14341
  }
14219
- function segmentImageConfigToVertex(fromObject, parentObject) {
14342
+ function segmentImageConfigToVertex(fromObject, parentObject, _rootObject) {
14220
14343
  const toObject = {};
14221
14344
  const fromMode = getValueByPath(fromObject, ['mode']);
14222
14345
  if (parentObject !== undefined && fromMode != null) {
@@ -14250,7 +14373,7 @@ function segmentImageConfigToVertex(fromObject, parentObject) {
14250
14373
  }
14251
14374
  return toObject;
14252
14375
  }
14253
- function segmentImageParametersToVertex(apiClient, fromObject) {
14376
+ function segmentImageParametersToVertex(apiClient, fromObject, rootObject) {
14254
14377
  const toObject = {};
14255
14378
  const fromModel = getValueByPath(fromObject, ['model']);
14256
14379
  if (fromModel != null) {
@@ -14266,7 +14389,7 @@ function segmentImageParametersToVertex(apiClient, fromObject) {
14266
14389
  }
14267
14390
  return toObject;
14268
14391
  }
14269
- function segmentImageResponseFromVertex(fromObject) {
14392
+ function segmentImageResponseFromVertex(fromObject, rootObject) {
14270
14393
  const toObject = {};
14271
14394
  const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
14272
14395
  if (fromGeneratedMasks != null) {
@@ -14280,7 +14403,7 @@ function segmentImageResponseFromVertex(fromObject) {
14280
14403
  }
14281
14404
  return toObject;
14282
14405
  }
14283
- function segmentImageSourceToVertex(fromObject, parentObject) {
14406
+ function segmentImageSourceToVertex(fromObject, parentObject, rootObject) {
14284
14407
  const toObject = {};
14285
14408
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
14286
14409
  if (parentObject !== undefined && fromPrompt != null) {
@@ -14298,7 +14421,7 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
14298
14421
  }
14299
14422
  return toObject;
14300
14423
  }
14301
- function toolConfigToMldev(fromObject) {
14424
+ function toolConfigToMldev(fromObject, rootObject) {
14302
14425
  const toObject = {};
14303
14426
  const fromRetrievalConfig = getValueByPath(fromObject, [
14304
14427
  'retrievalConfig',
@@ -14314,7 +14437,7 @@ function toolConfigToMldev(fromObject) {
14314
14437
  }
14315
14438
  return toObject;
14316
14439
  }
14317
- function toolToMldev$1(fromObject) {
14440
+ function toolToMldev$1(fromObject, rootObject) {
14318
14441
  const toObject = {};
14319
14442
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
14320
14443
  throw new Error('retrieval parameter is not supported in Gemini API.');
@@ -14368,7 +14491,7 @@ function toolToMldev$1(fromObject) {
14368
14491
  }
14369
14492
  return toObject;
14370
14493
  }
14371
- function toolToVertex(fromObject) {
14494
+ function toolToVertex(fromObject, rootObject) {
14372
14495
  const toObject = {};
14373
14496
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
14374
14497
  if (fromRetrieval != null) {
@@ -14425,7 +14548,7 @@ function toolToVertex(fromObject) {
14425
14548
  }
14426
14549
  return toObject;
14427
14550
  }
14428
- function tunedModelInfoFromMldev(fromObject) {
14551
+ function tunedModelInfoFromMldev(fromObject, _rootObject) {
14429
14552
  const toObject = {};
14430
14553
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
14431
14554
  if (fromBaseModel != null) {
@@ -14441,7 +14564,7 @@ function tunedModelInfoFromMldev(fromObject) {
14441
14564
  }
14442
14565
  return toObject;
14443
14566
  }
14444
- function tunedModelInfoFromVertex(fromObject) {
14567
+ function tunedModelInfoFromVertex(fromObject, _rootObject) {
14445
14568
  const toObject = {};
14446
14569
  const fromBaseModel = getValueByPath(fromObject, [
14447
14570
  'labels',
@@ -14460,7 +14583,7 @@ function tunedModelInfoFromVertex(fromObject) {
14460
14583
  }
14461
14584
  return toObject;
14462
14585
  }
14463
- function updateModelConfigToMldev(fromObject, parentObject) {
14586
+ function updateModelConfigToMldev(fromObject, parentObject, _rootObject) {
14464
14587
  const toObject = {};
14465
14588
  const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14466
14589
  if (parentObject !== undefined && fromDisplayName != null) {
@@ -14478,7 +14601,7 @@ function updateModelConfigToMldev(fromObject, parentObject) {
14478
14601
  }
14479
14602
  return toObject;
14480
14603
  }
14481
- function updateModelConfigToVertex(fromObject, parentObject) {
14604
+ function updateModelConfigToVertex(fromObject, parentObject, _rootObject) {
14482
14605
  const toObject = {};
14483
14606
  const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14484
14607
  if (parentObject !== undefined && fromDisplayName != null) {
@@ -14496,7 +14619,7 @@ function updateModelConfigToVertex(fromObject, parentObject) {
14496
14619
  }
14497
14620
  return toObject;
14498
14621
  }
14499
- function updateModelParametersToMldev(apiClient, fromObject) {
14622
+ function updateModelParametersToMldev(apiClient, fromObject, rootObject) {
14500
14623
  const toObject = {};
14501
14624
  const fromModel = getValueByPath(fromObject, ['model']);
14502
14625
  if (fromModel != null) {
@@ -14508,7 +14631,7 @@ function updateModelParametersToMldev(apiClient, fromObject) {
14508
14631
  }
14509
14632
  return toObject;
14510
14633
  }
14511
- function updateModelParametersToVertex(apiClient, fromObject) {
14634
+ function updateModelParametersToVertex(apiClient, fromObject, rootObject) {
14512
14635
  const toObject = {};
14513
14636
  const fromModel = getValueByPath(fromObject, ['model']);
14514
14637
  if (fromModel != null) {
@@ -14520,7 +14643,7 @@ function updateModelParametersToVertex(apiClient, fromObject) {
14520
14643
  }
14521
14644
  return toObject;
14522
14645
  }
14523
- function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
14646
+ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject, _rootObject) {
14524
14647
  const toObject = {};
14525
14648
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
14526
14649
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -14584,7 +14707,7 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
14584
14707
  }
14585
14708
  return toObject;
14586
14709
  }
14587
- function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
14710
+ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject, rootObject) {
14588
14711
  const toObject = {};
14589
14712
  const fromModel = getValueByPath(fromObject, ['model']);
14590
14713
  if (fromModel != null) {
@@ -14606,7 +14729,7 @@ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
14606
14729
  }
14607
14730
  return toObject;
14608
14731
  }
14609
- function upscaleImageResponseFromVertex(fromObject) {
14732
+ function upscaleImageResponseFromVertex(fromObject, rootObject) {
14610
14733
  const toObject = {};
14611
14734
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14612
14735
  'sdkHttpResponse',
@@ -14628,7 +14751,7 @@ function upscaleImageResponseFromVertex(fromObject) {
14628
14751
  }
14629
14752
  return toObject;
14630
14753
  }
14631
- function videoFromMldev(fromObject) {
14754
+ function videoFromMldev(fromObject, _rootObject) {
14632
14755
  const toObject = {};
14633
14756
  const fromUri = getValueByPath(fromObject, ['uri']);
14634
14757
  if (fromUri != null) {
@@ -14644,7 +14767,7 @@ function videoFromMldev(fromObject) {
14644
14767
  }
14645
14768
  return toObject;
14646
14769
  }
14647
- function videoFromVertex(fromObject) {
14770
+ function videoFromVertex(fromObject, _rootObject) {
14648
14771
  const toObject = {};
14649
14772
  const fromUri = getValueByPath(fromObject, ['gcsUri']);
14650
14773
  if (fromUri != null) {
@@ -14662,7 +14785,7 @@ function videoFromVertex(fromObject) {
14662
14785
  }
14663
14786
  return toObject;
14664
14787
  }
14665
- function videoGenerationMaskToVertex(fromObject) {
14788
+ function videoGenerationMaskToVertex(fromObject, rootObject) {
14666
14789
  const toObject = {};
14667
14790
  const fromImage = getValueByPath(fromObject, ['image']);
14668
14791
  if (fromImage != null) {
@@ -14674,7 +14797,7 @@ function videoGenerationMaskToVertex(fromObject) {
14674
14797
  }
14675
14798
  return toObject;
14676
14799
  }
14677
- function videoGenerationReferenceImageToMldev(fromObject) {
14800
+ function videoGenerationReferenceImageToMldev(fromObject, rootObject) {
14678
14801
  const toObject = {};
14679
14802
  const fromImage = getValueByPath(fromObject, ['image']);
14680
14803
  if (fromImage != null) {
@@ -14688,7 +14811,7 @@ function videoGenerationReferenceImageToMldev(fromObject) {
14688
14811
  }
14689
14812
  return toObject;
14690
14813
  }
14691
- function videoGenerationReferenceImageToVertex(fromObject) {
14814
+ function videoGenerationReferenceImageToVertex(fromObject, rootObject) {
14692
14815
  const toObject = {};
14693
14816
  const fromImage = getValueByPath(fromObject, ['image']);
14694
14817
  if (fromImage != null) {
@@ -14702,7 +14825,7 @@ function videoGenerationReferenceImageToVertex(fromObject) {
14702
14825
  }
14703
14826
  return toObject;
14704
14827
  }
14705
- function videoToMldev(fromObject) {
14828
+ function videoToMldev(fromObject, _rootObject) {
14706
14829
  const toObject = {};
14707
14830
  const fromUri = getValueByPath(fromObject, ['uri']);
14708
14831
  if (fromUri != null) {
@@ -14718,7 +14841,7 @@ function videoToMldev(fromObject) {
14718
14841
  }
14719
14842
  return toObject;
14720
14843
  }
14721
- function videoToVertex(fromObject) {
14844
+ function videoToVertex(fromObject, _rootObject) {
14722
14845
  const toObject = {};
14723
14846
  const fromUri = getValueByPath(fromObject, ['uri']);
14724
14847
  if (fromUri != null) {
@@ -15257,8 +15380,19 @@ class Live {
15257
15380
  }
15258
15381
  const headers = mapToHeaders(clientHeaders);
15259
15382
  if (this.apiClient.isVertexAI()) {
15260
- url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
15261
- await this.auth.addAuthHeaders(headers, url);
15383
+ const project = this.apiClient.getProject();
15384
+ const location = this.apiClient.getLocation();
15385
+ const apiKey = this.apiClient.getApiKey();
15386
+ const hasStandardAuth = (!!project && !!location) || !!apiKey;
15387
+ if (this.apiClient.getCustomBaseUrl() && !hasStandardAuth) {
15388
+ // Custom base URL without standard auth (e.g., proxy).
15389
+ url = websocketBaseUrl;
15390
+ // Auth headers are assumed to be in `clientHeaders` from httpOptions.
15391
+ }
15392
+ else {
15393
+ url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
15394
+ await this.auth.addAuthHeaders(headers, url);
15395
+ }
15262
15396
  }
15263
15397
  else {
15264
15398
  const apiKey = this.apiClient.getApiKey();
@@ -15304,8 +15438,10 @@ class Live {
15304
15438
  transformedModel.startsWith('publishers/')) {
15305
15439
  const project = this.apiClient.getProject();
15306
15440
  const location = this.apiClient.getLocation();
15307
- transformedModel =
15308
- `projects/${project}/locations/${location}/` + transformedModel;
15441
+ if (project && location) {
15442
+ transformedModel =
15443
+ `projects/${project}/locations/${location}/` + transformedModel;
15444
+ }
15309
15445
  }
15310
15446
  let clientMessage = {};
15311
15447
  if (this.apiClient.isVertexAI() &&
@@ -16261,7 +16397,7 @@ class Models extends BaseModule {
16261
16397
  _c = apiResponse_1_1.value;
16262
16398
  _d = false;
16263
16399
  const chunk = _c;
16264
- const resp = generateContentResponseFromVertex((yield __await(chunk.json())));
16400
+ const resp = generateContentResponseFromVertex((yield __await(chunk.json())), params);
16265
16401
  resp['sdkHttpResponse'] = {
16266
16402
  headers: chunk.headers,
16267
16403
  };
@@ -16303,7 +16439,7 @@ class Models extends BaseModule {
16303
16439
  _c = apiResponse_2_1.value;
16304
16440
  _d = false;
16305
16441
  const chunk = _c;
16306
- const resp = generateContentResponseFromMldev((yield __await(chunk.json())));
16442
+ const resp = generateContentResponseFromMldev((yield __await(chunk.json())), params);
16307
16443
  resp['sdkHttpResponse'] = {
16308
16444
  headers: chunk.headers,
16309
16445
  };
@@ -18077,6 +18213,12 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
18077
18213
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
18078
18214
  throw new Error('adapterSize parameter is not supported in Gemini API.');
18079
18215
  }
18216
+ if (getValueByPath(fromObject, ['tuningMode']) !== undefined) {
18217
+ throw new Error('tuningMode parameter is not supported in Gemini API.');
18218
+ }
18219
+ if (getValueByPath(fromObject, ['customBaseModel']) !== undefined) {
18220
+ throw new Error('customBaseModel parameter is not supported in Gemini API.');
18221
+ }
18080
18222
  const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
18081
18223
  if (parentObject !== undefined && fromBatchSize != null) {
18082
18224
  setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
@@ -18091,6 +18233,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
18091
18233
  if (getValueByPath(fromObject, ['beta']) !== undefined) {
18092
18234
  throw new Error('beta parameter is not supported in Gemini API.');
18093
18235
  }
18236
+ if (getValueByPath(fromObject, ['baseTeacherModel']) !== undefined) {
18237
+ throw new Error('baseTeacherModel parameter is not supported in Gemini API.');
18238
+ }
18239
+ if (getValueByPath(fromObject, ['tunedTeacherModelSource']) !== undefined) {
18240
+ throw new Error('tunedTeacherModelSource parameter is not supported in Gemini API.');
18241
+ }
18242
+ if (getValueByPath(fromObject, ['sftLossWeightMultiplier']) !== undefined) {
18243
+ throw new Error('sftLossWeightMultiplier parameter is not supported in Gemini API.');
18244
+ }
18245
+ if (getValueByPath(fromObject, ['outputUri']) !== undefined) {
18246
+ throw new Error('outputUri parameter is not supported in Gemini API.');
18247
+ }
18094
18248
  return toObject;
18095
18249
  }
18096
18250
  function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
@@ -18118,6 +18272,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18118
18272
  setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
18119
18273
  }
18120
18274
  }
18275
+ else if (discriminatorValidationDataset === 'DISTILLATION') {
18276
+ const fromValidationDataset = getValueByPath(fromObject, [
18277
+ 'validationDataset',
18278
+ ]);
18279
+ if (parentObject !== undefined && fromValidationDataset != null) {
18280
+ setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
18281
+ }
18282
+ }
18121
18283
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
18122
18284
  'tunedModelDisplayName',
18123
18285
  ]);
@@ -18147,6 +18309,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18147
18309
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
18148
18310
  }
18149
18311
  }
18312
+ else if (discriminatorEpochCount === 'DISTILLATION') {
18313
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
18314
+ if (parentObject !== undefined && fromEpochCount != null) {
18315
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
18316
+ }
18317
+ }
18150
18318
  let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
18151
18319
  'config',
18152
18320
  'method',
@@ -18174,6 +18342,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18174
18342
  ], fromLearningRateMultiplier);
18175
18343
  }
18176
18344
  }
18345
+ else if (discriminatorLearningRateMultiplier === 'DISTILLATION') {
18346
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
18347
+ 'learningRateMultiplier',
18348
+ ]);
18349
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
18350
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
18351
+ }
18352
+ }
18177
18353
  let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
18178
18354
  if (discriminatorExportLastCheckpointOnly === undefined) {
18179
18355
  discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
@@ -18194,6 +18370,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18194
18370
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
18195
18371
  }
18196
18372
  }
18373
+ else if (discriminatorExportLastCheckpointOnly === 'DISTILLATION') {
18374
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
18375
+ 'exportLastCheckpointOnly',
18376
+ ]);
18377
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
18378
+ setValueByPath(parentObject, ['distillationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
18379
+ }
18380
+ }
18197
18381
  let discriminatorAdapterSize = getValueByPath(rootObject, [
18198
18382
  'config',
18199
18383
  'method',
@@ -18213,11 +18397,58 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18213
18397
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
18214
18398
  }
18215
18399
  }
18216
- if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
18217
- throw new Error('batchSize parameter is not supported in Vertex AI.');
18400
+ else if (discriminatorAdapterSize === 'DISTILLATION') {
18401
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
18402
+ if (parentObject !== undefined && fromAdapterSize != null) {
18403
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
18404
+ }
18405
+ }
18406
+ let discriminatorTuningMode = getValueByPath(rootObject, [
18407
+ 'config',
18408
+ 'method',
18409
+ ]);
18410
+ if (discriminatorTuningMode === undefined) {
18411
+ discriminatorTuningMode = 'SUPERVISED_FINE_TUNING';
18412
+ }
18413
+ if (discriminatorTuningMode === 'SUPERVISED_FINE_TUNING') {
18414
+ const fromTuningMode = getValueByPath(fromObject, ['tuningMode']);
18415
+ if (parentObject !== undefined && fromTuningMode != null) {
18416
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'tuningMode'], fromTuningMode);
18417
+ }
18418
+ }
18419
+ const fromCustomBaseModel = getValueByPath(fromObject, [
18420
+ 'customBaseModel',
18421
+ ]);
18422
+ if (parentObject !== undefined && fromCustomBaseModel != null) {
18423
+ setValueByPath(parentObject, ['customBaseModel'], fromCustomBaseModel);
18218
18424
  }
18219
- if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
18220
- throw new Error('learningRate parameter is not supported in Vertex AI.');
18425
+ let discriminatorBatchSize = getValueByPath(rootObject, [
18426
+ 'config',
18427
+ 'method',
18428
+ ]);
18429
+ if (discriminatorBatchSize === undefined) {
18430
+ discriminatorBatchSize = 'SUPERVISED_FINE_TUNING';
18431
+ }
18432
+ if (discriminatorBatchSize === 'SUPERVISED_FINE_TUNING') {
18433
+ const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
18434
+ if (parentObject !== undefined && fromBatchSize != null) {
18435
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
18436
+ }
18437
+ }
18438
+ let discriminatorLearningRate = getValueByPath(rootObject, [
18439
+ 'config',
18440
+ 'method',
18441
+ ]);
18442
+ if (discriminatorLearningRate === undefined) {
18443
+ discriminatorLearningRate = 'SUPERVISED_FINE_TUNING';
18444
+ }
18445
+ if (discriminatorLearningRate === 'SUPERVISED_FINE_TUNING') {
18446
+ const fromLearningRate = getValueByPath(fromObject, [
18447
+ 'learningRate',
18448
+ ]);
18449
+ if (parentObject !== undefined && fromLearningRate != null) {
18450
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRate'], fromLearningRate);
18451
+ }
18221
18452
  }
18222
18453
  const fromLabels = getValueByPath(fromObject, ['labels']);
18223
18454
  if (parentObject !== undefined && fromLabels != null) {
@@ -18227,6 +18458,28 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18227
18458
  if (parentObject !== undefined && fromBeta != null) {
18228
18459
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
18229
18460
  }
18461
+ const fromBaseTeacherModel = getValueByPath(fromObject, [
18462
+ 'baseTeacherModel',
18463
+ ]);
18464
+ if (parentObject !== undefined && fromBaseTeacherModel != null) {
18465
+ setValueByPath(parentObject, ['distillationSpec', 'baseTeacherModel'], fromBaseTeacherModel);
18466
+ }
18467
+ const fromTunedTeacherModelSource = getValueByPath(fromObject, [
18468
+ 'tunedTeacherModelSource',
18469
+ ]);
18470
+ if (parentObject !== undefined && fromTunedTeacherModelSource != null) {
18471
+ setValueByPath(parentObject, ['distillationSpec', 'tunedTeacherModelSource'], fromTunedTeacherModelSource);
18472
+ }
18473
+ const fromSftLossWeightMultiplier = getValueByPath(fromObject, [
18474
+ 'sftLossWeightMultiplier',
18475
+ ]);
18476
+ if (parentObject !== undefined && fromSftLossWeightMultiplier != null) {
18477
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'sftLossWeightMultiplier'], fromSftLossWeightMultiplier);
18478
+ }
18479
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18480
+ if (parentObject !== undefined && fromOutputUri != null) {
18481
+ setValueByPath(parentObject, ['outputUri'], fromOutputUri);
18482
+ }
18230
18483
  return toObject;
18231
18484
  }
18232
18485
  function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
@@ -18446,6 +18699,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
18446
18699
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
18447
18700
  }
18448
18701
  }
18702
+ else if (discriminatorGcsUri === 'DISTILLATION') {
18703
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
18704
+ if (parentObject !== undefined && fromGcsUri != null) {
18705
+ setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
18706
+ }
18707
+ }
18449
18708
  let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
18450
18709
  'config',
18451
18710
  'method',
@@ -18469,6 +18728,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
18469
18728
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
18470
18729
  }
18471
18730
  }
18731
+ else if (discriminatorVertexDatasetResource === 'DISTILLATION') {
18732
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
18733
+ 'vertexDatasetResource',
18734
+ ]);
18735
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
18736
+ setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
18737
+ }
18738
+ }
18472
18739
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
18473
18740
  throw new Error('examples parameter is not supported in Vertex AI.');
18474
18741
  }
@@ -18592,6 +18859,12 @@ function tuningJobFromVertex(fromObject, _rootObject) {
18592
18859
  if (fromPreferenceOptimizationSpec != null) {
18593
18860
  setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
18594
18861
  }
18862
+ const fromDistillationSpec = getValueByPath(fromObject, [
18863
+ 'distillationSpec',
18864
+ ]);
18865
+ if (fromDistillationSpec != null) {
18866
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18867
+ }
18595
18868
  const fromTuningDataStats = getValueByPath(fromObject, [
18596
18869
  'tuningDataStats',
18597
18870
  ]);
@@ -19241,6 +19514,7 @@ exports.Operations = Operations;
19241
19514
  exports.Pager = Pager;
19242
19515
  exports.RawReferenceImage = RawReferenceImage;
19243
19516
  exports.RecontextImageResponse = RecontextImageResponse;
19517
+ exports.RegisterFilesResponse = RegisterFilesResponse;
19244
19518
  exports.ReplayResponse = ReplayResponse;
19245
19519
  exports.SegmentImageResponse = SegmentImageResponse;
19246
19520
  exports.Session = Session;