@google/genai 1.13.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -423,18 +423,6 @@ var ApiSpec;
423
423
  */
424
424
  ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
425
425
  })(ApiSpec || (ApiSpec = {}));
426
- /** Required. The environment being operated. */
427
- var Environment;
428
- (function (Environment) {
429
- /**
430
- * Defaults to browser.
431
- */
432
- Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
433
- /**
434
- * Operates in a web browser.
435
- */
436
- Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
437
- })(Environment || (Environment = {}));
438
426
  /** Status of the url retrieval. */
439
427
  var UrlRetrievalStatus;
440
428
  (function (UrlRetrievalStatus) {
@@ -702,6 +690,22 @@ var JobState;
702
690
  */
703
691
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
704
692
  })(JobState || (JobState = {}));
693
+ /** Tuning mode. */
694
+ var TuningMode;
695
+ (function (TuningMode) {
696
+ /**
697
+ * Tuning mode is unspecified.
698
+ */
699
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
700
+ /**
701
+ * Full fine-tuning mode.
702
+ */
703
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
704
+ /**
705
+ * PEFT adapter tuning mode.
706
+ */
707
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
708
+ })(TuningMode || (TuningMode = {}));
705
709
  /** Optional. Adapter size for tuning. */
706
710
  var AdapterSize;
707
711
  (function (AdapterSize) {
@@ -770,6 +774,18 @@ var DynamicRetrievalConfigMode;
770
774
  */
771
775
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
772
776
  })(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
777
+ /** The environment being operated. */
778
+ var Environment;
779
+ (function (Environment) {
780
+ /**
781
+ * Defaults to browser.
782
+ */
783
+ Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
784
+ /**
785
+ * Operates in a web browser.
786
+ */
787
+ Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
788
+ })(Environment || (Environment = {}));
773
789
  /** Config for the function calling config mode. */
774
790
  var FunctionCallingConfigMode;
775
791
  (function (FunctionCallingConfigMode) {
@@ -887,6 +903,15 @@ var EditMode;
887
903
  EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
888
904
  EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
889
905
  })(EditMode || (EditMode = {}));
906
+ /** Enum that represents the segmentation mode. */
907
+ var SegmentMode;
908
+ (function (SegmentMode) {
909
+ SegmentMode["FOREGROUND"] = "FOREGROUND";
910
+ SegmentMode["BACKGROUND"] = "BACKGROUND";
911
+ SegmentMode["PROMPT"] = "PROMPT";
912
+ SegmentMode["SEMANTIC"] = "SEMANTIC";
913
+ SegmentMode["INTERACTIVE"] = "INTERACTIVE";
914
+ })(SegmentMode || (SegmentMode = {}));
890
915
  /** Enum that controls the compression quality of the generated videos. */
891
916
  var VideoCompressionQuality;
892
917
  (function (VideoCompressionQuality) {
@@ -1533,6 +1558,9 @@ class UpscaleImageResponse {
1533
1558
  /** The output images response. */
1534
1559
  class RecontextImageResponse {
1535
1560
  }
1561
+ /** The output images response. */
1562
+ class SegmentImageResponse {
1563
+ }
1536
1564
  class ListModelsResponse {
1537
1565
  }
1538
1566
  class DeleteModelResponse {
@@ -2876,6 +2904,9 @@ function googleSearchToMldev$4(fromObject) {
2876
2904
  if (fromTimeRangeFilter != null) {
2877
2905
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
2878
2906
  }
2907
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
2908
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
2909
+ }
2879
2910
  return toObject;
2880
2911
  }
2881
2912
  function dynamicRetrievalConfigToMldev$4(fromObject) {
@@ -2906,6 +2937,14 @@ function urlContextToMldev$4() {
2906
2937
  const toObject = {};
2907
2938
  return toObject;
2908
2939
  }
2940
+ function toolComputerUseToMldev$4(fromObject) {
2941
+ const toObject = {};
2942
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
2943
+ if (fromEnvironment != null) {
2944
+ setValueByPath(toObject, ['environment'], fromEnvironment);
2945
+ }
2946
+ return toObject;
2947
+ }
2909
2948
  function toolToMldev$4(fromObject) {
2910
2949
  const toObject = {};
2911
2950
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -2943,16 +2982,16 @@ function toolToMldev$4(fromObject) {
2943
2982
  if (fromUrlContext != null) {
2944
2983
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
2945
2984
  }
2985
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2986
+ if (fromComputerUse != null) {
2987
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$4(fromComputerUse));
2988
+ }
2946
2989
  const fromCodeExecution = getValueByPath(fromObject, [
2947
2990
  'codeExecution',
2948
2991
  ]);
2949
2992
  if (fromCodeExecution != null) {
2950
2993
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2951
2994
  }
2952
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2953
- if (fromComputerUse != null) {
2954
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
2955
- }
2956
2995
  return toObject;
2957
2996
  }
2958
2997
  function functionCallingConfigToMldev$2(fromObject) {
@@ -4260,6 +4299,7 @@ class Batches extends BaseModule {
4260
4299
  * ```
4261
4300
  */
4262
4301
  this.create = async (params) => {
4302
+ var _a, _b;
4263
4303
  if (this.apiClient.isVertexAI()) {
4264
4304
  const timestamp = Date.now();
4265
4305
  const timestampStr = timestamp.toString();
@@ -4284,6 +4324,55 @@ class Batches extends BaseModule {
4284
4324
  }
4285
4325
  }
4286
4326
  }
4327
+ else {
4328
+ if (Array.isArray(params.src) ||
4329
+ (typeof params.src !== 'string' && params.src.inlinedRequests)) {
4330
+ // Move system instruction to httpOptions extraBody.
4331
+ let path = '';
4332
+ let queryParams = {};
4333
+ const body = createBatchJobParametersToMldev(this.apiClient, params);
4334
+ path = formatMap('{model}:batchGenerateContent', body['_url']);
4335
+ queryParams = body['_query'];
4336
+ // Move system instruction to 'request':
4337
+ // {'systemInstruction': system_instruction}
4338
+ const batch = body['batch'];
4339
+ const inputConfig = batch['inputConfig'];
4340
+ const requestsWrapper = inputConfig['requests'];
4341
+ const requests = requestsWrapper['requests'];
4342
+ const newRequests = [];
4343
+ for (const request of requests) {
4344
+ const requestDict = request;
4345
+ if (requestDict['systemInstruction']) {
4346
+ const systemInstructionValue = requestDict['systemInstruction'];
4347
+ delete requestDict['systemInstruction'];
4348
+ const requestContent = requestDict['request'];
4349
+ requestContent['systemInstruction'] = systemInstructionValue;
4350
+ requestDict['request'] = requestContent;
4351
+ }
4352
+ newRequests.push(requestDict);
4353
+ }
4354
+ requestsWrapper['requests'] = newRequests;
4355
+ delete body['config'];
4356
+ delete body['_url'];
4357
+ delete body['_query'];
4358
+ const response = this.apiClient
4359
+ .request({
4360
+ path: path,
4361
+ queryParams: queryParams,
4362
+ body: JSON.stringify(body),
4363
+ httpMethod: 'POST',
4364
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4365
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4366
+ })
4367
+ .then((httpResponse) => {
4368
+ return httpResponse.json();
4369
+ });
4370
+ return response.then((apiResponse) => {
4371
+ const resp = batchJobFromMldev(apiResponse);
4372
+ return resp;
4373
+ });
4374
+ }
4375
+ }
4287
4376
  return await this.createInternal(params);
4288
4377
  };
4289
4378
  /**
@@ -4806,6 +4895,9 @@ function googleSearchToMldev$3(fromObject) {
4806
4895
  if (fromTimeRangeFilter != null) {
4807
4896
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(fromTimeRangeFilter));
4808
4897
  }
4898
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4899
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
4900
+ }
4809
4901
  return toObject;
4810
4902
  }
4811
4903
  function dynamicRetrievalConfigToMldev$3(fromObject) {
@@ -4836,6 +4928,14 @@ function urlContextToMldev$3() {
4836
4928
  const toObject = {};
4837
4929
  return toObject;
4838
4930
  }
4931
+ function toolComputerUseToMldev$3(fromObject) {
4932
+ const toObject = {};
4933
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
4934
+ if (fromEnvironment != null) {
4935
+ setValueByPath(toObject, ['environment'], fromEnvironment);
4936
+ }
4937
+ return toObject;
4938
+ }
4839
4939
  function toolToMldev$3(fromObject) {
4840
4940
  const toObject = {};
4841
4941
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -4873,16 +4973,16 @@ function toolToMldev$3(fromObject) {
4873
4973
  if (fromUrlContext != null) {
4874
4974
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
4875
4975
  }
4976
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4977
+ if (fromComputerUse != null) {
4978
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$3(fromComputerUse));
4979
+ }
4876
4980
  const fromCodeExecution = getValueByPath(fromObject, [
4877
4981
  'codeExecution',
4878
4982
  ]);
4879
4983
  if (fromCodeExecution != null) {
4880
4984
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4881
4985
  }
4882
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4883
- if (fromComputerUse != null) {
4884
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
4885
- }
4886
4986
  return toObject;
4887
4987
  }
4888
4988
  function functionCallingConfigToMldev$1(fromObject) {
@@ -5243,6 +5343,12 @@ function googleSearchToVertex$2(fromObject) {
5243
5343
  if (fromTimeRangeFilter != null) {
5244
5344
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$2(fromTimeRangeFilter));
5245
5345
  }
5346
+ const fromExcludeDomains = getValueByPath(fromObject, [
5347
+ 'excludeDomains',
5348
+ ]);
5349
+ if (fromExcludeDomains != null) {
5350
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5351
+ }
5246
5352
  return toObject;
5247
5353
  }
5248
5354
  function dynamicRetrievalConfigToVertex$2(fromObject) {
@@ -5269,8 +5375,14 @@ function googleSearchRetrievalToVertex$2(fromObject) {
5269
5375
  }
5270
5376
  return toObject;
5271
5377
  }
5272
- function enterpriseWebSearchToVertex$2() {
5378
+ function enterpriseWebSearchToVertex$2(fromObject) {
5273
5379
  const toObject = {};
5380
+ const fromExcludeDomains = getValueByPath(fromObject, [
5381
+ 'excludeDomains',
5382
+ ]);
5383
+ if (fromExcludeDomains != null) {
5384
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5385
+ }
5274
5386
  return toObject;
5275
5387
  }
5276
5388
  function apiKeyConfigToVertex$2(fromObject) {
@@ -5325,6 +5437,14 @@ function urlContextToVertex$2() {
5325
5437
  const toObject = {};
5326
5438
  return toObject;
5327
5439
  }
5440
+ function toolComputerUseToVertex$2(fromObject) {
5441
+ const toObject = {};
5442
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
5443
+ if (fromEnvironment != null) {
5444
+ setValueByPath(toObject, ['environment'], fromEnvironment);
5445
+ }
5446
+ return toObject;
5447
+ }
5328
5448
  function toolToVertex$2(fromObject) {
5329
5449
  const toObject = {};
5330
5450
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5357,7 +5477,7 @@ function toolToVertex$2(fromObject) {
5357
5477
  'enterpriseWebSearch',
5358
5478
  ]);
5359
5479
  if (fromEnterpriseWebSearch != null) {
5360
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
5480
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2(fromEnterpriseWebSearch));
5361
5481
  }
5362
5482
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5363
5483
  if (fromGoogleMaps != null) {
@@ -5367,16 +5487,16 @@ function toolToVertex$2(fromObject) {
5367
5487
  if (fromUrlContext != null) {
5368
5488
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
5369
5489
  }
5490
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5491
+ if (fromComputerUse != null) {
5492
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$2(fromComputerUse));
5493
+ }
5370
5494
  const fromCodeExecution = getValueByPath(fromObject, [
5371
5495
  'codeExecution',
5372
5496
  ]);
5373
5497
  if (fromCodeExecution != null) {
5374
5498
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5375
5499
  }
5376
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5377
- if (fromComputerUse != null) {
5378
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5379
- }
5380
5500
  return toObject;
5381
5501
  }
5382
5502
  function functionCallingConfigToVertex$1(fromObject) {
@@ -6163,9 +6283,6 @@ function isValidContent(content) {
6163
6283
  if (part === undefined || Object.keys(part).length === 0) {
6164
6284
  return false;
6165
6285
  }
6166
- if (!part.thought && part.text !== undefined && part.text === '') {
6167
- return false;
6168
- }
6169
6286
  }
6170
6287
  return true;
6171
6288
  }
@@ -7262,6 +7379,9 @@ function googleSearchToMldev$2(fromObject) {
7262
7379
  if (fromTimeRangeFilter != null) {
7263
7380
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(fromTimeRangeFilter));
7264
7381
  }
7382
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7383
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
7384
+ }
7265
7385
  return toObject;
7266
7386
  }
7267
7387
  function dynamicRetrievalConfigToMldev$2(fromObject) {
@@ -7292,6 +7412,14 @@ function urlContextToMldev$2() {
7292
7412
  const toObject = {};
7293
7413
  return toObject;
7294
7414
  }
7415
+ function toolComputerUseToMldev$2(fromObject) {
7416
+ const toObject = {};
7417
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
7418
+ if (fromEnvironment != null) {
7419
+ setValueByPath(toObject, ['environment'], fromEnvironment);
7420
+ }
7421
+ return toObject;
7422
+ }
7295
7423
  function toolToMldev$2(fromObject) {
7296
7424
  const toObject = {};
7297
7425
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -7329,16 +7457,16 @@ function toolToMldev$2(fromObject) {
7329
7457
  if (fromUrlContext != null) {
7330
7458
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
7331
7459
  }
7460
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7461
+ if (fromComputerUse != null) {
7462
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$2(fromComputerUse));
7463
+ }
7332
7464
  const fromCodeExecution = getValueByPath(fromObject, [
7333
7465
  'codeExecution',
7334
7466
  ]);
7335
7467
  if (fromCodeExecution != null) {
7336
7468
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7337
7469
  }
7338
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7339
- if (fromComputerUse != null) {
7340
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7341
- }
7342
7470
  return toObject;
7343
7471
  }
7344
7472
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -7954,6 +8082,12 @@ function googleSearchToVertex$1(fromObject) {
7954
8082
  if (fromTimeRangeFilter != null) {
7955
8083
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$1(fromTimeRangeFilter));
7956
8084
  }
8085
+ const fromExcludeDomains = getValueByPath(fromObject, [
8086
+ 'excludeDomains',
8087
+ ]);
8088
+ if (fromExcludeDomains != null) {
8089
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8090
+ }
7957
8091
  return toObject;
7958
8092
  }
7959
8093
  function dynamicRetrievalConfigToVertex$1(fromObject) {
@@ -7980,8 +8114,14 @@ function googleSearchRetrievalToVertex$1(fromObject) {
7980
8114
  }
7981
8115
  return toObject;
7982
8116
  }
7983
- function enterpriseWebSearchToVertex$1() {
8117
+ function enterpriseWebSearchToVertex$1(fromObject) {
7984
8118
  const toObject = {};
8119
+ const fromExcludeDomains = getValueByPath(fromObject, [
8120
+ 'excludeDomains',
8121
+ ]);
8122
+ if (fromExcludeDomains != null) {
8123
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8124
+ }
7985
8125
  return toObject;
7986
8126
  }
7987
8127
  function apiKeyConfigToVertex$1(fromObject) {
@@ -8036,6 +8176,14 @@ function urlContextToVertex$1() {
8036
8176
  const toObject = {};
8037
8177
  return toObject;
8038
8178
  }
8179
+ function toolComputerUseToVertex$1(fromObject) {
8180
+ const toObject = {};
8181
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8182
+ if (fromEnvironment != null) {
8183
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8184
+ }
8185
+ return toObject;
8186
+ }
8039
8187
  function toolToVertex$1(fromObject) {
8040
8188
  const toObject = {};
8041
8189
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -8068,7 +8216,7 @@ function toolToVertex$1(fromObject) {
8068
8216
  'enterpriseWebSearch',
8069
8217
  ]);
8070
8218
  if (fromEnterpriseWebSearch != null) {
8071
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
8219
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1(fromEnterpriseWebSearch));
8072
8220
  }
8073
8221
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
8074
8222
  if (fromGoogleMaps != null) {
@@ -8078,16 +8226,16 @@ function toolToVertex$1(fromObject) {
8078
8226
  if (fromUrlContext != null) {
8079
8227
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
8080
8228
  }
8229
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8230
+ if (fromComputerUse != null) {
8231
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$1(fromComputerUse));
8232
+ }
8081
8233
  const fromCodeExecution = getValueByPath(fromObject, [
8082
8234
  'codeExecution',
8083
8235
  ]);
8084
8236
  if (fromCodeExecution != null) {
8085
8237
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8086
8238
  }
8087
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8088
- if (fromComputerUse != null) {
8089
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
8090
- }
8091
8239
  return toObject;
8092
8240
  }
8093
8241
  function sessionResumptionConfigToVertex(fromObject) {
@@ -9615,6 +9763,9 @@ function googleSearchToMldev$1(fromObject) {
9615
9763
  if (fromTimeRangeFilter != null) {
9616
9764
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(fromTimeRangeFilter));
9617
9765
  }
9766
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9767
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
9768
+ }
9618
9769
  return toObject;
9619
9770
  }
9620
9771
  function dynamicRetrievalConfigToMldev$1(fromObject) {
@@ -9645,6 +9796,14 @@ function urlContextToMldev$1() {
9645
9796
  const toObject = {};
9646
9797
  return toObject;
9647
9798
  }
9799
+ function toolComputerUseToMldev$1(fromObject) {
9800
+ const toObject = {};
9801
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
9802
+ if (fromEnvironment != null) {
9803
+ setValueByPath(toObject, ['environment'], fromEnvironment);
9804
+ }
9805
+ return toObject;
9806
+ }
9648
9807
  function toolToMldev$1(fromObject) {
9649
9808
  const toObject = {};
9650
9809
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -9682,16 +9841,16 @@ function toolToMldev$1(fromObject) {
9682
9841
  if (fromUrlContext != null) {
9683
9842
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
9684
9843
  }
9844
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
9845
+ if (fromComputerUse != null) {
9846
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$1(fromComputerUse));
9847
+ }
9685
9848
  const fromCodeExecution = getValueByPath(fromObject, [
9686
9849
  'codeExecution',
9687
9850
  ]);
9688
9851
  if (fromCodeExecution != null) {
9689
9852
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
9690
9853
  }
9691
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
9692
- if (fromComputerUse != null) {
9693
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
9694
- }
9695
9854
  return toObject;
9696
9855
  }
9697
9856
  function functionCallingConfigToMldev(fromObject) {
@@ -10328,6 +10487,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
10328
10487
  if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
10329
10488
  throw new Error('lastFrame parameter is not supported in Gemini API.');
10330
10489
  }
10490
+ if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
10491
+ throw new Error('referenceImages parameter is not supported in Gemini API.');
10492
+ }
10331
10493
  if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
10332
10494
  throw new Error('compressionQuality parameter is not supported in Gemini API.');
10333
10495
  }
@@ -10655,6 +10817,12 @@ function googleSearchToVertex(fromObject) {
10655
10817
  if (fromTimeRangeFilter != null) {
10656
10818
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex(fromTimeRangeFilter));
10657
10819
  }
10820
+ const fromExcludeDomains = getValueByPath(fromObject, [
10821
+ 'excludeDomains',
10822
+ ]);
10823
+ if (fromExcludeDomains != null) {
10824
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
10825
+ }
10658
10826
  return toObject;
10659
10827
  }
10660
10828
  function dynamicRetrievalConfigToVertex(fromObject) {
@@ -10681,8 +10849,14 @@ function googleSearchRetrievalToVertex(fromObject) {
10681
10849
  }
10682
10850
  return toObject;
10683
10851
  }
10684
- function enterpriseWebSearchToVertex() {
10852
+ function enterpriseWebSearchToVertex(fromObject) {
10685
10853
  const toObject = {};
10854
+ const fromExcludeDomains = getValueByPath(fromObject, [
10855
+ 'excludeDomains',
10856
+ ]);
10857
+ if (fromExcludeDomains != null) {
10858
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
10859
+ }
10686
10860
  return toObject;
10687
10861
  }
10688
10862
  function apiKeyConfigToVertex(fromObject) {
@@ -10737,6 +10911,14 @@ function urlContextToVertex() {
10737
10911
  const toObject = {};
10738
10912
  return toObject;
10739
10913
  }
10914
+ function toolComputerUseToVertex(fromObject) {
10915
+ const toObject = {};
10916
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
10917
+ if (fromEnvironment != null) {
10918
+ setValueByPath(toObject, ['environment'], fromEnvironment);
10919
+ }
10920
+ return toObject;
10921
+ }
10740
10922
  function toolToVertex(fromObject) {
10741
10923
  const toObject = {};
10742
10924
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10769,7 +10951,7 @@ function toolToVertex(fromObject) {
10769
10951
  'enterpriseWebSearch',
10770
10952
  ]);
10771
10953
  if (fromEnterpriseWebSearch != null) {
10772
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
10954
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex(fromEnterpriseWebSearch));
10773
10955
  }
10774
10956
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10775
10957
  if (fromGoogleMaps != null) {
@@ -10779,16 +10961,16 @@ function toolToVertex(fromObject) {
10779
10961
  if (fromUrlContext != null) {
10780
10962
  setValueByPath(toObject, ['urlContext'], urlContextToVertex());
10781
10963
  }
10964
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10965
+ if (fromComputerUse != null) {
10966
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex(fromComputerUse));
10967
+ }
10782
10968
  const fromCodeExecution = getValueByPath(fromObject, [
10783
10969
  'codeExecution',
10784
10970
  ]);
10785
10971
  if (fromCodeExecution != null) {
10786
10972
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10787
10973
  }
10788
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10789
- if (fromComputerUse != null) {
10790
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10791
- }
10792
10974
  return toObject;
10793
10975
  }
10794
10976
  function functionCallingConfigToVertex(fromObject) {
@@ -11618,6 +11800,78 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
11618
11800
  }
11619
11801
  return toObject;
11620
11802
  }
11803
+ function scribbleImageToVertex(fromObject) {
11804
+ const toObject = {};
11805
+ const fromImage = getValueByPath(fromObject, ['image']);
11806
+ if (fromImage != null) {
11807
+ setValueByPath(toObject, ['image'], imageToVertex(fromImage));
11808
+ }
11809
+ return toObject;
11810
+ }
11811
+ function segmentImageSourceToVertex(fromObject, parentObject) {
11812
+ const toObject = {};
11813
+ const fromPrompt = getValueByPath(fromObject, ['prompt']);
11814
+ if (parentObject !== undefined && fromPrompt != null) {
11815
+ setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
11816
+ }
11817
+ const fromImage = getValueByPath(fromObject, ['image']);
11818
+ if (parentObject !== undefined && fromImage != null) {
11819
+ setValueByPath(parentObject, ['instances[0]', 'image'], imageToVertex(fromImage));
11820
+ }
11821
+ const fromScribbleImage = getValueByPath(fromObject, [
11822
+ 'scribbleImage',
11823
+ ]);
11824
+ if (parentObject !== undefined && fromScribbleImage != null) {
11825
+ setValueByPath(parentObject, ['instances[0]', 'scribble'], scribbleImageToVertex(fromScribbleImage));
11826
+ }
11827
+ return toObject;
11828
+ }
11829
+ function segmentImageConfigToVertex(fromObject, parentObject) {
11830
+ const toObject = {};
11831
+ const fromMode = getValueByPath(fromObject, ['mode']);
11832
+ if (parentObject !== undefined && fromMode != null) {
11833
+ setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
11834
+ }
11835
+ const fromMaxPredictions = getValueByPath(fromObject, [
11836
+ 'maxPredictions',
11837
+ ]);
11838
+ if (parentObject !== undefined && fromMaxPredictions != null) {
11839
+ setValueByPath(parentObject, ['parameters', 'maxPredictions'], fromMaxPredictions);
11840
+ }
11841
+ const fromConfidenceThreshold = getValueByPath(fromObject, [
11842
+ 'confidenceThreshold',
11843
+ ]);
11844
+ if (parentObject !== undefined && fromConfidenceThreshold != null) {
11845
+ setValueByPath(parentObject, ['parameters', 'confidenceThreshold'], fromConfidenceThreshold);
11846
+ }
11847
+ const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
11848
+ if (parentObject !== undefined && fromMaskDilation != null) {
11849
+ setValueByPath(parentObject, ['parameters', 'maskDilation'], fromMaskDilation);
11850
+ }
11851
+ const fromBinaryColorThreshold = getValueByPath(fromObject, [
11852
+ 'binaryColorThreshold',
11853
+ ]);
11854
+ if (parentObject !== undefined && fromBinaryColorThreshold != null) {
11855
+ setValueByPath(parentObject, ['parameters', 'binaryColorThreshold'], fromBinaryColorThreshold);
11856
+ }
11857
+ return toObject;
11858
+ }
11859
+ function segmentImageParametersToVertex(apiClient, fromObject) {
11860
+ const toObject = {};
11861
+ const fromModel = getValueByPath(fromObject, ['model']);
11862
+ if (fromModel != null) {
11863
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
11864
+ }
11865
+ const fromSource = getValueByPath(fromObject, ['source']);
11866
+ if (fromSource != null) {
11867
+ setValueByPath(toObject, ['config'], segmentImageSourceToVertex(fromSource, toObject));
11868
+ }
11869
+ const fromConfig = getValueByPath(fromObject, ['config']);
11870
+ if (fromConfig != null) {
11871
+ setValueByPath(toObject, ['config'], segmentImageConfigToVertex(fromConfig, toObject));
11872
+ }
11873
+ return toObject;
11874
+ }
11621
11875
  function getModelParametersToVertex(apiClient, fromObject) {
11622
11876
  const toObject = {};
11623
11877
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -11786,6 +12040,20 @@ function videoToVertex(fromObject) {
11786
12040
  }
11787
12041
  return toObject;
11788
12042
  }
12043
+ function videoGenerationReferenceImageToVertex(fromObject) {
12044
+ const toObject = {};
12045
+ const fromImage = getValueByPath(fromObject, ['image']);
12046
+ if (fromImage != null) {
12047
+ setValueByPath(toObject, ['image'], imageToVertex(fromImage));
12048
+ }
12049
+ const fromReferenceType = getValueByPath(fromObject, [
12050
+ 'referenceType',
12051
+ ]);
12052
+ if (fromReferenceType != null) {
12053
+ setValueByPath(toObject, ['referenceType'], fromReferenceType);
12054
+ }
12055
+ return toObject;
12056
+ }
11789
12057
  function generateVideosConfigToVertex(fromObject, parentObject) {
11790
12058
  const toObject = {};
11791
12059
  const fromNumberOfVideos = getValueByPath(fromObject, [
@@ -11852,6 +12120,18 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
11852
12120
  if (parentObject !== undefined && fromLastFrame != null) {
11853
12121
  setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
11854
12122
  }
12123
+ const fromReferenceImages = getValueByPath(fromObject, [
12124
+ 'referenceImages',
12125
+ ]);
12126
+ if (parentObject !== undefined && fromReferenceImages != null) {
12127
+ let transformedList = fromReferenceImages;
12128
+ if (Array.isArray(transformedList)) {
12129
+ transformedList = transformedList.map((item) => {
12130
+ return videoGenerationReferenceImageToVertex(item);
12131
+ });
12132
+ }
12133
+ setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
12134
+ }
11855
12135
  const fromCompressionQuality = getValueByPath(fromObject, [
11856
12136
  'compressionQuality',
11857
12137
  ]);
@@ -12901,6 +13181,50 @@ function recontextImageResponseFromVertex(fromObject) {
12901
13181
  }
12902
13182
  return toObject;
12903
13183
  }
13184
+ function entityLabelFromVertex(fromObject) {
13185
+ const toObject = {};
13186
+ const fromLabel = getValueByPath(fromObject, ['label']);
13187
+ if (fromLabel != null) {
13188
+ setValueByPath(toObject, ['label'], fromLabel);
13189
+ }
13190
+ const fromScore = getValueByPath(fromObject, ['score']);
13191
+ if (fromScore != null) {
13192
+ setValueByPath(toObject, ['score'], fromScore);
13193
+ }
13194
+ return toObject;
13195
+ }
13196
+ function generatedImageMaskFromVertex(fromObject) {
13197
+ const toObject = {};
13198
+ const fromMask = getValueByPath(fromObject, ['_self']);
13199
+ if (fromMask != null) {
13200
+ setValueByPath(toObject, ['mask'], imageFromVertex(fromMask));
13201
+ }
13202
+ const fromLabels = getValueByPath(fromObject, ['labels']);
13203
+ if (fromLabels != null) {
13204
+ let transformedList = fromLabels;
13205
+ if (Array.isArray(transformedList)) {
13206
+ transformedList = transformedList.map((item) => {
13207
+ return entityLabelFromVertex(item);
13208
+ });
13209
+ }
13210
+ setValueByPath(toObject, ['labels'], transformedList);
13211
+ }
13212
+ return toObject;
13213
+ }
13214
+ function segmentImageResponseFromVertex(fromObject) {
13215
+ const toObject = {};
13216
+ const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
13217
+ if (fromGeneratedMasks != null) {
13218
+ let transformedList = fromGeneratedMasks;
13219
+ if (Array.isArray(transformedList)) {
13220
+ transformedList = transformedList.map((item) => {
13221
+ return generatedImageMaskFromVertex(item);
13222
+ });
13223
+ }
13224
+ setValueByPath(toObject, ['generatedMasks'], transformedList);
13225
+ }
13226
+ return toObject;
13227
+ }
12904
13228
  function endpointFromVertex(fromObject) {
12905
13229
  const toObject = {};
12906
13230
  const fromName = getValueByPath(fromObject, ['endpoint']);
@@ -13148,7 +13472,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
13148
13472
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
13149
13473
  const USER_AGENT_HEADER = 'User-Agent';
13150
13474
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
13151
- const SDK_VERSION = '1.13.0'; // x-release-please-version
13475
+ const SDK_VERSION = '1.15.0'; // x-release-please-version
13152
13476
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
13153
13477
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
13154
13478
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15591,6 +15915,61 @@ class Models extends BaseModule {
15591
15915
  throw new Error('This method is only supported by the Vertex AI.');
15592
15916
  }
15593
15917
  }
15918
+ /**
15919
+ * Segments an image, creating a mask of a specified area.
15920
+ *
15921
+ * @param params - The parameters for segmenting an image.
15922
+ * @return The response from the API.
15923
+ *
15924
+ * @example
15925
+ * ```ts
15926
+ * const response = await ai.models.segmentImage({
15927
+ * model: 'image-segmentation-001',
15928
+ * source: {
15929
+ * image: image,
15930
+ * },
15931
+ * config: {
15932
+ * mode: 'foreground',
15933
+ * },
15934
+ * });
15935
+ * console.log(response?.generatedMasks?.[0]?.mask?.imageBytes);
15936
+ * ```
15937
+ */
15938
+ async segmentImage(params) {
15939
+ var _a, _b;
15940
+ let response;
15941
+ let path = '';
15942
+ let queryParams = {};
15943
+ if (this.apiClient.isVertexAI()) {
15944
+ const body = segmentImageParametersToVertex(this.apiClient, params);
15945
+ path = formatMap('{model}:predict', body['_url']);
15946
+ queryParams = body['_query'];
15947
+ delete body['config'];
15948
+ delete body['_url'];
15949
+ delete body['_query'];
15950
+ response = this.apiClient
15951
+ .request({
15952
+ path: path,
15953
+ queryParams: queryParams,
15954
+ body: JSON.stringify(body),
15955
+ httpMethod: 'POST',
15956
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15957
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15958
+ })
15959
+ .then((httpResponse) => {
15960
+ return httpResponse.json();
15961
+ });
15962
+ return response.then((apiResponse) => {
15963
+ const resp = segmentImageResponseFromVertex(apiResponse);
15964
+ const typedResp = new SegmentImageResponse();
15965
+ Object.assign(typedResp, resp);
15966
+ return typedResp;
15967
+ });
15968
+ }
15969
+ else {
15970
+ throw new Error('This method is only supported by the Vertex AI.');
15971
+ }
15972
+ }
15594
15973
  /**
15595
15974
  * Fetches information about a model by name.
15596
15975
  *
@@ -16555,6 +16934,9 @@ function googleSearchToMldev(fromObject) {
16555
16934
  if (fromTimeRangeFilter != null) {
16556
16935
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(fromTimeRangeFilter));
16557
16936
  }
16937
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
16938
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
16939
+ }
16558
16940
  return toObject;
16559
16941
  }
16560
16942
  function dynamicRetrievalConfigToMldev(fromObject) {
@@ -16585,6 +16967,14 @@ function urlContextToMldev() {
16585
16967
  const toObject = {};
16586
16968
  return toObject;
16587
16969
  }
16970
+ function toolComputerUseToMldev(fromObject) {
16971
+ const toObject = {};
16972
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
16973
+ if (fromEnvironment != null) {
16974
+ setValueByPath(toObject, ['environment'], fromEnvironment);
16975
+ }
16976
+ return toObject;
16977
+ }
16588
16978
  function toolToMldev(fromObject) {
16589
16979
  const toObject = {};
16590
16980
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -16622,16 +17012,16 @@ function toolToMldev(fromObject) {
16622
17012
  if (fromUrlContext != null) {
16623
17013
  setValueByPath(toObject, ['urlContext'], urlContextToMldev());
16624
17014
  }
17015
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
17016
+ if (fromComputerUse != null) {
17017
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev(fromComputerUse));
17018
+ }
16625
17019
  const fromCodeExecution = getValueByPath(fromObject, [
16626
17020
  'codeExecution',
16627
17021
  ]);
16628
17022
  if (fromCodeExecution != null) {
16629
17023
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
16630
17024
  }
16631
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16632
- if (fromComputerUse != null) {
16633
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
16634
- }
16635
17025
  return toObject;
16636
17026
  }
16637
17027
  function sessionResumptionConfigToMldev(fromObject) {
@@ -17445,6 +17835,10 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17445
17835
  undefined) {
17446
17836
  throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
17447
17837
  }
17838
+ if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
17839
+ undefined) {
17840
+ throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
17841
+ }
17448
17842
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
17449
17843
  throw new Error('adapterSize parameter is not supported in Gemini API.');
17450
17844
  }
@@ -17458,12 +17852,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17458
17852
  }
17459
17853
  return toObject;
17460
17854
  }
17461
- function createTuningJobParametersToMldev(fromObject) {
17855
+ function createTuningJobParametersPrivateToMldev(fromObject) {
17462
17856
  const toObject = {};
17463
17857
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17464
17858
  if (fromBaseModel != null) {
17465
17859
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17466
17860
  }
17861
+ const fromPreTunedModel = getValueByPath(fromObject, [
17862
+ 'preTunedModel',
17863
+ ]);
17864
+ if (fromPreTunedModel != null) {
17865
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17866
+ }
17467
17867
  const fromTrainingDataset = getValueByPath(fromObject, [
17468
17868
  'trainingDataset',
17469
17869
  ]);
@@ -17577,6 +17977,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17577
17977
  if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
17578
17978
  setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
17579
17979
  }
17980
+ const fromPreTunedModelCheckpointId = getValueByPath(fromObject, [
17981
+ 'preTunedModelCheckpointId',
17982
+ ]);
17983
+ if (fromPreTunedModelCheckpointId != null) {
17984
+ setValueByPath(toObject, ['preTunedModel', 'checkpointId'], fromPreTunedModelCheckpointId);
17985
+ }
17580
17986
  const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
17581
17987
  if (parentObject !== undefined && fromAdapterSize != null) {
17582
17988
  setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
@@ -17589,12 +17995,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17589
17995
  }
17590
17996
  return toObject;
17591
17997
  }
17592
- function createTuningJobParametersToVertex(fromObject) {
17998
+ function createTuningJobParametersPrivateToVertex(fromObject) {
17593
17999
  const toObject = {};
17594
18000
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17595
18001
  if (fromBaseModel != null) {
17596
18002
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17597
18003
  }
18004
+ const fromPreTunedModel = getValueByPath(fromObject, [
18005
+ 'preTunedModel',
18006
+ ]);
18007
+ if (fromPreTunedModel != null) {
18008
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
18009
+ }
17598
18010
  const fromTrainingDataset = getValueByPath(fromObject, [
17599
18011
  'trainingDataset',
17600
18012
  ]);
@@ -17669,11 +18081,11 @@ function tuningJobFromMldev(fromObject) {
17669
18081
  if (fromTunedModel != null) {
17670
18082
  setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
17671
18083
  }
17672
- const fromDistillationSpec = getValueByPath(fromObject, [
17673
- 'distillationSpec',
18084
+ const fromCustomBaseModel = getValueByPath(fromObject, [
18085
+ 'customBaseModel',
17674
18086
  ]);
17675
- if (fromDistillationSpec != null) {
17676
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18087
+ if (fromCustomBaseModel != null) {
18088
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17677
18089
  }
17678
18090
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17679
18091
  if (fromExperiment != null) {
@@ -17683,18 +18095,14 @@ function tuningJobFromMldev(fromObject) {
17683
18095
  if (fromLabels != null) {
17684
18096
  setValueByPath(toObject, ['labels'], fromLabels);
17685
18097
  }
18098
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18099
+ if (fromOutputUri != null) {
18100
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
18101
+ }
17686
18102
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17687
18103
  if (fromPipelineJob != null) {
17688
18104
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17689
18105
  }
17690
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17691
- if (fromSatisfiesPzi != null) {
17692
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17693
- }
17694
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17695
- if (fromSatisfiesPzs != null) {
17696
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17697
- }
17698
18106
  const fromServiceAccount = getValueByPath(fromObject, [
17699
18107
  'serviceAccount',
17700
18108
  ]);
@@ -17851,6 +18259,12 @@ function tuningJobFromVertex(fromObject) {
17851
18259
  if (fromTunedModel != null) {
17852
18260
  setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(fromTunedModel));
17853
18261
  }
18262
+ const fromPreTunedModel = getValueByPath(fromObject, [
18263
+ 'preTunedModel',
18264
+ ]);
18265
+ if (fromPreTunedModel != null) {
18266
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
18267
+ }
17854
18268
  const fromSupervisedTuningSpec = getValueByPath(fromObject, [
17855
18269
  'supervisedTuningSpec',
17856
18270
  ]);
@@ -17875,11 +18289,11 @@ function tuningJobFromVertex(fromObject) {
17875
18289
  if (fromPartnerModelTuningSpec != null) {
17876
18290
  setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
17877
18291
  }
17878
- const fromDistillationSpec = getValueByPath(fromObject, [
17879
- 'distillationSpec',
18292
+ const fromCustomBaseModel = getValueByPath(fromObject, [
18293
+ 'customBaseModel',
17880
18294
  ]);
17881
- if (fromDistillationSpec != null) {
17882
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18295
+ if (fromCustomBaseModel != null) {
18296
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17883
18297
  }
17884
18298
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17885
18299
  if (fromExperiment != null) {
@@ -17889,18 +18303,14 @@ function tuningJobFromVertex(fromObject) {
17889
18303
  if (fromLabels != null) {
17890
18304
  setValueByPath(toObject, ['labels'], fromLabels);
17891
18305
  }
18306
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18307
+ if (fromOutputUri != null) {
18308
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
18309
+ }
17892
18310
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17893
18311
  if (fromPipelineJob != null) {
17894
18312
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17895
18313
  }
17896
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17897
- if (fromSatisfiesPzi != null) {
17898
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17899
- }
17900
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17901
- if (fromSatisfiesPzs != null) {
17902
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17903
- }
17904
18314
  const fromServiceAccount = getValueByPath(fromObject, [
17905
18315
  'serviceAccount',
17906
18316
  ]);
@@ -17986,10 +18396,22 @@ class Tunings extends BaseModule {
17986
18396
  */
17987
18397
  this.tune = async (params) => {
17988
18398
  if (this.apiClient.isVertexAI()) {
17989
- return await this.tuneInternal(params);
18399
+ if (params.baseModel.startsWith('projects/')) {
18400
+ const preTunedModel = {
18401
+ tunedModelName: params.baseModel,
18402
+ };
18403
+ const paramsPrivate = Object.assign(Object.assign({}, params), { preTunedModel: preTunedModel });
18404
+ paramsPrivate.baseModel = undefined;
18405
+ return await this.tuneInternal(paramsPrivate);
18406
+ }
18407
+ else {
18408
+ const paramsPrivate = Object.assign({}, params);
18409
+ return await this.tuneInternal(paramsPrivate);
18410
+ }
17990
18411
  }
17991
18412
  else {
17992
- const operation = await this.tuneMldevInternal(params);
18413
+ const paramsPrivate = Object.assign({}, params);
18414
+ const operation = await this.tuneMldevInternal(paramsPrivate);
17993
18415
  let tunedModelName = '';
17994
18416
  if (operation['metadata'] !== undefined &&
17995
18417
  operation['metadata']['tunedModel'] !== undefined) {
@@ -18149,7 +18571,7 @@ class Tunings extends BaseModule {
18149
18571
  let path = '';
18150
18572
  let queryParams = {};
18151
18573
  if (this.apiClient.isVertexAI()) {
18152
- const body = createTuningJobParametersToVertex(params);
18574
+ const body = createTuningJobParametersPrivateToVertex(params);
18153
18575
  path = formatMap('tuningJobs', body['_url']);
18154
18576
  queryParams = body['_query'];
18155
18577
  delete body['config'];
@@ -18191,7 +18613,7 @@ class Tunings extends BaseModule {
18191
18613
  throw new Error('This method is only supported by the Gemini Developer API.');
18192
18614
  }
18193
18615
  else {
18194
- const body = createTuningJobParametersToMldev(params);
18616
+ const body = createTuningJobParametersPrivateToMldev(params);
18195
18617
  path = formatMap('tunedModels', body['_url']);
18196
18618
  queryParams = body['_query'];
18197
18619
  delete body['config'];
@@ -18629,5 +19051,5 @@ function getApiKeyFromEnv() {
18629
19051
  return envGoogleApiKey || envGeminiApiKey;
18630
19052
  }
18631
19053
 
18632
- 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, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
19054
+ 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, SegmentImageResponse, SegmentMode, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
18633
19055
  //# sourceMappingURL=index.mjs.map