@google/genai 1.12.0 → 1.14.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.
@@ -423,18 +423,6 @@ var ApiSpec;
423
423
  */
424
424
  ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
425
425
  })(ApiSpec || (ApiSpec = {}));
426
- /** Required. The environment being operated. */
427
- var Environment;
428
- (function (Environment) {
429
- /**
430
- * Defaults to browser.
431
- */
432
- Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
433
- /**
434
- * Operates in a web browser.
435
- */
436
- Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
437
- })(Environment || (Environment = {}));
438
426
  /** Status of the url retrieval. */
439
427
  var UrlRetrievalStatus;
440
428
  (function (UrlRetrievalStatus) {
@@ -450,6 +438,14 @@ var UrlRetrievalStatus;
450
438
  * Url retrieval is failed due to error.
451
439
  */
452
440
  UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
441
+ /**
442
+ * Url retrieval is failed because the content is behind paywall.
443
+ */
444
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
445
+ /**
446
+ * Url retrieval is failed because the content is unsafe.
447
+ */
448
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
453
449
  })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
454
450
  /** Output only. The reason why the model stopped generating tokens.
455
451
 
@@ -694,6 +690,22 @@ var JobState;
694
690
  */
695
691
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
696
692
  })(JobState || (JobState = {}));
693
+ /** Tuning mode. */
694
+ var TuningMode;
695
+ (function (TuningMode) {
696
+ /**
697
+ * Tuning mode is unspecified.
698
+ */
699
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
700
+ /**
701
+ * Full fine-tuning mode.
702
+ */
703
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
704
+ /**
705
+ * PEFT adapter tuning mode.
706
+ */
707
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
708
+ })(TuningMode || (TuningMode = {}));
697
709
  /** Optional. Adapter size for tuning. */
698
710
  var AdapterSize;
699
711
  (function (AdapterSize) {
@@ -762,6 +774,18 @@ var DynamicRetrievalConfigMode;
762
774
  */
763
775
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
764
776
  })(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
777
+ /** The environment being operated. */
778
+ var Environment;
779
+ (function (Environment) {
780
+ /**
781
+ * Defaults to browser.
782
+ */
783
+ Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
784
+ /**
785
+ * Operates in a web browser.
786
+ */
787
+ Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
788
+ })(Environment || (Environment = {}));
765
789
  /** Config for the function calling config mode. */
766
790
  var FunctionCallingConfigMode;
767
791
  (function (FunctionCallingConfigMode) {
@@ -1076,6 +1100,29 @@ var Scale;
1076
1100
  */
1077
1101
  Scale["B_MAJOR_A_FLAT_MINOR"] = "B_MAJOR_A_FLAT_MINOR";
1078
1102
  })(Scale || (Scale = {}));
1103
+ /** The mode of music generation. */
1104
+ var MusicGenerationMode;
1105
+ (function (MusicGenerationMode) {
1106
+ /**
1107
+ * Rely on the server default generation mode.
1108
+ */
1109
+ MusicGenerationMode["MUSIC_GENERATION_MODE_UNSPECIFIED"] = "MUSIC_GENERATION_MODE_UNSPECIFIED";
1110
+ /**
1111
+ * Steer text prompts to regions of latent space with higher quality
1112
+ music.
1113
+ */
1114
+ MusicGenerationMode["QUALITY"] = "QUALITY";
1115
+ /**
1116
+ * Steer text prompts to regions of latent space with a larger
1117
+ diversity of music.
1118
+ */
1119
+ MusicGenerationMode["DIVERSITY"] = "DIVERSITY";
1120
+ /**
1121
+ * Steer text prompts to regions of latent space more likely to
1122
+ generate music with vocals.
1123
+ */
1124
+ MusicGenerationMode["VOCALIZATION"] = "VOCALIZATION";
1125
+ })(MusicGenerationMode || (MusicGenerationMode = {}));
1079
1126
  /** The playback control signal to apply to the music generation. */
1080
1127
  var LiveMusicPlaybackControl;
1081
1128
  (function (LiveMusicPlaybackControl) {
@@ -1499,6 +1546,9 @@ class EditImageResponse {
1499
1546
  }
1500
1547
  class UpscaleImageResponse {
1501
1548
  }
1549
+ /** The output images response. */
1550
+ class RecontextImageResponse {
1551
+ }
1502
1552
  class ListModelsResponse {
1503
1553
  }
1504
1554
  class DeleteModelResponse {
@@ -2842,6 +2892,9 @@ function googleSearchToMldev$4(fromObject) {
2842
2892
  if (fromTimeRangeFilter != null) {
2843
2893
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
2844
2894
  }
2895
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
2896
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
2897
+ }
2845
2898
  return toObject;
2846
2899
  }
2847
2900
  function dynamicRetrievalConfigToMldev$4(fromObject) {
@@ -2872,6 +2925,14 @@ function urlContextToMldev$4() {
2872
2925
  const toObject = {};
2873
2926
  return toObject;
2874
2927
  }
2928
+ function toolComputerUseToMldev$4(fromObject) {
2929
+ const toObject = {};
2930
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
2931
+ if (fromEnvironment != null) {
2932
+ setValueByPath(toObject, ['environment'], fromEnvironment);
2933
+ }
2934
+ return toObject;
2935
+ }
2875
2936
  function toolToMldev$4(fromObject) {
2876
2937
  const toObject = {};
2877
2938
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -2909,16 +2970,16 @@ function toolToMldev$4(fromObject) {
2909
2970
  if (fromUrlContext != null) {
2910
2971
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
2911
2972
  }
2973
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2974
+ if (fromComputerUse != null) {
2975
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$4(fromComputerUse));
2976
+ }
2912
2977
  const fromCodeExecution = getValueByPath(fromObject, [
2913
2978
  'codeExecution',
2914
2979
  ]);
2915
2980
  if (fromCodeExecution != null) {
2916
2981
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2917
2982
  }
2918
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2919
- if (fromComputerUse != null) {
2920
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
2921
- }
2922
2983
  return toObject;
2923
2984
  }
2924
2985
  function functionCallingConfigToMldev$2(fromObject) {
@@ -3704,6 +3765,10 @@ function generateContentResponseFromMldev$1(fromObject) {
3704
3765
  if (fromPromptFeedback != null) {
3705
3766
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
3706
3767
  }
3768
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
3769
+ if (fromResponseId != null) {
3770
+ setValueByPath(toObject, ['responseId'], fromResponseId);
3771
+ }
3707
3772
  const fromUsageMetadata = getValueByPath(fromObject, [
3708
3773
  'usageMetadata',
3709
3774
  ]);
@@ -3837,6 +3902,12 @@ function listBatchJobsResponseFromMldev(fromObject) {
3837
3902
  }
3838
3903
  function deleteResourceJobFromMldev(fromObject) {
3839
3904
  const toObject = {};
3905
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
3906
+ 'sdkHttpResponse',
3907
+ ]);
3908
+ if (fromSdkHttpResponse != null) {
3909
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
3910
+ }
3840
3911
  const fromName = getValueByPath(fromObject, ['name']);
3841
3912
  if (fromName != null) {
3842
3913
  setValueByPath(toObject, ['name'], fromName);
@@ -3986,6 +4057,12 @@ function listBatchJobsResponseFromVertex(fromObject) {
3986
4057
  }
3987
4058
  function deleteResourceJobFromVertex(fromObject) {
3988
4059
  const toObject = {};
4060
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
4061
+ 'sdkHttpResponse',
4062
+ ]);
4063
+ if (fromSdkHttpResponse != null) {
4064
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
4065
+ }
3989
4066
  const fromName = getValueByPath(fromObject, ['name']);
3990
4067
  if (fromName != null) {
3991
4068
  setValueByPath(toObject, ['name'], fromName);
@@ -4531,7 +4608,13 @@ class Batches extends BaseModule {
4531
4608
  abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4532
4609
  })
4533
4610
  .then((httpResponse) => {
4534
- return httpResponse.json();
4611
+ return httpResponse.json().then((jsonResponse) => {
4612
+ const response = jsonResponse;
4613
+ response.sdkHttpResponse = {
4614
+ headers: httpResponse.headers,
4615
+ };
4616
+ return response;
4617
+ });
4535
4618
  });
4536
4619
  return response.then((apiResponse) => {
4537
4620
  const resp = deleteResourceJobFromVertex(apiResponse);
@@ -4555,7 +4638,13 @@ class Batches extends BaseModule {
4555
4638
  abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4556
4639
  })
4557
4640
  .then((httpResponse) => {
4558
- return httpResponse.json();
4641
+ return httpResponse.json().then((jsonResponse) => {
4642
+ const response = jsonResponse;
4643
+ response.sdkHttpResponse = {
4644
+ headers: httpResponse.headers,
4645
+ };
4646
+ return response;
4647
+ });
4559
4648
  });
4560
4649
  return response.then((apiResponse) => {
4561
4650
  const resp = deleteResourceJobFromMldev(apiResponse);
@@ -4744,6 +4833,9 @@ function googleSearchToMldev$3(fromObject) {
4744
4833
  if (fromTimeRangeFilter != null) {
4745
4834
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(fromTimeRangeFilter));
4746
4835
  }
4836
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4837
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
4838
+ }
4747
4839
  return toObject;
4748
4840
  }
4749
4841
  function dynamicRetrievalConfigToMldev$3(fromObject) {
@@ -4774,6 +4866,14 @@ function urlContextToMldev$3() {
4774
4866
  const toObject = {};
4775
4867
  return toObject;
4776
4868
  }
4869
+ function toolComputerUseToMldev$3(fromObject) {
4870
+ const toObject = {};
4871
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
4872
+ if (fromEnvironment != null) {
4873
+ setValueByPath(toObject, ['environment'], fromEnvironment);
4874
+ }
4875
+ return toObject;
4876
+ }
4777
4877
  function toolToMldev$3(fromObject) {
4778
4878
  const toObject = {};
4779
4879
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -4811,16 +4911,16 @@ function toolToMldev$3(fromObject) {
4811
4911
  if (fromUrlContext != null) {
4812
4912
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
4813
4913
  }
4914
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4915
+ if (fromComputerUse != null) {
4916
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$3(fromComputerUse));
4917
+ }
4814
4918
  const fromCodeExecution = getValueByPath(fromObject, [
4815
4919
  'codeExecution',
4816
4920
  ]);
4817
4921
  if (fromCodeExecution != null) {
4818
4922
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4819
4923
  }
4820
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4821
- if (fromComputerUse != null) {
4822
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
4823
- }
4824
4924
  return toObject;
4825
4925
  }
4826
4926
  function functionCallingConfigToMldev$1(fromObject) {
@@ -5181,6 +5281,12 @@ function googleSearchToVertex$2(fromObject) {
5181
5281
  if (fromTimeRangeFilter != null) {
5182
5282
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$2(fromTimeRangeFilter));
5183
5283
  }
5284
+ const fromExcludeDomains = getValueByPath(fromObject, [
5285
+ 'excludeDomains',
5286
+ ]);
5287
+ if (fromExcludeDomains != null) {
5288
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5289
+ }
5184
5290
  return toObject;
5185
5291
  }
5186
5292
  function dynamicRetrievalConfigToVertex$2(fromObject) {
@@ -5207,8 +5313,14 @@ function googleSearchRetrievalToVertex$2(fromObject) {
5207
5313
  }
5208
5314
  return toObject;
5209
5315
  }
5210
- function enterpriseWebSearchToVertex$2() {
5316
+ function enterpriseWebSearchToVertex$2(fromObject) {
5211
5317
  const toObject = {};
5318
+ const fromExcludeDomains = getValueByPath(fromObject, [
5319
+ 'excludeDomains',
5320
+ ]);
5321
+ if (fromExcludeDomains != null) {
5322
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5323
+ }
5212
5324
  return toObject;
5213
5325
  }
5214
5326
  function apiKeyConfigToVertex$2(fromObject) {
@@ -5263,6 +5375,14 @@ function urlContextToVertex$2() {
5263
5375
  const toObject = {};
5264
5376
  return toObject;
5265
5377
  }
5378
+ function toolComputerUseToVertex$2(fromObject) {
5379
+ const toObject = {};
5380
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
5381
+ if (fromEnvironment != null) {
5382
+ setValueByPath(toObject, ['environment'], fromEnvironment);
5383
+ }
5384
+ return toObject;
5385
+ }
5266
5386
  function toolToVertex$2(fromObject) {
5267
5387
  const toObject = {};
5268
5388
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5295,7 +5415,7 @@ function toolToVertex$2(fromObject) {
5295
5415
  'enterpriseWebSearch',
5296
5416
  ]);
5297
5417
  if (fromEnterpriseWebSearch != null) {
5298
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
5418
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2(fromEnterpriseWebSearch));
5299
5419
  }
5300
5420
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5301
5421
  if (fromGoogleMaps != null) {
@@ -5305,16 +5425,16 @@ function toolToVertex$2(fromObject) {
5305
5425
  if (fromUrlContext != null) {
5306
5426
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
5307
5427
  }
5428
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5429
+ if (fromComputerUse != null) {
5430
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$2(fromComputerUse));
5431
+ }
5308
5432
  const fromCodeExecution = getValueByPath(fromObject, [
5309
5433
  'codeExecution',
5310
5434
  ]);
5311
5435
  if (fromCodeExecution != null) {
5312
5436
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5313
5437
  }
5314
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5315
- if (fromComputerUse != null) {
5316
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5317
- }
5318
5438
  return toObject;
5319
5439
  }
5320
5440
  function functionCallingConfigToVertex$1(fromObject) {
@@ -7200,6 +7320,9 @@ function googleSearchToMldev$2(fromObject) {
7200
7320
  if (fromTimeRangeFilter != null) {
7201
7321
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(fromTimeRangeFilter));
7202
7322
  }
7323
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7324
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
7325
+ }
7203
7326
  return toObject;
7204
7327
  }
7205
7328
  function dynamicRetrievalConfigToMldev$2(fromObject) {
@@ -7230,6 +7353,14 @@ function urlContextToMldev$2() {
7230
7353
  const toObject = {};
7231
7354
  return toObject;
7232
7355
  }
7356
+ function toolComputerUseToMldev$2(fromObject) {
7357
+ const toObject = {};
7358
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
7359
+ if (fromEnvironment != null) {
7360
+ setValueByPath(toObject, ['environment'], fromEnvironment);
7361
+ }
7362
+ return toObject;
7363
+ }
7233
7364
  function toolToMldev$2(fromObject) {
7234
7365
  const toObject = {};
7235
7366
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -7267,16 +7398,16 @@ function toolToMldev$2(fromObject) {
7267
7398
  if (fromUrlContext != null) {
7268
7399
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
7269
7400
  }
7401
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7402
+ if (fromComputerUse != null) {
7403
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$2(fromComputerUse));
7404
+ }
7270
7405
  const fromCodeExecution = getValueByPath(fromObject, [
7271
7406
  'codeExecution',
7272
7407
  ]);
7273
7408
  if (fromCodeExecution != null) {
7274
7409
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7275
7410
  }
7276
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7277
- if (fromComputerUse != null) {
7278
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7279
- }
7280
7411
  return toObject;
7281
7412
  }
7282
7413
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -7616,6 +7747,12 @@ function liveMusicGenerationConfigToMldev(fromObject) {
7616
7747
  if (fromOnlyBassAndDrums != null) {
7617
7748
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
7618
7749
  }
7750
+ const fromMusicGenerationMode = getValueByPath(fromObject, [
7751
+ 'musicGenerationMode',
7752
+ ]);
7753
+ if (fromMusicGenerationMode != null) {
7754
+ setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
7755
+ }
7619
7756
  return toObject;
7620
7757
  }
7621
7758
  function liveMusicSetConfigParametersToMldev(fromObject) {
@@ -7886,6 +8023,12 @@ function googleSearchToVertex$1(fromObject) {
7886
8023
  if (fromTimeRangeFilter != null) {
7887
8024
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$1(fromTimeRangeFilter));
7888
8025
  }
8026
+ const fromExcludeDomains = getValueByPath(fromObject, [
8027
+ 'excludeDomains',
8028
+ ]);
8029
+ if (fromExcludeDomains != null) {
8030
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8031
+ }
7889
8032
  return toObject;
7890
8033
  }
7891
8034
  function dynamicRetrievalConfigToVertex$1(fromObject) {
@@ -7912,8 +8055,14 @@ function googleSearchRetrievalToVertex$1(fromObject) {
7912
8055
  }
7913
8056
  return toObject;
7914
8057
  }
7915
- function enterpriseWebSearchToVertex$1() {
8058
+ function enterpriseWebSearchToVertex$1(fromObject) {
7916
8059
  const toObject = {};
8060
+ const fromExcludeDomains = getValueByPath(fromObject, [
8061
+ 'excludeDomains',
8062
+ ]);
8063
+ if (fromExcludeDomains != null) {
8064
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8065
+ }
7917
8066
  return toObject;
7918
8067
  }
7919
8068
  function apiKeyConfigToVertex$1(fromObject) {
@@ -7968,6 +8117,14 @@ function urlContextToVertex$1() {
7968
8117
  const toObject = {};
7969
8118
  return toObject;
7970
8119
  }
8120
+ function toolComputerUseToVertex$1(fromObject) {
8121
+ const toObject = {};
8122
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8123
+ if (fromEnvironment != null) {
8124
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8125
+ }
8126
+ return toObject;
8127
+ }
7971
8128
  function toolToVertex$1(fromObject) {
7972
8129
  const toObject = {};
7973
8130
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -8000,7 +8157,7 @@ function toolToVertex$1(fromObject) {
8000
8157
  'enterpriseWebSearch',
8001
8158
  ]);
8002
8159
  if (fromEnterpriseWebSearch != null) {
8003
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
8160
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1(fromEnterpriseWebSearch));
8004
8161
  }
8005
8162
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
8006
8163
  if (fromGoogleMaps != null) {
@@ -8010,16 +8167,16 @@ function toolToVertex$1(fromObject) {
8010
8167
  if (fromUrlContext != null) {
8011
8168
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
8012
8169
  }
8170
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8171
+ if (fromComputerUse != null) {
8172
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$1(fromComputerUse));
8173
+ }
8013
8174
  const fromCodeExecution = getValueByPath(fromObject, [
8014
8175
  'codeExecution',
8015
8176
  ]);
8016
8177
  if (fromCodeExecution != null) {
8017
8178
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8018
8179
  }
8019
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8020
- if (fromComputerUse != null) {
8021
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
8022
- }
8023
8180
  return toObject;
8024
8181
  }
8025
8182
  function sessionResumptionConfigToVertex(fromObject) {
@@ -8774,6 +8931,12 @@ function liveMusicGenerationConfigFromMldev(fromObject) {
8774
8931
  if (fromOnlyBassAndDrums != null) {
8775
8932
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
8776
8933
  }
8934
+ const fromMusicGenerationMode = getValueByPath(fromObject, [
8935
+ 'musicGenerationMode',
8936
+ ]);
8937
+ if (fromMusicGenerationMode != null) {
8938
+ setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
8939
+ }
8777
8940
  return toObject;
8778
8941
  }
8779
8942
  function liveMusicSourceMetadataFromMldev(fromObject) {
@@ -9541,6 +9704,9 @@ function googleSearchToMldev$1(fromObject) {
9541
9704
  if (fromTimeRangeFilter != null) {
9542
9705
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(fromTimeRangeFilter));
9543
9706
  }
9707
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9708
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
9709
+ }
9544
9710
  return toObject;
9545
9711
  }
9546
9712
  function dynamicRetrievalConfigToMldev$1(fromObject) {
@@ -9571,6 +9737,14 @@ function urlContextToMldev$1() {
9571
9737
  const toObject = {};
9572
9738
  return toObject;
9573
9739
  }
9740
+ function toolComputerUseToMldev$1(fromObject) {
9741
+ const toObject = {};
9742
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
9743
+ if (fromEnvironment != null) {
9744
+ setValueByPath(toObject, ['environment'], fromEnvironment);
9745
+ }
9746
+ return toObject;
9747
+ }
9574
9748
  function toolToMldev$1(fromObject) {
9575
9749
  const toObject = {};
9576
9750
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -9608,16 +9782,16 @@ function toolToMldev$1(fromObject) {
9608
9782
  if (fromUrlContext != null) {
9609
9783
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
9610
9784
  }
9785
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
9786
+ if (fromComputerUse != null) {
9787
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$1(fromComputerUse));
9788
+ }
9611
9789
  const fromCodeExecution = getValueByPath(fromObject, [
9612
9790
  'codeExecution',
9613
9791
  ]);
9614
9792
  if (fromCodeExecution != null) {
9615
9793
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
9616
9794
  }
9617
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
9618
- if (fromComputerUse != null) {
9619
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
9620
- }
9621
9795
  return toObject;
9622
9796
  }
9623
9797
  function functionCallingConfigToMldev(fromObject) {
@@ -10040,8 +10214,9 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
10040
10214
  if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
10041
10215
  throw new Error('addWatermark parameter is not supported in Gemini API.');
10042
10216
  }
10043
- if (getValueByPath(fromObject, ['imageSize']) !== undefined) {
10044
- throw new Error('imageSize parameter is not supported in Gemini API.');
10217
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10218
+ if (parentObject !== undefined && fromImageSize != null) {
10219
+ setValueByPath(parentObject, ['parameters', 'sampleImageSize'], fromImageSize);
10045
10220
  }
10046
10221
  if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
10047
10222
  throw new Error('enhancePrompt parameter is not supported in Gemini API.');
@@ -10580,6 +10755,12 @@ function googleSearchToVertex(fromObject) {
10580
10755
  if (fromTimeRangeFilter != null) {
10581
10756
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex(fromTimeRangeFilter));
10582
10757
  }
10758
+ const fromExcludeDomains = getValueByPath(fromObject, [
10759
+ 'excludeDomains',
10760
+ ]);
10761
+ if (fromExcludeDomains != null) {
10762
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
10763
+ }
10583
10764
  return toObject;
10584
10765
  }
10585
10766
  function dynamicRetrievalConfigToVertex(fromObject) {
@@ -10606,8 +10787,14 @@ function googleSearchRetrievalToVertex(fromObject) {
10606
10787
  }
10607
10788
  return toObject;
10608
10789
  }
10609
- function enterpriseWebSearchToVertex() {
10790
+ function enterpriseWebSearchToVertex(fromObject) {
10610
10791
  const toObject = {};
10792
+ const fromExcludeDomains = getValueByPath(fromObject, [
10793
+ 'excludeDomains',
10794
+ ]);
10795
+ if (fromExcludeDomains != null) {
10796
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
10797
+ }
10611
10798
  return toObject;
10612
10799
  }
10613
10800
  function apiKeyConfigToVertex(fromObject) {
@@ -10662,6 +10849,14 @@ function urlContextToVertex() {
10662
10849
  const toObject = {};
10663
10850
  return toObject;
10664
10851
  }
10852
+ function toolComputerUseToVertex(fromObject) {
10853
+ const toObject = {};
10854
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
10855
+ if (fromEnvironment != null) {
10856
+ setValueByPath(toObject, ['environment'], fromEnvironment);
10857
+ }
10858
+ return toObject;
10859
+ }
10665
10860
  function toolToVertex(fromObject) {
10666
10861
  const toObject = {};
10667
10862
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10694,7 +10889,7 @@ function toolToVertex(fromObject) {
10694
10889
  'enterpriseWebSearch',
10695
10890
  ]);
10696
10891
  if (fromEnterpriseWebSearch != null) {
10697
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
10892
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex(fromEnterpriseWebSearch));
10698
10893
  }
10699
10894
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10700
10895
  if (fromGoogleMaps != null) {
@@ -10704,16 +10899,16 @@ function toolToVertex(fromObject) {
10704
10899
  if (fromUrlContext != null) {
10705
10900
  setValueByPath(toObject, ['urlContext'], urlContextToVertex());
10706
10901
  }
10902
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10903
+ if (fromComputerUse != null) {
10904
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex(fromComputerUse));
10905
+ }
10707
10906
  const fromCodeExecution = getValueByPath(fromObject, [
10708
10907
  'codeExecution',
10709
10908
  ]);
10710
10909
  if (fromCodeExecution != null) {
10711
10910
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10712
10911
  }
10713
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10714
- if (fromComputerUse != null) {
10715
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10716
- }
10717
10912
  return toObject;
10718
10913
  }
10719
10914
  function functionCallingConfigToVertex(fromObject) {
@@ -11443,6 +11638,106 @@ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
11443
11638
  }
11444
11639
  return toObject;
11445
11640
  }
11641
+ function productImageToVertex(fromObject) {
11642
+ const toObject = {};
11643
+ const fromProductImage = getValueByPath(fromObject, ['productImage']);
11644
+ if (fromProductImage != null) {
11645
+ setValueByPath(toObject, ['image'], imageToVertex(fromProductImage));
11646
+ }
11647
+ return toObject;
11648
+ }
11649
+ function recontextImageSourceToVertex(fromObject, parentObject) {
11650
+ const toObject = {};
11651
+ const fromPrompt = getValueByPath(fromObject, ['prompt']);
11652
+ if (parentObject !== undefined && fromPrompt != null) {
11653
+ setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
11654
+ }
11655
+ const fromPersonImage = getValueByPath(fromObject, ['personImage']);
11656
+ if (parentObject !== undefined && fromPersonImage != null) {
11657
+ setValueByPath(parentObject, ['instances[0]', 'personImage', 'image'], imageToVertex(fromPersonImage));
11658
+ }
11659
+ const fromProductImages = getValueByPath(fromObject, [
11660
+ 'productImages',
11661
+ ]);
11662
+ if (parentObject !== undefined && fromProductImages != null) {
11663
+ let transformedList = fromProductImages;
11664
+ if (Array.isArray(transformedList)) {
11665
+ transformedList = transformedList.map((item) => {
11666
+ return productImageToVertex(item);
11667
+ });
11668
+ }
11669
+ setValueByPath(parentObject, ['instances[0]', 'productImages'], transformedList);
11670
+ }
11671
+ return toObject;
11672
+ }
11673
+ function recontextImageConfigToVertex(fromObject, parentObject) {
11674
+ const toObject = {};
11675
+ const fromNumberOfImages = getValueByPath(fromObject, [
11676
+ 'numberOfImages',
11677
+ ]);
11678
+ if (parentObject !== undefined && fromNumberOfImages != null) {
11679
+ setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
11680
+ }
11681
+ const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
11682
+ if (parentObject !== undefined && fromBaseSteps != null) {
11683
+ setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
11684
+ }
11685
+ const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
11686
+ if (parentObject !== undefined && fromOutputGcsUri != null) {
11687
+ setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
11688
+ }
11689
+ const fromSeed = getValueByPath(fromObject, ['seed']);
11690
+ if (parentObject !== undefined && fromSeed != null) {
11691
+ setValueByPath(parentObject, ['parameters', 'seed'], fromSeed);
11692
+ }
11693
+ const fromSafetyFilterLevel = getValueByPath(fromObject, [
11694
+ 'safetyFilterLevel',
11695
+ ]);
11696
+ if (parentObject !== undefined && fromSafetyFilterLevel != null) {
11697
+ setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
11698
+ }
11699
+ const fromPersonGeneration = getValueByPath(fromObject, [
11700
+ 'personGeneration',
11701
+ ]);
11702
+ if (parentObject !== undefined && fromPersonGeneration != null) {
11703
+ setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
11704
+ }
11705
+ const fromOutputMimeType = getValueByPath(fromObject, [
11706
+ 'outputMimeType',
11707
+ ]);
11708
+ if (parentObject !== undefined && fromOutputMimeType != null) {
11709
+ setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
11710
+ }
11711
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
11712
+ 'outputCompressionQuality',
11713
+ ]);
11714
+ if (parentObject !== undefined && fromOutputCompressionQuality != null) {
11715
+ setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
11716
+ }
11717
+ const fromEnhancePrompt = getValueByPath(fromObject, [
11718
+ 'enhancePrompt',
11719
+ ]);
11720
+ if (parentObject !== undefined && fromEnhancePrompt != null) {
11721
+ setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
11722
+ }
11723
+ return toObject;
11724
+ }
11725
+ function recontextImageParametersToVertex(apiClient, fromObject) {
11726
+ const toObject = {};
11727
+ const fromModel = getValueByPath(fromObject, ['model']);
11728
+ if (fromModel != null) {
11729
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
11730
+ }
11731
+ const fromSource = getValueByPath(fromObject, ['source']);
11732
+ if (fromSource != null) {
11733
+ setValueByPath(toObject, ['config'], recontextImageSourceToVertex(fromSource, toObject));
11734
+ }
11735
+ const fromConfig = getValueByPath(fromObject, ['config']);
11736
+ if (fromConfig != null) {
11737
+ setValueByPath(toObject, ['config'], recontextImageConfigToVertex(fromConfig, toObject));
11738
+ }
11739
+ return toObject;
11740
+ }
11446
11741
  function getModelParametersToVertex(apiClient, fromObject) {
11447
11742
  const toObject = {};
11448
11743
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -11939,6 +12234,10 @@ function generateContentResponseFromMldev(fromObject) {
11939
12234
  if (fromPromptFeedback != null) {
11940
12235
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
11941
12236
  }
12237
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
12238
+ if (fromResponseId != null) {
12239
+ setValueByPath(toObject, ['responseId'], fromResponseId);
12240
+ }
11942
12241
  const fromUsageMetadata = getValueByPath(fromObject, [
11943
12242
  'usageMetadata',
11944
12243
  ]);
@@ -12489,10 +12788,6 @@ function generateContentResponseFromVertex(fromObject) {
12489
12788
  if (fromCreateTime != null) {
12490
12789
  setValueByPath(toObject, ['createTime'], fromCreateTime);
12491
12790
  }
12492
- const fromResponseId = getValueByPath(fromObject, ['responseId']);
12493
- if (fromResponseId != null) {
12494
- setValueByPath(toObject, ['responseId'], fromResponseId);
12495
- }
12496
12791
  const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
12497
12792
  if (fromModelVersion != null) {
12498
12793
  setValueByPath(toObject, ['modelVersion'], fromModelVersion);
@@ -12503,6 +12798,10 @@ function generateContentResponseFromVertex(fromObject) {
12503
12798
  if (fromPromptFeedback != null) {
12504
12799
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
12505
12800
  }
12801
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
12802
+ if (fromResponseId != null) {
12803
+ setValueByPath(toObject, ['responseId'], fromResponseId);
12804
+ }
12506
12805
  const fromUsageMetadata = getValueByPath(fromObject, [
12507
12806
  'usageMetadata',
12508
12807
  ]);
@@ -12706,6 +13005,22 @@ function upscaleImageResponseFromVertex(fromObject) {
12706
13005
  }
12707
13006
  return toObject;
12708
13007
  }
13008
+ function recontextImageResponseFromVertex(fromObject) {
13009
+ const toObject = {};
13010
+ const fromGeneratedImages = getValueByPath(fromObject, [
13011
+ 'predictions',
13012
+ ]);
13013
+ if (fromGeneratedImages != null) {
13014
+ let transformedList = fromGeneratedImages;
13015
+ if (Array.isArray(transformedList)) {
13016
+ transformedList = transformedList.map((item) => {
13017
+ return generatedImageFromVertex(item);
13018
+ });
13019
+ }
13020
+ setValueByPath(toObject, ['generatedImages'], transformedList);
13021
+ }
13022
+ return toObject;
13023
+ }
12709
13024
  function endpointFromVertex(fromObject) {
12710
13025
  const toObject = {};
12711
13026
  const fromName = getValueByPath(fromObject, ['endpoint']);
@@ -12953,7 +13268,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
12953
13268
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
12954
13269
  const USER_AGENT_HEADER = 'User-Agent';
12955
13270
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
12956
- const SDK_VERSION = '1.12.0'; // x-release-please-version
13271
+ const SDK_VERSION = '1.14.0'; // x-release-please-version
12957
13272
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
12958
13273
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
12959
13274
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15323,6 +15638,79 @@ class Models extends BaseModule {
15323
15638
  throw new Error('This method is only supported by the Vertex AI.');
15324
15639
  }
15325
15640
  }
15641
+ /**
15642
+ * Recontextualizes an image.
15643
+ *
15644
+ * There are two types of recontextualization currently supported:
15645
+ * 1) Imagen Product Recontext - Generate images of products in new scenes
15646
+ * and contexts.
15647
+ * 2) Virtual Try-On: Generate images of persons modeling fashion products.
15648
+ *
15649
+ * @param params - The parameters for recontextualizing an image.
15650
+ * @return The response from the API.
15651
+ *
15652
+ * @example
15653
+ * ```ts
15654
+ * const response1 = await ai.models.recontextImage({
15655
+ * model: 'imagen-product-recontext-preview-06-30',
15656
+ * source: {
15657
+ * prompt: 'In a modern kitchen setting.',
15658
+ * productImages: [productImage],
15659
+ * },
15660
+ * config: {
15661
+ * numberOfImages: 1,
15662
+ * },
15663
+ * });
15664
+ * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
15665
+ *
15666
+ * const response2 = await ai.models.recontextImage({
15667
+ * model: 'virtual-try-on-preview-08-04',
15668
+ * source: {
15669
+ * personImage: personImage,
15670
+ * productImages: [productImage],
15671
+ * },
15672
+ * config: {
15673
+ * numberOfImages: 1,
15674
+ * },
15675
+ * });
15676
+ * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
15677
+ * ```
15678
+ */
15679
+ async recontextImage(params) {
15680
+ var _a, _b;
15681
+ let response;
15682
+ let path = '';
15683
+ let queryParams = {};
15684
+ if (this.apiClient.isVertexAI()) {
15685
+ const body = recontextImageParametersToVertex(this.apiClient, params);
15686
+ path = formatMap('{model}:predict', body['_url']);
15687
+ queryParams = body['_query'];
15688
+ delete body['config'];
15689
+ delete body['_url'];
15690
+ delete body['_query'];
15691
+ response = this.apiClient
15692
+ .request({
15693
+ path: path,
15694
+ queryParams: queryParams,
15695
+ body: JSON.stringify(body),
15696
+ httpMethod: 'POST',
15697
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15698
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15699
+ })
15700
+ .then((httpResponse) => {
15701
+ return httpResponse.json();
15702
+ });
15703
+ return response.then((apiResponse) => {
15704
+ const resp = recontextImageResponseFromVertex(apiResponse);
15705
+ const typedResp = new RecontextImageResponse();
15706
+ Object.assign(typedResp, resp);
15707
+ return typedResp;
15708
+ });
15709
+ }
15710
+ else {
15711
+ throw new Error('This method is only supported by the Vertex AI.');
15712
+ }
15713
+ }
15326
15714
  /**
15327
15715
  * Fetches information about a model by name.
15328
15716
  *
@@ -16287,6 +16675,9 @@ function googleSearchToMldev(fromObject) {
16287
16675
  if (fromTimeRangeFilter != null) {
16288
16676
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(fromTimeRangeFilter));
16289
16677
  }
16678
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
16679
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
16680
+ }
16290
16681
  return toObject;
16291
16682
  }
16292
16683
  function dynamicRetrievalConfigToMldev(fromObject) {
@@ -16317,6 +16708,14 @@ function urlContextToMldev() {
16317
16708
  const toObject = {};
16318
16709
  return toObject;
16319
16710
  }
16711
+ function toolComputerUseToMldev(fromObject) {
16712
+ const toObject = {};
16713
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
16714
+ if (fromEnvironment != null) {
16715
+ setValueByPath(toObject, ['environment'], fromEnvironment);
16716
+ }
16717
+ return toObject;
16718
+ }
16320
16719
  function toolToMldev(fromObject) {
16321
16720
  const toObject = {};
16322
16721
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -16354,16 +16753,16 @@ function toolToMldev(fromObject) {
16354
16753
  if (fromUrlContext != null) {
16355
16754
  setValueByPath(toObject, ['urlContext'], urlContextToMldev());
16356
16755
  }
16756
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16757
+ if (fromComputerUse != null) {
16758
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev(fromComputerUse));
16759
+ }
16357
16760
  const fromCodeExecution = getValueByPath(fromObject, [
16358
16761
  'codeExecution',
16359
16762
  ]);
16360
16763
  if (fromCodeExecution != null) {
16361
16764
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
16362
16765
  }
16363
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16364
- if (fromComputerUse != null) {
16365
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
16366
- }
16367
16766
  return toObject;
16368
16767
  }
16369
16768
  function sessionResumptionConfigToMldev(fromObject) {
@@ -17177,6 +17576,10 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17177
17576
  undefined) {
17178
17577
  throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
17179
17578
  }
17579
+ if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
17580
+ undefined) {
17581
+ throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
17582
+ }
17180
17583
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
17181
17584
  throw new Error('adapterSize parameter is not supported in Gemini API.');
17182
17585
  }
@@ -17190,12 +17593,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17190
17593
  }
17191
17594
  return toObject;
17192
17595
  }
17193
- function createTuningJobParametersToMldev(fromObject) {
17596
+ function createTuningJobParametersPrivateToMldev(fromObject) {
17194
17597
  const toObject = {};
17195
17598
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17196
17599
  if (fromBaseModel != null) {
17197
17600
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17198
17601
  }
17602
+ const fromPreTunedModel = getValueByPath(fromObject, [
17603
+ 'preTunedModel',
17604
+ ]);
17605
+ if (fromPreTunedModel != null) {
17606
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17607
+ }
17199
17608
  const fromTrainingDataset = getValueByPath(fromObject, [
17200
17609
  'trainingDataset',
17201
17610
  ]);
@@ -17309,6 +17718,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17309
17718
  if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
17310
17719
  setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
17311
17720
  }
17721
+ const fromPreTunedModelCheckpointId = getValueByPath(fromObject, [
17722
+ 'preTunedModelCheckpointId',
17723
+ ]);
17724
+ if (fromPreTunedModelCheckpointId != null) {
17725
+ setValueByPath(toObject, ['preTunedModel', 'checkpointId'], fromPreTunedModelCheckpointId);
17726
+ }
17312
17727
  const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
17313
17728
  if (parentObject !== undefined && fromAdapterSize != null) {
17314
17729
  setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
@@ -17321,12 +17736,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17321
17736
  }
17322
17737
  return toObject;
17323
17738
  }
17324
- function createTuningJobParametersToVertex(fromObject) {
17739
+ function createTuningJobParametersPrivateToVertex(fromObject) {
17325
17740
  const toObject = {};
17326
17741
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17327
17742
  if (fromBaseModel != null) {
17328
17743
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17329
17744
  }
17745
+ const fromPreTunedModel = getValueByPath(fromObject, [
17746
+ 'preTunedModel',
17747
+ ]);
17748
+ if (fromPreTunedModel != null) {
17749
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17750
+ }
17330
17751
  const fromTrainingDataset = getValueByPath(fromObject, [
17331
17752
  'trainingDataset',
17332
17753
  ]);
@@ -17401,11 +17822,11 @@ function tuningJobFromMldev(fromObject) {
17401
17822
  if (fromTunedModel != null) {
17402
17823
  setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
17403
17824
  }
17404
- const fromDistillationSpec = getValueByPath(fromObject, [
17405
- 'distillationSpec',
17825
+ const fromCustomBaseModel = getValueByPath(fromObject, [
17826
+ 'customBaseModel',
17406
17827
  ]);
17407
- if (fromDistillationSpec != null) {
17408
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
17828
+ if (fromCustomBaseModel != null) {
17829
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17409
17830
  }
17410
17831
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17411
17832
  if (fromExperiment != null) {
@@ -17415,18 +17836,14 @@ function tuningJobFromMldev(fromObject) {
17415
17836
  if (fromLabels != null) {
17416
17837
  setValueByPath(toObject, ['labels'], fromLabels);
17417
17838
  }
17839
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
17840
+ if (fromOutputUri != null) {
17841
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
17842
+ }
17418
17843
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17419
17844
  if (fromPipelineJob != null) {
17420
17845
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17421
17846
  }
17422
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17423
- if (fromSatisfiesPzi != null) {
17424
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17425
- }
17426
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17427
- if (fromSatisfiesPzs != null) {
17428
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17429
- }
17430
17847
  const fromServiceAccount = getValueByPath(fromObject, [
17431
17848
  'serviceAccount',
17432
17849
  ]);
@@ -17583,6 +18000,12 @@ function tuningJobFromVertex(fromObject) {
17583
18000
  if (fromTunedModel != null) {
17584
18001
  setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(fromTunedModel));
17585
18002
  }
18003
+ const fromPreTunedModel = getValueByPath(fromObject, [
18004
+ 'preTunedModel',
18005
+ ]);
18006
+ if (fromPreTunedModel != null) {
18007
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
18008
+ }
17586
18009
  const fromSupervisedTuningSpec = getValueByPath(fromObject, [
17587
18010
  'supervisedTuningSpec',
17588
18011
  ]);
@@ -17607,11 +18030,11 @@ function tuningJobFromVertex(fromObject) {
17607
18030
  if (fromPartnerModelTuningSpec != null) {
17608
18031
  setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
17609
18032
  }
17610
- const fromDistillationSpec = getValueByPath(fromObject, [
17611
- 'distillationSpec',
18033
+ const fromCustomBaseModel = getValueByPath(fromObject, [
18034
+ 'customBaseModel',
17612
18035
  ]);
17613
- if (fromDistillationSpec != null) {
17614
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18036
+ if (fromCustomBaseModel != null) {
18037
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17615
18038
  }
17616
18039
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17617
18040
  if (fromExperiment != null) {
@@ -17621,18 +18044,14 @@ function tuningJobFromVertex(fromObject) {
17621
18044
  if (fromLabels != null) {
17622
18045
  setValueByPath(toObject, ['labels'], fromLabels);
17623
18046
  }
18047
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18048
+ if (fromOutputUri != null) {
18049
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
18050
+ }
17624
18051
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17625
18052
  if (fromPipelineJob != null) {
17626
18053
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17627
18054
  }
17628
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17629
- if (fromSatisfiesPzi != null) {
17630
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17631
- }
17632
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17633
- if (fromSatisfiesPzs != null) {
17634
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17635
- }
17636
18055
  const fromServiceAccount = getValueByPath(fromObject, [
17637
18056
  'serviceAccount',
17638
18057
  ]);
@@ -17718,10 +18137,22 @@ class Tunings extends BaseModule {
17718
18137
  */
17719
18138
  this.tune = async (params) => {
17720
18139
  if (this.apiClient.isVertexAI()) {
17721
- return await this.tuneInternal(params);
18140
+ if (params.baseModel.startsWith('projects/')) {
18141
+ const preTunedModel = {
18142
+ tunedModelName: params.baseModel,
18143
+ };
18144
+ const paramsPrivate = Object.assign(Object.assign({}, params), { preTunedModel: preTunedModel });
18145
+ paramsPrivate.baseModel = undefined;
18146
+ return await this.tuneInternal(paramsPrivate);
18147
+ }
18148
+ else {
18149
+ const paramsPrivate = Object.assign({}, params);
18150
+ return await this.tuneInternal(paramsPrivate);
18151
+ }
17722
18152
  }
17723
18153
  else {
17724
- const operation = await this.tuneMldevInternal(params);
18154
+ const paramsPrivate = Object.assign({}, params);
18155
+ const operation = await this.tuneMldevInternal(paramsPrivate);
17725
18156
  let tunedModelName = '';
17726
18157
  if (operation['metadata'] !== undefined &&
17727
18158
  operation['metadata']['tunedModel'] !== undefined) {
@@ -17881,7 +18312,7 @@ class Tunings extends BaseModule {
17881
18312
  let path = '';
17882
18313
  let queryParams = {};
17883
18314
  if (this.apiClient.isVertexAI()) {
17884
- const body = createTuningJobParametersToVertex(params);
18315
+ const body = createTuningJobParametersPrivateToVertex(params);
17885
18316
  path = formatMap('tuningJobs', body['_url']);
17886
18317
  queryParams = body['_query'];
17887
18318
  delete body['config'];
@@ -17923,7 +18354,7 @@ class Tunings extends BaseModule {
17923
18354
  throw new Error('This method is only supported by the Gemini Developer API.');
17924
18355
  }
17925
18356
  else {
17926
- const body = createTuningJobParametersToMldev(params);
18357
+ const body = createTuningJobParametersPrivateToMldev(params);
17927
18358
  path = formatMap('tunedModels', body['_url']);
17928
18359
  queryParams = body['_query'];
17929
18360
  delete body['config'];
@@ -18361,5 +18792,5 @@ function getApiKeyFromEnv() {
18361
18792
  return envGoogleApiKey || envGeminiApiKey;
18362
18793
  }
18363
18794
 
18364
- export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
18795
+ export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
18365
18796
  //# sourceMappingURL=index.mjs.map