@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.
package/dist/index.cjs CHANGED
@@ -389,18 +389,6 @@ exports.ApiSpec = void 0;
389
389
  */
390
390
  ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
391
391
  })(exports.ApiSpec || (exports.ApiSpec = {}));
392
- /** Required. The environment being operated. */
393
- exports.Environment = void 0;
394
- (function (Environment) {
395
- /**
396
- * Defaults to browser.
397
- */
398
- Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
399
- /**
400
- * Operates in a web browser.
401
- */
402
- Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
403
- })(exports.Environment || (exports.Environment = {}));
404
392
  /** Status of the url retrieval. */
405
393
  exports.UrlRetrievalStatus = void 0;
406
394
  (function (UrlRetrievalStatus) {
@@ -416,6 +404,14 @@ exports.UrlRetrievalStatus = void 0;
416
404
  * Url retrieval is failed due to error.
417
405
  */
418
406
  UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
407
+ /**
408
+ * Url retrieval is failed because the content is behind paywall.
409
+ */
410
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
411
+ /**
412
+ * Url retrieval is failed because the content is unsafe.
413
+ */
414
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
419
415
  })(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
420
416
  /** Output only. The reason why the model stopped generating tokens.
421
417
 
@@ -660,6 +656,22 @@ exports.JobState = void 0;
660
656
  */
661
657
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
662
658
  })(exports.JobState || (exports.JobState = {}));
659
+ /** Tuning mode. */
660
+ exports.TuningMode = void 0;
661
+ (function (TuningMode) {
662
+ /**
663
+ * Tuning mode is unspecified.
664
+ */
665
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
666
+ /**
667
+ * Full fine-tuning mode.
668
+ */
669
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
670
+ /**
671
+ * PEFT adapter tuning mode.
672
+ */
673
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
674
+ })(exports.TuningMode || (exports.TuningMode = {}));
663
675
  /** Optional. Adapter size for tuning. */
664
676
  exports.AdapterSize = void 0;
665
677
  (function (AdapterSize) {
@@ -728,6 +740,18 @@ exports.DynamicRetrievalConfigMode = void 0;
728
740
  */
729
741
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
730
742
  })(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
743
+ /** The environment being operated. */
744
+ exports.Environment = void 0;
745
+ (function (Environment) {
746
+ /**
747
+ * Defaults to browser.
748
+ */
749
+ Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
750
+ /**
751
+ * Operates in a web browser.
752
+ */
753
+ Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
754
+ })(exports.Environment || (exports.Environment = {}));
731
755
  /** Config for the function calling config mode. */
732
756
  exports.FunctionCallingConfigMode = void 0;
733
757
  (function (FunctionCallingConfigMode) {
@@ -1042,6 +1066,29 @@ exports.Scale = void 0;
1042
1066
  */
1043
1067
  Scale["B_MAJOR_A_FLAT_MINOR"] = "B_MAJOR_A_FLAT_MINOR";
1044
1068
  })(exports.Scale || (exports.Scale = {}));
1069
+ /** The mode of music generation. */
1070
+ exports.MusicGenerationMode = void 0;
1071
+ (function (MusicGenerationMode) {
1072
+ /**
1073
+ * Rely on the server default generation mode.
1074
+ */
1075
+ MusicGenerationMode["MUSIC_GENERATION_MODE_UNSPECIFIED"] = "MUSIC_GENERATION_MODE_UNSPECIFIED";
1076
+ /**
1077
+ * Steer text prompts to regions of latent space with higher quality
1078
+ music.
1079
+ */
1080
+ MusicGenerationMode["QUALITY"] = "QUALITY";
1081
+ /**
1082
+ * Steer text prompts to regions of latent space with a larger
1083
+ diversity of music.
1084
+ */
1085
+ MusicGenerationMode["DIVERSITY"] = "DIVERSITY";
1086
+ /**
1087
+ * Steer text prompts to regions of latent space more likely to
1088
+ generate music with vocals.
1089
+ */
1090
+ MusicGenerationMode["VOCALIZATION"] = "VOCALIZATION";
1091
+ })(exports.MusicGenerationMode || (exports.MusicGenerationMode = {}));
1045
1092
  /** The playback control signal to apply to the music generation. */
1046
1093
  exports.LiveMusicPlaybackControl = void 0;
1047
1094
  (function (LiveMusicPlaybackControl) {
@@ -1465,6 +1512,9 @@ class EditImageResponse {
1465
1512
  }
1466
1513
  class UpscaleImageResponse {
1467
1514
  }
1515
+ /** The output images response. */
1516
+ class RecontextImageResponse {
1517
+ }
1468
1518
  class ListModelsResponse {
1469
1519
  }
1470
1520
  class DeleteModelResponse {
@@ -2808,6 +2858,9 @@ function googleSearchToMldev$4(fromObject) {
2808
2858
  if (fromTimeRangeFilter != null) {
2809
2859
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
2810
2860
  }
2861
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
2862
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
2863
+ }
2811
2864
  return toObject;
2812
2865
  }
2813
2866
  function dynamicRetrievalConfigToMldev$4(fromObject) {
@@ -2838,6 +2891,14 @@ function urlContextToMldev$4() {
2838
2891
  const toObject = {};
2839
2892
  return toObject;
2840
2893
  }
2894
+ function toolComputerUseToMldev$4(fromObject) {
2895
+ const toObject = {};
2896
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
2897
+ if (fromEnvironment != null) {
2898
+ setValueByPath(toObject, ['environment'], fromEnvironment);
2899
+ }
2900
+ return toObject;
2901
+ }
2841
2902
  function toolToMldev$4(fromObject) {
2842
2903
  const toObject = {};
2843
2904
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -2875,16 +2936,16 @@ function toolToMldev$4(fromObject) {
2875
2936
  if (fromUrlContext != null) {
2876
2937
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
2877
2938
  }
2939
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2940
+ if (fromComputerUse != null) {
2941
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$4(fromComputerUse));
2942
+ }
2878
2943
  const fromCodeExecution = getValueByPath(fromObject, [
2879
2944
  'codeExecution',
2880
2945
  ]);
2881
2946
  if (fromCodeExecution != null) {
2882
2947
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2883
2948
  }
2884
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2885
- if (fromComputerUse != null) {
2886
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
2887
- }
2888
2949
  return toObject;
2889
2950
  }
2890
2951
  function functionCallingConfigToMldev$2(fromObject) {
@@ -3670,6 +3731,10 @@ function generateContentResponseFromMldev$1(fromObject) {
3670
3731
  if (fromPromptFeedback != null) {
3671
3732
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
3672
3733
  }
3734
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
3735
+ if (fromResponseId != null) {
3736
+ setValueByPath(toObject, ['responseId'], fromResponseId);
3737
+ }
3673
3738
  const fromUsageMetadata = getValueByPath(fromObject, [
3674
3739
  'usageMetadata',
3675
3740
  ]);
@@ -3803,6 +3868,12 @@ function listBatchJobsResponseFromMldev(fromObject) {
3803
3868
  }
3804
3869
  function deleteResourceJobFromMldev(fromObject) {
3805
3870
  const toObject = {};
3871
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
3872
+ 'sdkHttpResponse',
3873
+ ]);
3874
+ if (fromSdkHttpResponse != null) {
3875
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
3876
+ }
3806
3877
  const fromName = getValueByPath(fromObject, ['name']);
3807
3878
  if (fromName != null) {
3808
3879
  setValueByPath(toObject, ['name'], fromName);
@@ -3952,6 +4023,12 @@ function listBatchJobsResponseFromVertex(fromObject) {
3952
4023
  }
3953
4024
  function deleteResourceJobFromVertex(fromObject) {
3954
4025
  const toObject = {};
4026
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
4027
+ 'sdkHttpResponse',
4028
+ ]);
4029
+ if (fromSdkHttpResponse != null) {
4030
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
4031
+ }
3955
4032
  const fromName = getValueByPath(fromObject, ['name']);
3956
4033
  if (fromName != null) {
3957
4034
  setValueByPath(toObject, ['name'], fromName);
@@ -4497,7 +4574,13 @@ class Batches extends BaseModule {
4497
4574
  abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4498
4575
  })
4499
4576
  .then((httpResponse) => {
4500
- return httpResponse.json();
4577
+ return httpResponse.json().then((jsonResponse) => {
4578
+ const response = jsonResponse;
4579
+ response.sdkHttpResponse = {
4580
+ headers: httpResponse.headers,
4581
+ };
4582
+ return response;
4583
+ });
4501
4584
  });
4502
4585
  return response.then((apiResponse) => {
4503
4586
  const resp = deleteResourceJobFromVertex(apiResponse);
@@ -4521,7 +4604,13 @@ class Batches extends BaseModule {
4521
4604
  abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4522
4605
  })
4523
4606
  .then((httpResponse) => {
4524
- return httpResponse.json();
4607
+ return httpResponse.json().then((jsonResponse) => {
4608
+ const response = jsonResponse;
4609
+ response.sdkHttpResponse = {
4610
+ headers: httpResponse.headers,
4611
+ };
4612
+ return response;
4613
+ });
4525
4614
  });
4526
4615
  return response.then((apiResponse) => {
4527
4616
  const resp = deleteResourceJobFromMldev(apiResponse);
@@ -4710,6 +4799,9 @@ function googleSearchToMldev$3(fromObject) {
4710
4799
  if (fromTimeRangeFilter != null) {
4711
4800
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(fromTimeRangeFilter));
4712
4801
  }
4802
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4803
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
4804
+ }
4713
4805
  return toObject;
4714
4806
  }
4715
4807
  function dynamicRetrievalConfigToMldev$3(fromObject) {
@@ -4740,6 +4832,14 @@ function urlContextToMldev$3() {
4740
4832
  const toObject = {};
4741
4833
  return toObject;
4742
4834
  }
4835
+ function toolComputerUseToMldev$3(fromObject) {
4836
+ const toObject = {};
4837
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
4838
+ if (fromEnvironment != null) {
4839
+ setValueByPath(toObject, ['environment'], fromEnvironment);
4840
+ }
4841
+ return toObject;
4842
+ }
4743
4843
  function toolToMldev$3(fromObject) {
4744
4844
  const toObject = {};
4745
4845
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -4777,16 +4877,16 @@ function toolToMldev$3(fromObject) {
4777
4877
  if (fromUrlContext != null) {
4778
4878
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
4779
4879
  }
4880
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4881
+ if (fromComputerUse != null) {
4882
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$3(fromComputerUse));
4883
+ }
4780
4884
  const fromCodeExecution = getValueByPath(fromObject, [
4781
4885
  'codeExecution',
4782
4886
  ]);
4783
4887
  if (fromCodeExecution != null) {
4784
4888
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4785
4889
  }
4786
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4787
- if (fromComputerUse != null) {
4788
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
4789
- }
4790
4890
  return toObject;
4791
4891
  }
4792
4892
  function functionCallingConfigToMldev$1(fromObject) {
@@ -5147,6 +5247,12 @@ function googleSearchToVertex$2(fromObject) {
5147
5247
  if (fromTimeRangeFilter != null) {
5148
5248
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$2(fromTimeRangeFilter));
5149
5249
  }
5250
+ const fromExcludeDomains = getValueByPath(fromObject, [
5251
+ 'excludeDomains',
5252
+ ]);
5253
+ if (fromExcludeDomains != null) {
5254
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5255
+ }
5150
5256
  return toObject;
5151
5257
  }
5152
5258
  function dynamicRetrievalConfigToVertex$2(fromObject) {
@@ -5173,8 +5279,14 @@ function googleSearchRetrievalToVertex$2(fromObject) {
5173
5279
  }
5174
5280
  return toObject;
5175
5281
  }
5176
- function enterpriseWebSearchToVertex$2() {
5282
+ function enterpriseWebSearchToVertex$2(fromObject) {
5177
5283
  const toObject = {};
5284
+ const fromExcludeDomains = getValueByPath(fromObject, [
5285
+ 'excludeDomains',
5286
+ ]);
5287
+ if (fromExcludeDomains != null) {
5288
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5289
+ }
5178
5290
  return toObject;
5179
5291
  }
5180
5292
  function apiKeyConfigToVertex$2(fromObject) {
@@ -5229,6 +5341,14 @@ function urlContextToVertex$2() {
5229
5341
  const toObject = {};
5230
5342
  return toObject;
5231
5343
  }
5344
+ function toolComputerUseToVertex$2(fromObject) {
5345
+ const toObject = {};
5346
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
5347
+ if (fromEnvironment != null) {
5348
+ setValueByPath(toObject, ['environment'], fromEnvironment);
5349
+ }
5350
+ return toObject;
5351
+ }
5232
5352
  function toolToVertex$2(fromObject) {
5233
5353
  const toObject = {};
5234
5354
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5261,7 +5381,7 @@ function toolToVertex$2(fromObject) {
5261
5381
  'enterpriseWebSearch',
5262
5382
  ]);
5263
5383
  if (fromEnterpriseWebSearch != null) {
5264
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
5384
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2(fromEnterpriseWebSearch));
5265
5385
  }
5266
5386
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5267
5387
  if (fromGoogleMaps != null) {
@@ -5271,16 +5391,16 @@ function toolToVertex$2(fromObject) {
5271
5391
  if (fromUrlContext != null) {
5272
5392
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
5273
5393
  }
5394
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5395
+ if (fromComputerUse != null) {
5396
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$2(fromComputerUse));
5397
+ }
5274
5398
  const fromCodeExecution = getValueByPath(fromObject, [
5275
5399
  'codeExecution',
5276
5400
  ]);
5277
5401
  if (fromCodeExecution != null) {
5278
5402
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5279
5403
  }
5280
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5281
- if (fromComputerUse != null) {
5282
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5283
- }
5284
5404
  return toObject;
5285
5405
  }
5286
5406
  function functionCallingConfigToVertex$1(fromObject) {
@@ -6392,7 +6512,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6392
6512
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6393
6513
  const USER_AGENT_HEADER = 'User-Agent';
6394
6514
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6395
- const SDK_VERSION = '1.12.0'; // x-release-please-version
6515
+ const SDK_VERSION = '1.14.0'; // x-release-please-version
6396
6516
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6397
6517
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6398
6518
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -7863,6 +7983,9 @@ function googleSearchToMldev$2(fromObject) {
7863
7983
  if (fromTimeRangeFilter != null) {
7864
7984
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(fromTimeRangeFilter));
7865
7985
  }
7986
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7987
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
7988
+ }
7866
7989
  return toObject;
7867
7990
  }
7868
7991
  function dynamicRetrievalConfigToMldev$2(fromObject) {
@@ -7893,6 +8016,14 @@ function urlContextToMldev$2() {
7893
8016
  const toObject = {};
7894
8017
  return toObject;
7895
8018
  }
8019
+ function toolComputerUseToMldev$2(fromObject) {
8020
+ const toObject = {};
8021
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8022
+ if (fromEnvironment != null) {
8023
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8024
+ }
8025
+ return toObject;
8026
+ }
7896
8027
  function toolToMldev$2(fromObject) {
7897
8028
  const toObject = {};
7898
8029
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -7930,16 +8061,16 @@ function toolToMldev$2(fromObject) {
7930
8061
  if (fromUrlContext != null) {
7931
8062
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
7932
8063
  }
8064
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8065
+ if (fromComputerUse != null) {
8066
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$2(fromComputerUse));
8067
+ }
7933
8068
  const fromCodeExecution = getValueByPath(fromObject, [
7934
8069
  'codeExecution',
7935
8070
  ]);
7936
8071
  if (fromCodeExecution != null) {
7937
8072
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7938
8073
  }
7939
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7940
- if (fromComputerUse != null) {
7941
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7942
- }
7943
8074
  return toObject;
7944
8075
  }
7945
8076
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -8279,6 +8410,12 @@ function liveMusicGenerationConfigToMldev(fromObject) {
8279
8410
  if (fromOnlyBassAndDrums != null) {
8280
8411
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
8281
8412
  }
8413
+ const fromMusicGenerationMode = getValueByPath(fromObject, [
8414
+ 'musicGenerationMode',
8415
+ ]);
8416
+ if (fromMusicGenerationMode != null) {
8417
+ setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
8418
+ }
8282
8419
  return toObject;
8283
8420
  }
8284
8421
  function liveMusicSetConfigParametersToMldev(fromObject) {
@@ -8549,6 +8686,12 @@ function googleSearchToVertex$1(fromObject) {
8549
8686
  if (fromTimeRangeFilter != null) {
8550
8687
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$1(fromTimeRangeFilter));
8551
8688
  }
8689
+ const fromExcludeDomains = getValueByPath(fromObject, [
8690
+ 'excludeDomains',
8691
+ ]);
8692
+ if (fromExcludeDomains != null) {
8693
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8694
+ }
8552
8695
  return toObject;
8553
8696
  }
8554
8697
  function dynamicRetrievalConfigToVertex$1(fromObject) {
@@ -8575,8 +8718,14 @@ function googleSearchRetrievalToVertex$1(fromObject) {
8575
8718
  }
8576
8719
  return toObject;
8577
8720
  }
8578
- function enterpriseWebSearchToVertex$1() {
8721
+ function enterpriseWebSearchToVertex$1(fromObject) {
8579
8722
  const toObject = {};
8723
+ const fromExcludeDomains = getValueByPath(fromObject, [
8724
+ 'excludeDomains',
8725
+ ]);
8726
+ if (fromExcludeDomains != null) {
8727
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8728
+ }
8580
8729
  return toObject;
8581
8730
  }
8582
8731
  function apiKeyConfigToVertex$1(fromObject) {
@@ -8631,6 +8780,14 @@ function urlContextToVertex$1() {
8631
8780
  const toObject = {};
8632
8781
  return toObject;
8633
8782
  }
8783
+ function toolComputerUseToVertex$1(fromObject) {
8784
+ const toObject = {};
8785
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8786
+ if (fromEnvironment != null) {
8787
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8788
+ }
8789
+ return toObject;
8790
+ }
8634
8791
  function toolToVertex$1(fromObject) {
8635
8792
  const toObject = {};
8636
8793
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -8663,7 +8820,7 @@ function toolToVertex$1(fromObject) {
8663
8820
  'enterpriseWebSearch',
8664
8821
  ]);
8665
8822
  if (fromEnterpriseWebSearch != null) {
8666
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
8823
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1(fromEnterpriseWebSearch));
8667
8824
  }
8668
8825
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
8669
8826
  if (fromGoogleMaps != null) {
@@ -8673,16 +8830,16 @@ function toolToVertex$1(fromObject) {
8673
8830
  if (fromUrlContext != null) {
8674
8831
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
8675
8832
  }
8833
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8834
+ if (fromComputerUse != null) {
8835
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$1(fromComputerUse));
8836
+ }
8676
8837
  const fromCodeExecution = getValueByPath(fromObject, [
8677
8838
  'codeExecution',
8678
8839
  ]);
8679
8840
  if (fromCodeExecution != null) {
8680
8841
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8681
8842
  }
8682
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8683
- if (fromComputerUse != null) {
8684
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
8685
- }
8686
8843
  return toObject;
8687
8844
  }
8688
8845
  function sessionResumptionConfigToVertex(fromObject) {
@@ -9437,6 +9594,12 @@ function liveMusicGenerationConfigFromMldev(fromObject) {
9437
9594
  if (fromOnlyBassAndDrums != null) {
9438
9595
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
9439
9596
  }
9597
+ const fromMusicGenerationMode = getValueByPath(fromObject, [
9598
+ 'musicGenerationMode',
9599
+ ]);
9600
+ if (fromMusicGenerationMode != null) {
9601
+ setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
9602
+ }
9440
9603
  return toObject;
9441
9604
  }
9442
9605
  function liveMusicSourceMetadataFromMldev(fromObject) {
@@ -10204,6 +10367,9 @@ function googleSearchToMldev$1(fromObject) {
10204
10367
  if (fromTimeRangeFilter != null) {
10205
10368
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(fromTimeRangeFilter));
10206
10369
  }
10370
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
10371
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
10372
+ }
10207
10373
  return toObject;
10208
10374
  }
10209
10375
  function dynamicRetrievalConfigToMldev$1(fromObject) {
@@ -10234,6 +10400,14 @@ function urlContextToMldev$1() {
10234
10400
  const toObject = {};
10235
10401
  return toObject;
10236
10402
  }
10403
+ function toolComputerUseToMldev$1(fromObject) {
10404
+ const toObject = {};
10405
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
10406
+ if (fromEnvironment != null) {
10407
+ setValueByPath(toObject, ['environment'], fromEnvironment);
10408
+ }
10409
+ return toObject;
10410
+ }
10237
10411
  function toolToMldev$1(fromObject) {
10238
10412
  const toObject = {};
10239
10413
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10271,16 +10445,16 @@ function toolToMldev$1(fromObject) {
10271
10445
  if (fromUrlContext != null) {
10272
10446
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
10273
10447
  }
10448
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10449
+ if (fromComputerUse != null) {
10450
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$1(fromComputerUse));
10451
+ }
10274
10452
  const fromCodeExecution = getValueByPath(fromObject, [
10275
10453
  'codeExecution',
10276
10454
  ]);
10277
10455
  if (fromCodeExecution != null) {
10278
10456
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10279
10457
  }
10280
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10281
- if (fromComputerUse != null) {
10282
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10283
- }
10284
10458
  return toObject;
10285
10459
  }
10286
10460
  function functionCallingConfigToMldev(fromObject) {
@@ -10703,8 +10877,9 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
10703
10877
  if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
10704
10878
  throw new Error('addWatermark parameter is not supported in Gemini API.');
10705
10879
  }
10706
- if (getValueByPath(fromObject, ['imageSize']) !== undefined) {
10707
- throw new Error('imageSize parameter is not supported in Gemini API.');
10880
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10881
+ if (parentObject !== undefined && fromImageSize != null) {
10882
+ setValueByPath(parentObject, ['parameters', 'sampleImageSize'], fromImageSize);
10708
10883
  }
10709
10884
  if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
10710
10885
  throw new Error('enhancePrompt parameter is not supported in Gemini API.');
@@ -11243,6 +11418,12 @@ function googleSearchToVertex(fromObject) {
11243
11418
  if (fromTimeRangeFilter != null) {
11244
11419
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex(fromTimeRangeFilter));
11245
11420
  }
11421
+ const fromExcludeDomains = getValueByPath(fromObject, [
11422
+ 'excludeDomains',
11423
+ ]);
11424
+ if (fromExcludeDomains != null) {
11425
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
11426
+ }
11246
11427
  return toObject;
11247
11428
  }
11248
11429
  function dynamicRetrievalConfigToVertex(fromObject) {
@@ -11269,8 +11450,14 @@ function googleSearchRetrievalToVertex(fromObject) {
11269
11450
  }
11270
11451
  return toObject;
11271
11452
  }
11272
- function enterpriseWebSearchToVertex() {
11453
+ function enterpriseWebSearchToVertex(fromObject) {
11273
11454
  const toObject = {};
11455
+ const fromExcludeDomains = getValueByPath(fromObject, [
11456
+ 'excludeDomains',
11457
+ ]);
11458
+ if (fromExcludeDomains != null) {
11459
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
11460
+ }
11274
11461
  return toObject;
11275
11462
  }
11276
11463
  function apiKeyConfigToVertex(fromObject) {
@@ -11325,6 +11512,14 @@ function urlContextToVertex() {
11325
11512
  const toObject = {};
11326
11513
  return toObject;
11327
11514
  }
11515
+ function toolComputerUseToVertex(fromObject) {
11516
+ const toObject = {};
11517
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
11518
+ if (fromEnvironment != null) {
11519
+ setValueByPath(toObject, ['environment'], fromEnvironment);
11520
+ }
11521
+ return toObject;
11522
+ }
11328
11523
  function toolToVertex(fromObject) {
11329
11524
  const toObject = {};
11330
11525
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -11357,7 +11552,7 @@ function toolToVertex(fromObject) {
11357
11552
  'enterpriseWebSearch',
11358
11553
  ]);
11359
11554
  if (fromEnterpriseWebSearch != null) {
11360
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
11555
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex(fromEnterpriseWebSearch));
11361
11556
  }
11362
11557
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
11363
11558
  if (fromGoogleMaps != null) {
@@ -11367,16 +11562,16 @@ function toolToVertex(fromObject) {
11367
11562
  if (fromUrlContext != null) {
11368
11563
  setValueByPath(toObject, ['urlContext'], urlContextToVertex());
11369
11564
  }
11565
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
11566
+ if (fromComputerUse != null) {
11567
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex(fromComputerUse));
11568
+ }
11370
11569
  const fromCodeExecution = getValueByPath(fromObject, [
11371
11570
  'codeExecution',
11372
11571
  ]);
11373
11572
  if (fromCodeExecution != null) {
11374
11573
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
11375
11574
  }
11376
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
11377
- if (fromComputerUse != null) {
11378
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
11379
- }
11380
11575
  return toObject;
11381
11576
  }
11382
11577
  function functionCallingConfigToVertex(fromObject) {
@@ -12106,6 +12301,106 @@ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
12106
12301
  }
12107
12302
  return toObject;
12108
12303
  }
12304
+ function productImageToVertex(fromObject) {
12305
+ const toObject = {};
12306
+ const fromProductImage = getValueByPath(fromObject, ['productImage']);
12307
+ if (fromProductImage != null) {
12308
+ setValueByPath(toObject, ['image'], imageToVertex(fromProductImage));
12309
+ }
12310
+ return toObject;
12311
+ }
12312
+ function recontextImageSourceToVertex(fromObject, parentObject) {
12313
+ const toObject = {};
12314
+ const fromPrompt = getValueByPath(fromObject, ['prompt']);
12315
+ if (parentObject !== undefined && fromPrompt != null) {
12316
+ setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
12317
+ }
12318
+ const fromPersonImage = getValueByPath(fromObject, ['personImage']);
12319
+ if (parentObject !== undefined && fromPersonImage != null) {
12320
+ setValueByPath(parentObject, ['instances[0]', 'personImage', 'image'], imageToVertex(fromPersonImage));
12321
+ }
12322
+ const fromProductImages = getValueByPath(fromObject, [
12323
+ 'productImages',
12324
+ ]);
12325
+ if (parentObject !== undefined && fromProductImages != null) {
12326
+ let transformedList = fromProductImages;
12327
+ if (Array.isArray(transformedList)) {
12328
+ transformedList = transformedList.map((item) => {
12329
+ return productImageToVertex(item);
12330
+ });
12331
+ }
12332
+ setValueByPath(parentObject, ['instances[0]', 'productImages'], transformedList);
12333
+ }
12334
+ return toObject;
12335
+ }
12336
+ function recontextImageConfigToVertex(fromObject, parentObject) {
12337
+ const toObject = {};
12338
+ const fromNumberOfImages = getValueByPath(fromObject, [
12339
+ 'numberOfImages',
12340
+ ]);
12341
+ if (parentObject !== undefined && fromNumberOfImages != null) {
12342
+ setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
12343
+ }
12344
+ const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
12345
+ if (parentObject !== undefined && fromBaseSteps != null) {
12346
+ setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
12347
+ }
12348
+ const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
12349
+ if (parentObject !== undefined && fromOutputGcsUri != null) {
12350
+ setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
12351
+ }
12352
+ const fromSeed = getValueByPath(fromObject, ['seed']);
12353
+ if (parentObject !== undefined && fromSeed != null) {
12354
+ setValueByPath(parentObject, ['parameters', 'seed'], fromSeed);
12355
+ }
12356
+ const fromSafetyFilterLevel = getValueByPath(fromObject, [
12357
+ 'safetyFilterLevel',
12358
+ ]);
12359
+ if (parentObject !== undefined && fromSafetyFilterLevel != null) {
12360
+ setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
12361
+ }
12362
+ const fromPersonGeneration = getValueByPath(fromObject, [
12363
+ 'personGeneration',
12364
+ ]);
12365
+ if (parentObject !== undefined && fromPersonGeneration != null) {
12366
+ setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
12367
+ }
12368
+ const fromOutputMimeType = getValueByPath(fromObject, [
12369
+ 'outputMimeType',
12370
+ ]);
12371
+ if (parentObject !== undefined && fromOutputMimeType != null) {
12372
+ setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
12373
+ }
12374
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
12375
+ 'outputCompressionQuality',
12376
+ ]);
12377
+ if (parentObject !== undefined && fromOutputCompressionQuality != null) {
12378
+ setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
12379
+ }
12380
+ const fromEnhancePrompt = getValueByPath(fromObject, [
12381
+ 'enhancePrompt',
12382
+ ]);
12383
+ if (parentObject !== undefined && fromEnhancePrompt != null) {
12384
+ setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
12385
+ }
12386
+ return toObject;
12387
+ }
12388
+ function recontextImageParametersToVertex(apiClient, fromObject) {
12389
+ const toObject = {};
12390
+ const fromModel = getValueByPath(fromObject, ['model']);
12391
+ if (fromModel != null) {
12392
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
12393
+ }
12394
+ const fromSource = getValueByPath(fromObject, ['source']);
12395
+ if (fromSource != null) {
12396
+ setValueByPath(toObject, ['config'], recontextImageSourceToVertex(fromSource, toObject));
12397
+ }
12398
+ const fromConfig = getValueByPath(fromObject, ['config']);
12399
+ if (fromConfig != null) {
12400
+ setValueByPath(toObject, ['config'], recontextImageConfigToVertex(fromConfig, toObject));
12401
+ }
12402
+ return toObject;
12403
+ }
12109
12404
  function getModelParametersToVertex(apiClient, fromObject) {
12110
12405
  const toObject = {};
12111
12406
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -12602,6 +12897,10 @@ function generateContentResponseFromMldev(fromObject) {
12602
12897
  if (fromPromptFeedback != null) {
12603
12898
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
12604
12899
  }
12900
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
12901
+ if (fromResponseId != null) {
12902
+ setValueByPath(toObject, ['responseId'], fromResponseId);
12903
+ }
12605
12904
  const fromUsageMetadata = getValueByPath(fromObject, [
12606
12905
  'usageMetadata',
12607
12906
  ]);
@@ -13152,10 +13451,6 @@ function generateContentResponseFromVertex(fromObject) {
13152
13451
  if (fromCreateTime != null) {
13153
13452
  setValueByPath(toObject, ['createTime'], fromCreateTime);
13154
13453
  }
13155
- const fromResponseId = getValueByPath(fromObject, ['responseId']);
13156
- if (fromResponseId != null) {
13157
- setValueByPath(toObject, ['responseId'], fromResponseId);
13158
- }
13159
13454
  const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
13160
13455
  if (fromModelVersion != null) {
13161
13456
  setValueByPath(toObject, ['modelVersion'], fromModelVersion);
@@ -13166,6 +13461,10 @@ function generateContentResponseFromVertex(fromObject) {
13166
13461
  if (fromPromptFeedback != null) {
13167
13462
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
13168
13463
  }
13464
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
13465
+ if (fromResponseId != null) {
13466
+ setValueByPath(toObject, ['responseId'], fromResponseId);
13467
+ }
13169
13468
  const fromUsageMetadata = getValueByPath(fromObject, [
13170
13469
  'usageMetadata',
13171
13470
  ]);
@@ -13369,6 +13668,22 @@ function upscaleImageResponseFromVertex(fromObject) {
13369
13668
  }
13370
13669
  return toObject;
13371
13670
  }
13671
+ function recontextImageResponseFromVertex(fromObject) {
13672
+ const toObject = {};
13673
+ const fromGeneratedImages = getValueByPath(fromObject, [
13674
+ 'predictions',
13675
+ ]);
13676
+ if (fromGeneratedImages != null) {
13677
+ let transformedList = fromGeneratedImages;
13678
+ if (Array.isArray(transformedList)) {
13679
+ transformedList = transformedList.map((item) => {
13680
+ return generatedImageFromVertex(item);
13681
+ });
13682
+ }
13683
+ setValueByPath(toObject, ['generatedImages'], transformedList);
13684
+ }
13685
+ return toObject;
13686
+ }
13372
13687
  function endpointFromVertex(fromObject) {
13373
13688
  const toObject = {};
13374
13689
  const fromName = getValueByPath(fromObject, ['endpoint']);
@@ -15412,6 +15727,79 @@ class Models extends BaseModule {
15412
15727
  throw new Error('This method is only supported by the Vertex AI.');
15413
15728
  }
15414
15729
  }
15730
+ /**
15731
+ * Recontextualizes an image.
15732
+ *
15733
+ * There are two types of recontextualization currently supported:
15734
+ * 1) Imagen Product Recontext - Generate images of products in new scenes
15735
+ * and contexts.
15736
+ * 2) Virtual Try-On: Generate images of persons modeling fashion products.
15737
+ *
15738
+ * @param params - The parameters for recontextualizing an image.
15739
+ * @return The response from the API.
15740
+ *
15741
+ * @example
15742
+ * ```ts
15743
+ * const response1 = await ai.models.recontextImage({
15744
+ * model: 'imagen-product-recontext-preview-06-30',
15745
+ * source: {
15746
+ * prompt: 'In a modern kitchen setting.',
15747
+ * productImages: [productImage],
15748
+ * },
15749
+ * config: {
15750
+ * numberOfImages: 1,
15751
+ * },
15752
+ * });
15753
+ * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
15754
+ *
15755
+ * const response2 = await ai.models.recontextImage({
15756
+ * model: 'virtual-try-on-preview-08-04',
15757
+ * source: {
15758
+ * personImage: personImage,
15759
+ * productImages: [productImage],
15760
+ * },
15761
+ * config: {
15762
+ * numberOfImages: 1,
15763
+ * },
15764
+ * });
15765
+ * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
15766
+ * ```
15767
+ */
15768
+ async recontextImage(params) {
15769
+ var _a, _b;
15770
+ let response;
15771
+ let path = '';
15772
+ let queryParams = {};
15773
+ if (this.apiClient.isVertexAI()) {
15774
+ const body = recontextImageParametersToVertex(this.apiClient, params);
15775
+ path = formatMap('{model}:predict', body['_url']);
15776
+ queryParams = body['_query'];
15777
+ delete body['config'];
15778
+ delete body['_url'];
15779
+ delete body['_query'];
15780
+ response = this.apiClient
15781
+ .request({
15782
+ path: path,
15783
+ queryParams: queryParams,
15784
+ body: JSON.stringify(body),
15785
+ httpMethod: 'POST',
15786
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15787
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15788
+ })
15789
+ .then((httpResponse) => {
15790
+ return httpResponse.json();
15791
+ });
15792
+ return response.then((apiResponse) => {
15793
+ const resp = recontextImageResponseFromVertex(apiResponse);
15794
+ const typedResp = new RecontextImageResponse();
15795
+ Object.assign(typedResp, resp);
15796
+ return typedResp;
15797
+ });
15798
+ }
15799
+ else {
15800
+ throw new Error('This method is only supported by the Vertex AI.');
15801
+ }
15802
+ }
15415
15803
  /**
15416
15804
  * Fetches information about a model by name.
15417
15805
  *
@@ -16376,6 +16764,9 @@ function googleSearchToMldev(fromObject) {
16376
16764
  if (fromTimeRangeFilter != null) {
16377
16765
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(fromTimeRangeFilter));
16378
16766
  }
16767
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
16768
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
16769
+ }
16379
16770
  return toObject;
16380
16771
  }
16381
16772
  function dynamicRetrievalConfigToMldev(fromObject) {
@@ -16406,6 +16797,14 @@ function urlContextToMldev() {
16406
16797
  const toObject = {};
16407
16798
  return toObject;
16408
16799
  }
16800
+ function toolComputerUseToMldev(fromObject) {
16801
+ const toObject = {};
16802
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
16803
+ if (fromEnvironment != null) {
16804
+ setValueByPath(toObject, ['environment'], fromEnvironment);
16805
+ }
16806
+ return toObject;
16807
+ }
16409
16808
  function toolToMldev(fromObject) {
16410
16809
  const toObject = {};
16411
16810
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -16443,16 +16842,16 @@ function toolToMldev(fromObject) {
16443
16842
  if (fromUrlContext != null) {
16444
16843
  setValueByPath(toObject, ['urlContext'], urlContextToMldev());
16445
16844
  }
16845
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16846
+ if (fromComputerUse != null) {
16847
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev(fromComputerUse));
16848
+ }
16446
16849
  const fromCodeExecution = getValueByPath(fromObject, [
16447
16850
  'codeExecution',
16448
16851
  ]);
16449
16852
  if (fromCodeExecution != null) {
16450
16853
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
16451
16854
  }
16452
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16453
- if (fromComputerUse != null) {
16454
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
16455
- }
16456
16855
  return toObject;
16457
16856
  }
16458
16857
  function sessionResumptionConfigToMldev(fromObject) {
@@ -17092,6 +17491,10 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17092
17491
  undefined) {
17093
17492
  throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
17094
17493
  }
17494
+ if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
17495
+ undefined) {
17496
+ throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
17497
+ }
17095
17498
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
17096
17499
  throw new Error('adapterSize parameter is not supported in Gemini API.');
17097
17500
  }
@@ -17105,12 +17508,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17105
17508
  }
17106
17509
  return toObject;
17107
17510
  }
17108
- function createTuningJobParametersToMldev(fromObject) {
17511
+ function createTuningJobParametersPrivateToMldev(fromObject) {
17109
17512
  const toObject = {};
17110
17513
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17111
17514
  if (fromBaseModel != null) {
17112
17515
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17113
17516
  }
17517
+ const fromPreTunedModel = getValueByPath(fromObject, [
17518
+ 'preTunedModel',
17519
+ ]);
17520
+ if (fromPreTunedModel != null) {
17521
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17522
+ }
17114
17523
  const fromTrainingDataset = getValueByPath(fromObject, [
17115
17524
  'trainingDataset',
17116
17525
  ]);
@@ -17224,6 +17633,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17224
17633
  if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
17225
17634
  setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
17226
17635
  }
17636
+ const fromPreTunedModelCheckpointId = getValueByPath(fromObject, [
17637
+ 'preTunedModelCheckpointId',
17638
+ ]);
17639
+ if (fromPreTunedModelCheckpointId != null) {
17640
+ setValueByPath(toObject, ['preTunedModel', 'checkpointId'], fromPreTunedModelCheckpointId);
17641
+ }
17227
17642
  const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
17228
17643
  if (parentObject !== undefined && fromAdapterSize != null) {
17229
17644
  setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
@@ -17236,12 +17651,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17236
17651
  }
17237
17652
  return toObject;
17238
17653
  }
17239
- function createTuningJobParametersToVertex(fromObject) {
17654
+ function createTuningJobParametersPrivateToVertex(fromObject) {
17240
17655
  const toObject = {};
17241
17656
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17242
17657
  if (fromBaseModel != null) {
17243
17658
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17244
17659
  }
17660
+ const fromPreTunedModel = getValueByPath(fromObject, [
17661
+ 'preTunedModel',
17662
+ ]);
17663
+ if (fromPreTunedModel != null) {
17664
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17665
+ }
17245
17666
  const fromTrainingDataset = getValueByPath(fromObject, [
17246
17667
  'trainingDataset',
17247
17668
  ]);
@@ -17316,11 +17737,11 @@ function tuningJobFromMldev(fromObject) {
17316
17737
  if (fromTunedModel != null) {
17317
17738
  setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
17318
17739
  }
17319
- const fromDistillationSpec = getValueByPath(fromObject, [
17320
- 'distillationSpec',
17740
+ const fromCustomBaseModel = getValueByPath(fromObject, [
17741
+ 'customBaseModel',
17321
17742
  ]);
17322
- if (fromDistillationSpec != null) {
17323
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
17743
+ if (fromCustomBaseModel != null) {
17744
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17324
17745
  }
17325
17746
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17326
17747
  if (fromExperiment != null) {
@@ -17330,18 +17751,14 @@ function tuningJobFromMldev(fromObject) {
17330
17751
  if (fromLabels != null) {
17331
17752
  setValueByPath(toObject, ['labels'], fromLabels);
17332
17753
  }
17754
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
17755
+ if (fromOutputUri != null) {
17756
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
17757
+ }
17333
17758
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17334
17759
  if (fromPipelineJob != null) {
17335
17760
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17336
17761
  }
17337
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17338
- if (fromSatisfiesPzi != null) {
17339
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17340
- }
17341
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17342
- if (fromSatisfiesPzs != null) {
17343
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17344
- }
17345
17762
  const fromServiceAccount = getValueByPath(fromObject, [
17346
17763
  'serviceAccount',
17347
17764
  ]);
@@ -17498,6 +17915,12 @@ function tuningJobFromVertex(fromObject) {
17498
17915
  if (fromTunedModel != null) {
17499
17916
  setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(fromTunedModel));
17500
17917
  }
17918
+ const fromPreTunedModel = getValueByPath(fromObject, [
17919
+ 'preTunedModel',
17920
+ ]);
17921
+ if (fromPreTunedModel != null) {
17922
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17923
+ }
17501
17924
  const fromSupervisedTuningSpec = getValueByPath(fromObject, [
17502
17925
  'supervisedTuningSpec',
17503
17926
  ]);
@@ -17522,11 +17945,11 @@ function tuningJobFromVertex(fromObject) {
17522
17945
  if (fromPartnerModelTuningSpec != null) {
17523
17946
  setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
17524
17947
  }
17525
- const fromDistillationSpec = getValueByPath(fromObject, [
17526
- 'distillationSpec',
17948
+ const fromCustomBaseModel = getValueByPath(fromObject, [
17949
+ 'customBaseModel',
17527
17950
  ]);
17528
- if (fromDistillationSpec != null) {
17529
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
17951
+ if (fromCustomBaseModel != null) {
17952
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17530
17953
  }
17531
17954
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17532
17955
  if (fromExperiment != null) {
@@ -17536,18 +17959,14 @@ function tuningJobFromVertex(fromObject) {
17536
17959
  if (fromLabels != null) {
17537
17960
  setValueByPath(toObject, ['labels'], fromLabels);
17538
17961
  }
17962
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
17963
+ if (fromOutputUri != null) {
17964
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
17965
+ }
17539
17966
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17540
17967
  if (fromPipelineJob != null) {
17541
17968
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17542
17969
  }
17543
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17544
- if (fromSatisfiesPzi != null) {
17545
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17546
- }
17547
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17548
- if (fromSatisfiesPzs != null) {
17549
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17550
- }
17551
17970
  const fromServiceAccount = getValueByPath(fromObject, [
17552
17971
  'serviceAccount',
17553
17972
  ]);
@@ -17633,10 +18052,22 @@ class Tunings extends BaseModule {
17633
18052
  */
17634
18053
  this.tune = async (params) => {
17635
18054
  if (this.apiClient.isVertexAI()) {
17636
- return await this.tuneInternal(params);
18055
+ if (params.baseModel.startsWith('projects/')) {
18056
+ const preTunedModel = {
18057
+ tunedModelName: params.baseModel,
18058
+ };
18059
+ const paramsPrivate = Object.assign(Object.assign({}, params), { preTunedModel: preTunedModel });
18060
+ paramsPrivate.baseModel = undefined;
18061
+ return await this.tuneInternal(paramsPrivate);
18062
+ }
18063
+ else {
18064
+ const paramsPrivate = Object.assign({}, params);
18065
+ return await this.tuneInternal(paramsPrivate);
18066
+ }
17637
18067
  }
17638
18068
  else {
17639
- const operation = await this.tuneMldevInternal(params);
18069
+ const paramsPrivate = Object.assign({}, params);
18070
+ const operation = await this.tuneMldevInternal(paramsPrivate);
17640
18071
  let tunedModelName = '';
17641
18072
  if (operation['metadata'] !== undefined &&
17642
18073
  operation['metadata']['tunedModel'] !== undefined) {
@@ -17796,7 +18227,7 @@ class Tunings extends BaseModule {
17796
18227
  let path = '';
17797
18228
  let queryParams = {};
17798
18229
  if (this.apiClient.isVertexAI()) {
17799
- const body = createTuningJobParametersToVertex(params);
18230
+ const body = createTuningJobParametersPrivateToVertex(params);
17800
18231
  path = formatMap('tuningJobs', body['_url']);
17801
18232
  queryParams = body['_query'];
17802
18233
  delete body['config'];
@@ -17838,7 +18269,7 @@ class Tunings extends BaseModule {
17838
18269
  throw new Error('This method is only supported by the Gemini Developer API.');
17839
18270
  }
17840
18271
  else {
17841
- const body = createTuningJobParametersToMldev(params);
18272
+ const body = createTuningJobParametersPrivateToMldev(params);
17842
18273
  path = formatMap('tunedModels', body['_url']);
17843
18274
  queryParams = body['_query'];
17844
18275
  delete body['config'];
@@ -18005,6 +18436,7 @@ exports.Models = Models;
18005
18436
  exports.Operations = Operations;
18006
18437
  exports.Pager = Pager;
18007
18438
  exports.RawReferenceImage = RawReferenceImage;
18439
+ exports.RecontextImageResponse = RecontextImageResponse;
18008
18440
  exports.ReplayResponse = ReplayResponse;
18009
18441
  exports.Session = Session;
18010
18442
  exports.StyleReferenceImage = StyleReferenceImage;