@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.
@@ -1324,6 +1324,18 @@ var PartMediaResolutionLevel;
1324
1324
  */
1325
1325
  PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
1326
1326
  })(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
1327
+ /** Resource scope. */
1328
+ var ResourceScope;
1329
+ (function (ResourceScope) {
1330
+ /**
1331
+ * When setting base_url, this value configures resource scope to be the collection.
1332
+ The resource name will not include api version, project, or location.
1333
+ For example, if base_url is set to "https://aiplatform.googleapis.com",
1334
+ then the resource name for a Model would be
1335
+ "https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
1336
+ */
1337
+ ResourceScope["COLLECTION"] = "COLLECTION";
1338
+ })(ResourceScope || (ResourceScope = {}));
1327
1339
  /** Options for feature selection preference. */
1328
1340
  var FeatureSelectionPreference;
1329
1341
  (function (FeatureSelectionPreference) {
@@ -1517,6 +1529,10 @@ var TuningMethod;
1517
1529
  * Preference optimization tuning.
1518
1530
  */
1519
1531
  TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
1532
+ /**
1533
+ * Distillation tuning.
1534
+ */
1535
+ TuningMethod["DISTILLATION"] = "DISTILLATION";
1520
1536
  })(TuningMethod || (TuningMethod = {}));
1521
1537
  /** State for the lifecycle of a Document. */
1522
1538
  var DocumentState;
@@ -2308,6 +2324,9 @@ class CreateFileResponse {
2308
2324
  /** Response for the delete file method. */
2309
2325
  class DeleteFileResponse {
2310
2326
  }
2327
+ /** Response for the _register file method. */
2328
+ class RegisterFilesResponse {
2329
+ }
2311
2330
  /** Config for `inlined_responses` parameter. */
2312
2331
  class InlinedResponse {
2313
2332
  }
@@ -4160,6 +4179,9 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4160
4179
  if (fromEnableEnhancedCivicAnswers != null) {
4161
4180
  setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
4162
4181
  }
4182
+ if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
4183
+ throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
4184
+ }
4163
4185
  return toObject;
4164
4186
  }
4165
4187
  function generateContentResponseFromMldev$1(fromObject) {
@@ -4299,6 +4321,10 @@ function inlinedResponseFromMldev(fromObject) {
4299
4321
  if (fromResponse != null) {
4300
4322
  setValueByPath(toObject, ['response'], generateContentResponseFromMldev$1(fromResponse));
4301
4323
  }
4324
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
4325
+ if (fromMetadata != null) {
4326
+ setValueByPath(toObject, ['metadata'], fromMetadata);
4327
+ }
4302
4328
  const fromError = getValueByPath(fromObject, ['error']);
4303
4329
  if (fromError != null) {
4304
4330
  setValueByPath(toObject, ['error'], fromError);
@@ -6739,6 +6765,14 @@ function getFileParametersToMldev(fromObject) {
6739
6765
  }
6740
6766
  return toObject;
6741
6767
  }
6768
+ function internalRegisterFilesParametersToMldev(fromObject) {
6769
+ const toObject = {};
6770
+ const fromUris = getValueByPath(fromObject, ['uris']);
6771
+ if (fromUris != null) {
6772
+ setValueByPath(toObject, ['uris'], fromUris);
6773
+ }
6774
+ return toObject;
6775
+ }
6742
6776
  function listFilesConfigToMldev(fromObject, parentObject) {
6743
6777
  const toObject = {};
6744
6778
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
@@ -6785,6 +6819,26 @@ function listFilesResponseFromMldev(fromObject) {
6785
6819
  }
6786
6820
  return toObject;
6787
6821
  }
6822
+ function registerFilesResponseFromMldev(fromObject) {
6823
+ const toObject = {};
6824
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
6825
+ 'sdkHttpResponse',
6826
+ ]);
6827
+ if (fromSdkHttpResponse != null) {
6828
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
6829
+ }
6830
+ const fromFiles = getValueByPath(fromObject, ['files']);
6831
+ if (fromFiles != null) {
6832
+ let transformedList = fromFiles;
6833
+ if (Array.isArray(transformedList)) {
6834
+ transformedList = transformedList.map((item) => {
6835
+ return item;
6836
+ });
6837
+ }
6838
+ setValueByPath(toObject, ['files'], transformedList);
6839
+ }
6840
+ return toObject;
6841
+ }
6788
6842
 
6789
6843
  /**
6790
6844
  * @license
@@ -6885,6 +6939,16 @@ class Files extends BaseModule {
6885
6939
  async download(params) {
6886
6940
  await this.apiClient.downloadFile(params);
6887
6941
  }
6942
+ /**
6943
+ * Registers Google Cloud Storage files for use with the API.
6944
+ * This method is only available in Node.js environments.
6945
+ */
6946
+ async registerFiles(params) {
6947
+ throw new Error('registerFiles is only supported in Node.js environments.');
6948
+ }
6949
+ async _registerFiles(params) {
6950
+ return this.registerFilesInternal(params);
6951
+ }
6888
6952
  async listInternal(params) {
6889
6953
  var _a, _b;
6890
6954
  let response;
@@ -7058,6 +7122,40 @@ class Files extends BaseModule {
7058
7122
  });
7059
7123
  }
7060
7124
  }
7125
+ async registerFilesInternal(params) {
7126
+ var _a, _b;
7127
+ let response;
7128
+ let path = '';
7129
+ let queryParams = {};
7130
+ if (this.apiClient.isVertexAI()) {
7131
+ throw new Error('This method is only supported by the Gemini Developer API.');
7132
+ }
7133
+ else {
7134
+ const body = internalRegisterFilesParametersToMldev(params);
7135
+ path = formatMap('files:register', body['_url']);
7136
+ queryParams = body['_query'];
7137
+ delete body['_url'];
7138
+ delete body['_query'];
7139
+ response = this.apiClient
7140
+ .request({
7141
+ path: path,
7142
+ queryParams: queryParams,
7143
+ body: JSON.stringify(body),
7144
+ httpMethod: 'POST',
7145
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
7146
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
7147
+ })
7148
+ .then((httpResponse) => {
7149
+ return httpResponse.json();
7150
+ });
7151
+ return response.then((apiResponse) => {
7152
+ const resp = registerFilesResponseFromMldev(apiResponse);
7153
+ const typedResp = new RegisterFilesResponse();
7154
+ Object.assign(typedResp, resp);
7155
+ return typedResp;
7156
+ });
7157
+ }
7158
+ }
7061
7159
  }
7062
7160
 
7063
7161
  /**
@@ -8030,7 +8128,7 @@ function voiceActivityFromVertex(fromObject) {
8030
8128
  * Copyright 2025 Google LLC
8031
8129
  * SPDX-License-Identifier: Apache-2.0
8032
8130
  */
8033
- function blobToMldev$1(fromObject) {
8131
+ function blobToMldev$1(fromObject, _rootObject) {
8034
8132
  const toObject = {};
8035
8133
  const fromData = getValueByPath(fromObject, ['data']);
8036
8134
  if (fromData != null) {
@@ -8045,7 +8143,7 @@ function blobToMldev$1(fromObject) {
8045
8143
  }
8046
8144
  return toObject;
8047
8145
  }
8048
- function candidateFromMldev(fromObject) {
8146
+ function candidateFromMldev(fromObject, rootObject) {
8049
8147
  const toObject = {};
8050
8148
  const fromContent = getValueByPath(fromObject, ['content']);
8051
8149
  if (fromContent != null) {
@@ -8105,7 +8203,7 @@ function candidateFromMldev(fromObject) {
8105
8203
  }
8106
8204
  return toObject;
8107
8205
  }
8108
- function citationMetadataFromMldev(fromObject) {
8206
+ function citationMetadataFromMldev(fromObject, _rootObject) {
8109
8207
  const toObject = {};
8110
8208
  const fromCitations = getValueByPath(fromObject, ['citationSources']);
8111
8209
  if (fromCitations != null) {
@@ -8119,7 +8217,7 @@ function citationMetadataFromMldev(fromObject) {
8119
8217
  }
8120
8218
  return toObject;
8121
8219
  }
8122
- function computeTokensParametersToVertex(apiClient, fromObject) {
8220
+ function computeTokensParametersToVertex(apiClient, fromObject, _rootObject) {
8123
8221
  const toObject = {};
8124
8222
  const fromModel = getValueByPath(fromObject, ['model']);
8125
8223
  if (fromModel != null) {
@@ -8137,7 +8235,7 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
8137
8235
  }
8138
8236
  return toObject;
8139
8237
  }
8140
- function computeTokensResponseFromVertex(fromObject) {
8238
+ function computeTokensResponseFromVertex(fromObject, _rootObject) {
8141
8239
  const toObject = {};
8142
8240
  const fromSdkHttpResponse = getValueByPath(fromObject, [
8143
8241
  'sdkHttpResponse',
@@ -8157,7 +8255,7 @@ function computeTokensResponseFromVertex(fromObject) {
8157
8255
  }
8158
8256
  return toObject;
8159
8257
  }
8160
- function contentEmbeddingFromVertex(fromObject) {
8258
+ function contentEmbeddingFromVertex(fromObject, rootObject) {
8161
8259
  const toObject = {};
8162
8260
  const fromValues = getValueByPath(fromObject, ['values']);
8163
8261
  if (fromValues != null) {
@@ -8169,7 +8267,7 @@ function contentEmbeddingFromVertex(fromObject) {
8169
8267
  }
8170
8268
  return toObject;
8171
8269
  }
8172
- function contentEmbeddingStatisticsFromVertex(fromObject) {
8270
+ function contentEmbeddingStatisticsFromVertex(fromObject, _rootObject) {
8173
8271
  const toObject = {};
8174
8272
  const fromTruncated = getValueByPath(fromObject, ['truncated']);
8175
8273
  if (fromTruncated != null) {
@@ -8181,7 +8279,7 @@ function contentEmbeddingStatisticsFromVertex(fromObject) {
8181
8279
  }
8182
8280
  return toObject;
8183
8281
  }
8184
- function contentToMldev$1(fromObject) {
8282
+ function contentToMldev$1(fromObject, rootObject) {
8185
8283
  const toObject = {};
8186
8284
  const fromParts = getValueByPath(fromObject, ['parts']);
8187
8285
  if (fromParts != null) {
@@ -8199,7 +8297,7 @@ function contentToMldev$1(fromObject) {
8199
8297
  }
8200
8298
  return toObject;
8201
8299
  }
8202
- function controlReferenceConfigToVertex(fromObject) {
8300
+ function controlReferenceConfigToVertex(fromObject, _rootObject) {
8203
8301
  const toObject = {};
8204
8302
  const fromControlType = getValueByPath(fromObject, ['controlType']);
8205
8303
  if (fromControlType != null) {
@@ -8213,7 +8311,7 @@ function controlReferenceConfigToVertex(fromObject) {
8213
8311
  }
8214
8312
  return toObject;
8215
8313
  }
8216
- function countTokensConfigToMldev(fromObject) {
8314
+ function countTokensConfigToMldev(fromObject, _rootObject) {
8217
8315
  const toObject = {};
8218
8316
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
8219
8317
  throw new Error('systemInstruction parameter is not supported in Gemini API.');
@@ -8226,7 +8324,7 @@ function countTokensConfigToMldev(fromObject) {
8226
8324
  }
8227
8325
  return toObject;
8228
8326
  }
8229
- function countTokensConfigToVertex(fromObject, parentObject) {
8327
+ function countTokensConfigToVertex(fromObject, parentObject, rootObject) {
8230
8328
  const toObject = {};
8231
8329
  const fromSystemInstruction = getValueByPath(fromObject, [
8232
8330
  'systemInstruction',
@@ -8252,7 +8350,7 @@ function countTokensConfigToVertex(fromObject, parentObject) {
8252
8350
  }
8253
8351
  return toObject;
8254
8352
  }
8255
- function countTokensParametersToMldev(apiClient, fromObject) {
8353
+ function countTokensParametersToMldev(apiClient, fromObject, rootObject) {
8256
8354
  const toObject = {};
8257
8355
  const fromModel = getValueByPath(fromObject, ['model']);
8258
8356
  if (fromModel != null) {
@@ -8274,7 +8372,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
8274
8372
  }
8275
8373
  return toObject;
8276
8374
  }
8277
- function countTokensParametersToVertex(apiClient, fromObject) {
8375
+ function countTokensParametersToVertex(apiClient, fromObject, rootObject) {
8278
8376
  const toObject = {};
8279
8377
  const fromModel = getValueByPath(fromObject, ['model']);
8280
8378
  if (fromModel != null) {
@@ -8296,7 +8394,7 @@ function countTokensParametersToVertex(apiClient, fromObject) {
8296
8394
  }
8297
8395
  return toObject;
8298
8396
  }
8299
- function countTokensResponseFromMldev(fromObject) {
8397
+ function countTokensResponseFromMldev(fromObject, _rootObject) {
8300
8398
  const toObject = {};
8301
8399
  const fromSdkHttpResponse = getValueByPath(fromObject, [
8302
8400
  'sdkHttpResponse',
@@ -8316,7 +8414,7 @@ function countTokensResponseFromMldev(fromObject) {
8316
8414
  }
8317
8415
  return toObject;
8318
8416
  }
8319
- function countTokensResponseFromVertex(fromObject) {
8417
+ function countTokensResponseFromVertex(fromObject, _rootObject) {
8320
8418
  const toObject = {};
8321
8419
  const fromSdkHttpResponse = getValueByPath(fromObject, [
8322
8420
  'sdkHttpResponse',
@@ -8330,7 +8428,7 @@ function countTokensResponseFromVertex(fromObject) {
8330
8428
  }
8331
8429
  return toObject;
8332
8430
  }
8333
- function deleteModelParametersToMldev(apiClient, fromObject) {
8431
+ function deleteModelParametersToMldev(apiClient, fromObject, _rootObject) {
8334
8432
  const toObject = {};
8335
8433
  const fromModel = getValueByPath(fromObject, ['model']);
8336
8434
  if (fromModel != null) {
@@ -8338,7 +8436,7 @@ function deleteModelParametersToMldev(apiClient, fromObject) {
8338
8436
  }
8339
8437
  return toObject;
8340
8438
  }
8341
- function deleteModelParametersToVertex(apiClient, fromObject) {
8439
+ function deleteModelParametersToVertex(apiClient, fromObject, _rootObject) {
8342
8440
  const toObject = {};
8343
8441
  const fromModel = getValueByPath(fromObject, ['model']);
8344
8442
  if (fromModel != null) {
@@ -8346,7 +8444,7 @@ function deleteModelParametersToVertex(apiClient, fromObject) {
8346
8444
  }
8347
8445
  return toObject;
8348
8446
  }
8349
- function deleteModelResponseFromMldev(fromObject) {
8447
+ function deleteModelResponseFromMldev(fromObject, _rootObject) {
8350
8448
  const toObject = {};
8351
8449
  const fromSdkHttpResponse = getValueByPath(fromObject, [
8352
8450
  'sdkHttpResponse',
@@ -8356,7 +8454,7 @@ function deleteModelResponseFromMldev(fromObject) {
8356
8454
  }
8357
8455
  return toObject;
8358
8456
  }
8359
- function deleteModelResponseFromVertex(fromObject) {
8457
+ function deleteModelResponseFromVertex(fromObject, _rootObject) {
8360
8458
  const toObject = {};
8361
8459
  const fromSdkHttpResponse = getValueByPath(fromObject, [
8362
8460
  'sdkHttpResponse',
@@ -8366,7 +8464,7 @@ function deleteModelResponseFromVertex(fromObject) {
8366
8464
  }
8367
8465
  return toObject;
8368
8466
  }
8369
- function editImageConfigToVertex(fromObject, parentObject) {
8467
+ function editImageConfigToVertex(fromObject, parentObject, _rootObject) {
8370
8468
  const toObject = {};
8371
8469
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
8372
8470
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -8456,7 +8554,7 @@ function editImageConfigToVertex(fromObject, parentObject) {
8456
8554
  }
8457
8555
  return toObject;
8458
8556
  }
8459
- function editImageParametersInternalToVertex(apiClient, fromObject) {
8557
+ function editImageParametersInternalToVertex(apiClient, fromObject, rootObject) {
8460
8558
  const toObject = {};
8461
8559
  const fromModel = getValueByPath(fromObject, ['model']);
8462
8560
  if (fromModel != null) {
@@ -8484,7 +8582,7 @@ function editImageParametersInternalToVertex(apiClient, fromObject) {
8484
8582
  }
8485
8583
  return toObject;
8486
8584
  }
8487
- function editImageResponseFromVertex(fromObject) {
8585
+ function editImageResponseFromVertex(fromObject, rootObject) {
8488
8586
  const toObject = {};
8489
8587
  const fromSdkHttpResponse = getValueByPath(fromObject, [
8490
8588
  'sdkHttpResponse',
@@ -8506,7 +8604,7 @@ function editImageResponseFromVertex(fromObject) {
8506
8604
  }
8507
8605
  return toObject;
8508
8606
  }
8509
- function embedContentConfigToMldev(fromObject, parentObject) {
8607
+ function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
8510
8608
  const toObject = {};
8511
8609
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
8512
8610
  if (parentObject !== undefined && fromTaskType != null) {
@@ -8530,7 +8628,7 @@ function embedContentConfigToMldev(fromObject, parentObject) {
8530
8628
  }
8531
8629
  return toObject;
8532
8630
  }
8533
- function embedContentConfigToVertex(fromObject, parentObject) {
8631
+ function embedContentConfigToVertex(fromObject, parentObject, _rootObject) {
8534
8632
  const toObject = {};
8535
8633
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
8536
8634
  if (parentObject !== undefined && fromTaskType != null) {
@@ -8556,7 +8654,7 @@ function embedContentConfigToVertex(fromObject, parentObject) {
8556
8654
  }
8557
8655
  return toObject;
8558
8656
  }
8559
- function embedContentParametersToMldev(apiClient, fromObject) {
8657
+ function embedContentParametersToMldev(apiClient, fromObject, rootObject) {
8560
8658
  const toObject = {};
8561
8659
  const fromModel = getValueByPath(fromObject, ['model']);
8562
8660
  if (fromModel != null) {
@@ -8582,7 +8680,7 @@ function embedContentParametersToMldev(apiClient, fromObject) {
8582
8680
  }
8583
8681
  return toObject;
8584
8682
  }
8585
- function embedContentParametersToVertex(apiClient, fromObject) {
8683
+ function embedContentParametersToVertex(apiClient, fromObject, rootObject) {
8586
8684
  const toObject = {};
8587
8685
  const fromModel = getValueByPath(fromObject, ['model']);
8588
8686
  if (fromModel != null) {
@@ -8604,7 +8702,7 @@ function embedContentParametersToVertex(apiClient, fromObject) {
8604
8702
  }
8605
8703
  return toObject;
8606
8704
  }
8607
- function embedContentResponseFromMldev(fromObject) {
8705
+ function embedContentResponseFromMldev(fromObject, _rootObject) {
8608
8706
  const toObject = {};
8609
8707
  const fromSdkHttpResponse = getValueByPath(fromObject, [
8610
8708
  'sdkHttpResponse',
@@ -8628,7 +8726,7 @@ function embedContentResponseFromMldev(fromObject) {
8628
8726
  }
8629
8727
  return toObject;
8630
8728
  }
8631
- function embedContentResponseFromVertex(fromObject) {
8729
+ function embedContentResponseFromVertex(fromObject, rootObject) {
8632
8730
  const toObject = {};
8633
8731
  const fromSdkHttpResponse = getValueByPath(fromObject, [
8634
8732
  'sdkHttpResponse',
@@ -8655,7 +8753,7 @@ function embedContentResponseFromVertex(fromObject) {
8655
8753
  }
8656
8754
  return toObject;
8657
8755
  }
8658
- function endpointFromVertex(fromObject) {
8756
+ function endpointFromVertex(fromObject, _rootObject) {
8659
8757
  const toObject = {};
8660
8758
  const fromName = getValueByPath(fromObject, ['endpoint']);
8661
8759
  if (fromName != null) {
@@ -8669,7 +8767,7 @@ function endpointFromVertex(fromObject) {
8669
8767
  }
8670
8768
  return toObject;
8671
8769
  }
8672
- function fileDataToMldev$1(fromObject) {
8770
+ function fileDataToMldev$1(fromObject, _rootObject) {
8673
8771
  const toObject = {};
8674
8772
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
8675
8773
  throw new Error('displayName parameter is not supported in Gemini API.');
@@ -8684,7 +8782,7 @@ function fileDataToMldev$1(fromObject) {
8684
8782
  }
8685
8783
  return toObject;
8686
8784
  }
8687
- function functionCallToMldev$1(fromObject) {
8785
+ function functionCallToMldev$1(fromObject, _rootObject) {
8688
8786
  const toObject = {};
8689
8787
  const fromId = getValueByPath(fromObject, ['id']);
8690
8788
  if (fromId != null) {
@@ -8706,7 +8804,7 @@ function functionCallToMldev$1(fromObject) {
8706
8804
  }
8707
8805
  return toObject;
8708
8806
  }
8709
- function functionCallingConfigToMldev(fromObject) {
8807
+ function functionCallingConfigToMldev(fromObject, _rootObject) {
8710
8808
  const toObject = {};
8711
8809
  const fromAllowedFunctionNames = getValueByPath(fromObject, [
8712
8810
  'allowedFunctionNames',
@@ -8724,7 +8822,7 @@ function functionCallingConfigToMldev(fromObject) {
8724
8822
  }
8725
8823
  return toObject;
8726
8824
  }
8727
- function functionDeclarationToVertex(fromObject) {
8825
+ function functionDeclarationToVertex(fromObject, _rootObject) {
8728
8826
  const toObject = {};
8729
8827
  const fromDescription = getValueByPath(fromObject, ['description']);
8730
8828
  if (fromDescription != null) {
@@ -8759,7 +8857,7 @@ function functionDeclarationToVertex(fromObject) {
8759
8857
  }
8760
8858
  return toObject;
8761
8859
  }
8762
- function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8860
+ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootObject) {
8763
8861
  const toObject = {};
8764
8862
  const fromSystemInstruction = getValueByPath(fromObject, [
8765
8863
  'systemInstruction',
@@ -8917,9 +9015,12 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8917
9015
  if (fromEnableEnhancedCivicAnswers != null) {
8918
9016
  setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
8919
9017
  }
9018
+ if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
9019
+ throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
9020
+ }
8920
9021
  return toObject;
8921
9022
  }
8922
- function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
9023
+ function generateContentConfigToVertex(apiClient, fromObject, parentObject, rootObject) {
8923
9024
  const toObject = {};
8924
9025
  const fromSystemInstruction = getValueByPath(fromObject, [
8925
9026
  'systemInstruction',
@@ -9085,9 +9186,15 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
9085
9186
  undefined) {
9086
9187
  throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
9087
9188
  }
9189
+ const fromModelArmorConfig = getValueByPath(fromObject, [
9190
+ 'modelArmorConfig',
9191
+ ]);
9192
+ if (parentObject !== undefined && fromModelArmorConfig != null) {
9193
+ setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
9194
+ }
9088
9195
  return toObject;
9089
9196
  }
9090
- function generateContentParametersToMldev(apiClient, fromObject) {
9197
+ function generateContentParametersToMldev(apiClient, fromObject, rootObject) {
9091
9198
  const toObject = {};
9092
9199
  const fromModel = getValueByPath(fromObject, ['model']);
9093
9200
  if (fromModel != null) {
@@ -9109,7 +9216,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
9109
9216
  }
9110
9217
  return toObject;
9111
9218
  }
9112
- function generateContentParametersToVertex(apiClient, fromObject) {
9219
+ function generateContentParametersToVertex(apiClient, fromObject, rootObject) {
9113
9220
  const toObject = {};
9114
9221
  const fromModel = getValueByPath(fromObject, ['model']);
9115
9222
  if (fromModel != null) {
@@ -9131,7 +9238,7 @@ function generateContentParametersToVertex(apiClient, fromObject) {
9131
9238
  }
9132
9239
  return toObject;
9133
9240
  }
9134
- function generateContentResponseFromMldev(fromObject) {
9241
+ function generateContentResponseFromMldev(fromObject, rootObject) {
9135
9242
  const toObject = {};
9136
9243
  const fromSdkHttpResponse = getValueByPath(fromObject, [
9137
9244
  'sdkHttpResponse',
@@ -9171,7 +9278,7 @@ function generateContentResponseFromMldev(fromObject) {
9171
9278
  }
9172
9279
  return toObject;
9173
9280
  }
9174
- function generateContentResponseFromVertex(fromObject) {
9281
+ function generateContentResponseFromVertex(fromObject, _rootObject) {
9175
9282
  const toObject = {};
9176
9283
  const fromSdkHttpResponse = getValueByPath(fromObject, [
9177
9284
  'sdkHttpResponse',
@@ -9215,7 +9322,7 @@ function generateContentResponseFromVertex(fromObject) {
9215
9322
  }
9216
9323
  return toObject;
9217
9324
  }
9218
- function generateImagesConfigToMldev(fromObject, parentObject) {
9325
+ function generateImagesConfigToMldev(fromObject, parentObject, _rootObject) {
9219
9326
  const toObject = {};
9220
9327
  if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
9221
9328
  throw new Error('outputGcsUri parameter is not supported in Gemini API.');
@@ -9297,7 +9404,7 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
9297
9404
  }
9298
9405
  return toObject;
9299
9406
  }
9300
- function generateImagesConfigToVertex(fromObject, parentObject) {
9407
+ function generateImagesConfigToVertex(fromObject, parentObject, _rootObject) {
9301
9408
  const toObject = {};
9302
9409
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
9303
9410
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -9389,7 +9496,7 @@ function generateImagesConfigToVertex(fromObject, parentObject) {
9389
9496
  }
9390
9497
  return toObject;
9391
9498
  }
9392
- function generateImagesParametersToMldev(apiClient, fromObject) {
9499
+ function generateImagesParametersToMldev(apiClient, fromObject, rootObject) {
9393
9500
  const toObject = {};
9394
9501
  const fromModel = getValueByPath(fromObject, ['model']);
9395
9502
  if (fromModel != null) {
@@ -9405,7 +9512,7 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
9405
9512
  }
9406
9513
  return toObject;
9407
9514
  }
9408
- function generateImagesParametersToVertex(apiClient, fromObject) {
9515
+ function generateImagesParametersToVertex(apiClient, fromObject, rootObject) {
9409
9516
  const toObject = {};
9410
9517
  const fromModel = getValueByPath(fromObject, ['model']);
9411
9518
  if (fromModel != null) {
@@ -9421,7 +9528,7 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
9421
9528
  }
9422
9529
  return toObject;
9423
9530
  }
9424
- function generateImagesResponseFromMldev(fromObject) {
9531
+ function generateImagesResponseFromMldev(fromObject, rootObject) {
9425
9532
  const toObject = {};
9426
9533
  const fromSdkHttpResponse = getValueByPath(fromObject, [
9427
9534
  'sdkHttpResponse',
@@ -9449,7 +9556,7 @@ function generateImagesResponseFromMldev(fromObject) {
9449
9556
  }
9450
9557
  return toObject;
9451
9558
  }
9452
- function generateImagesResponseFromVertex(fromObject) {
9559
+ function generateImagesResponseFromVertex(fromObject, rootObject) {
9453
9560
  const toObject = {};
9454
9561
  const fromSdkHttpResponse = getValueByPath(fromObject, [
9455
9562
  'sdkHttpResponse',
@@ -9477,7 +9584,7 @@ function generateImagesResponseFromVertex(fromObject) {
9477
9584
  }
9478
9585
  return toObject;
9479
9586
  }
9480
- function generateVideosConfigToMldev(fromObject, parentObject) {
9587
+ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
9481
9588
  const toObject = {};
9482
9589
  const fromNumberOfVideos = getValueByPath(fromObject, [
9483
9590
  'numberOfVideos',
@@ -9556,7 +9663,7 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
9556
9663
  }
9557
9664
  return toObject;
9558
9665
  }
9559
- function generateVideosConfigToVertex(fromObject, parentObject) {
9666
+ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
9560
9667
  const toObject = {};
9561
9668
  const fromNumberOfVideos = getValueByPath(fromObject, [
9562
9669
  'numberOfVideos',
@@ -9646,7 +9753,7 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
9646
9753
  }
9647
9754
  return toObject;
9648
9755
  }
9649
- function generateVideosOperationFromMldev(fromObject) {
9756
+ function generateVideosOperationFromMldev(fromObject, rootObject) {
9650
9757
  const toObject = {};
9651
9758
  const fromName = getValueByPath(fromObject, ['name']);
9652
9759
  if (fromName != null) {
@@ -9673,7 +9780,7 @@ function generateVideosOperationFromMldev(fromObject) {
9673
9780
  }
9674
9781
  return toObject;
9675
9782
  }
9676
- function generateVideosOperationFromVertex(fromObject) {
9783
+ function generateVideosOperationFromVertex(fromObject, rootObject) {
9677
9784
  const toObject = {};
9678
9785
  const fromName = getValueByPath(fromObject, ['name']);
9679
9786
  if (fromName != null) {
@@ -9697,7 +9804,7 @@ function generateVideosOperationFromVertex(fromObject) {
9697
9804
  }
9698
9805
  return toObject;
9699
9806
  }
9700
- function generateVideosParametersToMldev(apiClient, fromObject) {
9807
+ function generateVideosParametersToMldev(apiClient, fromObject, rootObject) {
9701
9808
  const toObject = {};
9702
9809
  const fromModel = getValueByPath(fromObject, ['model']);
9703
9810
  if (fromModel != null) {
@@ -9725,7 +9832,7 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
9725
9832
  }
9726
9833
  return toObject;
9727
9834
  }
9728
- function generateVideosParametersToVertex(apiClient, fromObject) {
9835
+ function generateVideosParametersToVertex(apiClient, fromObject, rootObject) {
9729
9836
  const toObject = {};
9730
9837
  const fromModel = getValueByPath(fromObject, ['model']);
9731
9838
  if (fromModel != null) {
@@ -9753,7 +9860,7 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
9753
9860
  }
9754
9861
  return toObject;
9755
9862
  }
9756
- function generateVideosResponseFromMldev(fromObject) {
9863
+ function generateVideosResponseFromMldev(fromObject, rootObject) {
9757
9864
  const toObject = {};
9758
9865
  const fromGeneratedVideos = getValueByPath(fromObject, [
9759
9866
  'generatedSamples',
@@ -9781,7 +9888,7 @@ function generateVideosResponseFromMldev(fromObject) {
9781
9888
  }
9782
9889
  return toObject;
9783
9890
  }
9784
- function generateVideosResponseFromVertex(fromObject) {
9891
+ function generateVideosResponseFromVertex(fromObject, rootObject) {
9785
9892
  const toObject = {};
9786
9893
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
9787
9894
  if (fromGeneratedVideos != null) {
@@ -9807,7 +9914,7 @@ function generateVideosResponseFromVertex(fromObject) {
9807
9914
  }
9808
9915
  return toObject;
9809
9916
  }
9810
- function generateVideosSourceToMldev(fromObject, parentObject) {
9917
+ function generateVideosSourceToMldev(fromObject, parentObject, rootObject) {
9811
9918
  const toObject = {};
9812
9919
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
9813
9920
  if (parentObject !== undefined && fromPrompt != null) {
@@ -9823,7 +9930,7 @@ function generateVideosSourceToMldev(fromObject, parentObject) {
9823
9930
  }
9824
9931
  return toObject;
9825
9932
  }
9826
- function generateVideosSourceToVertex(fromObject, parentObject) {
9933
+ function generateVideosSourceToVertex(fromObject, parentObject, rootObject) {
9827
9934
  const toObject = {};
9828
9935
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
9829
9936
  if (parentObject !== undefined && fromPrompt != null) {
@@ -9839,7 +9946,7 @@ function generateVideosSourceToVertex(fromObject, parentObject) {
9839
9946
  }
9840
9947
  return toObject;
9841
9948
  }
9842
- function generatedImageFromMldev(fromObject) {
9949
+ function generatedImageFromMldev(fromObject, rootObject) {
9843
9950
  const toObject = {};
9844
9951
  const fromImage = getValueByPath(fromObject, ['_self']);
9845
9952
  if (fromImage != null) {
@@ -9857,7 +9964,7 @@ function generatedImageFromMldev(fromObject) {
9857
9964
  }
9858
9965
  return toObject;
9859
9966
  }
9860
- function generatedImageFromVertex(fromObject) {
9967
+ function generatedImageFromVertex(fromObject, rootObject) {
9861
9968
  const toObject = {};
9862
9969
  const fromImage = getValueByPath(fromObject, ['_self']);
9863
9970
  if (fromImage != null) {
@@ -9879,7 +9986,7 @@ function generatedImageFromVertex(fromObject) {
9879
9986
  }
9880
9987
  return toObject;
9881
9988
  }
9882
- function generatedImageMaskFromVertex(fromObject) {
9989
+ function generatedImageMaskFromVertex(fromObject, rootObject) {
9883
9990
  const toObject = {};
9884
9991
  const fromMask = getValueByPath(fromObject, ['_self']);
9885
9992
  if (fromMask != null) {
@@ -9897,7 +10004,7 @@ function generatedImageMaskFromVertex(fromObject) {
9897
10004
  }
9898
10005
  return toObject;
9899
10006
  }
9900
- function generatedVideoFromMldev(fromObject) {
10007
+ function generatedVideoFromMldev(fromObject, rootObject) {
9901
10008
  const toObject = {};
9902
10009
  const fromVideo = getValueByPath(fromObject, ['video']);
9903
10010
  if (fromVideo != null) {
@@ -9905,7 +10012,7 @@ function generatedVideoFromMldev(fromObject) {
9905
10012
  }
9906
10013
  return toObject;
9907
10014
  }
9908
- function generatedVideoFromVertex(fromObject) {
10015
+ function generatedVideoFromVertex(fromObject, rootObject) {
9909
10016
  const toObject = {};
9910
10017
  const fromVideo = getValueByPath(fromObject, ['_self']);
9911
10018
  if (fromVideo != null) {
@@ -9913,7 +10020,7 @@ function generatedVideoFromVertex(fromObject) {
9913
10020
  }
9914
10021
  return toObject;
9915
10022
  }
9916
- function generationConfigToVertex(fromObject) {
10023
+ function generationConfigToVertex(fromObject, _rootObject) {
9917
10024
  const toObject = {};
9918
10025
  const fromModelSelectionConfig = getValueByPath(fromObject, [
9919
10026
  'modelSelectionConfig',
@@ -10041,7 +10148,7 @@ function generationConfigToVertex(fromObject) {
10041
10148
  }
10042
10149
  return toObject;
10043
10150
  }
10044
- function getModelParametersToMldev(apiClient, fromObject) {
10151
+ function getModelParametersToMldev(apiClient, fromObject, _rootObject) {
10045
10152
  const toObject = {};
10046
10153
  const fromModel = getValueByPath(fromObject, ['model']);
10047
10154
  if (fromModel != null) {
@@ -10049,7 +10156,7 @@ function getModelParametersToMldev(apiClient, fromObject) {
10049
10156
  }
10050
10157
  return toObject;
10051
10158
  }
10052
- function getModelParametersToVertex(apiClient, fromObject) {
10159
+ function getModelParametersToVertex(apiClient, fromObject, _rootObject) {
10053
10160
  const toObject = {};
10054
10161
  const fromModel = getValueByPath(fromObject, ['model']);
10055
10162
  if (fromModel != null) {
@@ -10057,7 +10164,7 @@ function getModelParametersToVertex(apiClient, fromObject) {
10057
10164
  }
10058
10165
  return toObject;
10059
10166
  }
10060
- function googleMapsToMldev$1(fromObject) {
10167
+ function googleMapsToMldev$1(fromObject, _rootObject) {
10061
10168
  const toObject = {};
10062
10169
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
10063
10170
  throw new Error('authConfig parameter is not supported in Gemini API.');
@@ -10068,7 +10175,7 @@ function googleMapsToMldev$1(fromObject) {
10068
10175
  }
10069
10176
  return toObject;
10070
10177
  }
10071
- function googleSearchToMldev$1(fromObject) {
10178
+ function googleSearchToMldev$1(fromObject, _rootObject) {
10072
10179
  const toObject = {};
10073
10180
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
10074
10181
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
@@ -10084,7 +10191,7 @@ function googleSearchToMldev$1(fromObject) {
10084
10191
  }
10085
10192
  return toObject;
10086
10193
  }
10087
- function imageConfigToMldev(fromObject) {
10194
+ function imageConfigToMldev(fromObject, _rootObject) {
10088
10195
  const toObject = {};
10089
10196
  const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10090
10197
  if (fromAspectRatio != null) {
@@ -10106,7 +10213,7 @@ function imageConfigToMldev(fromObject) {
10106
10213
  }
10107
10214
  return toObject;
10108
10215
  }
10109
- function imageConfigToVertex(fromObject) {
10216
+ function imageConfigToVertex(fromObject, _rootObject) {
10110
10217
  const toObject = {};
10111
10218
  const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10112
10219
  if (fromAspectRatio != null) {
@@ -10136,7 +10243,7 @@ function imageConfigToVertex(fromObject) {
10136
10243
  }
10137
10244
  return toObject;
10138
10245
  }
10139
- function imageFromMldev(fromObject) {
10246
+ function imageFromMldev(fromObject, _rootObject) {
10140
10247
  const toObject = {};
10141
10248
  const fromImageBytes = getValueByPath(fromObject, [
10142
10249
  'bytesBase64Encoded',
@@ -10150,7 +10257,7 @@ function imageFromMldev(fromObject) {
10150
10257
  }
10151
10258
  return toObject;
10152
10259
  }
10153
- function imageFromVertex(fromObject) {
10260
+ function imageFromVertex(fromObject, _rootObject) {
10154
10261
  const toObject = {};
10155
10262
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
10156
10263
  if (fromGcsUri != null) {
@@ -10168,7 +10275,7 @@ function imageFromVertex(fromObject) {
10168
10275
  }
10169
10276
  return toObject;
10170
10277
  }
10171
- function imageToMldev(fromObject) {
10278
+ function imageToMldev(fromObject, _rootObject) {
10172
10279
  const toObject = {};
10173
10280
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
10174
10281
  throw new Error('gcsUri parameter is not supported in Gemini API.');
@@ -10183,7 +10290,7 @@ function imageToMldev(fromObject) {
10183
10290
  }
10184
10291
  return toObject;
10185
10292
  }
10186
- function imageToVertex(fromObject) {
10293
+ function imageToVertex(fromObject, _rootObject) {
10187
10294
  const toObject = {};
10188
10295
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
10189
10296
  if (fromGcsUri != null) {
@@ -10199,7 +10306,7 @@ function imageToVertex(fromObject) {
10199
10306
  }
10200
10307
  return toObject;
10201
10308
  }
10202
- function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
10309
+ function listModelsConfigToMldev(apiClient, fromObject, parentObject, _rootObject) {
10203
10310
  const toObject = {};
10204
10311
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
10205
10312
  if (parentObject !== undefined && fromPageSize != null) {
@@ -10219,7 +10326,7 @@ function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
10219
10326
  }
10220
10327
  return toObject;
10221
10328
  }
10222
- function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
10329
+ function listModelsConfigToVertex(apiClient, fromObject, parentObject, _rootObject) {
10223
10330
  const toObject = {};
10224
10331
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
10225
10332
  if (parentObject !== undefined && fromPageSize != null) {
@@ -10239,7 +10346,7 @@ function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
10239
10346
  }
10240
10347
  return toObject;
10241
10348
  }
10242
- function listModelsParametersToMldev(apiClient, fromObject) {
10349
+ function listModelsParametersToMldev(apiClient, fromObject, rootObject) {
10243
10350
  const toObject = {};
10244
10351
  const fromConfig = getValueByPath(fromObject, ['config']);
10245
10352
  if (fromConfig != null) {
@@ -10247,7 +10354,7 @@ function listModelsParametersToMldev(apiClient, fromObject) {
10247
10354
  }
10248
10355
  return toObject;
10249
10356
  }
10250
- function listModelsParametersToVertex(apiClient, fromObject) {
10357
+ function listModelsParametersToVertex(apiClient, fromObject, rootObject) {
10251
10358
  const toObject = {};
10252
10359
  const fromConfig = getValueByPath(fromObject, ['config']);
10253
10360
  if (fromConfig != null) {
@@ -10255,7 +10362,7 @@ function listModelsParametersToVertex(apiClient, fromObject) {
10255
10362
  }
10256
10363
  return toObject;
10257
10364
  }
10258
- function listModelsResponseFromMldev(fromObject) {
10365
+ function listModelsResponseFromMldev(fromObject, rootObject) {
10259
10366
  const toObject = {};
10260
10367
  const fromSdkHttpResponse = getValueByPath(fromObject, [
10261
10368
  'sdkHttpResponse',
@@ -10281,7 +10388,7 @@ function listModelsResponseFromMldev(fromObject) {
10281
10388
  }
10282
10389
  return toObject;
10283
10390
  }
10284
- function listModelsResponseFromVertex(fromObject) {
10391
+ function listModelsResponseFromVertex(fromObject, rootObject) {
10285
10392
  const toObject = {};
10286
10393
  const fromSdkHttpResponse = getValueByPath(fromObject, [
10287
10394
  'sdkHttpResponse',
@@ -10307,7 +10414,7 @@ function listModelsResponseFromVertex(fromObject) {
10307
10414
  }
10308
10415
  return toObject;
10309
10416
  }
10310
- function maskReferenceConfigToVertex(fromObject) {
10417
+ function maskReferenceConfigToVertex(fromObject, _rootObject) {
10311
10418
  const toObject = {};
10312
10419
  const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
10313
10420
  if (fromMaskMode != null) {
@@ -10325,7 +10432,7 @@ function maskReferenceConfigToVertex(fromObject) {
10325
10432
  }
10326
10433
  return toObject;
10327
10434
  }
10328
- function modelFromMldev(fromObject) {
10435
+ function modelFromMldev(fromObject, rootObject) {
10329
10436
  const toObject = {};
10330
10437
  const fromName = getValueByPath(fromObject, ['name']);
10331
10438
  if (fromName != null) {
@@ -10389,7 +10496,7 @@ function modelFromMldev(fromObject) {
10389
10496
  }
10390
10497
  return toObject;
10391
10498
  }
10392
- function modelFromVertex(fromObject) {
10499
+ function modelFromVertex(fromObject, rootObject) {
10393
10500
  const toObject = {};
10394
10501
  const fromName = getValueByPath(fromObject, ['name']);
10395
10502
  if (fromName != null) {
@@ -10443,7 +10550,7 @@ function modelFromVertex(fromObject) {
10443
10550
  }
10444
10551
  return toObject;
10445
10552
  }
10446
- function partToMldev$1(fromObject) {
10553
+ function partToMldev$1(fromObject, rootObject) {
10447
10554
  const toObject = {};
10448
10555
  const fromMediaResolution = getValueByPath(fromObject, [
10449
10556
  'mediaResolution',
@@ -10503,7 +10610,7 @@ function partToMldev$1(fromObject) {
10503
10610
  }
10504
10611
  return toObject;
10505
10612
  }
10506
- function productImageToVertex(fromObject) {
10613
+ function productImageToVertex(fromObject, rootObject) {
10507
10614
  const toObject = {};
10508
10615
  const fromProductImage = getValueByPath(fromObject, ['productImage']);
10509
10616
  if (fromProductImage != null) {
@@ -10511,7 +10618,7 @@ function productImageToVertex(fromObject) {
10511
10618
  }
10512
10619
  return toObject;
10513
10620
  }
10514
- function recontextImageConfigToVertex(fromObject, parentObject) {
10621
+ function recontextImageConfigToVertex(fromObject, parentObject, _rootObject) {
10515
10622
  const toObject = {};
10516
10623
  const fromNumberOfImages = getValueByPath(fromObject, [
10517
10624
  'numberOfImages',
@@ -10571,7 +10678,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
10571
10678
  }
10572
10679
  return toObject;
10573
10680
  }
10574
- function recontextImageParametersToVertex(apiClient, fromObject) {
10681
+ function recontextImageParametersToVertex(apiClient, fromObject, rootObject) {
10575
10682
  const toObject = {};
10576
10683
  const fromModel = getValueByPath(fromObject, ['model']);
10577
10684
  if (fromModel != null) {
@@ -10587,7 +10694,7 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
10587
10694
  }
10588
10695
  return toObject;
10589
10696
  }
10590
- function recontextImageResponseFromVertex(fromObject) {
10697
+ function recontextImageResponseFromVertex(fromObject, rootObject) {
10591
10698
  const toObject = {};
10592
10699
  const fromGeneratedImages = getValueByPath(fromObject, [
10593
10700
  'predictions',
@@ -10603,7 +10710,7 @@ function recontextImageResponseFromVertex(fromObject) {
10603
10710
  }
10604
10711
  return toObject;
10605
10712
  }
10606
- function recontextImageSourceToVertex(fromObject, parentObject) {
10713
+ function recontextImageSourceToVertex(fromObject, parentObject, rootObject) {
10607
10714
  const toObject = {};
10608
10715
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
10609
10716
  if (parentObject !== undefined && fromPrompt != null) {
@@ -10627,7 +10734,7 @@ function recontextImageSourceToVertex(fromObject, parentObject) {
10627
10734
  }
10628
10735
  return toObject;
10629
10736
  }
10630
- function referenceImageAPIInternalToVertex(fromObject) {
10737
+ function referenceImageAPIInternalToVertex(fromObject, rootObject) {
10631
10738
  const toObject = {};
10632
10739
  const fromReferenceImage = getValueByPath(fromObject, [
10633
10740
  'referenceImage',
@@ -10671,7 +10778,7 @@ function referenceImageAPIInternalToVertex(fromObject) {
10671
10778
  }
10672
10779
  return toObject;
10673
10780
  }
10674
- function safetyAttributesFromMldev(fromObject) {
10781
+ function safetyAttributesFromMldev(fromObject, _rootObject) {
10675
10782
  const toObject = {};
10676
10783
  const fromCategories = getValueByPath(fromObject, [
10677
10784
  'safetyAttributes',
@@ -10693,7 +10800,7 @@ function safetyAttributesFromMldev(fromObject) {
10693
10800
  }
10694
10801
  return toObject;
10695
10802
  }
10696
- function safetyAttributesFromVertex(fromObject) {
10803
+ function safetyAttributesFromVertex(fromObject, _rootObject) {
10697
10804
  const toObject = {};
10698
10805
  const fromCategories = getValueByPath(fromObject, [
10699
10806
  'safetyAttributes',
@@ -10715,7 +10822,7 @@ function safetyAttributesFromVertex(fromObject) {
10715
10822
  }
10716
10823
  return toObject;
10717
10824
  }
10718
- function safetySettingToMldev(fromObject) {
10825
+ function safetySettingToMldev(fromObject, _rootObject) {
10719
10826
  const toObject = {};
10720
10827
  const fromCategory = getValueByPath(fromObject, ['category']);
10721
10828
  if (fromCategory != null) {
@@ -10730,7 +10837,7 @@ function safetySettingToMldev(fromObject) {
10730
10837
  }
10731
10838
  return toObject;
10732
10839
  }
10733
- function scribbleImageToVertex(fromObject) {
10840
+ function scribbleImageToVertex(fromObject, rootObject) {
10734
10841
  const toObject = {};
10735
10842
  const fromImage = getValueByPath(fromObject, ['image']);
10736
10843
  if (fromImage != null) {
@@ -10738,7 +10845,7 @@ function scribbleImageToVertex(fromObject) {
10738
10845
  }
10739
10846
  return toObject;
10740
10847
  }
10741
- function segmentImageConfigToVertex(fromObject, parentObject) {
10848
+ function segmentImageConfigToVertex(fromObject, parentObject, _rootObject) {
10742
10849
  const toObject = {};
10743
10850
  const fromMode = getValueByPath(fromObject, ['mode']);
10744
10851
  if (parentObject !== undefined && fromMode != null) {
@@ -10772,7 +10879,7 @@ function segmentImageConfigToVertex(fromObject, parentObject) {
10772
10879
  }
10773
10880
  return toObject;
10774
10881
  }
10775
- function segmentImageParametersToVertex(apiClient, fromObject) {
10882
+ function segmentImageParametersToVertex(apiClient, fromObject, rootObject) {
10776
10883
  const toObject = {};
10777
10884
  const fromModel = getValueByPath(fromObject, ['model']);
10778
10885
  if (fromModel != null) {
@@ -10788,7 +10895,7 @@ function segmentImageParametersToVertex(apiClient, fromObject) {
10788
10895
  }
10789
10896
  return toObject;
10790
10897
  }
10791
- function segmentImageResponseFromVertex(fromObject) {
10898
+ function segmentImageResponseFromVertex(fromObject, rootObject) {
10792
10899
  const toObject = {};
10793
10900
  const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
10794
10901
  if (fromGeneratedMasks != null) {
@@ -10802,7 +10909,7 @@ function segmentImageResponseFromVertex(fromObject) {
10802
10909
  }
10803
10910
  return toObject;
10804
10911
  }
10805
- function segmentImageSourceToVertex(fromObject, parentObject) {
10912
+ function segmentImageSourceToVertex(fromObject, parentObject, rootObject) {
10806
10913
  const toObject = {};
10807
10914
  const fromPrompt = getValueByPath(fromObject, ['prompt']);
10808
10915
  if (parentObject !== undefined && fromPrompt != null) {
@@ -10820,7 +10927,7 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
10820
10927
  }
10821
10928
  return toObject;
10822
10929
  }
10823
- function toolConfigToMldev(fromObject) {
10930
+ function toolConfigToMldev(fromObject, rootObject) {
10824
10931
  const toObject = {};
10825
10932
  const fromRetrievalConfig = getValueByPath(fromObject, [
10826
10933
  'retrievalConfig',
@@ -10836,7 +10943,7 @@ function toolConfigToMldev(fromObject) {
10836
10943
  }
10837
10944
  return toObject;
10838
10945
  }
10839
- function toolToMldev$1(fromObject) {
10946
+ function toolToMldev$1(fromObject, rootObject) {
10840
10947
  const toObject = {};
10841
10948
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
10842
10949
  throw new Error('retrieval parameter is not supported in Gemini API.');
@@ -10890,7 +10997,7 @@ function toolToMldev$1(fromObject) {
10890
10997
  }
10891
10998
  return toObject;
10892
10999
  }
10893
- function toolToVertex(fromObject) {
11000
+ function toolToVertex(fromObject, rootObject) {
10894
11001
  const toObject = {};
10895
11002
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
10896
11003
  if (fromRetrieval != null) {
@@ -10947,7 +11054,7 @@ function toolToVertex(fromObject) {
10947
11054
  }
10948
11055
  return toObject;
10949
11056
  }
10950
- function tunedModelInfoFromMldev(fromObject) {
11057
+ function tunedModelInfoFromMldev(fromObject, _rootObject) {
10951
11058
  const toObject = {};
10952
11059
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
10953
11060
  if (fromBaseModel != null) {
@@ -10963,7 +11070,7 @@ function tunedModelInfoFromMldev(fromObject) {
10963
11070
  }
10964
11071
  return toObject;
10965
11072
  }
10966
- function tunedModelInfoFromVertex(fromObject) {
11073
+ function tunedModelInfoFromVertex(fromObject, _rootObject) {
10967
11074
  const toObject = {};
10968
11075
  const fromBaseModel = getValueByPath(fromObject, [
10969
11076
  'labels',
@@ -10982,7 +11089,7 @@ function tunedModelInfoFromVertex(fromObject) {
10982
11089
  }
10983
11090
  return toObject;
10984
11091
  }
10985
- function updateModelConfigToMldev(fromObject, parentObject) {
11092
+ function updateModelConfigToMldev(fromObject, parentObject, _rootObject) {
10986
11093
  const toObject = {};
10987
11094
  const fromDisplayName = getValueByPath(fromObject, ['displayName']);
10988
11095
  if (parentObject !== undefined && fromDisplayName != null) {
@@ -11000,7 +11107,7 @@ function updateModelConfigToMldev(fromObject, parentObject) {
11000
11107
  }
11001
11108
  return toObject;
11002
11109
  }
11003
- function updateModelConfigToVertex(fromObject, parentObject) {
11110
+ function updateModelConfigToVertex(fromObject, parentObject, _rootObject) {
11004
11111
  const toObject = {};
11005
11112
  const fromDisplayName = getValueByPath(fromObject, ['displayName']);
11006
11113
  if (parentObject !== undefined && fromDisplayName != null) {
@@ -11018,7 +11125,7 @@ function updateModelConfigToVertex(fromObject, parentObject) {
11018
11125
  }
11019
11126
  return toObject;
11020
11127
  }
11021
- function updateModelParametersToMldev(apiClient, fromObject) {
11128
+ function updateModelParametersToMldev(apiClient, fromObject, rootObject) {
11022
11129
  const toObject = {};
11023
11130
  const fromModel = getValueByPath(fromObject, ['model']);
11024
11131
  if (fromModel != null) {
@@ -11030,7 +11137,7 @@ function updateModelParametersToMldev(apiClient, fromObject) {
11030
11137
  }
11031
11138
  return toObject;
11032
11139
  }
11033
- function updateModelParametersToVertex(apiClient, fromObject) {
11140
+ function updateModelParametersToVertex(apiClient, fromObject, rootObject) {
11034
11141
  const toObject = {};
11035
11142
  const fromModel = getValueByPath(fromObject, ['model']);
11036
11143
  if (fromModel != null) {
@@ -11042,7 +11149,7 @@ function updateModelParametersToVertex(apiClient, fromObject) {
11042
11149
  }
11043
11150
  return toObject;
11044
11151
  }
11045
- function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
11152
+ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject, _rootObject) {
11046
11153
  const toObject = {};
11047
11154
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
11048
11155
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -11106,7 +11213,7 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
11106
11213
  }
11107
11214
  return toObject;
11108
11215
  }
11109
- function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
11216
+ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject, rootObject) {
11110
11217
  const toObject = {};
11111
11218
  const fromModel = getValueByPath(fromObject, ['model']);
11112
11219
  if (fromModel != null) {
@@ -11128,7 +11235,7 @@ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
11128
11235
  }
11129
11236
  return toObject;
11130
11237
  }
11131
- function upscaleImageResponseFromVertex(fromObject) {
11238
+ function upscaleImageResponseFromVertex(fromObject, rootObject) {
11132
11239
  const toObject = {};
11133
11240
  const fromSdkHttpResponse = getValueByPath(fromObject, [
11134
11241
  'sdkHttpResponse',
@@ -11150,7 +11257,7 @@ function upscaleImageResponseFromVertex(fromObject) {
11150
11257
  }
11151
11258
  return toObject;
11152
11259
  }
11153
- function videoFromMldev(fromObject) {
11260
+ function videoFromMldev(fromObject, _rootObject) {
11154
11261
  const toObject = {};
11155
11262
  const fromUri = getValueByPath(fromObject, ['uri']);
11156
11263
  if (fromUri != null) {
@@ -11166,7 +11273,7 @@ function videoFromMldev(fromObject) {
11166
11273
  }
11167
11274
  return toObject;
11168
11275
  }
11169
- function videoFromVertex(fromObject) {
11276
+ function videoFromVertex(fromObject, _rootObject) {
11170
11277
  const toObject = {};
11171
11278
  const fromUri = getValueByPath(fromObject, ['gcsUri']);
11172
11279
  if (fromUri != null) {
@@ -11184,7 +11291,7 @@ function videoFromVertex(fromObject) {
11184
11291
  }
11185
11292
  return toObject;
11186
11293
  }
11187
- function videoGenerationMaskToVertex(fromObject) {
11294
+ function videoGenerationMaskToVertex(fromObject, rootObject) {
11188
11295
  const toObject = {};
11189
11296
  const fromImage = getValueByPath(fromObject, ['image']);
11190
11297
  if (fromImage != null) {
@@ -11196,7 +11303,7 @@ function videoGenerationMaskToVertex(fromObject) {
11196
11303
  }
11197
11304
  return toObject;
11198
11305
  }
11199
- function videoGenerationReferenceImageToMldev(fromObject) {
11306
+ function videoGenerationReferenceImageToMldev(fromObject, rootObject) {
11200
11307
  const toObject = {};
11201
11308
  const fromImage = getValueByPath(fromObject, ['image']);
11202
11309
  if (fromImage != null) {
@@ -11210,7 +11317,7 @@ function videoGenerationReferenceImageToMldev(fromObject) {
11210
11317
  }
11211
11318
  return toObject;
11212
11319
  }
11213
- function videoGenerationReferenceImageToVertex(fromObject) {
11320
+ function videoGenerationReferenceImageToVertex(fromObject, rootObject) {
11214
11321
  const toObject = {};
11215
11322
  const fromImage = getValueByPath(fromObject, ['image']);
11216
11323
  if (fromImage != null) {
@@ -11224,7 +11331,7 @@ function videoGenerationReferenceImageToVertex(fromObject) {
11224
11331
  }
11225
11332
  return toObject;
11226
11333
  }
11227
- function videoToMldev(fromObject) {
11334
+ function videoToMldev(fromObject, _rootObject) {
11228
11335
  const toObject = {};
11229
11336
  const fromUri = getValueByPath(fromObject, ['uri']);
11230
11337
  if (fromUri != null) {
@@ -11240,7 +11347,7 @@ function videoToMldev(fromObject) {
11240
11347
  }
11241
11348
  return toObject;
11242
11349
  }
11243
- function videoToVertex(fromObject) {
11350
+ function videoToVertex(fromObject, _rootObject) {
11244
11351
  const toObject = {};
11245
11352
  const fromUri = getValueByPath(fromObject, ['uri']);
11246
11353
  if (fromUri != null) {
@@ -11501,7 +11608,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
11501
11608
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
11502
11609
  const USER_AGENT_HEADER = 'User-Agent';
11503
11610
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
11504
- const SDK_VERSION = '1.37.0'; // x-release-please-version
11611
+ const SDK_VERSION = '1.39.0'; // x-release-please-version
11505
11612
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
11506
11613
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
11507
11614
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -11511,19 +11618,57 @@ const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
11511
11618
  */
11512
11619
  class ApiClient {
11513
11620
  constructor(opts) {
11514
- var _a, _b;
11515
- this.clientOptions = Object.assign(Object.assign({}, opts), { project: opts.project, location: opts.location, apiKey: opts.apiKey, vertexai: opts.vertexai });
11621
+ var _a, _b, _c;
11622
+ this.clientOptions = Object.assign({}, opts);
11623
+ this.customBaseUrl = (_a = opts.httpOptions) === null || _a === void 0 ? void 0 : _a.baseUrl;
11624
+ if (this.clientOptions.vertexai) {
11625
+ if (this.clientOptions.project && this.clientOptions.location) {
11626
+ this.clientOptions.apiKey = undefined;
11627
+ }
11628
+ else if (this.clientOptions.apiKey) {
11629
+ this.clientOptions.project = undefined;
11630
+ this.clientOptions.location = undefined;
11631
+ }
11632
+ }
11516
11633
  const initHttpOptions = {};
11517
11634
  if (this.clientOptions.vertexai) {
11635
+ if (!this.clientOptions.location &&
11636
+ !this.clientOptions.apiKey &&
11637
+ !this.customBaseUrl) {
11638
+ this.clientOptions.location = 'global';
11639
+ }
11640
+ const hasSufficientAuth = (this.clientOptions.project && this.clientOptions.location) ||
11641
+ this.clientOptions.apiKey;
11642
+ if (!hasSufficientAuth && !this.customBaseUrl) {
11643
+ throw new Error('Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.');
11644
+ }
11645
+ const hasConstructorAuth = (opts.project && opts.location) || !!opts.apiKey;
11646
+ if (this.customBaseUrl && !hasConstructorAuth) {
11647
+ initHttpOptions.baseUrl = this.customBaseUrl;
11648
+ this.clientOptions.project = undefined;
11649
+ this.clientOptions.location = undefined;
11650
+ }
11651
+ else if (this.clientOptions.apiKey ||
11652
+ this.clientOptions.location === 'global') {
11653
+ // Vertex Express or global endpoint case.
11654
+ initHttpOptions.baseUrl = 'https://aiplatform.googleapis.com/';
11655
+ }
11656
+ else if (this.clientOptions.project && this.clientOptions.location) {
11657
+ initHttpOptions.baseUrl = `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
11658
+ }
11518
11659
  initHttpOptions.apiVersion =
11519
- (_a = this.clientOptions.apiVersion) !== null && _a !== void 0 ? _a : VERTEX_AI_API_DEFAULT_VERSION;
11520
- initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
11521
- this.normalizeAuthParameters();
11660
+ (_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : VERTEX_AI_API_DEFAULT_VERSION;
11522
11661
  }
11523
11662
  else {
11524
11663
  // Gemini API
11664
+ if (!this.clientOptions.apiKey) {
11665
+ throw new ApiError({
11666
+ message: 'API key must be set when using the Gemini API.',
11667
+ status: 403,
11668
+ });
11669
+ }
11525
11670
  initHttpOptions.apiVersion =
11526
- (_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : GOOGLE_AI_API_DEFAULT_VERSION;
11671
+ (_c = this.clientOptions.apiVersion) !== null && _c !== void 0 ? _c : GOOGLE_AI_API_DEFAULT_VERSION;
11527
11672
  initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
11528
11673
  }
11529
11674
  initHttpOptions.headers = this.getDefaultHeaders();
@@ -11532,39 +11677,6 @@ class ApiClient {
11532
11677
  this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
11533
11678
  }
11534
11679
  }
11535
- /**
11536
- * Determines the base URL for Vertex AI based on project and location.
11537
- * Uses the global endpoint if location is 'global' or if project/location
11538
- * are not specified (implying API key usage).
11539
- * @private
11540
- */
11541
- baseUrlFromProjectLocation() {
11542
- if (this.clientOptions.project &&
11543
- this.clientOptions.location &&
11544
- this.clientOptions.location !== 'global') {
11545
- // Regional endpoint
11546
- return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
11547
- }
11548
- // Global endpoint (covers 'global' location and API key usage)
11549
- return `https://aiplatform.googleapis.com/`;
11550
- }
11551
- /**
11552
- * Normalizes authentication parameters for Vertex AI.
11553
- * If project and location are provided, API key is cleared.
11554
- * If project and location are not provided (implying API key usage),
11555
- * project and location are cleared.
11556
- * @private
11557
- */
11558
- normalizeAuthParameters() {
11559
- if (this.clientOptions.project && this.clientOptions.location) {
11560
- // Using project/location for auth, clear potential API key
11561
- this.clientOptions.apiKey = undefined;
11562
- return;
11563
- }
11564
- // Using API key for auth (or no auth provided yet), clear project/location
11565
- this.clientOptions.project = undefined;
11566
- this.clientOptions.location = undefined;
11567
- }
11568
11680
  isVertexAI() {
11569
11681
  var _a;
11570
11682
  return (_a = this.clientOptions.vertexai) !== null && _a !== void 0 ? _a : false;
@@ -11575,6 +11687,9 @@ class ApiClient {
11575
11687
  getLocation() {
11576
11688
  return this.clientOptions.location;
11577
11689
  }
11690
+ getCustomBaseUrl() {
11691
+ return this.customBaseUrl;
11692
+ }
11578
11693
  async getAuthHeaders() {
11579
11694
  const headers = new Headers();
11580
11695
  await this.clientOptions.auth.addAuthHeaders(headers);
@@ -11652,7 +11767,11 @@ class ApiClient {
11652
11767
  const url = new URL(`${urlElement.join('/')}`);
11653
11768
  return url;
11654
11769
  }
11655
- shouldPrependVertexProjectPath(request) {
11770
+ shouldPrependVertexProjectPath(request, httpOptions) {
11771
+ if (httpOptions.baseUrl &&
11772
+ httpOptions.baseUrlResourceScope === ResourceScope.COLLECTION) {
11773
+ return false;
11774
+ }
11656
11775
  if (this.clientOptions.apiKey) {
11657
11776
  return false;
11658
11777
  }
@@ -11678,7 +11797,7 @@ class ApiClient {
11678
11797
  if (request.httpOptions) {
11679
11798
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
11680
11799
  }
11681
- const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
11800
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request, patchedHttpOptions);
11682
11801
  const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
11683
11802
  if (request.queryParams) {
11684
11803
  for (const [key, value] of Object.entries(request.queryParams)) {
@@ -11721,7 +11840,7 @@ class ApiClient {
11721
11840
  if (request.httpOptions) {
11722
11841
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
11723
11842
  }
11724
- const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
11843
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request, patchedHttpOptions);
11725
11844
  const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
11726
11845
  if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
11727
11846
  url.searchParams.set('alt', 'sse');
@@ -12648,8 +12767,19 @@ class Live {
12648
12767
  }
12649
12768
  const headers = mapToHeaders(clientHeaders);
12650
12769
  if (this.apiClient.isVertexAI()) {
12651
- url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
12652
- await this.auth.addAuthHeaders(headers, url);
12770
+ const project = this.apiClient.getProject();
12771
+ const location = this.apiClient.getLocation();
12772
+ const apiKey = this.apiClient.getApiKey();
12773
+ const hasStandardAuth = (!!project && !!location) || !!apiKey;
12774
+ if (this.apiClient.getCustomBaseUrl() && !hasStandardAuth) {
12775
+ // Custom base URL without standard auth (e.g., proxy).
12776
+ url = websocketBaseUrl;
12777
+ // Auth headers are assumed to be in `clientHeaders` from httpOptions.
12778
+ }
12779
+ else {
12780
+ url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
12781
+ await this.auth.addAuthHeaders(headers, url);
12782
+ }
12653
12783
  }
12654
12784
  else {
12655
12785
  const apiKey = this.apiClient.getApiKey();
@@ -12695,8 +12825,10 @@ class Live {
12695
12825
  transformedModel.startsWith('publishers/')) {
12696
12826
  const project = this.apiClient.getProject();
12697
12827
  const location = this.apiClient.getLocation();
12698
- transformedModel =
12699
- `projects/${project}/locations/${location}/` + transformedModel;
12828
+ if (project && location) {
12829
+ transformedModel =
12830
+ `projects/${project}/locations/${location}/` + transformedModel;
12831
+ }
12700
12832
  }
12701
12833
  let clientMessage = {};
12702
12834
  if (this.apiClient.isVertexAI() &&
@@ -13652,7 +13784,7 @@ class Models extends BaseModule {
13652
13784
  _c = apiResponse_1_1.value;
13653
13785
  _d = false;
13654
13786
  const chunk = _c;
13655
- const resp = generateContentResponseFromVertex((yield __await(chunk.json())));
13787
+ const resp = generateContentResponseFromVertex((yield __await(chunk.json())), params);
13656
13788
  resp['sdkHttpResponse'] = {
13657
13789
  headers: chunk.headers,
13658
13790
  };
@@ -13694,7 +13826,7 @@ class Models extends BaseModule {
13694
13826
  _c = apiResponse_2_1.value;
13695
13827
  _d = false;
13696
13828
  const chunk = _c;
13697
- const resp = generateContentResponseFromMldev((yield __await(chunk.json())));
13829
+ const resp = generateContentResponseFromMldev((yield __await(chunk.json())), params);
13698
13830
  resp['sdkHttpResponse'] = {
13699
13831
  headers: chunk.headers,
13700
13832
  };
@@ -16627,7 +16759,9 @@ class BaseInteractions extends APIResource {
16627
16759
  *
16628
16760
  * @example
16629
16761
  * ```ts
16630
- * const interaction = await client.interactions.delete('id');
16762
+ * const interaction = await client.interactions.delete('id', {
16763
+ * api_version: 'api_version',
16764
+ * });
16631
16765
  * ```
16632
16766
  */
16633
16767
  delete(id, params = {}, options) {
@@ -16639,7 +16773,9 @@ class BaseInteractions extends APIResource {
16639
16773
  *
16640
16774
  * @example
16641
16775
  * ```ts
16642
- * const interaction = await client.interactions.cancel('id');
16776
+ * const interaction = await client.interactions.cancel('id', {
16777
+ * api_version: 'api_version',
16778
+ * });
16643
16779
  * ```
16644
16780
  */
16645
16781
  cancel(id, params = {}, options) {
@@ -17957,6 +18093,12 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
17957
18093
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
17958
18094
  throw new Error('adapterSize parameter is not supported in Gemini API.');
17959
18095
  }
18096
+ if (getValueByPath(fromObject, ['tuningMode']) !== undefined) {
18097
+ throw new Error('tuningMode parameter is not supported in Gemini API.');
18098
+ }
18099
+ if (getValueByPath(fromObject, ['customBaseModel']) !== undefined) {
18100
+ throw new Error('customBaseModel parameter is not supported in Gemini API.');
18101
+ }
17960
18102
  const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
17961
18103
  if (parentObject !== undefined && fromBatchSize != null) {
17962
18104
  setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
@@ -17971,6 +18113,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
17971
18113
  if (getValueByPath(fromObject, ['beta']) !== undefined) {
17972
18114
  throw new Error('beta parameter is not supported in Gemini API.');
17973
18115
  }
18116
+ if (getValueByPath(fromObject, ['baseTeacherModel']) !== undefined) {
18117
+ throw new Error('baseTeacherModel parameter is not supported in Gemini API.');
18118
+ }
18119
+ if (getValueByPath(fromObject, ['tunedTeacherModelSource']) !== undefined) {
18120
+ throw new Error('tunedTeacherModelSource parameter is not supported in Gemini API.');
18121
+ }
18122
+ if (getValueByPath(fromObject, ['sftLossWeightMultiplier']) !== undefined) {
18123
+ throw new Error('sftLossWeightMultiplier parameter is not supported in Gemini API.');
18124
+ }
18125
+ if (getValueByPath(fromObject, ['outputUri']) !== undefined) {
18126
+ throw new Error('outputUri parameter is not supported in Gemini API.');
18127
+ }
17974
18128
  return toObject;
17975
18129
  }
17976
18130
  function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
@@ -17998,6 +18152,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
17998
18152
  setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
17999
18153
  }
18000
18154
  }
18155
+ else if (discriminatorValidationDataset === 'DISTILLATION') {
18156
+ const fromValidationDataset = getValueByPath(fromObject, [
18157
+ 'validationDataset',
18158
+ ]);
18159
+ if (parentObject !== undefined && fromValidationDataset != null) {
18160
+ setValueByPath(parentObject, ['distillationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
18161
+ }
18162
+ }
18001
18163
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
18002
18164
  'tunedModelDisplayName',
18003
18165
  ]);
@@ -18027,6 +18189,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18027
18189
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
18028
18190
  }
18029
18191
  }
18192
+ else if (discriminatorEpochCount === 'DISTILLATION') {
18193
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
18194
+ if (parentObject !== undefined && fromEpochCount != null) {
18195
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
18196
+ }
18197
+ }
18030
18198
  let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
18031
18199
  'config',
18032
18200
  'method',
@@ -18054,6 +18222,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18054
18222
  ], fromLearningRateMultiplier);
18055
18223
  }
18056
18224
  }
18225
+ else if (discriminatorLearningRateMultiplier === 'DISTILLATION') {
18226
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
18227
+ 'learningRateMultiplier',
18228
+ ]);
18229
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
18230
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
18231
+ }
18232
+ }
18057
18233
  let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
18058
18234
  if (discriminatorExportLastCheckpointOnly === undefined) {
18059
18235
  discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
@@ -18074,6 +18250,14 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18074
18250
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
18075
18251
  }
18076
18252
  }
18253
+ else if (discriminatorExportLastCheckpointOnly === 'DISTILLATION') {
18254
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
18255
+ 'exportLastCheckpointOnly',
18256
+ ]);
18257
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
18258
+ setValueByPath(parentObject, ['distillationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
18259
+ }
18260
+ }
18077
18261
  let discriminatorAdapterSize = getValueByPath(rootObject, [
18078
18262
  'config',
18079
18263
  'method',
@@ -18093,11 +18277,58 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18093
18277
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
18094
18278
  }
18095
18279
  }
18096
- if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
18097
- throw new Error('batchSize parameter is not supported in Vertex AI.');
18280
+ else if (discriminatorAdapterSize === 'DISTILLATION') {
18281
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
18282
+ if (parentObject !== undefined && fromAdapterSize != null) {
18283
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
18284
+ }
18285
+ }
18286
+ let discriminatorTuningMode = getValueByPath(rootObject, [
18287
+ 'config',
18288
+ 'method',
18289
+ ]);
18290
+ if (discriminatorTuningMode === undefined) {
18291
+ discriminatorTuningMode = 'SUPERVISED_FINE_TUNING';
18292
+ }
18293
+ if (discriminatorTuningMode === 'SUPERVISED_FINE_TUNING') {
18294
+ const fromTuningMode = getValueByPath(fromObject, ['tuningMode']);
18295
+ if (parentObject !== undefined && fromTuningMode != null) {
18296
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'tuningMode'], fromTuningMode);
18297
+ }
18298
+ }
18299
+ const fromCustomBaseModel = getValueByPath(fromObject, [
18300
+ 'customBaseModel',
18301
+ ]);
18302
+ if (parentObject !== undefined && fromCustomBaseModel != null) {
18303
+ setValueByPath(parentObject, ['customBaseModel'], fromCustomBaseModel);
18098
18304
  }
18099
- if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
18100
- throw new Error('learningRate parameter is not supported in Vertex AI.');
18305
+ let discriminatorBatchSize = getValueByPath(rootObject, [
18306
+ 'config',
18307
+ 'method',
18308
+ ]);
18309
+ if (discriminatorBatchSize === undefined) {
18310
+ discriminatorBatchSize = 'SUPERVISED_FINE_TUNING';
18311
+ }
18312
+ if (discriminatorBatchSize === 'SUPERVISED_FINE_TUNING') {
18313
+ const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
18314
+ if (parentObject !== undefined && fromBatchSize != null) {
18315
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'batchSize'], fromBatchSize);
18316
+ }
18317
+ }
18318
+ let discriminatorLearningRate = getValueByPath(rootObject, [
18319
+ 'config',
18320
+ 'method',
18321
+ ]);
18322
+ if (discriminatorLearningRate === undefined) {
18323
+ discriminatorLearningRate = 'SUPERVISED_FINE_TUNING';
18324
+ }
18325
+ if (discriminatorLearningRate === 'SUPERVISED_FINE_TUNING') {
18326
+ const fromLearningRate = getValueByPath(fromObject, [
18327
+ 'learningRate',
18328
+ ]);
18329
+ if (parentObject !== undefined && fromLearningRate != null) {
18330
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRate'], fromLearningRate);
18331
+ }
18101
18332
  }
18102
18333
  const fromLabels = getValueByPath(fromObject, ['labels']);
18103
18334
  if (parentObject !== undefined && fromLabels != null) {
@@ -18107,6 +18338,28 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
18107
18338
  if (parentObject !== undefined && fromBeta != null) {
18108
18339
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
18109
18340
  }
18341
+ const fromBaseTeacherModel = getValueByPath(fromObject, [
18342
+ 'baseTeacherModel',
18343
+ ]);
18344
+ if (parentObject !== undefined && fromBaseTeacherModel != null) {
18345
+ setValueByPath(parentObject, ['distillationSpec', 'baseTeacherModel'], fromBaseTeacherModel);
18346
+ }
18347
+ const fromTunedTeacherModelSource = getValueByPath(fromObject, [
18348
+ 'tunedTeacherModelSource',
18349
+ ]);
18350
+ if (parentObject !== undefined && fromTunedTeacherModelSource != null) {
18351
+ setValueByPath(parentObject, ['distillationSpec', 'tunedTeacherModelSource'], fromTunedTeacherModelSource);
18352
+ }
18353
+ const fromSftLossWeightMultiplier = getValueByPath(fromObject, [
18354
+ 'sftLossWeightMultiplier',
18355
+ ]);
18356
+ if (parentObject !== undefined && fromSftLossWeightMultiplier != null) {
18357
+ setValueByPath(parentObject, ['distillationSpec', 'hyperParameters', 'sftLossWeightMultiplier'], fromSftLossWeightMultiplier);
18358
+ }
18359
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18360
+ if (parentObject !== undefined && fromOutputUri != null) {
18361
+ setValueByPath(parentObject, ['outputUri'], fromOutputUri);
18362
+ }
18110
18363
  return toObject;
18111
18364
  }
18112
18365
  function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
@@ -18326,6 +18579,12 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
18326
18579
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
18327
18580
  }
18328
18581
  }
18582
+ else if (discriminatorGcsUri === 'DISTILLATION') {
18583
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
18584
+ if (parentObject !== undefined && fromGcsUri != null) {
18585
+ setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromGcsUri);
18586
+ }
18587
+ }
18329
18588
  let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
18330
18589
  'config',
18331
18590
  'method',
@@ -18349,6 +18608,14 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
18349
18608
  setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
18350
18609
  }
18351
18610
  }
18611
+ else if (discriminatorVertexDatasetResource === 'DISTILLATION') {
18612
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
18613
+ 'vertexDatasetResource',
18614
+ ]);
18615
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
18616
+ setValueByPath(parentObject, ['distillationSpec', 'promptDatasetUri'], fromVertexDatasetResource);
18617
+ }
18618
+ }
18352
18619
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
18353
18620
  throw new Error('examples parameter is not supported in Vertex AI.');
18354
18621
  }
@@ -18472,6 +18739,12 @@ function tuningJobFromVertex(fromObject, _rootObject) {
18472
18739
  if (fromPreferenceOptimizationSpec != null) {
18473
18740
  setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
18474
18741
  }
18742
+ const fromDistillationSpec = getValueByPath(fromObject, [
18743
+ 'distillationSpec',
18744
+ ]);
18745
+ if (fromDistillationSpec != null) {
18746
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18747
+ }
18475
18748
  const fromTuningDataStats = getValueByPath(fromObject, [
18476
18749
  'tuningDataStats',
18477
18750
  ]);
@@ -19243,5 +19516,5 @@ class GoogleGenAI {
19243
19516
  }
19244
19517
  }
19245
19518
 
19246
- 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 };
19519
+ 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 };
19247
19520
  //# sourceMappingURL=index.mjs.map