@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.mjs CHANGED
@@ -387,18 +387,6 @@ var ApiSpec;
387
387
  */
388
388
  ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
389
389
  })(ApiSpec || (ApiSpec = {}));
390
- /** Required. The environment being operated. */
391
- var Environment;
392
- (function (Environment) {
393
- /**
394
- * Defaults to browser.
395
- */
396
- Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
397
- /**
398
- * Operates in a web browser.
399
- */
400
- Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
401
- })(Environment || (Environment = {}));
402
390
  /** Status of the url retrieval. */
403
391
  var UrlRetrievalStatus;
404
392
  (function (UrlRetrievalStatus) {
@@ -414,6 +402,14 @@ var UrlRetrievalStatus;
414
402
  * Url retrieval is failed due to error.
415
403
  */
416
404
  UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
405
+ /**
406
+ * Url retrieval is failed because the content is behind paywall.
407
+ */
408
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
409
+ /**
410
+ * Url retrieval is failed because the content is unsafe.
411
+ */
412
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
417
413
  })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
418
414
  /** Output only. The reason why the model stopped generating tokens.
419
415
 
@@ -658,6 +654,22 @@ var JobState;
658
654
  */
659
655
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
660
656
  })(JobState || (JobState = {}));
657
+ /** Tuning mode. */
658
+ var TuningMode;
659
+ (function (TuningMode) {
660
+ /**
661
+ * Tuning mode is unspecified.
662
+ */
663
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
664
+ /**
665
+ * Full fine-tuning mode.
666
+ */
667
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
668
+ /**
669
+ * PEFT adapter tuning mode.
670
+ */
671
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
672
+ })(TuningMode || (TuningMode = {}));
661
673
  /** Optional. Adapter size for tuning. */
662
674
  var AdapterSize;
663
675
  (function (AdapterSize) {
@@ -726,6 +738,18 @@ var DynamicRetrievalConfigMode;
726
738
  */
727
739
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
728
740
  })(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
741
+ /** The environment being operated. */
742
+ var Environment;
743
+ (function (Environment) {
744
+ /**
745
+ * Defaults to browser.
746
+ */
747
+ Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
748
+ /**
749
+ * Operates in a web browser.
750
+ */
751
+ Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
752
+ })(Environment || (Environment = {}));
729
753
  /** Config for the function calling config mode. */
730
754
  var FunctionCallingConfigMode;
731
755
  (function (FunctionCallingConfigMode) {
@@ -1040,6 +1064,29 @@ var Scale;
1040
1064
  */
1041
1065
  Scale["B_MAJOR_A_FLAT_MINOR"] = "B_MAJOR_A_FLAT_MINOR";
1042
1066
  })(Scale || (Scale = {}));
1067
+ /** The mode of music generation. */
1068
+ var MusicGenerationMode;
1069
+ (function (MusicGenerationMode) {
1070
+ /**
1071
+ * Rely on the server default generation mode.
1072
+ */
1073
+ MusicGenerationMode["MUSIC_GENERATION_MODE_UNSPECIFIED"] = "MUSIC_GENERATION_MODE_UNSPECIFIED";
1074
+ /**
1075
+ * Steer text prompts to regions of latent space with higher quality
1076
+ music.
1077
+ */
1078
+ MusicGenerationMode["QUALITY"] = "QUALITY";
1079
+ /**
1080
+ * Steer text prompts to regions of latent space with a larger
1081
+ diversity of music.
1082
+ */
1083
+ MusicGenerationMode["DIVERSITY"] = "DIVERSITY";
1084
+ /**
1085
+ * Steer text prompts to regions of latent space more likely to
1086
+ generate music with vocals.
1087
+ */
1088
+ MusicGenerationMode["VOCALIZATION"] = "VOCALIZATION";
1089
+ })(MusicGenerationMode || (MusicGenerationMode = {}));
1043
1090
  /** The playback control signal to apply to the music generation. */
1044
1091
  var LiveMusicPlaybackControl;
1045
1092
  (function (LiveMusicPlaybackControl) {
@@ -1463,6 +1510,9 @@ class EditImageResponse {
1463
1510
  }
1464
1511
  class UpscaleImageResponse {
1465
1512
  }
1513
+ /** The output images response. */
1514
+ class RecontextImageResponse {
1515
+ }
1466
1516
  class ListModelsResponse {
1467
1517
  }
1468
1518
  class DeleteModelResponse {
@@ -2806,6 +2856,9 @@ function googleSearchToMldev$4(fromObject) {
2806
2856
  if (fromTimeRangeFilter != null) {
2807
2857
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
2808
2858
  }
2859
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
2860
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
2861
+ }
2809
2862
  return toObject;
2810
2863
  }
2811
2864
  function dynamicRetrievalConfigToMldev$4(fromObject) {
@@ -2836,6 +2889,14 @@ function urlContextToMldev$4() {
2836
2889
  const toObject = {};
2837
2890
  return toObject;
2838
2891
  }
2892
+ function toolComputerUseToMldev$4(fromObject) {
2893
+ const toObject = {};
2894
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
2895
+ if (fromEnvironment != null) {
2896
+ setValueByPath(toObject, ['environment'], fromEnvironment);
2897
+ }
2898
+ return toObject;
2899
+ }
2839
2900
  function toolToMldev$4(fromObject) {
2840
2901
  const toObject = {};
2841
2902
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -2873,16 +2934,16 @@ function toolToMldev$4(fromObject) {
2873
2934
  if (fromUrlContext != null) {
2874
2935
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
2875
2936
  }
2937
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2938
+ if (fromComputerUse != null) {
2939
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$4(fromComputerUse));
2940
+ }
2876
2941
  const fromCodeExecution = getValueByPath(fromObject, [
2877
2942
  'codeExecution',
2878
2943
  ]);
2879
2944
  if (fromCodeExecution != null) {
2880
2945
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2881
2946
  }
2882
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2883
- if (fromComputerUse != null) {
2884
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
2885
- }
2886
2947
  return toObject;
2887
2948
  }
2888
2949
  function functionCallingConfigToMldev$2(fromObject) {
@@ -3668,6 +3729,10 @@ function generateContentResponseFromMldev$1(fromObject) {
3668
3729
  if (fromPromptFeedback != null) {
3669
3730
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
3670
3731
  }
3732
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
3733
+ if (fromResponseId != null) {
3734
+ setValueByPath(toObject, ['responseId'], fromResponseId);
3735
+ }
3671
3736
  const fromUsageMetadata = getValueByPath(fromObject, [
3672
3737
  'usageMetadata',
3673
3738
  ]);
@@ -3801,6 +3866,12 @@ function listBatchJobsResponseFromMldev(fromObject) {
3801
3866
  }
3802
3867
  function deleteResourceJobFromMldev(fromObject) {
3803
3868
  const toObject = {};
3869
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
3870
+ 'sdkHttpResponse',
3871
+ ]);
3872
+ if (fromSdkHttpResponse != null) {
3873
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
3874
+ }
3804
3875
  const fromName = getValueByPath(fromObject, ['name']);
3805
3876
  if (fromName != null) {
3806
3877
  setValueByPath(toObject, ['name'], fromName);
@@ -3950,6 +4021,12 @@ function listBatchJobsResponseFromVertex(fromObject) {
3950
4021
  }
3951
4022
  function deleteResourceJobFromVertex(fromObject) {
3952
4023
  const toObject = {};
4024
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
4025
+ 'sdkHttpResponse',
4026
+ ]);
4027
+ if (fromSdkHttpResponse != null) {
4028
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
4029
+ }
3953
4030
  const fromName = getValueByPath(fromObject, ['name']);
3954
4031
  if (fromName != null) {
3955
4032
  setValueByPath(toObject, ['name'], fromName);
@@ -4495,7 +4572,13 @@ class Batches extends BaseModule {
4495
4572
  abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4496
4573
  })
4497
4574
  .then((httpResponse) => {
4498
- return httpResponse.json();
4575
+ return httpResponse.json().then((jsonResponse) => {
4576
+ const response = jsonResponse;
4577
+ response.sdkHttpResponse = {
4578
+ headers: httpResponse.headers,
4579
+ };
4580
+ return response;
4581
+ });
4499
4582
  });
4500
4583
  return response.then((apiResponse) => {
4501
4584
  const resp = deleteResourceJobFromVertex(apiResponse);
@@ -4519,7 +4602,13 @@ class Batches extends BaseModule {
4519
4602
  abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
4520
4603
  })
4521
4604
  .then((httpResponse) => {
4522
- return httpResponse.json();
4605
+ return httpResponse.json().then((jsonResponse) => {
4606
+ const response = jsonResponse;
4607
+ response.sdkHttpResponse = {
4608
+ headers: httpResponse.headers,
4609
+ };
4610
+ return response;
4611
+ });
4523
4612
  });
4524
4613
  return response.then((apiResponse) => {
4525
4614
  const resp = deleteResourceJobFromMldev(apiResponse);
@@ -4708,6 +4797,9 @@ function googleSearchToMldev$3(fromObject) {
4708
4797
  if (fromTimeRangeFilter != null) {
4709
4798
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(fromTimeRangeFilter));
4710
4799
  }
4800
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4801
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
4802
+ }
4711
4803
  return toObject;
4712
4804
  }
4713
4805
  function dynamicRetrievalConfigToMldev$3(fromObject) {
@@ -4738,6 +4830,14 @@ function urlContextToMldev$3() {
4738
4830
  const toObject = {};
4739
4831
  return toObject;
4740
4832
  }
4833
+ function toolComputerUseToMldev$3(fromObject) {
4834
+ const toObject = {};
4835
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
4836
+ if (fromEnvironment != null) {
4837
+ setValueByPath(toObject, ['environment'], fromEnvironment);
4838
+ }
4839
+ return toObject;
4840
+ }
4741
4841
  function toolToMldev$3(fromObject) {
4742
4842
  const toObject = {};
4743
4843
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -4775,16 +4875,16 @@ function toolToMldev$3(fromObject) {
4775
4875
  if (fromUrlContext != null) {
4776
4876
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
4777
4877
  }
4878
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4879
+ if (fromComputerUse != null) {
4880
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$3(fromComputerUse));
4881
+ }
4778
4882
  const fromCodeExecution = getValueByPath(fromObject, [
4779
4883
  'codeExecution',
4780
4884
  ]);
4781
4885
  if (fromCodeExecution != null) {
4782
4886
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4783
4887
  }
4784
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4785
- if (fromComputerUse != null) {
4786
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
4787
- }
4788
4888
  return toObject;
4789
4889
  }
4790
4890
  function functionCallingConfigToMldev$1(fromObject) {
@@ -5145,6 +5245,12 @@ function googleSearchToVertex$2(fromObject) {
5145
5245
  if (fromTimeRangeFilter != null) {
5146
5246
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$2(fromTimeRangeFilter));
5147
5247
  }
5248
+ const fromExcludeDomains = getValueByPath(fromObject, [
5249
+ 'excludeDomains',
5250
+ ]);
5251
+ if (fromExcludeDomains != null) {
5252
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5253
+ }
5148
5254
  return toObject;
5149
5255
  }
5150
5256
  function dynamicRetrievalConfigToVertex$2(fromObject) {
@@ -5171,8 +5277,14 @@ function googleSearchRetrievalToVertex$2(fromObject) {
5171
5277
  }
5172
5278
  return toObject;
5173
5279
  }
5174
- function enterpriseWebSearchToVertex$2() {
5280
+ function enterpriseWebSearchToVertex$2(fromObject) {
5175
5281
  const toObject = {};
5282
+ const fromExcludeDomains = getValueByPath(fromObject, [
5283
+ 'excludeDomains',
5284
+ ]);
5285
+ if (fromExcludeDomains != null) {
5286
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5287
+ }
5176
5288
  return toObject;
5177
5289
  }
5178
5290
  function apiKeyConfigToVertex$2(fromObject) {
@@ -5227,6 +5339,14 @@ function urlContextToVertex$2() {
5227
5339
  const toObject = {};
5228
5340
  return toObject;
5229
5341
  }
5342
+ function toolComputerUseToVertex$2(fromObject) {
5343
+ const toObject = {};
5344
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
5345
+ if (fromEnvironment != null) {
5346
+ setValueByPath(toObject, ['environment'], fromEnvironment);
5347
+ }
5348
+ return toObject;
5349
+ }
5230
5350
  function toolToVertex$2(fromObject) {
5231
5351
  const toObject = {};
5232
5352
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5259,7 +5379,7 @@ function toolToVertex$2(fromObject) {
5259
5379
  'enterpriseWebSearch',
5260
5380
  ]);
5261
5381
  if (fromEnterpriseWebSearch != null) {
5262
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
5382
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2(fromEnterpriseWebSearch));
5263
5383
  }
5264
5384
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5265
5385
  if (fromGoogleMaps != null) {
@@ -5269,16 +5389,16 @@ function toolToVertex$2(fromObject) {
5269
5389
  if (fromUrlContext != null) {
5270
5390
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
5271
5391
  }
5392
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5393
+ if (fromComputerUse != null) {
5394
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$2(fromComputerUse));
5395
+ }
5272
5396
  const fromCodeExecution = getValueByPath(fromObject, [
5273
5397
  'codeExecution',
5274
5398
  ]);
5275
5399
  if (fromCodeExecution != null) {
5276
5400
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5277
5401
  }
5278
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5279
- if (fromComputerUse != null) {
5280
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5281
- }
5282
5402
  return toObject;
5283
5403
  }
5284
5404
  function functionCallingConfigToVertex$1(fromObject) {
@@ -6390,7 +6510,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6390
6510
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6391
6511
  const USER_AGENT_HEADER = 'User-Agent';
6392
6512
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6393
- const SDK_VERSION = '1.12.0'; // x-release-please-version
6513
+ const SDK_VERSION = '1.14.0'; // x-release-please-version
6394
6514
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6395
6515
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6396
6516
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -7861,6 +7981,9 @@ function googleSearchToMldev$2(fromObject) {
7861
7981
  if (fromTimeRangeFilter != null) {
7862
7982
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(fromTimeRangeFilter));
7863
7983
  }
7984
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7985
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
7986
+ }
7864
7987
  return toObject;
7865
7988
  }
7866
7989
  function dynamicRetrievalConfigToMldev$2(fromObject) {
@@ -7891,6 +8014,14 @@ function urlContextToMldev$2() {
7891
8014
  const toObject = {};
7892
8015
  return toObject;
7893
8016
  }
8017
+ function toolComputerUseToMldev$2(fromObject) {
8018
+ const toObject = {};
8019
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8020
+ if (fromEnvironment != null) {
8021
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8022
+ }
8023
+ return toObject;
8024
+ }
7894
8025
  function toolToMldev$2(fromObject) {
7895
8026
  const toObject = {};
7896
8027
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -7928,16 +8059,16 @@ function toolToMldev$2(fromObject) {
7928
8059
  if (fromUrlContext != null) {
7929
8060
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
7930
8061
  }
8062
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8063
+ if (fromComputerUse != null) {
8064
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$2(fromComputerUse));
8065
+ }
7931
8066
  const fromCodeExecution = getValueByPath(fromObject, [
7932
8067
  'codeExecution',
7933
8068
  ]);
7934
8069
  if (fromCodeExecution != null) {
7935
8070
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7936
8071
  }
7937
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7938
- if (fromComputerUse != null) {
7939
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7940
- }
7941
8072
  return toObject;
7942
8073
  }
7943
8074
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -8277,6 +8408,12 @@ function liveMusicGenerationConfigToMldev(fromObject) {
8277
8408
  if (fromOnlyBassAndDrums != null) {
8278
8409
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
8279
8410
  }
8411
+ const fromMusicGenerationMode = getValueByPath(fromObject, [
8412
+ 'musicGenerationMode',
8413
+ ]);
8414
+ if (fromMusicGenerationMode != null) {
8415
+ setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
8416
+ }
8280
8417
  return toObject;
8281
8418
  }
8282
8419
  function liveMusicSetConfigParametersToMldev(fromObject) {
@@ -8547,6 +8684,12 @@ function googleSearchToVertex$1(fromObject) {
8547
8684
  if (fromTimeRangeFilter != null) {
8548
8685
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$1(fromTimeRangeFilter));
8549
8686
  }
8687
+ const fromExcludeDomains = getValueByPath(fromObject, [
8688
+ 'excludeDomains',
8689
+ ]);
8690
+ if (fromExcludeDomains != null) {
8691
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8692
+ }
8550
8693
  return toObject;
8551
8694
  }
8552
8695
  function dynamicRetrievalConfigToVertex$1(fromObject) {
@@ -8573,8 +8716,14 @@ function googleSearchRetrievalToVertex$1(fromObject) {
8573
8716
  }
8574
8717
  return toObject;
8575
8718
  }
8576
- function enterpriseWebSearchToVertex$1() {
8719
+ function enterpriseWebSearchToVertex$1(fromObject) {
8577
8720
  const toObject = {};
8721
+ const fromExcludeDomains = getValueByPath(fromObject, [
8722
+ 'excludeDomains',
8723
+ ]);
8724
+ if (fromExcludeDomains != null) {
8725
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8726
+ }
8578
8727
  return toObject;
8579
8728
  }
8580
8729
  function apiKeyConfigToVertex$1(fromObject) {
@@ -8629,6 +8778,14 @@ function urlContextToVertex$1() {
8629
8778
  const toObject = {};
8630
8779
  return toObject;
8631
8780
  }
8781
+ function toolComputerUseToVertex$1(fromObject) {
8782
+ const toObject = {};
8783
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8784
+ if (fromEnvironment != null) {
8785
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8786
+ }
8787
+ return toObject;
8788
+ }
8632
8789
  function toolToVertex$1(fromObject) {
8633
8790
  const toObject = {};
8634
8791
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -8661,7 +8818,7 @@ function toolToVertex$1(fromObject) {
8661
8818
  'enterpriseWebSearch',
8662
8819
  ]);
8663
8820
  if (fromEnterpriseWebSearch != null) {
8664
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
8821
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1(fromEnterpriseWebSearch));
8665
8822
  }
8666
8823
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
8667
8824
  if (fromGoogleMaps != null) {
@@ -8671,16 +8828,16 @@ function toolToVertex$1(fromObject) {
8671
8828
  if (fromUrlContext != null) {
8672
8829
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
8673
8830
  }
8831
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8832
+ if (fromComputerUse != null) {
8833
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$1(fromComputerUse));
8834
+ }
8674
8835
  const fromCodeExecution = getValueByPath(fromObject, [
8675
8836
  'codeExecution',
8676
8837
  ]);
8677
8838
  if (fromCodeExecution != null) {
8678
8839
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8679
8840
  }
8680
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8681
- if (fromComputerUse != null) {
8682
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
8683
- }
8684
8841
  return toObject;
8685
8842
  }
8686
8843
  function sessionResumptionConfigToVertex(fromObject) {
@@ -9435,6 +9592,12 @@ function liveMusicGenerationConfigFromMldev(fromObject) {
9435
9592
  if (fromOnlyBassAndDrums != null) {
9436
9593
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
9437
9594
  }
9595
+ const fromMusicGenerationMode = getValueByPath(fromObject, [
9596
+ 'musicGenerationMode',
9597
+ ]);
9598
+ if (fromMusicGenerationMode != null) {
9599
+ setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
9600
+ }
9438
9601
  return toObject;
9439
9602
  }
9440
9603
  function liveMusicSourceMetadataFromMldev(fromObject) {
@@ -10202,6 +10365,9 @@ function googleSearchToMldev$1(fromObject) {
10202
10365
  if (fromTimeRangeFilter != null) {
10203
10366
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(fromTimeRangeFilter));
10204
10367
  }
10368
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
10369
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
10370
+ }
10205
10371
  return toObject;
10206
10372
  }
10207
10373
  function dynamicRetrievalConfigToMldev$1(fromObject) {
@@ -10232,6 +10398,14 @@ function urlContextToMldev$1() {
10232
10398
  const toObject = {};
10233
10399
  return toObject;
10234
10400
  }
10401
+ function toolComputerUseToMldev$1(fromObject) {
10402
+ const toObject = {};
10403
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
10404
+ if (fromEnvironment != null) {
10405
+ setValueByPath(toObject, ['environment'], fromEnvironment);
10406
+ }
10407
+ return toObject;
10408
+ }
10235
10409
  function toolToMldev$1(fromObject) {
10236
10410
  const toObject = {};
10237
10411
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10269,16 +10443,16 @@ function toolToMldev$1(fromObject) {
10269
10443
  if (fromUrlContext != null) {
10270
10444
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
10271
10445
  }
10446
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10447
+ if (fromComputerUse != null) {
10448
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$1(fromComputerUse));
10449
+ }
10272
10450
  const fromCodeExecution = getValueByPath(fromObject, [
10273
10451
  'codeExecution',
10274
10452
  ]);
10275
10453
  if (fromCodeExecution != null) {
10276
10454
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10277
10455
  }
10278
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10279
- if (fromComputerUse != null) {
10280
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10281
- }
10282
10456
  return toObject;
10283
10457
  }
10284
10458
  function functionCallingConfigToMldev(fromObject) {
@@ -10701,8 +10875,9 @@ function generateImagesConfigToMldev(fromObject, parentObject) {
10701
10875
  if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
10702
10876
  throw new Error('addWatermark parameter is not supported in Gemini API.');
10703
10877
  }
10704
- if (getValueByPath(fromObject, ['imageSize']) !== undefined) {
10705
- throw new Error('imageSize parameter is not supported in Gemini API.');
10878
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10879
+ if (parentObject !== undefined && fromImageSize != null) {
10880
+ setValueByPath(parentObject, ['parameters', 'sampleImageSize'], fromImageSize);
10706
10881
  }
10707
10882
  if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
10708
10883
  throw new Error('enhancePrompt parameter is not supported in Gemini API.');
@@ -11241,6 +11416,12 @@ function googleSearchToVertex(fromObject) {
11241
11416
  if (fromTimeRangeFilter != null) {
11242
11417
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex(fromTimeRangeFilter));
11243
11418
  }
11419
+ const fromExcludeDomains = getValueByPath(fromObject, [
11420
+ 'excludeDomains',
11421
+ ]);
11422
+ if (fromExcludeDomains != null) {
11423
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
11424
+ }
11244
11425
  return toObject;
11245
11426
  }
11246
11427
  function dynamicRetrievalConfigToVertex(fromObject) {
@@ -11267,8 +11448,14 @@ function googleSearchRetrievalToVertex(fromObject) {
11267
11448
  }
11268
11449
  return toObject;
11269
11450
  }
11270
- function enterpriseWebSearchToVertex() {
11451
+ function enterpriseWebSearchToVertex(fromObject) {
11271
11452
  const toObject = {};
11453
+ const fromExcludeDomains = getValueByPath(fromObject, [
11454
+ 'excludeDomains',
11455
+ ]);
11456
+ if (fromExcludeDomains != null) {
11457
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
11458
+ }
11272
11459
  return toObject;
11273
11460
  }
11274
11461
  function apiKeyConfigToVertex(fromObject) {
@@ -11323,6 +11510,14 @@ function urlContextToVertex() {
11323
11510
  const toObject = {};
11324
11511
  return toObject;
11325
11512
  }
11513
+ function toolComputerUseToVertex(fromObject) {
11514
+ const toObject = {};
11515
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
11516
+ if (fromEnvironment != null) {
11517
+ setValueByPath(toObject, ['environment'], fromEnvironment);
11518
+ }
11519
+ return toObject;
11520
+ }
11326
11521
  function toolToVertex(fromObject) {
11327
11522
  const toObject = {};
11328
11523
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -11355,7 +11550,7 @@ function toolToVertex(fromObject) {
11355
11550
  'enterpriseWebSearch',
11356
11551
  ]);
11357
11552
  if (fromEnterpriseWebSearch != null) {
11358
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
11553
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex(fromEnterpriseWebSearch));
11359
11554
  }
11360
11555
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
11361
11556
  if (fromGoogleMaps != null) {
@@ -11365,16 +11560,16 @@ function toolToVertex(fromObject) {
11365
11560
  if (fromUrlContext != null) {
11366
11561
  setValueByPath(toObject, ['urlContext'], urlContextToVertex());
11367
11562
  }
11563
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
11564
+ if (fromComputerUse != null) {
11565
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex(fromComputerUse));
11566
+ }
11368
11567
  const fromCodeExecution = getValueByPath(fromObject, [
11369
11568
  'codeExecution',
11370
11569
  ]);
11371
11570
  if (fromCodeExecution != null) {
11372
11571
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
11373
11572
  }
11374
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
11375
- if (fromComputerUse != null) {
11376
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
11377
- }
11378
11573
  return toObject;
11379
11574
  }
11380
11575
  function functionCallingConfigToVertex(fromObject) {
@@ -12104,6 +12299,106 @@ function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
12104
12299
  }
12105
12300
  return toObject;
12106
12301
  }
12302
+ function productImageToVertex(fromObject) {
12303
+ const toObject = {};
12304
+ const fromProductImage = getValueByPath(fromObject, ['productImage']);
12305
+ if (fromProductImage != null) {
12306
+ setValueByPath(toObject, ['image'], imageToVertex(fromProductImage));
12307
+ }
12308
+ return toObject;
12309
+ }
12310
+ function recontextImageSourceToVertex(fromObject, parentObject) {
12311
+ const toObject = {};
12312
+ const fromPrompt = getValueByPath(fromObject, ['prompt']);
12313
+ if (parentObject !== undefined && fromPrompt != null) {
12314
+ setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
12315
+ }
12316
+ const fromPersonImage = getValueByPath(fromObject, ['personImage']);
12317
+ if (parentObject !== undefined && fromPersonImage != null) {
12318
+ setValueByPath(parentObject, ['instances[0]', 'personImage', 'image'], imageToVertex(fromPersonImage));
12319
+ }
12320
+ const fromProductImages = getValueByPath(fromObject, [
12321
+ 'productImages',
12322
+ ]);
12323
+ if (parentObject !== undefined && fromProductImages != null) {
12324
+ let transformedList = fromProductImages;
12325
+ if (Array.isArray(transformedList)) {
12326
+ transformedList = transformedList.map((item) => {
12327
+ return productImageToVertex(item);
12328
+ });
12329
+ }
12330
+ setValueByPath(parentObject, ['instances[0]', 'productImages'], transformedList);
12331
+ }
12332
+ return toObject;
12333
+ }
12334
+ function recontextImageConfigToVertex(fromObject, parentObject) {
12335
+ const toObject = {};
12336
+ const fromNumberOfImages = getValueByPath(fromObject, [
12337
+ 'numberOfImages',
12338
+ ]);
12339
+ if (parentObject !== undefined && fromNumberOfImages != null) {
12340
+ setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
12341
+ }
12342
+ const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
12343
+ if (parentObject !== undefined && fromBaseSteps != null) {
12344
+ setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
12345
+ }
12346
+ const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
12347
+ if (parentObject !== undefined && fromOutputGcsUri != null) {
12348
+ setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
12349
+ }
12350
+ const fromSeed = getValueByPath(fromObject, ['seed']);
12351
+ if (parentObject !== undefined && fromSeed != null) {
12352
+ setValueByPath(parentObject, ['parameters', 'seed'], fromSeed);
12353
+ }
12354
+ const fromSafetyFilterLevel = getValueByPath(fromObject, [
12355
+ 'safetyFilterLevel',
12356
+ ]);
12357
+ if (parentObject !== undefined && fromSafetyFilterLevel != null) {
12358
+ setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
12359
+ }
12360
+ const fromPersonGeneration = getValueByPath(fromObject, [
12361
+ 'personGeneration',
12362
+ ]);
12363
+ if (parentObject !== undefined && fromPersonGeneration != null) {
12364
+ setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
12365
+ }
12366
+ const fromOutputMimeType = getValueByPath(fromObject, [
12367
+ 'outputMimeType',
12368
+ ]);
12369
+ if (parentObject !== undefined && fromOutputMimeType != null) {
12370
+ setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
12371
+ }
12372
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
12373
+ 'outputCompressionQuality',
12374
+ ]);
12375
+ if (parentObject !== undefined && fromOutputCompressionQuality != null) {
12376
+ setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
12377
+ }
12378
+ const fromEnhancePrompt = getValueByPath(fromObject, [
12379
+ 'enhancePrompt',
12380
+ ]);
12381
+ if (parentObject !== undefined && fromEnhancePrompt != null) {
12382
+ setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
12383
+ }
12384
+ return toObject;
12385
+ }
12386
+ function recontextImageParametersToVertex(apiClient, fromObject) {
12387
+ const toObject = {};
12388
+ const fromModel = getValueByPath(fromObject, ['model']);
12389
+ if (fromModel != null) {
12390
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
12391
+ }
12392
+ const fromSource = getValueByPath(fromObject, ['source']);
12393
+ if (fromSource != null) {
12394
+ setValueByPath(toObject, ['config'], recontextImageSourceToVertex(fromSource, toObject));
12395
+ }
12396
+ const fromConfig = getValueByPath(fromObject, ['config']);
12397
+ if (fromConfig != null) {
12398
+ setValueByPath(toObject, ['config'], recontextImageConfigToVertex(fromConfig, toObject));
12399
+ }
12400
+ return toObject;
12401
+ }
12107
12402
  function getModelParametersToVertex(apiClient, fromObject) {
12108
12403
  const toObject = {};
12109
12404
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -12600,6 +12895,10 @@ function generateContentResponseFromMldev(fromObject) {
12600
12895
  if (fromPromptFeedback != null) {
12601
12896
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
12602
12897
  }
12898
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
12899
+ if (fromResponseId != null) {
12900
+ setValueByPath(toObject, ['responseId'], fromResponseId);
12901
+ }
12603
12902
  const fromUsageMetadata = getValueByPath(fromObject, [
12604
12903
  'usageMetadata',
12605
12904
  ]);
@@ -13150,10 +13449,6 @@ function generateContentResponseFromVertex(fromObject) {
13150
13449
  if (fromCreateTime != null) {
13151
13450
  setValueByPath(toObject, ['createTime'], fromCreateTime);
13152
13451
  }
13153
- const fromResponseId = getValueByPath(fromObject, ['responseId']);
13154
- if (fromResponseId != null) {
13155
- setValueByPath(toObject, ['responseId'], fromResponseId);
13156
- }
13157
13452
  const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
13158
13453
  if (fromModelVersion != null) {
13159
13454
  setValueByPath(toObject, ['modelVersion'], fromModelVersion);
@@ -13164,6 +13459,10 @@ function generateContentResponseFromVertex(fromObject) {
13164
13459
  if (fromPromptFeedback != null) {
13165
13460
  setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
13166
13461
  }
13462
+ const fromResponseId = getValueByPath(fromObject, ['responseId']);
13463
+ if (fromResponseId != null) {
13464
+ setValueByPath(toObject, ['responseId'], fromResponseId);
13465
+ }
13167
13466
  const fromUsageMetadata = getValueByPath(fromObject, [
13168
13467
  'usageMetadata',
13169
13468
  ]);
@@ -13367,6 +13666,22 @@ function upscaleImageResponseFromVertex(fromObject) {
13367
13666
  }
13368
13667
  return toObject;
13369
13668
  }
13669
+ function recontextImageResponseFromVertex(fromObject) {
13670
+ const toObject = {};
13671
+ const fromGeneratedImages = getValueByPath(fromObject, [
13672
+ 'predictions',
13673
+ ]);
13674
+ if (fromGeneratedImages != null) {
13675
+ let transformedList = fromGeneratedImages;
13676
+ if (Array.isArray(transformedList)) {
13677
+ transformedList = transformedList.map((item) => {
13678
+ return generatedImageFromVertex(item);
13679
+ });
13680
+ }
13681
+ setValueByPath(toObject, ['generatedImages'], transformedList);
13682
+ }
13683
+ return toObject;
13684
+ }
13370
13685
  function endpointFromVertex(fromObject) {
13371
13686
  const toObject = {};
13372
13687
  const fromName = getValueByPath(fromObject, ['endpoint']);
@@ -15410,6 +15725,79 @@ class Models extends BaseModule {
15410
15725
  throw new Error('This method is only supported by the Vertex AI.');
15411
15726
  }
15412
15727
  }
15728
+ /**
15729
+ * Recontextualizes an image.
15730
+ *
15731
+ * There are two types of recontextualization currently supported:
15732
+ * 1) Imagen Product Recontext - Generate images of products in new scenes
15733
+ * and contexts.
15734
+ * 2) Virtual Try-On: Generate images of persons modeling fashion products.
15735
+ *
15736
+ * @param params - The parameters for recontextualizing an image.
15737
+ * @return The response from the API.
15738
+ *
15739
+ * @example
15740
+ * ```ts
15741
+ * const response1 = await ai.models.recontextImage({
15742
+ * model: 'imagen-product-recontext-preview-06-30',
15743
+ * source: {
15744
+ * prompt: 'In a modern kitchen setting.',
15745
+ * productImages: [productImage],
15746
+ * },
15747
+ * config: {
15748
+ * numberOfImages: 1,
15749
+ * },
15750
+ * });
15751
+ * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
15752
+ *
15753
+ * const response2 = await ai.models.recontextImage({
15754
+ * model: 'virtual-try-on-preview-08-04',
15755
+ * source: {
15756
+ * personImage: personImage,
15757
+ * productImages: [productImage],
15758
+ * },
15759
+ * config: {
15760
+ * numberOfImages: 1,
15761
+ * },
15762
+ * });
15763
+ * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
15764
+ * ```
15765
+ */
15766
+ async recontextImage(params) {
15767
+ var _a, _b;
15768
+ let response;
15769
+ let path = '';
15770
+ let queryParams = {};
15771
+ if (this.apiClient.isVertexAI()) {
15772
+ const body = recontextImageParametersToVertex(this.apiClient, params);
15773
+ path = formatMap('{model}:predict', body['_url']);
15774
+ queryParams = body['_query'];
15775
+ delete body['config'];
15776
+ delete body['_url'];
15777
+ delete body['_query'];
15778
+ response = this.apiClient
15779
+ .request({
15780
+ path: path,
15781
+ queryParams: queryParams,
15782
+ body: JSON.stringify(body),
15783
+ httpMethod: 'POST',
15784
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15785
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15786
+ })
15787
+ .then((httpResponse) => {
15788
+ return httpResponse.json();
15789
+ });
15790
+ return response.then((apiResponse) => {
15791
+ const resp = recontextImageResponseFromVertex(apiResponse);
15792
+ const typedResp = new RecontextImageResponse();
15793
+ Object.assign(typedResp, resp);
15794
+ return typedResp;
15795
+ });
15796
+ }
15797
+ else {
15798
+ throw new Error('This method is only supported by the Vertex AI.');
15799
+ }
15800
+ }
15413
15801
  /**
15414
15802
  * Fetches information about a model by name.
15415
15803
  *
@@ -16374,6 +16762,9 @@ function googleSearchToMldev(fromObject) {
16374
16762
  if (fromTimeRangeFilter != null) {
16375
16763
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(fromTimeRangeFilter));
16376
16764
  }
16765
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
16766
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
16767
+ }
16377
16768
  return toObject;
16378
16769
  }
16379
16770
  function dynamicRetrievalConfigToMldev(fromObject) {
@@ -16404,6 +16795,14 @@ function urlContextToMldev() {
16404
16795
  const toObject = {};
16405
16796
  return toObject;
16406
16797
  }
16798
+ function toolComputerUseToMldev(fromObject) {
16799
+ const toObject = {};
16800
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
16801
+ if (fromEnvironment != null) {
16802
+ setValueByPath(toObject, ['environment'], fromEnvironment);
16803
+ }
16804
+ return toObject;
16805
+ }
16407
16806
  function toolToMldev(fromObject) {
16408
16807
  const toObject = {};
16409
16808
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -16441,16 +16840,16 @@ function toolToMldev(fromObject) {
16441
16840
  if (fromUrlContext != null) {
16442
16841
  setValueByPath(toObject, ['urlContext'], urlContextToMldev());
16443
16842
  }
16843
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16844
+ if (fromComputerUse != null) {
16845
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev(fromComputerUse));
16846
+ }
16444
16847
  const fromCodeExecution = getValueByPath(fromObject, [
16445
16848
  'codeExecution',
16446
16849
  ]);
16447
16850
  if (fromCodeExecution != null) {
16448
16851
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
16449
16852
  }
16450
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16451
- if (fromComputerUse != null) {
16452
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
16453
- }
16454
16853
  return toObject;
16455
16854
  }
16456
16855
  function sessionResumptionConfigToMldev(fromObject) {
@@ -17090,6 +17489,10 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17090
17489
  undefined) {
17091
17490
  throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
17092
17491
  }
17492
+ if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
17493
+ undefined) {
17494
+ throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
17495
+ }
17093
17496
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
17094
17497
  throw new Error('adapterSize parameter is not supported in Gemini API.');
17095
17498
  }
@@ -17103,12 +17506,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17103
17506
  }
17104
17507
  return toObject;
17105
17508
  }
17106
- function createTuningJobParametersToMldev(fromObject) {
17509
+ function createTuningJobParametersPrivateToMldev(fromObject) {
17107
17510
  const toObject = {};
17108
17511
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17109
17512
  if (fromBaseModel != null) {
17110
17513
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17111
17514
  }
17515
+ const fromPreTunedModel = getValueByPath(fromObject, [
17516
+ 'preTunedModel',
17517
+ ]);
17518
+ if (fromPreTunedModel != null) {
17519
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17520
+ }
17112
17521
  const fromTrainingDataset = getValueByPath(fromObject, [
17113
17522
  'trainingDataset',
17114
17523
  ]);
@@ -17222,6 +17631,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17222
17631
  if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
17223
17632
  setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
17224
17633
  }
17634
+ const fromPreTunedModelCheckpointId = getValueByPath(fromObject, [
17635
+ 'preTunedModelCheckpointId',
17636
+ ]);
17637
+ if (fromPreTunedModelCheckpointId != null) {
17638
+ setValueByPath(toObject, ['preTunedModel', 'checkpointId'], fromPreTunedModelCheckpointId);
17639
+ }
17225
17640
  const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
17226
17641
  if (parentObject !== undefined && fromAdapterSize != null) {
17227
17642
  setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
@@ -17234,12 +17649,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17234
17649
  }
17235
17650
  return toObject;
17236
17651
  }
17237
- function createTuningJobParametersToVertex(fromObject) {
17652
+ function createTuningJobParametersPrivateToVertex(fromObject) {
17238
17653
  const toObject = {};
17239
17654
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17240
17655
  if (fromBaseModel != null) {
17241
17656
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17242
17657
  }
17658
+ const fromPreTunedModel = getValueByPath(fromObject, [
17659
+ 'preTunedModel',
17660
+ ]);
17661
+ if (fromPreTunedModel != null) {
17662
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17663
+ }
17243
17664
  const fromTrainingDataset = getValueByPath(fromObject, [
17244
17665
  'trainingDataset',
17245
17666
  ]);
@@ -17314,11 +17735,11 @@ function tuningJobFromMldev(fromObject) {
17314
17735
  if (fromTunedModel != null) {
17315
17736
  setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
17316
17737
  }
17317
- const fromDistillationSpec = getValueByPath(fromObject, [
17318
- 'distillationSpec',
17738
+ const fromCustomBaseModel = getValueByPath(fromObject, [
17739
+ 'customBaseModel',
17319
17740
  ]);
17320
- if (fromDistillationSpec != null) {
17321
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
17741
+ if (fromCustomBaseModel != null) {
17742
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17322
17743
  }
17323
17744
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17324
17745
  if (fromExperiment != null) {
@@ -17328,18 +17749,14 @@ function tuningJobFromMldev(fromObject) {
17328
17749
  if (fromLabels != null) {
17329
17750
  setValueByPath(toObject, ['labels'], fromLabels);
17330
17751
  }
17752
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
17753
+ if (fromOutputUri != null) {
17754
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
17755
+ }
17331
17756
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17332
17757
  if (fromPipelineJob != null) {
17333
17758
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17334
17759
  }
17335
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17336
- if (fromSatisfiesPzi != null) {
17337
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17338
- }
17339
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17340
- if (fromSatisfiesPzs != null) {
17341
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17342
- }
17343
17760
  const fromServiceAccount = getValueByPath(fromObject, [
17344
17761
  'serviceAccount',
17345
17762
  ]);
@@ -17496,6 +17913,12 @@ function tuningJobFromVertex(fromObject) {
17496
17913
  if (fromTunedModel != null) {
17497
17914
  setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(fromTunedModel));
17498
17915
  }
17916
+ const fromPreTunedModel = getValueByPath(fromObject, [
17917
+ 'preTunedModel',
17918
+ ]);
17919
+ if (fromPreTunedModel != null) {
17920
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17921
+ }
17499
17922
  const fromSupervisedTuningSpec = getValueByPath(fromObject, [
17500
17923
  'supervisedTuningSpec',
17501
17924
  ]);
@@ -17520,11 +17943,11 @@ function tuningJobFromVertex(fromObject) {
17520
17943
  if (fromPartnerModelTuningSpec != null) {
17521
17944
  setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
17522
17945
  }
17523
- const fromDistillationSpec = getValueByPath(fromObject, [
17524
- 'distillationSpec',
17946
+ const fromCustomBaseModel = getValueByPath(fromObject, [
17947
+ 'customBaseModel',
17525
17948
  ]);
17526
- if (fromDistillationSpec != null) {
17527
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
17949
+ if (fromCustomBaseModel != null) {
17950
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17528
17951
  }
17529
17952
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17530
17953
  if (fromExperiment != null) {
@@ -17534,18 +17957,14 @@ function tuningJobFromVertex(fromObject) {
17534
17957
  if (fromLabels != null) {
17535
17958
  setValueByPath(toObject, ['labels'], fromLabels);
17536
17959
  }
17960
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
17961
+ if (fromOutputUri != null) {
17962
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
17963
+ }
17537
17964
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17538
17965
  if (fromPipelineJob != null) {
17539
17966
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17540
17967
  }
17541
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17542
- if (fromSatisfiesPzi != null) {
17543
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17544
- }
17545
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17546
- if (fromSatisfiesPzs != null) {
17547
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17548
- }
17549
17968
  const fromServiceAccount = getValueByPath(fromObject, [
17550
17969
  'serviceAccount',
17551
17970
  ]);
@@ -17631,10 +18050,22 @@ class Tunings extends BaseModule {
17631
18050
  */
17632
18051
  this.tune = async (params) => {
17633
18052
  if (this.apiClient.isVertexAI()) {
17634
- return await this.tuneInternal(params);
18053
+ if (params.baseModel.startsWith('projects/')) {
18054
+ const preTunedModel = {
18055
+ tunedModelName: params.baseModel,
18056
+ };
18057
+ const paramsPrivate = Object.assign(Object.assign({}, params), { preTunedModel: preTunedModel });
18058
+ paramsPrivate.baseModel = undefined;
18059
+ return await this.tuneInternal(paramsPrivate);
18060
+ }
18061
+ else {
18062
+ const paramsPrivate = Object.assign({}, params);
18063
+ return await this.tuneInternal(paramsPrivate);
18064
+ }
17635
18065
  }
17636
18066
  else {
17637
- const operation = await this.tuneMldevInternal(params);
18067
+ const paramsPrivate = Object.assign({}, params);
18068
+ const operation = await this.tuneMldevInternal(paramsPrivate);
17638
18069
  let tunedModelName = '';
17639
18070
  if (operation['metadata'] !== undefined &&
17640
18071
  operation['metadata']['tunedModel'] !== undefined) {
@@ -17794,7 +18225,7 @@ class Tunings extends BaseModule {
17794
18225
  let path = '';
17795
18226
  let queryParams = {};
17796
18227
  if (this.apiClient.isVertexAI()) {
17797
- const body = createTuningJobParametersToVertex(params);
18228
+ const body = createTuningJobParametersPrivateToVertex(params);
17798
18229
  path = formatMap('tuningJobs', body['_url']);
17799
18230
  queryParams = body['_query'];
17800
18231
  delete body['config'];
@@ -17836,7 +18267,7 @@ class Tunings extends BaseModule {
17836
18267
  throw new Error('This method is only supported by the Gemini Developer API.');
17837
18268
  }
17838
18269
  else {
17839
- const body = createTuningJobParametersToMldev(params);
18270
+ const body = createTuningJobParametersPrivateToMldev(params);
17840
18271
  path = formatMap('tunedModels', body['_url']);
17841
18272
  queryParams = body['_query'];
17842
18273
  delete body['config'];
@@ -17963,5 +18394,5 @@ class GoogleGenAI {
17963
18394
  }
17964
18395
  }
17965
18396
 
17966
- 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 };
18397
+ 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 };
17967
18398
  //# sourceMappingURL=index.mjs.map