@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.mjs CHANGED
@@ -1294,6 +1294,18 @@ var PartMediaResolutionLevel;
1294
1294
  */
1295
1295
  PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
1296
1296
  })(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
1297
+ /** Resource scope. */
1298
+ var ResourceScope;
1299
+ (function (ResourceScope) {
1300
+ /**
1301
+ * When setting base_url, this value configures resource scope to be the collection.
1302
+ The resource name will not include api version, project, or location.
1303
+ For example, if base_url is set to "https://aiplatform.googleapis.com",
1304
+ then the resource name for a Model would be
1305
+ "https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
1306
+ */
1307
+ ResourceScope["COLLECTION"] = "COLLECTION";
1308
+ })(ResourceScope || (ResourceScope = {}));
1297
1309
  /** Options for feature selection preference. */
1298
1310
  var FeatureSelectionPreference;
1299
1311
  (function (FeatureSelectionPreference) {
@@ -1487,6 +1499,10 @@ var TuningMethod;
1487
1499
  * Preference optimization tuning.
1488
1500
  */
1489
1501
  TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
1502
+ /**
1503
+ * Distillation tuning.
1504
+ */
1505
+ TuningMethod["DISTILLATION"] = "DISTILLATION";
1490
1506
  })(TuningMethod || (TuningMethod = {}));
1491
1507
  /** State for the lifecycle of a Document. */
1492
1508
  var DocumentState;
@@ -2278,6 +2294,9 @@ class CreateFileResponse {
2278
2294
  /** Response for the delete file method. */
2279
2295
  class DeleteFileResponse {
2280
2296
  }
2297
+ /** Response for the _register file method. */
2298
+ class RegisterFilesResponse {
2299
+ }
2281
2300
  /** Config for `inlined_responses` parameter. */
2282
2301
  class InlinedResponse {
2283
2302
  }
@@ -4130,6 +4149,9 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4130
4149
  if (fromEnableEnhancedCivicAnswers != null) {
4131
4150
  setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
4132
4151
  }
4152
+ if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
4153
+ throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
4154
+ }
4133
4155
  return toObject;
4134
4156
  }
4135
4157
  function generateContentResponseFromMldev$1(fromObject) {
@@ -4269,6 +4291,10 @@ function inlinedResponseFromMldev(fromObject) {
4269
4291
  if (fromResponse != null) {
4270
4292
  setValueByPath(toObject, ['response'], generateContentResponseFromMldev$1(fromResponse));
4271
4293
  }
4294
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
4295
+ if (fromMetadata != null) {
4296
+ setValueByPath(toObject, ['metadata'], fromMetadata);
4297
+ }
4272
4298
  const fromError = getValueByPath(fromObject, ['error']);
4273
4299
  if (fromError != null) {
4274
4300
  setValueByPath(toObject, ['error'], fromError);
@@ -6903,7 +6929,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6903
6929
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6904
6930
  const USER_AGENT_HEADER = 'User-Agent';
6905
6931
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6906
- const SDK_VERSION = '1.37.0'; // x-release-please-version
6932
+ const SDK_VERSION = '1.39.0'; // x-release-please-version
6907
6933
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6908
6934
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6909
6935
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6913,19 +6939,57 @@ const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
6913
6939
  */
6914
6940
  class ApiClient {
6915
6941
  constructor(opts) {
6916
- var _a, _b;
6917
- this.clientOptions = Object.assign(Object.assign({}, opts), { project: opts.project, location: opts.location, apiKey: opts.apiKey, vertexai: opts.vertexai });
6942
+ var _a, _b, _c;
6943
+ this.clientOptions = Object.assign({}, opts);
6944
+ this.customBaseUrl = (_a = opts.httpOptions) === null || _a === void 0 ? void 0 : _a.baseUrl;
6945
+ if (this.clientOptions.vertexai) {
6946
+ if (this.clientOptions.project && this.clientOptions.location) {
6947
+ this.clientOptions.apiKey = undefined;
6948
+ }
6949
+ else if (this.clientOptions.apiKey) {
6950
+ this.clientOptions.project = undefined;
6951
+ this.clientOptions.location = undefined;
6952
+ }
6953
+ }
6918
6954
  const initHttpOptions = {};
6919
6955
  if (this.clientOptions.vertexai) {
6956
+ if (!this.clientOptions.location &&
6957
+ !this.clientOptions.apiKey &&
6958
+ !this.customBaseUrl) {
6959
+ this.clientOptions.location = 'global';
6960
+ }
6961
+ const hasSufficientAuth = (this.clientOptions.project && this.clientOptions.location) ||
6962
+ this.clientOptions.apiKey;
6963
+ if (!hasSufficientAuth && !this.customBaseUrl) {
6964
+ throw new Error('Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.');
6965
+ }
6966
+ const hasConstructorAuth = (opts.project && opts.location) || !!opts.apiKey;
6967
+ if (this.customBaseUrl && !hasConstructorAuth) {
6968
+ initHttpOptions.baseUrl = this.customBaseUrl;
6969
+ this.clientOptions.project = undefined;
6970
+ this.clientOptions.location = undefined;
6971
+ }
6972
+ else if (this.clientOptions.apiKey ||
6973
+ this.clientOptions.location === 'global') {
6974
+ // Vertex Express or global endpoint case.
6975
+ initHttpOptions.baseUrl = 'https://aiplatform.googleapis.com/';
6976
+ }
6977
+ else if (this.clientOptions.project && this.clientOptions.location) {
6978
+ initHttpOptions.baseUrl = `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
6979
+ }
6920
6980
  initHttpOptions.apiVersion =
6921
- (_a = this.clientOptions.apiVersion) !== null && _a !== void 0 ? _a : VERTEX_AI_API_DEFAULT_VERSION;
6922
- initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
6923
- this.normalizeAuthParameters();
6981
+ (_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : VERTEX_AI_API_DEFAULT_VERSION;
6924
6982
  }
6925
6983
  else {
6926
6984
  // Gemini API
6985
+ if (!this.clientOptions.apiKey) {
6986
+ throw new ApiError({
6987
+ message: 'API key must be set when using the Gemini API.',
6988
+ status: 403,
6989
+ });
6990
+ }
6927
6991
  initHttpOptions.apiVersion =
6928
- (_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : GOOGLE_AI_API_DEFAULT_VERSION;
6992
+ (_c = this.clientOptions.apiVersion) !== null && _c !== void 0 ? _c : GOOGLE_AI_API_DEFAULT_VERSION;
6929
6993
  initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
6930
6994
  }
6931
6995
  initHttpOptions.headers = this.getDefaultHeaders();
@@ -6934,39 +6998,6 @@ class ApiClient {
6934
6998
  this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
6935
6999
  }
6936
7000
  }
6937
- /**
6938
- * Determines the base URL for Vertex AI based on project and location.
6939
- * Uses the global endpoint if location is 'global' or if project/location
6940
- * are not specified (implying API key usage).
6941
- * @private
6942
- */
6943
- baseUrlFromProjectLocation() {
6944
- if (this.clientOptions.project &&
6945
- this.clientOptions.location &&
6946
- this.clientOptions.location !== 'global') {
6947
- // Regional endpoint
6948
- return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
6949
- }
6950
- // Global endpoint (covers 'global' location and API key usage)
6951
- return `https://aiplatform.googleapis.com/`;
6952
- }
6953
- /**
6954
- * Normalizes authentication parameters for Vertex AI.
6955
- * If project and location are provided, API key is cleared.
6956
- * If project and location are not provided (implying API key usage),
6957
- * project and location are cleared.
6958
- * @private
6959
- */
6960
- normalizeAuthParameters() {
6961
- if (this.clientOptions.project && this.clientOptions.location) {
6962
- // Using project/location for auth, clear potential API key
6963
- this.clientOptions.apiKey = undefined;
6964
- return;
6965
- }
6966
- // Using API key for auth (or no auth provided yet), clear project/location
6967
- this.clientOptions.project = undefined;
6968
- this.clientOptions.location = undefined;
6969
- }
6970
7001
  isVertexAI() {
6971
7002
  var _a;
6972
7003
  return (_a = this.clientOptions.vertexai) !== null && _a !== void 0 ? _a : false;
@@ -6977,6 +7008,9 @@ class ApiClient {
6977
7008
  getLocation() {
6978
7009
  return this.clientOptions.location;
6979
7010
  }
7011
+ getCustomBaseUrl() {
7012
+ return this.customBaseUrl;
7013
+ }
6980
7014
  async getAuthHeaders() {
6981
7015
  const headers = new Headers();
6982
7016
  await this.clientOptions.auth.addAuthHeaders(headers);
@@ -7054,7 +7088,11 @@ class ApiClient {
7054
7088
  const url = new URL(`${urlElement.join('/')}`);
7055
7089
  return url;
7056
7090
  }
7057
- shouldPrependVertexProjectPath(request) {
7091
+ shouldPrependVertexProjectPath(request, httpOptions) {
7092
+ if (httpOptions.baseUrl &&
7093
+ httpOptions.baseUrlResourceScope === ResourceScope.COLLECTION) {
7094
+ return false;
7095
+ }
7058
7096
  if (this.clientOptions.apiKey) {
7059
7097
  return false;
7060
7098
  }
@@ -7080,7 +7118,7 @@ class ApiClient {
7080
7118
  if (request.httpOptions) {
7081
7119
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
7082
7120
  }
7083
- const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
7121
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request, patchedHttpOptions);
7084
7122
  const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
7085
7123
  if (request.queryParams) {
7086
7124
  for (const [key, value] of Object.entries(request.queryParams)) {
@@ -7123,7 +7161,7 @@ class ApiClient {
7123
7161
  if (request.httpOptions) {
7124
7162
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
7125
7163
  }
7126
- const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
7164
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request, patchedHttpOptions);
7127
7165
  const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
7128
7166
  if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
7129
7167
  url.searchParams.set('alt', 'sse');
@@ -7726,6 +7764,14 @@ function getFileParametersToMldev(fromObject) {
7726
7764
  }
7727
7765
  return toObject;
7728
7766
  }
7767
+ function internalRegisterFilesParametersToMldev(fromObject) {
7768
+ const toObject = {};
7769
+ const fromUris = getValueByPath(fromObject, ['uris']);
7770
+ if (fromUris != null) {
7771
+ setValueByPath(toObject, ['uris'], fromUris);
7772
+ }
7773
+ return toObject;
7774
+ }
7729
7775
  function listFilesConfigToMldev(fromObject, parentObject) {
7730
7776
  const toObject = {};
7731
7777
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
@@ -7772,6 +7818,26 @@ function listFilesResponseFromMldev(fromObject) {
7772
7818
  }
7773
7819
  return toObject;
7774
7820
  }
7821
+ function registerFilesResponseFromMldev(fromObject) {
7822
+ const toObject = {};
7823
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
7824
+ 'sdkHttpResponse',
7825
+ ]);
7826
+ if (fromSdkHttpResponse != null) {
7827
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
7828
+ }
7829
+ const fromFiles = getValueByPath(fromObject, ['files']);
7830
+ if (fromFiles != null) {
7831
+ let transformedList = fromFiles;
7832
+ if (Array.isArray(transformedList)) {
7833
+ transformedList = transformedList.map((item) => {
7834
+ return item;
7835
+ });
7836
+ }
7837
+ setValueByPath(toObject, ['files'], transformedList);
7838
+ }
7839
+ return toObject;
7840
+ }
7775
7841
 
7776
7842
  /**
7777
7843
  * @license
@@ -7872,6 +7938,16 @@ class Files extends BaseModule {
7872
7938
  async download(params) {
7873
7939
  await this.apiClient.downloadFile(params);
7874
7940
  }
7941
+ /**
7942
+ * Registers Google Cloud Storage files for use with the API.
7943
+ * This method is only available in Node.js environments.
7944
+ */
7945
+ async registerFiles(params) {
7946
+ throw new Error('registerFiles is only supported in Node.js environments.');
7947
+ }
7948
+ async _registerFiles(params) {
7949
+ return this.registerFilesInternal(params);
7950
+ }
7875
7951
  async listInternal(params) {
7876
7952
  var _a, _b;
7877
7953
  let response;
@@ -8045,6 +8121,40 @@ class Files extends BaseModule {
8045
8121
  });
8046
8122
  }
8047
8123
  }
8124
+ async registerFilesInternal(params) {
8125
+ var _a, _b;
8126
+ let response;
8127
+ let path = '';
8128
+ let queryParams = {};
8129
+ if (this.apiClient.isVertexAI()) {
8130
+ throw new Error('This method is only supported by the Gemini Developer API.');
8131
+ }
8132
+ else {
8133
+ const body = internalRegisterFilesParametersToMldev(params);
8134
+ path = formatMap('files:register', body['_url']);
8135
+ queryParams = body['_query'];
8136
+ delete body['_url'];
8137
+ delete body['_query'];
8138
+ response = this.apiClient
8139
+ .request({
8140
+ path: path,
8141
+ queryParams: queryParams,
8142
+ body: JSON.stringify(body),
8143
+ httpMethod: 'POST',
8144
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8145
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
8146
+ })
8147
+ .then((httpResponse) => {
8148
+ return httpResponse.json();
8149
+ });
8150
+ return response.then((apiResponse) => {
8151
+ const resp = registerFilesResponseFromMldev(apiResponse);
8152
+ const typedResp = new RegisterFilesResponse();
8153
+ Object.assign(typedResp, resp);
8154
+ return typedResp;
8155
+ });
8156
+ }
8157
+ }
8048
8158
  }
8049
8159
 
8050
8160
  /**
@@ -9283,7 +9393,9 @@ class BaseInteractions extends APIResource {
9283
9393
  *
9284
9394
  * @example
9285
9395
  * ```ts
9286
- * const interaction = await client.interactions.delete('id');
9396
+ * const interaction = await client.interactions.delete('id', {
9397
+ * api_version: 'api_version',
9398
+ * });
9287
9399
  * ```
9288
9400
  */
9289
9401
  delete(id, params = {}, options) {
@@ -9295,7 +9407,9 @@ class BaseInteractions extends APIResource {
9295
9407
  *
9296
9408
  * @example
9297
9409
  * ```ts
9298
- * const interaction = await client.interactions.cancel('id');
9410
+ * const interaction = await client.interactions.cancel('id', {
9411
+ * api_version: 'api_version',
9412
+ * });
9299
9413
  * ```
9300
9414
  */
9301
9415
  cancel(id, params = {}, options) {
@@ -11506,7 +11620,7 @@ function voiceActivityFromVertex(fromObject) {
11506
11620
  * Copyright 2025 Google LLC
11507
11621
  * SPDX-License-Identifier: Apache-2.0
11508
11622
  */
11509
- function blobToMldev$1(fromObject) {
11623
+ function blobToMldev$1(fromObject, _rootObject) {
11510
11624
  const toObject = {};
11511
11625
  const fromData = getValueByPath(fromObject, ['data']);
11512
11626
  if (fromData != null) {
@@ -11521,7 +11635,7 @@ function blobToMldev$1(fromObject) {
11521
11635
  }
11522
11636
  return toObject;
11523
11637
  }
11524
- function candidateFromMldev(fromObject) {
11638
+ function candidateFromMldev(fromObject, rootObject) {
11525
11639
  const toObject = {};
11526
11640
  const fromContent = getValueByPath(fromObject, ['content']);
11527
11641
  if (fromContent != null) {
@@ -11581,7 +11695,7 @@ function candidateFromMldev(fromObject) {
11581
11695
  }
11582
11696
  return toObject;
11583
11697
  }
11584
- function citationMetadataFromMldev(fromObject) {
11698
+ function citationMetadataFromMldev(fromObject, _rootObject) {
11585
11699
  const toObject = {};
11586
11700
  const fromCitations = getValueByPath(fromObject, ['citationSources']);
11587
11701
  if (fromCitations != null) {
@@ -11595,7 +11709,7 @@ function citationMetadataFromMldev(fromObject) {
11595
11709
  }
11596
11710
  return toObject;
11597
11711
  }
11598
- function computeTokensParametersToVertex(apiClient, fromObject) {
11712
+ function computeTokensParametersToVertex(apiClient, fromObject, _rootObject) {
11599
11713
  const toObject = {};
11600
11714
  const fromModel = getValueByPath(fromObject, ['model']);
11601
11715
  if (fromModel != null) {
@@ -11613,7 +11727,7 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
11613
11727
  }
11614
11728
  return toObject;
11615
11729
  }
11616
- function computeTokensResponseFromVertex(fromObject) {
11730
+ function computeTokensResponseFromVertex(fromObject, _rootObject) {
11617
11731
  const toObject = {};
11618
11732
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11619
11733
  'sdkHttpResponse',
@@ -11633,7 +11747,7 @@ function computeTokensResponseFromVertex(fromObject) {
11633
11747
  }
11634
11748
  return toObject;
11635
11749
  }
11636
- function contentEmbeddingFromVertex(fromObject) {
11750
+ function contentEmbeddingFromVertex(fromObject, rootObject) {
11637
11751
  const toObject = {};
11638
11752
  const fromValues = getValueByPath(fromObject, ['values']);
11639
11753
  if (fromValues != null) {
@@ -11645,7 +11759,7 @@ function contentEmbeddingFromVertex(fromObject) {
11645
11759
  }
11646
11760
  return toObject;
11647
11761
  }
11648
- function contentEmbeddingStatisticsFromVertex(fromObject) {
11762
+ function contentEmbeddingStatisticsFromVertex(fromObject, _rootObject) {
11649
11763
  const toObject = {};
11650
11764
  const fromTruncated = getValueByPath(fromObject, ['truncated']);
11651
11765
  if (fromTruncated != null) {
@@ -11657,7 +11771,7 @@ function contentEmbeddingStatisticsFromVertex(fromObject) {
11657
11771
  }
11658
11772
  return toObject;
11659
11773
  }
11660
- function contentToMldev$1(fromObject) {
11774
+ function contentToMldev$1(fromObject, rootObject) {
11661
11775
  const toObject = {};
11662
11776
  const fromParts = getValueByPath(fromObject, ['parts']);
11663
11777
  if (fromParts != null) {
@@ -11675,7 +11789,7 @@ function contentToMldev$1(fromObject) {
11675
11789
  }
11676
11790
  return toObject;
11677
11791
  }
11678
- function controlReferenceConfigToVertex(fromObject) {
11792
+ function controlReferenceConfigToVertex(fromObject, _rootObject) {
11679
11793
  const toObject = {};
11680
11794
  const fromControlType = getValueByPath(fromObject, ['controlType']);
11681
11795
  if (fromControlType != null) {
@@ -11689,7 +11803,7 @@ function controlReferenceConfigToVertex(fromObject) {
11689
11803
  }
11690
11804
  return toObject;
11691
11805
  }
11692
- function countTokensConfigToMldev(fromObject) {
11806
+ function countTokensConfigToMldev(fromObject, _rootObject) {
11693
11807
  const toObject = {};
11694
11808
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
11695
11809
  throw new Error('systemInstruction parameter is not supported in Gemini API.');
@@ -11702,7 +11816,7 @@ function countTokensConfigToMldev(fromObject) {
11702
11816
  }
11703
11817
  return toObject;
11704
11818
  }
11705
- function countTokensConfigToVertex(fromObject, parentObject) {
11819
+ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
11706
11820
  const toObject = {};
11707
11821
  const fromSystemInstruction = getValueByPath(fromObject, [
11708
11822
  'systemInstruction',
@@ -11728,7 +11842,7 @@ function countTokensConfigToVertex(fromObject, parentObject) {
11728
11842
  }
11729
11843
  return toObject;
11730
11844
  }
11731
- function countTokensParametersToMldev(apiClient, fromObject) {
11845
+ function countTokensParametersToMldev(apiClient, fromObject, rootObject) {
11732
11846
  const toObject = {};
11733
11847
  const fromModel = getValueByPath(fromObject, ['model']);
11734
11848
  if (fromModel != null) {
@@ -11750,7 +11864,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
11750
11864
  }
11751
11865
  return toObject;
11752
11866
  }
11753
- function countTokensParametersToVertex(apiClient, fromObject) {
11867
+ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
11754
11868
  const toObject = {};
11755
11869
  const fromModel = getValueByPath(fromObject, ['model']);
11756
11870
  if (fromModel != null) {
@@ -11772,7 +11886,7 @@ function countTokensParametersToVertex(apiClient, fromObject) {
11772
11886
  }
11773
11887
  return toObject;
11774
11888
  }
11775
- function countTokensResponseFromMldev(fromObject) {
11889
+ function countTokensResponseFromMldev(fromObject, _rootObject) {
11776
11890
  const toObject = {};
11777
11891
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11778
11892
  'sdkHttpResponse',
@@ -11792,7 +11906,7 @@ function countTokensResponseFromMldev(fromObject) {
11792
11906
  }
11793
11907
  return toObject;
11794
11908
  }
11795
- function countTokensResponseFromVertex(fromObject) {
11909
+ function countTokensResponseFromVertex(fromObject, _rootObject) {
11796
11910
  const toObject = {};
11797
11911
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11798
11912
  'sdkHttpResponse',
@@ -11806,7 +11920,7 @@ function countTokensResponseFromVertex(fromObject) {
11806
11920
  }
11807
11921
  return toObject;
11808
11922
  }
11809
- function deleteModelParametersToMldev(apiClient, fromObject) {
11923
+ function deleteModelParametersToMldev(apiClient, fromObject, _rootObject) {
11810
11924
  const toObject = {};
11811
11925
  const fromModel = getValueByPath(fromObject, ['model']);
11812
11926
  if (fromModel != null) {
@@ -11814,7 +11928,7 @@ function deleteModelParametersToMldev(apiClient, fromObject) {
11814
11928
  }
11815
11929
  return toObject;
11816
11930
  }
11817
- function deleteModelParametersToVertex(apiClient, fromObject) {
11931
+ function deleteModelParametersToVertex(apiClient, fromObject, _rootObject) {
11818
11932
  const toObject = {};
11819
11933
  const fromModel = getValueByPath(fromObject, ['model']);
11820
11934
  if (fromModel != null) {
@@ -11822,7 +11936,7 @@ function deleteModelParametersToVertex(apiClient, fromObject) {
11822
11936
  }
11823
11937
  return toObject;
11824
11938
  }
11825
- function deleteModelResponseFromMldev(fromObject) {
11939
+ function deleteModelResponseFromMldev(fromObject, _rootObject) {
11826
11940
  const toObject = {};
11827
11941
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11828
11942
  'sdkHttpResponse',
@@ -11832,7 +11946,7 @@ function deleteModelResponseFromMldev(fromObject) {
11832
11946
  }
11833
11947
  return toObject;
11834
11948
  }
11835
- function deleteModelResponseFromVertex(fromObject) {
11949
+ function deleteModelResponseFromVertex(fromObject, _rootObject) {
11836
11950
  const toObject = {};
11837
11951
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11838
11952
  'sdkHttpResponse',
@@ -11842,7 +11956,7 @@ function deleteModelResponseFromVertex(fromObject) {
11842
11956
  }
11843
11957
  return toObject;
11844
11958
  }
11845
- function editImageConfigToVertex(fromObject, parentObject) {
11959
+ function editImageConfigToVertex(fromObject, parentObject, _rootObject) {
11846
11960
  const toObject = {};
11847
11961
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
11848
11962
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -11932,7 +12046,7 @@ function editImageConfigToVertex(fromObject, parentObject) {
11932
12046
  }
11933
12047
  return toObject;
11934
12048
  }
11935
- function editImageParametersInternalToVertex(apiClient, fromObject) {
12049
+ function editImageParametersInternalToVertex(apiClient, fromObject, rootObject) {
11936
12050
  const toObject = {};
11937
12051
  const fromModel = getValueByPath(fromObject, ['model']);
11938
12052
  if (fromModel != null) {
@@ -11960,7 +12074,7 @@ function editImageParametersInternalToVertex(apiClient, fromObject) {
11960
12074
  }
11961
12075
  return toObject;
11962
12076
  }
11963
- function editImageResponseFromVertex(fromObject) {
12077
+ function editImageResponseFromVertex(fromObject, rootObject) {
11964
12078
  const toObject = {};
11965
12079
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11966
12080
  'sdkHttpResponse',
@@ -11982,7 +12096,7 @@ function editImageResponseFromVertex(fromObject) {
11982
12096
  }
11983
12097
  return toObject;
11984
12098
  }
11985
- function embedContentConfigToMldev(fromObject, parentObject) {
12099
+ function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
11986
12100
  const toObject = {};
11987
12101
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
11988
12102
  if (parentObject !== undefined && fromTaskType != null) {
@@ -12006,7 +12120,7 @@ function embedContentConfigToMldev(fromObject, parentObject) {
12006
12120
  }
12007
12121
  return toObject;
12008
12122
  }
12009
- function embedContentConfigToVertex(fromObject, parentObject) {
12123
+ function embedContentConfigToVertex(fromObject, parentObject, _rootObject) {
12010
12124
  const toObject = {};
12011
12125
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
12012
12126
  if (parentObject !== undefined && fromTaskType != null) {
@@ -12032,7 +12146,7 @@ function embedContentConfigToVertex(fromObject, parentObject) {
12032
12146
  }
12033
12147
  return toObject;
12034
12148
  }
12035
- function embedContentParametersToMldev(apiClient, fromObject) {
12149
+ function embedContentParametersToMldev(apiClient, fromObject, rootObject) {
12036
12150
  const toObject = {};
12037
12151
  const fromModel = getValueByPath(fromObject, ['model']);
12038
12152
  if (fromModel != null) {
@@ -12058,7 +12172,7 @@ function embedContentParametersToMldev(apiClient, fromObject) {
12058
12172
  }
12059
12173
  return toObject;
12060
12174
  }
12061
- function embedContentParametersToVertex(apiClient, fromObject) {
12175
+ function embedContentParametersToVertex(apiClient, fromObject, rootObject) {
12062
12176
  const toObject = {};
12063
12177
  const fromModel = getValueByPath(fromObject, ['model']);
12064
12178
  if (fromModel != null) {
@@ -12080,7 +12194,7 @@ function embedContentParametersToVertex(apiClient, fromObject) {
12080
12194
  }
12081
12195
  return toObject;
12082
12196
  }
12083
- function embedContentResponseFromMldev(fromObject) {
12197
+ function embedContentResponseFromMldev(fromObject, _rootObject) {
12084
12198
  const toObject = {};
12085
12199
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12086
12200
  'sdkHttpResponse',
@@ -12104,7 +12218,7 @@ function embedContentResponseFromMldev(fromObject) {
12104
12218
  }
12105
12219
  return toObject;
12106
12220
  }
12107
- function embedContentResponseFromVertex(fromObject) {
12221
+ function embedContentResponseFromVertex(fromObject, rootObject) {
12108
12222
  const toObject = {};
12109
12223
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12110
12224
  'sdkHttpResponse',
@@ -12131,7 +12245,7 @@ function embedContentResponseFromVertex(fromObject) {
12131
12245
  }
12132
12246
  return toObject;
12133
12247
  }
12134
- function endpointFromVertex(fromObject) {
12248
+ function endpointFromVertex(fromObject, _rootObject) {
12135
12249
  const toObject = {};
12136
12250
  const fromName = getValueByPath(fromObject, ['endpoint']);
12137
12251
  if (fromName != null) {
@@ -12145,7 +12259,7 @@ function endpointFromVertex(fromObject) {
12145
12259
  }
12146
12260
  return toObject;
12147
12261
  }
12148
- function fileDataToMldev$1(fromObject) {
12262
+ function fileDataToMldev$1(fromObject, _rootObject) {
12149
12263
  const toObject = {};
12150
12264
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
12151
12265
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -12160,7 +12274,7 @@ function fileDataToMldev$1(fromObject) {
12160
12274
  }
12161
12275
  return toObject;
12162
12276
  }
12163
- function functionCallToMldev$1(fromObject) {
12277
+ function functionCallToMldev$1(fromObject, _rootObject) {
12164
12278
  const toObject = {};
12165
12279
  const fromId = getValueByPath(fromObject, ['id']);
12166
12280
  if (fromId != null) {
@@ -12182,7 +12296,7 @@ function functionCallToMldev$1(fromObject) {
12182
12296
  }
12183
12297
  return toObject;
12184
12298
  }
12185
- function functionCallingConfigToMldev(fromObject) {
12299
+ function functionCallingConfigToMldev(fromObject, _rootObject) {
12186
12300
  const toObject = {};
12187
12301
  const fromAllowedFunctionNames = getValueByPath(fromObject, [
12188
12302
  'allowedFunctionNames',
@@ -12200,7 +12314,7 @@ function functionCallingConfigToMldev(fromObject) {
12200
12314
  }
12201
12315
  return toObject;
12202
12316
  }
12203
- function functionDeclarationToVertex(fromObject) {
12317
+ function functionDeclarationToVertex(fromObject, _rootObject) {
12204
12318
  const toObject = {};
12205
12319
  const fromDescription = getValueByPath(fromObject, ['description']);
12206
12320
  if (fromDescription != null) {
@@ -12235,7 +12349,7 @@ function functionDeclarationToVertex(fromObject) {
12235
12349
  }
12236
12350
  return toObject;
12237
12351
  }
12238
- function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
12352
+ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootObject) {
12239
12353
  const toObject = {};
12240
12354
  const fromSystemInstruction = getValueByPath(fromObject, [
12241
12355
  'systemInstruction',
@@ -12393,9 +12507,12 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
12393
12507
  if (fromEnableEnhancedCivicAnswers != null) {
12394
12508
  setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
12395
12509
  }
12510
+ if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
12511
+ throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
12512
+ }
12396
12513
  return toObject;
12397
12514
  }
12398
- function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
12515
+ function generateContentConfigToVertex(apiClient, fromObject, parentObject, rootObject) {
12399
12516
  const toObject = {};
12400
12517
  const fromSystemInstruction = getValueByPath(fromObject, [
12401
12518
  'systemInstruction',
@@ -12561,9 +12678,15 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
12561
12678
  undefined) {
12562
12679
  throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
12563
12680
  }
12681
+ const fromModelArmorConfig = getValueByPath(fromObject, [
12682
+ 'modelArmorConfig',
12683
+ ]);
12684
+ if (parentObject !== undefined && fromModelArmorConfig != null) {
12685
+ setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
12686
+ }
12564
12687
  return toObject;
12565
12688
  }
12566
- function generateContentParametersToMldev(apiClient, fromObject) {
12689
+ function generateContentParametersToMldev(apiClient, fromObject, rootObject) {
12567
12690
  const toObject = {};
12568
12691
  const fromModel = getValueByPath(fromObject, ['model']);
12569
12692
  if (fromModel != null) {
@@ -12585,7 +12708,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
12585
12708
  }
12586
12709
  return toObject;
12587
12710
  }
12588
- function generateContentParametersToVertex(apiClient, fromObject) {
12711
+ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
12589
12712
  const toObject = {};
12590
12713
  const fromModel = getValueByPath(fromObject, ['model']);
12591
12714
  if (fromModel != null) {
@@ -12607,7 +12730,7 @@ function generateContentParametersToVertex(apiClient, fromObject) {
12607
12730
  }
12608
12731
  return toObject;
12609
12732
  }
12610
- function generateContentResponseFromMldev(fromObject) {
12733
+ function generateContentResponseFromMldev(fromObject, rootObject) {
12611
12734
  const toObject = {};
12612
12735
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12613
12736
  'sdkHttpResponse',
@@ -12647,7 +12770,7 @@ function generateContentResponseFromMldev(fromObject) {
12647
12770
  }
12648
12771
  return toObject;
12649
12772
  }
12650
- function generateContentResponseFromVertex(fromObject) {
12773
+ function generateContentResponseFromVertex(fromObject, _rootObject) {
12651
12774
  const toObject = {};
12652
12775
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12653
12776
  'sdkHttpResponse',
@@ -12691,7 +12814,7 @@ function generateContentResponseFromVertex(fromObject) {
12691
12814
  }
12692
12815
  return toObject;
12693
12816
  }
12694
- function generateImagesConfigToMldev(fromObject, parentObject) {
12817
+ function generateImagesConfigToMldev(fromObject, parentObject, _rootObject) {
12695
12818
  const toObject = {};
12696
12819
  if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
12697
12820
  throw new Error('outputGcsUri parameter is not supported in Gemini API.');
@@ -12773,7 +12896,7 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
12773
12896
  }
12774
12897
  return toObject;
12775
12898
  }
12776
- function generateImagesConfigToVertex(fromObject, parentObject) {
12899
+ function generateImagesConfigToVertex(fromObject, parentObject, _rootObject) {
12777
12900
  const toObject = {};
12778
12901
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
12779
12902
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -12865,7 +12988,7 @@ function generateImagesConfigToVertex(fromObject, parentObject) {
12865
12988
  }
12866
12989
  return toObject;
12867
12990
  }
12868
- function generateImagesParametersToMldev(apiClient, fromObject) {
12991
+ function generateImagesParametersToMldev(apiClient, fromObject, rootObject) {
12869
12992
  const toObject = {};
12870
12993
  const fromModel = getValueByPath(fromObject, ['model']);
12871
12994
  if (fromModel != null) {
@@ -12881,7 +13004,7 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
12881
13004
  }
12882
13005
  return toObject;
12883
13006
  }
12884
- function generateImagesParametersToVertex(apiClient, fromObject) {
13007
+ function generateImagesParametersToVertex(apiClient, fromObject, rootObject) {
12885
13008
  const toObject = {};
12886
13009
  const fromModel = getValueByPath(fromObject, ['model']);
12887
13010
  if (fromModel != null) {
@@ -12897,7 +13020,7 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
12897
13020
  }
12898
13021
  return toObject;
12899
13022
  }
12900
- function generateImagesResponseFromMldev(fromObject) {
13023
+ function generateImagesResponseFromMldev(fromObject, rootObject) {
12901
13024
  const toObject = {};
12902
13025
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12903
13026
  'sdkHttpResponse',
@@ -12925,7 +13048,7 @@ function generateImagesResponseFromMldev(fromObject) {
12925
13048
  }
12926
13049
  return toObject;
12927
13050
  }
12928
- function generateImagesResponseFromVertex(fromObject) {
13051
+ function generateImagesResponseFromVertex(fromObject, rootObject) {
12929
13052
  const toObject = {};
12930
13053
  const fromSdkHttpResponse = getValueByPath(fromObject, [
12931
13054
  'sdkHttpResponse',
@@ -12953,7 +13076,7 @@ function generateImagesResponseFromVertex(fromObject) {
12953
13076
  }
12954
13077
  return toObject;
12955
13078
  }
12956
- function generateVideosConfigToMldev(fromObject, parentObject) {
13079
+ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
12957
13080
  const toObject = {};
12958
13081
  const fromNumberOfVideos = getValueByPath(fromObject, [
12959
13082
  'numberOfVideos',
@@ -13032,7 +13155,7 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
13032
13155
  }
13033
13156
  return toObject;
13034
13157
  }
13035
- function generateVideosConfigToVertex(fromObject, parentObject) {
13158
+ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
13036
13159
  const toObject = {};
13037
13160
  const fromNumberOfVideos = getValueByPath(fromObject, [
13038
13161
  'numberOfVideos',
@@ -13122,7 +13245,7 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
13122
13245
  }
13123
13246
  return toObject;
13124
13247
  }
13125
- function generateVideosOperationFromMldev(fromObject) {
13248
+ function generateVideosOperationFromMldev(fromObject, rootObject) {
13126
13249
  const toObject = {};
13127
13250
  const fromName = getValueByPath(fromObject, ['name']);
13128
13251
  if (fromName != null) {
@@ -13149,7 +13272,7 @@ function generateVideosOperationFromMldev(fromObject) {
13149
13272
  }
13150
13273
  return toObject;
13151
13274
  }
13152
- function generateVideosOperationFromVertex(fromObject) {
13275
+ function generateVideosOperationFromVertex(fromObject, rootObject) {
13153
13276
  const toObject = {};
13154
13277
  const fromName = getValueByPath(fromObject, ['name']);
13155
13278
  if (fromName != null) {
@@ -13173,7 +13296,7 @@ function generateVideosOperationFromVertex(fromObject) {
13173
13296
  }
13174
13297
  return toObject;
13175
13298
  }
13176
- function generateVideosParametersToMldev(apiClient, fromObject) {
13299
+ function generateVideosParametersToMldev(apiClient, fromObject, rootObject) {
13177
13300
  const toObject = {};
13178
13301
  const fromModel = getValueByPath(fromObject, ['model']);
13179
13302
  if (fromModel != null) {
@@ -13201,7 +13324,7 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
13201
13324
  }
13202
13325
  return toObject;
13203
13326
  }
13204
- function generateVideosParametersToVertex(apiClient, fromObject) {
13327
+ function generateVideosParametersToVertex(apiClient, fromObject, rootObject) {
13205
13328
  const toObject = {};
13206
13329
  const fromModel = getValueByPath(fromObject, ['model']);
13207
13330
  if (fromModel != null) {
@@ -13229,7 +13352,7 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
13229
13352
  }
13230
13353
  return toObject;
13231
13354
  }
13232
- function generateVideosResponseFromMldev(fromObject) {
13355
+ function generateVideosResponseFromMldev(fromObject, rootObject) {
13233
13356
  const toObject = {};
13234
13357
  const fromGeneratedVideos = getValueByPath(fromObject, [
13235
13358
  'generatedSamples',
@@ -13257,7 +13380,7 @@ function generateVideosResponseFromMldev(fromObject) {
13257
13380
  }
13258
13381
  return toObject;
13259
13382
  }
13260
- function generateVideosResponseFromVertex(fromObject) {
13383
+ function generateVideosResponseFromVertex(fromObject, rootObject) {
13261
13384
  const toObject = {};
13262
13385
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
13263
13386
  if (fromGeneratedVideos != null) {
@@ -13283,7 +13406,7 @@ function generateVideosResponseFromVertex(fromObject) {
13283
13406
  }
13284
13407
  return toObject;
13285
13408
  }
13286
- function generateVideosSourceToMldev(fromObject, parentObject) {
13409
+ function generateVideosSourceToMldev(fromObject, parentObject, rootObject) {
13287
13410
  const toObject = {};
13288
13411
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
13289
13412
  if (parentObject !== undefined && fromPrompt != null) {
@@ -13299,7 +13422,7 @@ function generateVideosSourceToMldev(fromObject, parentObject) {
13299
13422
  }
13300
13423
  return toObject;
13301
13424
  }
13302
- function generateVideosSourceToVertex(fromObject, parentObject) {
13425
+ function generateVideosSourceToVertex(fromObject, parentObject, rootObject) {
13303
13426
  const toObject = {};
13304
13427
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
13305
13428
  if (parentObject !== undefined && fromPrompt != null) {
@@ -13315,7 +13438,7 @@ function generateVideosSourceToVertex(fromObject, parentObject) {
13315
13438
  }
13316
13439
  return toObject;
13317
13440
  }
13318
- function generatedImageFromMldev(fromObject) {
13441
+ function generatedImageFromMldev(fromObject, rootObject) {
13319
13442
  const toObject = {};
13320
13443
  const fromImage = getValueByPath(fromObject, ['_self']);
13321
13444
  if (fromImage != null) {
@@ -13333,7 +13456,7 @@ function generatedImageFromMldev(fromObject) {
13333
13456
  }
13334
13457
  return toObject;
13335
13458
  }
13336
- function generatedImageFromVertex(fromObject) {
13459
+ function generatedImageFromVertex(fromObject, rootObject) {
13337
13460
  const toObject = {};
13338
13461
  const fromImage = getValueByPath(fromObject, ['_self']);
13339
13462
  if (fromImage != null) {
@@ -13355,7 +13478,7 @@ function generatedImageFromVertex(fromObject) {
13355
13478
  }
13356
13479
  return toObject;
13357
13480
  }
13358
- function generatedImageMaskFromVertex(fromObject) {
13481
+ function generatedImageMaskFromVertex(fromObject, rootObject) {
13359
13482
  const toObject = {};
13360
13483
  const fromMask = getValueByPath(fromObject, ['_self']);
13361
13484
  if (fromMask != null) {
@@ -13373,7 +13496,7 @@ function generatedImageMaskFromVertex(fromObject) {
13373
13496
  }
13374
13497
  return toObject;
13375
13498
  }
13376
- function generatedVideoFromMldev(fromObject) {
13499
+ function generatedVideoFromMldev(fromObject, rootObject) {
13377
13500
  const toObject = {};
13378
13501
  const fromVideo = getValueByPath(fromObject, ['video']);
13379
13502
  if (fromVideo != null) {
@@ -13381,7 +13504,7 @@ function generatedVideoFromMldev(fromObject) {
13381
13504
  }
13382
13505
  return toObject;
13383
13506
  }
13384
- function generatedVideoFromVertex(fromObject) {
13507
+ function generatedVideoFromVertex(fromObject, rootObject) {
13385
13508
  const toObject = {};
13386
13509
  const fromVideo = getValueByPath(fromObject, ['_self']);
13387
13510
  if (fromVideo != null) {
@@ -13389,7 +13512,7 @@ function generatedVideoFromVertex(fromObject) {
13389
13512
  }
13390
13513
  return toObject;
13391
13514
  }
13392
- function generationConfigToVertex(fromObject) {
13515
+ function generationConfigToVertex(fromObject, _rootObject) {
13393
13516
  const toObject = {};
13394
13517
  const fromModelSelectionConfig = getValueByPath(fromObject, [
13395
13518
  'modelSelectionConfig',
@@ -13517,7 +13640,7 @@ function generationConfigToVertex(fromObject) {
13517
13640
  }
13518
13641
  return toObject;
13519
13642
  }
13520
- function getModelParametersToMldev(apiClient, fromObject) {
13643
+ function getModelParametersToMldev(apiClient, fromObject, _rootObject) {
13521
13644
  const toObject = {};
13522
13645
  const fromModel = getValueByPath(fromObject, ['model']);
13523
13646
  if (fromModel != null) {
@@ -13525,7 +13648,7 @@ function getModelParametersToMldev(apiClient, fromObject) {
13525
13648
  }
13526
13649
  return toObject;
13527
13650
  }
13528
- function getModelParametersToVertex(apiClient, fromObject) {
13651
+ function getModelParametersToVertex(apiClient, fromObject, _rootObject) {
13529
13652
  const toObject = {};
13530
13653
  const fromModel = getValueByPath(fromObject, ['model']);
13531
13654
  if (fromModel != null) {
@@ -13533,7 +13656,7 @@ function getModelParametersToVertex(apiClient, fromObject) {
13533
13656
  }
13534
13657
  return toObject;
13535
13658
  }
13536
- function googleMapsToMldev$1(fromObject) {
13659
+ function googleMapsToMldev$1(fromObject, _rootObject) {
13537
13660
  const toObject = {};
13538
13661
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
13539
13662
  throw new Error('authConfig parameter is not supported in Gemini API.');
@@ -13544,7 +13667,7 @@ function googleMapsToMldev$1(fromObject) {
13544
13667
  }
13545
13668
  return toObject;
13546
13669
  }
13547
- function googleSearchToMldev$1(fromObject) {
13670
+ function googleSearchToMldev$1(fromObject, _rootObject) {
13548
13671
  const toObject = {};
13549
13672
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13550
13673
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
@@ -13560,7 +13683,7 @@ function googleSearchToMldev$1(fromObject) {
13560
13683
  }
13561
13684
  return toObject;
13562
13685
  }
13563
- function imageConfigToMldev(fromObject) {
13686
+ function imageConfigToMldev(fromObject, _rootObject) {
13564
13687
  const toObject = {};
13565
13688
  const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
13566
13689
  if (fromAspectRatio != null) {
@@ -13582,7 +13705,7 @@ function imageConfigToMldev(fromObject) {
13582
13705
  }
13583
13706
  return toObject;
13584
13707
  }
13585
- function imageConfigToVertex(fromObject) {
13708
+ function imageConfigToVertex(fromObject, _rootObject) {
13586
13709
  const toObject = {};
13587
13710
  const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
13588
13711
  if (fromAspectRatio != null) {
@@ -13612,7 +13735,7 @@ function imageConfigToVertex(fromObject) {
13612
13735
  }
13613
13736
  return toObject;
13614
13737
  }
13615
- function imageFromMldev(fromObject) {
13738
+ function imageFromMldev(fromObject, _rootObject) {
13616
13739
  const toObject = {};
13617
13740
  const fromImageBytes = getValueByPath(fromObject, [
13618
13741
  'bytesBase64Encoded',
@@ -13626,7 +13749,7 @@ function imageFromMldev(fromObject) {
13626
13749
  }
13627
13750
  return toObject;
13628
13751
  }
13629
- function imageFromVertex(fromObject) {
13752
+ function imageFromVertex(fromObject, _rootObject) {
13630
13753
  const toObject = {};
13631
13754
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
13632
13755
  if (fromGcsUri != null) {
@@ -13644,7 +13767,7 @@ function imageFromVertex(fromObject) {
13644
13767
  }
13645
13768
  return toObject;
13646
13769
  }
13647
- function imageToMldev(fromObject) {
13770
+ function imageToMldev(fromObject, _rootObject) {
13648
13771
  const toObject = {};
13649
13772
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
13650
13773
  throw new Error('gcsUri parameter is not supported in Gemini API.');
@@ -13659,7 +13782,7 @@ function imageToMldev(fromObject) {
13659
13782
  }
13660
13783
  return toObject;
13661
13784
  }
13662
- function imageToVertex(fromObject) {
13785
+ function imageToVertex(fromObject, _rootObject) {
13663
13786
  const toObject = {};
13664
13787
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
13665
13788
  if (fromGcsUri != null) {
@@ -13675,7 +13798,7 @@ function imageToVertex(fromObject) {
13675
13798
  }
13676
13799
  return toObject;
13677
13800
  }
13678
- function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
13801
+ function listModelsConfigToMldev(apiClient, fromObject, parentObject, _rootObject) {
13679
13802
  const toObject = {};
13680
13803
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
13681
13804
  if (parentObject !== undefined && fromPageSize != null) {
@@ -13695,7 +13818,7 @@ function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
13695
13818
  }
13696
13819
  return toObject;
13697
13820
  }
13698
- function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
13821
+ function listModelsConfigToVertex(apiClient, fromObject, parentObject, _rootObject) {
13699
13822
  const toObject = {};
13700
13823
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
13701
13824
  if (parentObject !== undefined && fromPageSize != null) {
@@ -13715,7 +13838,7 @@ function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
13715
13838
  }
13716
13839
  return toObject;
13717
13840
  }
13718
- function listModelsParametersToMldev(apiClient, fromObject) {
13841
+ function listModelsParametersToMldev(apiClient, fromObject, rootObject) {
13719
13842
  const toObject = {};
13720
13843
  const fromConfig = getValueByPath(fromObject, ['config']);
13721
13844
  if (fromConfig != null) {
@@ -13723,7 +13846,7 @@ function listModelsParametersToMldev(apiClient, fromObject) {
13723
13846
  }
13724
13847
  return toObject;
13725
13848
  }
13726
- function listModelsParametersToVertex(apiClient, fromObject) {
13849
+ function listModelsParametersToVertex(apiClient, fromObject, rootObject) {
13727
13850
  const toObject = {};
13728
13851
  const fromConfig = getValueByPath(fromObject, ['config']);
13729
13852
  if (fromConfig != null) {
@@ -13731,7 +13854,7 @@ function listModelsParametersToVertex(apiClient, fromObject) {
13731
13854
  }
13732
13855
  return toObject;
13733
13856
  }
13734
- function listModelsResponseFromMldev(fromObject) {
13857
+ function listModelsResponseFromMldev(fromObject, rootObject) {
13735
13858
  const toObject = {};
13736
13859
  const fromSdkHttpResponse = getValueByPath(fromObject, [
13737
13860
  'sdkHttpResponse',
@@ -13757,7 +13880,7 @@ function listModelsResponseFromMldev(fromObject) {
13757
13880
  }
13758
13881
  return toObject;
13759
13882
  }
13760
- function listModelsResponseFromVertex(fromObject) {
13883
+ function listModelsResponseFromVertex(fromObject, rootObject) {
13761
13884
  const toObject = {};
13762
13885
  const fromSdkHttpResponse = getValueByPath(fromObject, [
13763
13886
  'sdkHttpResponse',
@@ -13783,7 +13906,7 @@ function listModelsResponseFromVertex(fromObject) {
13783
13906
  }
13784
13907
  return toObject;
13785
13908
  }
13786
- function maskReferenceConfigToVertex(fromObject) {
13909
+ function maskReferenceConfigToVertex(fromObject, _rootObject) {
13787
13910
  const toObject = {};
13788
13911
  const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
13789
13912
  if (fromMaskMode != null) {
@@ -13801,7 +13924,7 @@ function maskReferenceConfigToVertex(fromObject) {
13801
13924
  }
13802
13925
  return toObject;
13803
13926
  }
13804
- function modelFromMldev(fromObject) {
13927
+ function modelFromMldev(fromObject, rootObject) {
13805
13928
  const toObject = {};
13806
13929
  const fromName = getValueByPath(fromObject, ['name']);
13807
13930
  if (fromName != null) {
@@ -13865,7 +13988,7 @@ function modelFromMldev(fromObject) {
13865
13988
  }
13866
13989
  return toObject;
13867
13990
  }
13868
- function modelFromVertex(fromObject) {
13991
+ function modelFromVertex(fromObject, rootObject) {
13869
13992
  const toObject = {};
13870
13993
  const fromName = getValueByPath(fromObject, ['name']);
13871
13994
  if (fromName != null) {
@@ -13919,7 +14042,7 @@ function modelFromVertex(fromObject) {
13919
14042
  }
13920
14043
  return toObject;
13921
14044
  }
13922
- function partToMldev$1(fromObject) {
14045
+ function partToMldev$1(fromObject, rootObject) {
13923
14046
  const toObject = {};
13924
14047
  const fromMediaResolution = getValueByPath(fromObject, [
13925
14048
  'mediaResolution',
@@ -13979,7 +14102,7 @@ function partToMldev$1(fromObject) {
13979
14102
  }
13980
14103
  return toObject;
13981
14104
  }
13982
- function productImageToVertex(fromObject) {
14105
+ function productImageToVertex(fromObject, rootObject) {
13983
14106
  const toObject = {};
13984
14107
  const fromProductImage = getValueByPath(fromObject, ['productImage']);
13985
14108
  if (fromProductImage != null) {
@@ -13987,7 +14110,7 @@ function productImageToVertex(fromObject) {
13987
14110
  }
13988
14111
  return toObject;
13989
14112
  }
13990
- function recontextImageConfigToVertex(fromObject, parentObject) {
14113
+ function recontextImageConfigToVertex(fromObject, parentObject, _rootObject) {
13991
14114
  const toObject = {};
13992
14115
  const fromNumberOfImages = getValueByPath(fromObject, [
13993
14116
  'numberOfImages',
@@ -14047,7 +14170,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
14047
14170
  }
14048
14171
  return toObject;
14049
14172
  }
14050
- function recontextImageParametersToVertex(apiClient, fromObject) {
14173
+ function recontextImageParametersToVertex(apiClient, fromObject, rootObject) {
14051
14174
  const toObject = {};
14052
14175
  const fromModel = getValueByPath(fromObject, ['model']);
14053
14176
  if (fromModel != null) {
@@ -14063,7 +14186,7 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
14063
14186
  }
14064
14187
  return toObject;
14065
14188
  }
14066
- function recontextImageResponseFromVertex(fromObject) {
14189
+ function recontextImageResponseFromVertex(fromObject, rootObject) {
14067
14190
  const toObject = {};
14068
14191
  const fromGeneratedImages = getValueByPath(fromObject, [
14069
14192
  'predictions',
@@ -14079,7 +14202,7 @@ function recontextImageResponseFromVertex(fromObject) {
14079
14202
  }
14080
14203
  return toObject;
14081
14204
  }
14082
- function recontextImageSourceToVertex(fromObject, parentObject) {
14205
+ function recontextImageSourceToVertex(fromObject, parentObject, rootObject) {
14083
14206
  const toObject = {};
14084
14207
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
14085
14208
  if (parentObject !== undefined && fromPrompt != null) {
@@ -14103,7 +14226,7 @@ function recontextImageSourceToVertex(fromObject, parentObject) {
14103
14226
  }
14104
14227
  return toObject;
14105
14228
  }
14106
- function referenceImageAPIInternalToVertex(fromObject) {
14229
+ function referenceImageAPIInternalToVertex(fromObject, rootObject) {
14107
14230
  const toObject = {};
14108
14231
  const fromReferenceImage = getValueByPath(fromObject, [
14109
14232
  'referenceImage',
@@ -14147,7 +14270,7 @@ function referenceImageAPIInternalToVertex(fromObject) {
14147
14270
  }
14148
14271
  return toObject;
14149
14272
  }
14150
- function safetyAttributesFromMldev(fromObject) {
14273
+ function safetyAttributesFromMldev(fromObject, _rootObject) {
14151
14274
  const toObject = {};
14152
14275
  const fromCategories = getValueByPath(fromObject, [
14153
14276
  'safetyAttributes',
@@ -14169,7 +14292,7 @@ function safetyAttributesFromMldev(fromObject) {
14169
14292
  }
14170
14293
  return toObject;
14171
14294
  }
14172
- function safetyAttributesFromVertex(fromObject) {
14295
+ function safetyAttributesFromVertex(fromObject, _rootObject) {
14173
14296
  const toObject = {};
14174
14297
  const fromCategories = getValueByPath(fromObject, [
14175
14298
  'safetyAttributes',
@@ -14191,7 +14314,7 @@ function safetyAttributesFromVertex(fromObject) {
14191
14314
  }
14192
14315
  return toObject;
14193
14316
  }
14194
- function safetySettingToMldev(fromObject) {
14317
+ function safetySettingToMldev(fromObject, _rootObject) {
14195
14318
  const toObject = {};
14196
14319
  const fromCategory = getValueByPath(fromObject, ['category']);
14197
14320
  if (fromCategory != null) {
@@ -14206,7 +14329,7 @@ function safetySettingToMldev(fromObject) {
14206
14329
  }
14207
14330
  return toObject;
14208
14331
  }
14209
- function scribbleImageToVertex(fromObject) {
14332
+ function scribbleImageToVertex(fromObject, rootObject) {
14210
14333
  const toObject = {};
14211
14334
  const fromImage = getValueByPath(fromObject, ['image']);
14212
14335
  if (fromImage != null) {
@@ -14214,7 +14337,7 @@ function scribbleImageToVertex(fromObject) {
14214
14337
  }
14215
14338
  return toObject;
14216
14339
  }
14217
- function segmentImageConfigToVertex(fromObject, parentObject) {
14340
+ function segmentImageConfigToVertex(fromObject, parentObject, _rootObject) {
14218
14341
  const toObject = {};
14219
14342
  const fromMode = getValueByPath(fromObject, ['mode']);
14220
14343
  if (parentObject !== undefined && fromMode != null) {
@@ -14248,7 +14371,7 @@ function segmentImageConfigToVertex(fromObject, parentObject) {
14248
14371
  }
14249
14372
  return toObject;
14250
14373
  }
14251
- function segmentImageParametersToVertex(apiClient, fromObject) {
14374
+ function segmentImageParametersToVertex(apiClient, fromObject, rootObject) {
14252
14375
  const toObject = {};
14253
14376
  const fromModel = getValueByPath(fromObject, ['model']);
14254
14377
  if (fromModel != null) {
@@ -14264,7 +14387,7 @@ function segmentImageParametersToVertex(apiClient, fromObject) {
14264
14387
  }
14265
14388
  return toObject;
14266
14389
  }
14267
- function segmentImageResponseFromVertex(fromObject) {
14390
+ function segmentImageResponseFromVertex(fromObject, rootObject) {
14268
14391
  const toObject = {};
14269
14392
  const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
14270
14393
  if (fromGeneratedMasks != null) {
@@ -14278,7 +14401,7 @@ function segmentImageResponseFromVertex(fromObject) {
14278
14401
  }
14279
14402
  return toObject;
14280
14403
  }
14281
- function segmentImageSourceToVertex(fromObject, parentObject) {
14404
+ function segmentImageSourceToVertex(fromObject, parentObject, rootObject) {
14282
14405
  const toObject = {};
14283
14406
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
14284
14407
  if (parentObject !== undefined && fromPrompt != null) {
@@ -14296,7 +14419,7 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
14296
14419
  }
14297
14420
  return toObject;
14298
14421
  }
14299
- function toolConfigToMldev(fromObject) {
14422
+ function toolConfigToMldev(fromObject, rootObject) {
14300
14423
  const toObject = {};
14301
14424
  const fromRetrievalConfig = getValueByPath(fromObject, [
14302
14425
  'retrievalConfig',
@@ -14312,7 +14435,7 @@ function toolConfigToMldev(fromObject) {
14312
14435
  }
14313
14436
  return toObject;
14314
14437
  }
14315
- function toolToMldev$1(fromObject) {
14438
+ function toolToMldev$1(fromObject, rootObject) {
14316
14439
  const toObject = {};
14317
14440
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
14318
14441
  throw new Error('retrieval parameter is not supported in Gemini API.');
@@ -14366,7 +14489,7 @@ function toolToMldev$1(fromObject) {
14366
14489
  }
14367
14490
  return toObject;
14368
14491
  }
14369
- function toolToVertex(fromObject) {
14492
+ function toolToVertex(fromObject, rootObject) {
14370
14493
  const toObject = {};
14371
14494
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
14372
14495
  if (fromRetrieval != null) {
@@ -14423,7 +14546,7 @@ function toolToVertex(fromObject) {
14423
14546
  }
14424
14547
  return toObject;
14425
14548
  }
14426
- function tunedModelInfoFromMldev(fromObject) {
14549
+ function tunedModelInfoFromMldev(fromObject, _rootObject) {
14427
14550
  const toObject = {};
14428
14551
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
14429
14552
  if (fromBaseModel != null) {
@@ -14439,7 +14562,7 @@ function tunedModelInfoFromMldev(fromObject) {
14439
14562
  }
14440
14563
  return toObject;
14441
14564
  }
14442
- function tunedModelInfoFromVertex(fromObject) {
14565
+ function tunedModelInfoFromVertex(fromObject, _rootObject) {
14443
14566
  const toObject = {};
14444
14567
  const fromBaseModel = getValueByPath(fromObject, [
14445
14568
  'labels',
@@ -14458,7 +14581,7 @@ function tunedModelInfoFromVertex(fromObject) {
14458
14581
  }
14459
14582
  return toObject;
14460
14583
  }
14461
- function updateModelConfigToMldev(fromObject, parentObject) {
14584
+ function updateModelConfigToMldev(fromObject, parentObject, _rootObject) {
14462
14585
  const toObject = {};
14463
14586
  const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14464
14587
  if (parentObject !== undefined && fromDisplayName != null) {
@@ -14476,7 +14599,7 @@ function updateModelConfigToMldev(fromObject, parentObject) {
14476
14599
  }
14477
14600
  return toObject;
14478
14601
  }
14479
- function updateModelConfigToVertex(fromObject, parentObject) {
14602
+ function updateModelConfigToVertex(fromObject, parentObject, _rootObject) {
14480
14603
  const toObject = {};
14481
14604
  const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14482
14605
  if (parentObject !== undefined && fromDisplayName != null) {
@@ -14494,7 +14617,7 @@ function updateModelConfigToVertex(fromObject, parentObject) {
14494
14617
  }
14495
14618
  return toObject;
14496
14619
  }
14497
- function updateModelParametersToMldev(apiClient, fromObject) {
14620
+ function updateModelParametersToMldev(apiClient, fromObject, rootObject) {
14498
14621
  const toObject = {};
14499
14622
  const fromModel = getValueByPath(fromObject, ['model']);
14500
14623
  if (fromModel != null) {
@@ -14506,7 +14629,7 @@ function updateModelParametersToMldev(apiClient, fromObject) {
14506
14629
  }
14507
14630
  return toObject;
14508
14631
  }
14509
- function updateModelParametersToVertex(apiClient, fromObject) {
14632
+ function updateModelParametersToVertex(apiClient, fromObject, rootObject) {
14510
14633
  const toObject = {};
14511
14634
  const fromModel = getValueByPath(fromObject, ['model']);
14512
14635
  if (fromModel != null) {
@@ -14518,7 +14641,7 @@ function updateModelParametersToVertex(apiClient, fromObject) {
14518
14641
  }
14519
14642
  return toObject;
14520
14643
  }
14521
- function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
14644
+ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject, _rootObject) {
14522
14645
  const toObject = {};
14523
14646
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
14524
14647
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -14582,7 +14705,7 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
14582
14705
  }
14583
14706
  return toObject;
14584
14707
  }
14585
- function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
14708
+ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject, rootObject) {
14586
14709
  const toObject = {};
14587
14710
  const fromModel = getValueByPath(fromObject, ['model']);
14588
14711
  if (fromModel != null) {
@@ -14604,7 +14727,7 @@ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
14604
14727
  }
14605
14728
  return toObject;
14606
14729
  }
14607
- function upscaleImageResponseFromVertex(fromObject) {
14730
+ function upscaleImageResponseFromVertex(fromObject, rootObject) {
14608
14731
  const toObject = {};
14609
14732
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14610
14733
  'sdkHttpResponse',
@@ -14626,7 +14749,7 @@ function upscaleImageResponseFromVertex(fromObject) {
14626
14749
  }
14627
14750
  return toObject;
14628
14751
  }
14629
- function videoFromMldev(fromObject) {
14752
+ function videoFromMldev(fromObject, _rootObject) {
14630
14753
  const toObject = {};
14631
14754
  const fromUri = getValueByPath(fromObject, ['uri']);
14632
14755
  if (fromUri != null) {
@@ -14642,7 +14765,7 @@ function videoFromMldev(fromObject) {
14642
14765
  }
14643
14766
  return toObject;
14644
14767
  }
14645
- function videoFromVertex(fromObject) {
14768
+ function videoFromVertex(fromObject, _rootObject) {
14646
14769
  const toObject = {};
14647
14770
  const fromUri = getValueByPath(fromObject, ['gcsUri']);
14648
14771
  if (fromUri != null) {
@@ -14660,7 +14783,7 @@ function videoFromVertex(fromObject) {
14660
14783
  }
14661
14784
  return toObject;
14662
14785
  }
14663
- function videoGenerationMaskToVertex(fromObject) {
14786
+ function videoGenerationMaskToVertex(fromObject, rootObject) {
14664
14787
  const toObject = {};
14665
14788
  const fromImage = getValueByPath(fromObject, ['image']);
14666
14789
  if (fromImage != null) {
@@ -14672,7 +14795,7 @@ function videoGenerationMaskToVertex(fromObject) {
14672
14795
  }
14673
14796
  return toObject;
14674
14797
  }
14675
- function videoGenerationReferenceImageToMldev(fromObject) {
14798
+ function videoGenerationReferenceImageToMldev(fromObject, rootObject) {
14676
14799
  const toObject = {};
14677
14800
  const fromImage = getValueByPath(fromObject, ['image']);
14678
14801
  if (fromImage != null) {
@@ -14686,7 +14809,7 @@ function videoGenerationReferenceImageToMldev(fromObject) {
14686
14809
  }
14687
14810
  return toObject;
14688
14811
  }
14689
- function videoGenerationReferenceImageToVertex(fromObject) {
14812
+ function videoGenerationReferenceImageToVertex(fromObject, rootObject) {
14690
14813
  const toObject = {};
14691
14814
  const fromImage = getValueByPath(fromObject, ['image']);
14692
14815
  if (fromImage != null) {
@@ -14700,7 +14823,7 @@ function videoGenerationReferenceImageToVertex(fromObject) {
14700
14823
  }
14701
14824
  return toObject;
14702
14825
  }
14703
- function videoToMldev(fromObject) {
14826
+ function videoToMldev(fromObject, _rootObject) {
14704
14827
  const toObject = {};
14705
14828
  const fromUri = getValueByPath(fromObject, ['uri']);
14706
14829
  if (fromUri != null) {
@@ -14716,7 +14839,7 @@ function videoToMldev(fromObject) {
14716
14839
  }
14717
14840
  return toObject;
14718
14841
  }
14719
- function videoToVertex(fromObject) {
14842
+ function videoToVertex(fromObject, _rootObject) {
14720
14843
  const toObject = {};
14721
14844
  const fromUri = getValueByPath(fromObject, ['uri']);
14722
14845
  if (fromUri != null) {
@@ -15255,8 +15378,19 @@ class Live {
15255
15378
  }
15256
15379
  const headers = mapToHeaders(clientHeaders);
15257
15380
  if (this.apiClient.isVertexAI()) {
15258
- url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
15259
- await this.auth.addAuthHeaders(headers, url);
15381
+ const project = this.apiClient.getProject();
15382
+ const location = this.apiClient.getLocation();
15383
+ const apiKey = this.apiClient.getApiKey();
15384
+ const hasStandardAuth = (!!project && !!location) || !!apiKey;
15385
+ if (this.apiClient.getCustomBaseUrl() && !hasStandardAuth) {
15386
+ // Custom base URL without standard auth (e.g., proxy).
15387
+ url = websocketBaseUrl;
15388
+ // Auth headers are assumed to be in `clientHeaders` from httpOptions.
15389
+ }
15390
+ else {
15391
+ url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
15392
+ await this.auth.addAuthHeaders(headers, url);
15393
+ }
15260
15394
  }
15261
15395
  else {
15262
15396
  const apiKey = this.apiClient.getApiKey();
@@ -15302,8 +15436,10 @@ class Live {
15302
15436
  transformedModel.startsWith('publishers/')) {
15303
15437
  const project = this.apiClient.getProject();
15304
15438
  const location = this.apiClient.getLocation();
15305
- transformedModel =
15306
- `projects/${project}/locations/${location}/` + transformedModel;
15439
+ if (project && location) {
15440
+ transformedModel =
15441
+ `projects/${project}/locations/${location}/` + transformedModel;
15442
+ }
15307
15443
  }
15308
15444
  let clientMessage = {};
15309
15445
  if (this.apiClient.isVertexAI() &&
@@ -16259,7 +16395,7 @@ class Models extends BaseModule {
16259
16395
  _c = apiResponse_1_1.value;
16260
16396
  _d = false;
16261
16397
  const chunk = _c;
16262
- const resp = generateContentResponseFromVertex((yield __await(chunk.json())));
16398
+ const resp = generateContentResponseFromVertex((yield __await(chunk.json())), params);
16263
16399
  resp['sdkHttpResponse'] = {
16264
16400
  headers: chunk.headers,
16265
16401
  };
@@ -16301,7 +16437,7 @@ class Models extends BaseModule {
16301
16437
  _c = apiResponse_2_1.value;
16302
16438
  _d = false;
16303
16439
  const chunk = _c;
16304
- const resp = generateContentResponseFromMldev((yield __await(chunk.json())));
16440
+ const resp = generateContentResponseFromMldev((yield __await(chunk.json())), params);
16305
16441
  resp['sdkHttpResponse'] = {
16306
16442
  headers: chunk.headers,
16307
16443
  };
@@ -18075,6 +18211,12 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
18075
18211
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
18076
18212
  throw new Error('adapterSize parameter is not supported in Gemini API.');
18077
18213
  }
18214
+ if (getValueByPath(fromObject, ['tuningMode']) !== undefined) {
18215
+ throw new Error('tuningMode parameter is not supported in Gemini API.');
18216
+ }
18217
+ if (getValueByPath(fromObject, ['customBaseModel']) !== undefined) {
18218
+ throw new Error('customBaseModel parameter is not supported in Gemini API.');
18219
+ }
18078
18220
  const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
18079
18221
  if (parentObject !== undefined && fromBatchSize != null) {
18080
18222
  setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
@@ -18089,6 +18231,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
18089
18231
  if (getValueByPath(fromObject, ['beta']) !== undefined) {
18090
18232
  throw new Error('beta parameter is not supported in Gemini API.');
18091
18233
  }
18234
+ if (getValueByPath(fromObject, ['baseTeacherModel']) !== undefined) {
18235
+ throw new Error('baseTeacherModel parameter is not supported in Gemini API.');
18236
+ }
18237
+ if (getValueByPath(fromObject, ['tunedTeacherModelSource']) !== undefined) {
18238
+ throw new Error('tunedTeacherModelSource parameter is not supported in Gemini API.');
18239
+ }
18240
+ if (getValueByPath(fromObject, ['sftLossWeightMultiplier']) !== undefined) {
18241
+ throw new Error('sftLossWeightMultiplier parameter is not supported in Gemini API.');
18242
+ }
18243
+ if (getValueByPath(fromObject, ['outputUri']) !== undefined) {
18244
+ throw new Error('outputUri parameter is not supported in Gemini API.');
18245
+ }
18092
18246
  return toObject;
18093
18247
  }
18094
18248
  function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
@@ -18116,6 +18270,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18116
18270
  setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
18117
18271
  }
18118
18272
  }
18273
+ else if (discriminatorValidationDataset === 'DISTILLATION') {
18274
+ const fromValidationDataset = getValueByPath(fromObject, [
18275
+ 'validationDataset',
18276
+ ]);
18277
+ if (parentObject !== undefined && fromValidationDataset != null) {
18278
+ setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
18279
+ }
18280
+ }
18119
18281
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
18120
18282
  'tunedModelDisplayName',
18121
18283
  ]);
@@ -18145,6 +18307,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18145
18307
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
18146
18308
  }
18147
18309
  }
18310
+ else if (discriminatorEpochCount === 'DISTILLATION') {
18311
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
18312
+ if (parentObject !== undefined && fromEpochCount != null) {
18313
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
18314
+ }
18315
+ }
18148
18316
  let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
18149
18317
  'config',
18150
18318
  'method',
@@ -18172,6 +18340,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18172
18340
  ], fromLearningRateMultiplier);
18173
18341
  }
18174
18342
  }
18343
+ else if (discriminatorLearningRateMultiplier === 'DISTILLATION') {
18344
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
18345
+ 'learningRateMultiplier',
18346
+ ]);
18347
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
18348
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
18349
+ }
18350
+ }
18175
18351
  let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
18176
18352
  if (discriminatorExportLastCheckpointOnly === undefined) {
18177
18353
  discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
@@ -18192,6 +18368,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18192
18368
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
18193
18369
  }
18194
18370
  }
18371
+ else if (discriminatorExportLastCheckpointOnly === 'DISTILLATION') {
18372
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
18373
+ 'exportLastCheckpointOnly',
18374
+ ]);
18375
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
18376
+ setValueByPath(parentObject, ['distillationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
18377
+ }
18378
+ }
18195
18379
  let discriminatorAdapterSize = getValueByPath(rootObject, [
18196
18380
  'config',
18197
18381
  'method',
@@ -18211,11 +18395,58 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18211
18395
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
18212
18396
  }
18213
18397
  }
18214
- if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
18215
- throw new Error('batchSize parameter is not supported in Vertex AI.');
18398
+ else if (discriminatorAdapterSize === 'DISTILLATION') {
18399
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
18400
+ if (parentObject !== undefined && fromAdapterSize != null) {
18401
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
18402
+ }
18403
+ }
18404
+ let discriminatorTuningMode = getValueByPath(rootObject, [
18405
+ 'config',
18406
+ 'method',
18407
+ ]);
18408
+ if (discriminatorTuningMode === undefined) {
18409
+ discriminatorTuningMode = 'SUPERVISED_FINE_TUNING';
18410
+ }
18411
+ if (discriminatorTuningMode === 'SUPERVISED_FINE_TUNING') {
18412
+ const fromTuningMode = getValueByPath(fromObject, ['tuningMode']);
18413
+ if (parentObject !== undefined && fromTuningMode != null) {
18414
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'tuningMode'], fromTuningMode);
18415
+ }
18416
+ }
18417
+ const fromCustomBaseModel = getValueByPath(fromObject, [
18418
+ 'customBaseModel',
18419
+ ]);
18420
+ if (parentObject !== undefined && fromCustomBaseModel != null) {
18421
+ setValueByPath(parentObject, ['customBaseModel'], fromCustomBaseModel);
18216
18422
  }
18217
- if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
18218
- throw new Error('learningRate parameter is not supported in Vertex AI.');
18423
+ let discriminatorBatchSize = getValueByPath(rootObject, [
18424
+ 'config',
18425
+ 'method',
18426
+ ]);
18427
+ if (discriminatorBatchSize === undefined) {
18428
+ discriminatorBatchSize = 'SUPERVISED_FINE_TUNING';
18429
+ }
18430
+ if (discriminatorBatchSize === 'SUPERVISED_FINE_TUNING') {
18431
+ const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
18432
+ if (parentObject !== undefined && fromBatchSize != null) {
18433
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
18434
+ }
18435
+ }
18436
+ let discriminatorLearningRate = getValueByPath(rootObject, [
18437
+ 'config',
18438
+ 'method',
18439
+ ]);
18440
+ if (discriminatorLearningRate === undefined) {
18441
+ discriminatorLearningRate = 'SUPERVISED_FINE_TUNING';
18442
+ }
18443
+ if (discriminatorLearningRate === 'SUPERVISED_FINE_TUNING') {
18444
+ const fromLearningRate = getValueByPath(fromObject, [
18445
+ 'learningRate',
18446
+ ]);
18447
+ if (parentObject !== undefined && fromLearningRate != null) {
18448
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRate'], fromLearningRate);
18449
+ }
18219
18450
  }
18220
18451
  const fromLabels = getValueByPath(fromObject, ['labels']);
18221
18452
  if (parentObject !== undefined && fromLabels != null) {
@@ -18225,6 +18456,28 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18225
18456
  if (parentObject !== undefined && fromBeta != null) {
18226
18457
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
18227
18458
  }
18459
+ const fromBaseTeacherModel = getValueByPath(fromObject, [
18460
+ 'baseTeacherModel',
18461
+ ]);
18462
+ if (parentObject !== undefined && fromBaseTeacherModel != null) {
18463
+ setValueByPath(parentObject, ['distillationSpec', 'baseTeacherModel'], fromBaseTeacherModel);
18464
+ }
18465
+ const fromTunedTeacherModelSource = getValueByPath(fromObject, [
18466
+ 'tunedTeacherModelSource',
18467
+ ]);
18468
+ if (parentObject !== undefined && fromTunedTeacherModelSource != null) {
18469
+ setValueByPath(parentObject, ['distillationSpec', 'tunedTeacherModelSource'], fromTunedTeacherModelSource);
18470
+ }
18471
+ const fromSftLossWeightMultiplier = getValueByPath(fromObject, [
18472
+ 'sftLossWeightMultiplier',
18473
+ ]);
18474
+ if (parentObject !== undefined && fromSftLossWeightMultiplier != null) {
18475
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'sftLossWeightMultiplier'], fromSftLossWeightMultiplier);
18476
+ }
18477
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18478
+ if (parentObject !== undefined && fromOutputUri != null) {
18479
+ setValueByPath(parentObject, ['outputUri'], fromOutputUri);
18480
+ }
18228
18481
  return toObject;
18229
18482
  }
18230
18483
  function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
@@ -18444,6 +18697,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
18444
18697
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
18445
18698
  }
18446
18699
  }
18700
+ else if (discriminatorGcsUri === 'DISTILLATION') {
18701
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
18702
+ if (parentObject !== undefined && fromGcsUri != null) {
18703
+ setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
18704
+ }
18705
+ }
18447
18706
  let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
18448
18707
  'config',
18449
18708
  'method',
@@ -18467,6 +18726,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
18467
18726
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
18468
18727
  }
18469
18728
  }
18729
+ else if (discriminatorVertexDatasetResource === 'DISTILLATION') {
18730
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
18731
+ 'vertexDatasetResource',
18732
+ ]);
18733
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
18734
+ setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
18735
+ }
18736
+ }
18470
18737
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
18471
18738
  throw new Error('examples parameter is not supported in Vertex AI.');
18472
18739
  }
@@ -18590,6 +18857,12 @@ function tuningJobFromVertex(fromObject, _rootObject) {
18590
18857
  if (fromPreferenceOptimizationSpec != null) {
18591
18858
  setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
18592
18859
  }
18860
+ const fromDistillationSpec = getValueByPath(fromObject, [
18861
+ 'distillationSpec',
18862
+ ]);
18863
+ if (fromDistillationSpec != null) {
18864
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18865
+ }
18593
18866
  const fromTuningDataStats = getValueByPath(fromObject, [
18594
18867
  'tuningDataStats',
18595
18868
  ]);
@@ -19188,5 +19461,5 @@ class GoogleGenAI {
19188
19461
  }
19189
19462
  }
19190
19463
 
19191
- export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
19464
+ export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReplayResponse, ResourceScope, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
19192
19465
  //# sourceMappingURL=index.mjs.map