@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.
@@ -417,18 +417,6 @@ var ApiSpec;
417
417
  */
418
418
  ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
419
419
  })(ApiSpec || (ApiSpec = {}));
420
- /** Required. The environment being operated. */
421
- var Environment;
422
- (function (Environment) {
423
- /**
424
- * Defaults to browser.
425
- */
426
- Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
427
- /**
428
- * Operates in a web browser.
429
- */
430
- Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
431
- })(Environment || (Environment = {}));
432
420
  /** Status of the url retrieval. */
433
421
  var UrlRetrievalStatus;
434
422
  (function (UrlRetrievalStatus) {
@@ -696,6 +684,22 @@ var JobState;
696
684
  */
697
685
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
698
686
  })(JobState || (JobState = {}));
687
+ /** Tuning mode. */
688
+ var TuningMode;
689
+ (function (TuningMode) {
690
+ /**
691
+ * Tuning mode is unspecified.
692
+ */
693
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
694
+ /**
695
+ * Full fine-tuning mode.
696
+ */
697
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
698
+ /**
699
+ * PEFT adapter tuning mode.
700
+ */
701
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
702
+ })(TuningMode || (TuningMode = {}));
699
703
  /** Optional. Adapter size for tuning. */
700
704
  var AdapterSize;
701
705
  (function (AdapterSize) {
@@ -764,6 +768,18 @@ var DynamicRetrievalConfigMode;
764
768
  */
765
769
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
766
770
  })(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
771
+ /** The environment being operated. */
772
+ var Environment;
773
+ (function (Environment) {
774
+ /**
775
+ * Defaults to browser.
776
+ */
777
+ Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
778
+ /**
779
+ * Operates in a web browser.
780
+ */
781
+ Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
782
+ })(Environment || (Environment = {}));
767
783
  /** Config for the function calling config mode. */
768
784
  var FunctionCallingConfigMode;
769
785
  (function (FunctionCallingConfigMode) {
@@ -881,6 +897,15 @@ var EditMode;
881
897
  EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
882
898
  EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
883
899
  })(EditMode || (EditMode = {}));
900
+ /** Enum that represents the segmentation mode. */
901
+ var SegmentMode;
902
+ (function (SegmentMode) {
903
+ SegmentMode["FOREGROUND"] = "FOREGROUND";
904
+ SegmentMode["BACKGROUND"] = "BACKGROUND";
905
+ SegmentMode["PROMPT"] = "PROMPT";
906
+ SegmentMode["SEMANTIC"] = "SEMANTIC";
907
+ SegmentMode["INTERACTIVE"] = "INTERACTIVE";
908
+ })(SegmentMode || (SegmentMode = {}));
884
909
  /** Enum that controls the compression quality of the generated videos. */
885
910
  var VideoCompressionQuality;
886
911
  (function (VideoCompressionQuality) {
@@ -1527,6 +1552,9 @@ class UpscaleImageResponse {
1527
1552
  /** The output images response. */
1528
1553
  class RecontextImageResponse {
1529
1554
  }
1555
+ /** The output images response. */
1556
+ class SegmentImageResponse {
1557
+ }
1530
1558
  class ListModelsResponse {
1531
1559
  }
1532
1560
  class DeleteModelResponse {
@@ -2870,6 +2898,9 @@ function googleSearchToMldev$4(fromObject) {
2870
2898
  if (fromTimeRangeFilter != null) {
2871
2899
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
2872
2900
  }
2901
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
2902
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
2903
+ }
2873
2904
  return toObject;
2874
2905
  }
2875
2906
  function dynamicRetrievalConfigToMldev$4(fromObject) {
@@ -2900,6 +2931,14 @@ function urlContextToMldev$4() {
2900
2931
  const toObject = {};
2901
2932
  return toObject;
2902
2933
  }
2934
+ function toolComputerUseToMldev$4(fromObject) {
2935
+ const toObject = {};
2936
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
2937
+ if (fromEnvironment != null) {
2938
+ setValueByPath(toObject, ['environment'], fromEnvironment);
2939
+ }
2940
+ return toObject;
2941
+ }
2903
2942
  function toolToMldev$4(fromObject) {
2904
2943
  const toObject = {};
2905
2944
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -2937,16 +2976,16 @@ function toolToMldev$4(fromObject) {
2937
2976
  if (fromUrlContext != null) {
2938
2977
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
2939
2978
  }
2979
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2980
+ if (fromComputerUse != null) {
2981
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$4(fromComputerUse));
2982
+ }
2940
2983
  const fromCodeExecution = getValueByPath(fromObject, [
2941
2984
  'codeExecution',
2942
2985
  ]);
2943
2986
  if (fromCodeExecution != null) {
2944
2987
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2945
2988
  }
2946
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2947
- if (fromComputerUse != null) {
2948
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
2949
- }
2950
2989
  return toObject;
2951
2990
  }
2952
2991
  function functionCallingConfigToMldev$2(fromObject) {
@@ -4254,6 +4293,7 @@ class Batches extends BaseModule {
4254
4293
  * ```
4255
4294
  */
4256
4295
  this.create = async (params) => {
4296
+ var _a, _b;
4257
4297
  if (this.apiClient.isVertexAI()) {
4258
4298
  const timestamp = Date.now();
4259
4299
  const timestampStr = timestamp.toString();
@@ -4278,6 +4318,55 @@ class Batches extends BaseModule {
4278
4318
  }
4279
4319
  }
4280
4320
  }
4321
+ else {
4322
+ if (Array.isArray(params.src) ||
4323
+ (typeof params.src !== 'string' && params.src.inlinedRequests)) {
4324
+ // Move system instruction to httpOptions extraBody.
4325
+ let path = '';
4326
+ let queryParams = {};
4327
+ const body = createBatchJobParametersToMldev(this.apiClient, params);
4328
+ path = formatMap('{model}:batchGenerateContent', body['_url']);
4329
+ queryParams = body['_query'];
4330
+ // Move system instruction to 'request':
4331
+ // {'systemInstruction': system_instruction}
4332
+ const batch = body['batch'];
4333
+ const inputConfig = batch['inputConfig'];
4334
+ const requestsWrapper = inputConfig['requests'];
4335
+ const requests = requestsWrapper['requests'];
4336
+ const newRequests = [];
4337
+ for (const request of requests) {
4338
+ const requestDict = request;
4339
+ if (requestDict['systemInstruction']) {
4340
+ const systemInstructionValue = requestDict['systemInstruction'];
4341
+ delete requestDict['systemInstruction'];
4342
+ const requestContent = requestDict['request'];
4343
+ requestContent['systemInstruction'] = systemInstructionValue;
4344
+ requestDict['request'] = requestContent;
4345
+ }
4346
+ newRequests.push(requestDict);
4347
+ }
4348
+ requestsWrapper['requests'] = newRequests;
4349
+ delete body['config'];
4350
+ delete body['_url'];
4351
+ delete body['_query'];
4352
+ const response = this.apiClient
4353
+ .request({
4354
+ path: path,
4355
+ queryParams: queryParams,
4356
+ body: JSON.stringify(body),
4357
+ httpMethod: 'POST',
4358
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4359
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4360
+ })
4361
+ .then((httpResponse) => {
4362
+ return httpResponse.json();
4363
+ });
4364
+ return response.then((apiResponse) => {
4365
+ const resp = batchJobFromMldev(apiResponse);
4366
+ return resp;
4367
+ });
4368
+ }
4369
+ }
4281
4370
  return await this.createInternal(params);
4282
4371
  };
4283
4372
  /**
@@ -4800,6 +4889,9 @@ function googleSearchToMldev$3(fromObject) {
4800
4889
  if (fromTimeRangeFilter != null) {
4801
4890
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(fromTimeRangeFilter));
4802
4891
  }
4892
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4893
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
4894
+ }
4803
4895
  return toObject;
4804
4896
  }
4805
4897
  function dynamicRetrievalConfigToMldev$3(fromObject) {
@@ -4830,6 +4922,14 @@ function urlContextToMldev$3() {
4830
4922
  const toObject = {};
4831
4923
  return toObject;
4832
4924
  }
4925
+ function toolComputerUseToMldev$3(fromObject) {
4926
+ const toObject = {};
4927
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
4928
+ if (fromEnvironment != null) {
4929
+ setValueByPath(toObject, ['environment'], fromEnvironment);
4930
+ }
4931
+ return toObject;
4932
+ }
4833
4933
  function toolToMldev$3(fromObject) {
4834
4934
  const toObject = {};
4835
4935
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -4867,16 +4967,16 @@ function toolToMldev$3(fromObject) {
4867
4967
  if (fromUrlContext != null) {
4868
4968
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
4869
4969
  }
4970
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4971
+ if (fromComputerUse != null) {
4972
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$3(fromComputerUse));
4973
+ }
4870
4974
  const fromCodeExecution = getValueByPath(fromObject, [
4871
4975
  'codeExecution',
4872
4976
  ]);
4873
4977
  if (fromCodeExecution != null) {
4874
4978
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4875
4979
  }
4876
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4877
- if (fromComputerUse != null) {
4878
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
4879
- }
4880
4980
  return toObject;
4881
4981
  }
4882
4982
  function functionCallingConfigToMldev$1(fromObject) {
@@ -5237,6 +5337,12 @@ function googleSearchToVertex$2(fromObject) {
5237
5337
  if (fromTimeRangeFilter != null) {
5238
5338
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$2(fromTimeRangeFilter));
5239
5339
  }
5340
+ const fromExcludeDomains = getValueByPath(fromObject, [
5341
+ 'excludeDomains',
5342
+ ]);
5343
+ if (fromExcludeDomains != null) {
5344
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5345
+ }
5240
5346
  return toObject;
5241
5347
  }
5242
5348
  function dynamicRetrievalConfigToVertex$2(fromObject) {
@@ -5263,8 +5369,14 @@ function googleSearchRetrievalToVertex$2(fromObject) {
5263
5369
  }
5264
5370
  return toObject;
5265
5371
  }
5266
- function enterpriseWebSearchToVertex$2() {
5372
+ function enterpriseWebSearchToVertex$2(fromObject) {
5267
5373
  const toObject = {};
5374
+ const fromExcludeDomains = getValueByPath(fromObject, [
5375
+ 'excludeDomains',
5376
+ ]);
5377
+ if (fromExcludeDomains != null) {
5378
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5379
+ }
5268
5380
  return toObject;
5269
5381
  }
5270
5382
  function apiKeyConfigToVertex$2(fromObject) {
@@ -5319,6 +5431,14 @@ function urlContextToVertex$2() {
5319
5431
  const toObject = {};
5320
5432
  return toObject;
5321
5433
  }
5434
+ function toolComputerUseToVertex$2(fromObject) {
5435
+ const toObject = {};
5436
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
5437
+ if (fromEnvironment != null) {
5438
+ setValueByPath(toObject, ['environment'], fromEnvironment);
5439
+ }
5440
+ return toObject;
5441
+ }
5322
5442
  function toolToVertex$2(fromObject) {
5323
5443
  const toObject = {};
5324
5444
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5351,7 +5471,7 @@ function toolToVertex$2(fromObject) {
5351
5471
  'enterpriseWebSearch',
5352
5472
  ]);
5353
5473
  if (fromEnterpriseWebSearch != null) {
5354
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
5474
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2(fromEnterpriseWebSearch));
5355
5475
  }
5356
5476
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5357
5477
  if (fromGoogleMaps != null) {
@@ -5361,16 +5481,16 @@ function toolToVertex$2(fromObject) {
5361
5481
  if (fromUrlContext != null) {
5362
5482
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
5363
5483
  }
5484
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5485
+ if (fromComputerUse != null) {
5486
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$2(fromComputerUse));
5487
+ }
5364
5488
  const fromCodeExecution = getValueByPath(fromObject, [
5365
5489
  'codeExecution',
5366
5490
  ]);
5367
5491
  if (fromCodeExecution != null) {
5368
5492
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5369
5493
  }
5370
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5371
- if (fromComputerUse != null) {
5372
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5373
- }
5374
5494
  return toObject;
5375
5495
  }
5376
5496
  function functionCallingConfigToVertex$1(fromObject) {
@@ -6157,9 +6277,6 @@ function isValidContent(content) {
6157
6277
  if (part === undefined || Object.keys(part).length === 0) {
6158
6278
  return false;
6159
6279
  }
6160
- if (!part.thought && part.text !== undefined && part.text === '') {
6161
- return false;
6162
- }
6163
6280
  }
6164
6281
  return true;
6165
6282
  }
@@ -7256,6 +7373,9 @@ function googleSearchToMldev$2(fromObject) {
7256
7373
  if (fromTimeRangeFilter != null) {
7257
7374
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(fromTimeRangeFilter));
7258
7375
  }
7376
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7377
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
7378
+ }
7259
7379
  return toObject;
7260
7380
  }
7261
7381
  function dynamicRetrievalConfigToMldev$2(fromObject) {
@@ -7286,6 +7406,14 @@ function urlContextToMldev$2() {
7286
7406
  const toObject = {};
7287
7407
  return toObject;
7288
7408
  }
7409
+ function toolComputerUseToMldev$2(fromObject) {
7410
+ const toObject = {};
7411
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
7412
+ if (fromEnvironment != null) {
7413
+ setValueByPath(toObject, ['environment'], fromEnvironment);
7414
+ }
7415
+ return toObject;
7416
+ }
7289
7417
  function toolToMldev$2(fromObject) {
7290
7418
  const toObject = {};
7291
7419
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -7323,16 +7451,16 @@ function toolToMldev$2(fromObject) {
7323
7451
  if (fromUrlContext != null) {
7324
7452
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
7325
7453
  }
7454
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7455
+ if (fromComputerUse != null) {
7456
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$2(fromComputerUse));
7457
+ }
7326
7458
  const fromCodeExecution = getValueByPath(fromObject, [
7327
7459
  'codeExecution',
7328
7460
  ]);
7329
7461
  if (fromCodeExecution != null) {
7330
7462
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7331
7463
  }
7332
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7333
- if (fromComputerUse != null) {
7334
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7335
- }
7336
7464
  return toObject;
7337
7465
  }
7338
7466
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -7948,6 +8076,12 @@ function googleSearchToVertex$1(fromObject) {
7948
8076
  if (fromTimeRangeFilter != null) {
7949
8077
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$1(fromTimeRangeFilter));
7950
8078
  }
8079
+ const fromExcludeDomains = getValueByPath(fromObject, [
8080
+ 'excludeDomains',
8081
+ ]);
8082
+ if (fromExcludeDomains != null) {
8083
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8084
+ }
7951
8085
  return toObject;
7952
8086
  }
7953
8087
  function dynamicRetrievalConfigToVertex$1(fromObject) {
@@ -7974,8 +8108,14 @@ function googleSearchRetrievalToVertex$1(fromObject) {
7974
8108
  }
7975
8109
  return toObject;
7976
8110
  }
7977
- function enterpriseWebSearchToVertex$1() {
8111
+ function enterpriseWebSearchToVertex$1(fromObject) {
7978
8112
  const toObject = {};
8113
+ const fromExcludeDomains = getValueByPath(fromObject, [
8114
+ 'excludeDomains',
8115
+ ]);
8116
+ if (fromExcludeDomains != null) {
8117
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8118
+ }
7979
8119
  return toObject;
7980
8120
  }
7981
8121
  function apiKeyConfigToVertex$1(fromObject) {
@@ -8030,6 +8170,14 @@ function urlContextToVertex$1() {
8030
8170
  const toObject = {};
8031
8171
  return toObject;
8032
8172
  }
8173
+ function toolComputerUseToVertex$1(fromObject) {
8174
+ const toObject = {};
8175
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8176
+ if (fromEnvironment != null) {
8177
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8178
+ }
8179
+ return toObject;
8180
+ }
8033
8181
  function toolToVertex$1(fromObject) {
8034
8182
  const toObject = {};
8035
8183
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -8062,7 +8210,7 @@ function toolToVertex$1(fromObject) {
8062
8210
  'enterpriseWebSearch',
8063
8211
  ]);
8064
8212
  if (fromEnterpriseWebSearch != null) {
8065
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
8213
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1(fromEnterpriseWebSearch));
8066
8214
  }
8067
8215
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
8068
8216
  if (fromGoogleMaps != null) {
@@ -8072,16 +8220,16 @@ function toolToVertex$1(fromObject) {
8072
8220
  if (fromUrlContext != null) {
8073
8221
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
8074
8222
  }
8223
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8224
+ if (fromComputerUse != null) {
8225
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$1(fromComputerUse));
8226
+ }
8075
8227
  const fromCodeExecution = getValueByPath(fromObject, [
8076
8228
  'codeExecution',
8077
8229
  ]);
8078
8230
  if (fromCodeExecution != null) {
8079
8231
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8080
8232
  }
8081
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8082
- if (fromComputerUse != null) {
8083
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
8084
- }
8085
8233
  return toObject;
8086
8234
  }
8087
8235
  function sessionResumptionConfigToVertex(fromObject) {
@@ -9609,6 +9757,9 @@ function googleSearchToMldev$1(fromObject) {
9609
9757
  if (fromTimeRangeFilter != null) {
9610
9758
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(fromTimeRangeFilter));
9611
9759
  }
9760
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9761
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
9762
+ }
9612
9763
  return toObject;
9613
9764
  }
9614
9765
  function dynamicRetrievalConfigToMldev$1(fromObject) {
@@ -9639,6 +9790,14 @@ function urlContextToMldev$1() {
9639
9790
  const toObject = {};
9640
9791
  return toObject;
9641
9792
  }
9793
+ function toolComputerUseToMldev$1(fromObject) {
9794
+ const toObject = {};
9795
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
9796
+ if (fromEnvironment != null) {
9797
+ setValueByPath(toObject, ['environment'], fromEnvironment);
9798
+ }
9799
+ return toObject;
9800
+ }
9642
9801
  function toolToMldev$1(fromObject) {
9643
9802
  const toObject = {};
9644
9803
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -9676,16 +9835,16 @@ function toolToMldev$1(fromObject) {
9676
9835
  if (fromUrlContext != null) {
9677
9836
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
9678
9837
  }
9838
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
9839
+ if (fromComputerUse != null) {
9840
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$1(fromComputerUse));
9841
+ }
9679
9842
  const fromCodeExecution = getValueByPath(fromObject, [
9680
9843
  'codeExecution',
9681
9844
  ]);
9682
9845
  if (fromCodeExecution != null) {
9683
9846
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
9684
9847
  }
9685
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
9686
- if (fromComputerUse != null) {
9687
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
9688
- }
9689
9848
  return toObject;
9690
9849
  }
9691
9850
  function functionCallingConfigToMldev(fromObject) {
@@ -10322,6 +10481,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
10322
10481
  if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
10323
10482
  throw new Error('lastFrame parameter is not supported in Gemini API.');
10324
10483
  }
10484
+ if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
10485
+ throw new Error('referenceImages parameter is not supported in Gemini API.');
10486
+ }
10325
10487
  if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
10326
10488
  throw new Error('compressionQuality parameter is not supported in Gemini API.');
10327
10489
  }
@@ -10649,6 +10811,12 @@ function googleSearchToVertex(fromObject) {
10649
10811
  if (fromTimeRangeFilter != null) {
10650
10812
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex(fromTimeRangeFilter));
10651
10813
  }
10814
+ const fromExcludeDomains = getValueByPath(fromObject, [
10815
+ 'excludeDomains',
10816
+ ]);
10817
+ if (fromExcludeDomains != null) {
10818
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
10819
+ }
10652
10820
  return toObject;
10653
10821
  }
10654
10822
  function dynamicRetrievalConfigToVertex(fromObject) {
@@ -10675,8 +10843,14 @@ function googleSearchRetrievalToVertex(fromObject) {
10675
10843
  }
10676
10844
  return toObject;
10677
10845
  }
10678
- function enterpriseWebSearchToVertex() {
10846
+ function enterpriseWebSearchToVertex(fromObject) {
10679
10847
  const toObject = {};
10848
+ const fromExcludeDomains = getValueByPath(fromObject, [
10849
+ 'excludeDomains',
10850
+ ]);
10851
+ if (fromExcludeDomains != null) {
10852
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
10853
+ }
10680
10854
  return toObject;
10681
10855
  }
10682
10856
  function apiKeyConfigToVertex(fromObject) {
@@ -10731,6 +10905,14 @@ function urlContextToVertex() {
10731
10905
  const toObject = {};
10732
10906
  return toObject;
10733
10907
  }
10908
+ function toolComputerUseToVertex(fromObject) {
10909
+ const toObject = {};
10910
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
10911
+ if (fromEnvironment != null) {
10912
+ setValueByPath(toObject, ['environment'], fromEnvironment);
10913
+ }
10914
+ return toObject;
10915
+ }
10734
10916
  function toolToVertex(fromObject) {
10735
10917
  const toObject = {};
10736
10918
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10763,7 +10945,7 @@ function toolToVertex(fromObject) {
10763
10945
  'enterpriseWebSearch',
10764
10946
  ]);
10765
10947
  if (fromEnterpriseWebSearch != null) {
10766
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
10948
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex(fromEnterpriseWebSearch));
10767
10949
  }
10768
10950
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10769
10951
  if (fromGoogleMaps != null) {
@@ -10773,16 +10955,16 @@ function toolToVertex(fromObject) {
10773
10955
  if (fromUrlContext != null) {
10774
10956
  setValueByPath(toObject, ['urlContext'], urlContextToVertex());
10775
10957
  }
10958
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10959
+ if (fromComputerUse != null) {
10960
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex(fromComputerUse));
10961
+ }
10776
10962
  const fromCodeExecution = getValueByPath(fromObject, [
10777
10963
  'codeExecution',
10778
10964
  ]);
10779
10965
  if (fromCodeExecution != null) {
10780
10966
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10781
10967
  }
10782
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10783
- if (fromComputerUse != null) {
10784
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10785
- }
10786
10968
  return toObject;
10787
10969
  }
10788
10970
  function functionCallingConfigToVertex(fromObject) {
@@ -11612,6 +11794,78 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
11612
11794
  }
11613
11795
  return toObject;
11614
11796
  }
11797
+ function scribbleImageToVertex(fromObject) {
11798
+ const toObject = {};
11799
+ const fromImage = getValueByPath(fromObject, ['image']);
11800
+ if (fromImage != null) {
11801
+ setValueByPath(toObject, ['image'], imageToVertex(fromImage));
11802
+ }
11803
+ return toObject;
11804
+ }
11805
+ function segmentImageSourceToVertex(fromObject, parentObject) {
11806
+ const toObject = {};
11807
+ const fromPrompt = getValueByPath(fromObject, ['prompt']);
11808
+ if (parentObject !== undefined && fromPrompt != null) {
11809
+ setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
11810
+ }
11811
+ const fromImage = getValueByPath(fromObject, ['image']);
11812
+ if (parentObject !== undefined && fromImage != null) {
11813
+ setValueByPath(parentObject, ['instances[0]', 'image'], imageToVertex(fromImage));
11814
+ }
11815
+ const fromScribbleImage = getValueByPath(fromObject, [
11816
+ 'scribbleImage',
11817
+ ]);
11818
+ if (parentObject !== undefined && fromScribbleImage != null) {
11819
+ setValueByPath(parentObject, ['instances[0]', 'scribble'], scribbleImageToVertex(fromScribbleImage));
11820
+ }
11821
+ return toObject;
11822
+ }
11823
+ function segmentImageConfigToVertex(fromObject, parentObject) {
11824
+ const toObject = {};
11825
+ const fromMode = getValueByPath(fromObject, ['mode']);
11826
+ if (parentObject !== undefined && fromMode != null) {
11827
+ setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
11828
+ }
11829
+ const fromMaxPredictions = getValueByPath(fromObject, [
11830
+ 'maxPredictions',
11831
+ ]);
11832
+ if (parentObject !== undefined && fromMaxPredictions != null) {
11833
+ setValueByPath(parentObject, ['parameters', 'maxPredictions'], fromMaxPredictions);
11834
+ }
11835
+ const fromConfidenceThreshold = getValueByPath(fromObject, [
11836
+ 'confidenceThreshold',
11837
+ ]);
11838
+ if (parentObject !== undefined && fromConfidenceThreshold != null) {
11839
+ setValueByPath(parentObject, ['parameters', 'confidenceThreshold'], fromConfidenceThreshold);
11840
+ }
11841
+ const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
11842
+ if (parentObject !== undefined && fromMaskDilation != null) {
11843
+ setValueByPath(parentObject, ['parameters', 'maskDilation'], fromMaskDilation);
11844
+ }
11845
+ const fromBinaryColorThreshold = getValueByPath(fromObject, [
11846
+ 'binaryColorThreshold',
11847
+ ]);
11848
+ if (parentObject !== undefined && fromBinaryColorThreshold != null) {
11849
+ setValueByPath(parentObject, ['parameters', 'binaryColorThreshold'], fromBinaryColorThreshold);
11850
+ }
11851
+ return toObject;
11852
+ }
11853
+ function segmentImageParametersToVertex(apiClient, fromObject) {
11854
+ const toObject = {};
11855
+ const fromModel = getValueByPath(fromObject, ['model']);
11856
+ if (fromModel != null) {
11857
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
11858
+ }
11859
+ const fromSource = getValueByPath(fromObject, ['source']);
11860
+ if (fromSource != null) {
11861
+ setValueByPath(toObject, ['config'], segmentImageSourceToVertex(fromSource, toObject));
11862
+ }
11863
+ const fromConfig = getValueByPath(fromObject, ['config']);
11864
+ if (fromConfig != null) {
11865
+ setValueByPath(toObject, ['config'], segmentImageConfigToVertex(fromConfig, toObject));
11866
+ }
11867
+ return toObject;
11868
+ }
11615
11869
  function getModelParametersToVertex(apiClient, fromObject) {
11616
11870
  const toObject = {};
11617
11871
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -11780,6 +12034,20 @@ function videoToVertex(fromObject) {
11780
12034
  }
11781
12035
  return toObject;
11782
12036
  }
12037
+ function videoGenerationReferenceImageToVertex(fromObject) {
12038
+ const toObject = {};
12039
+ const fromImage = getValueByPath(fromObject, ['image']);
12040
+ if (fromImage != null) {
12041
+ setValueByPath(toObject, ['image'], imageToVertex(fromImage));
12042
+ }
12043
+ const fromReferenceType = getValueByPath(fromObject, [
12044
+ 'referenceType',
12045
+ ]);
12046
+ if (fromReferenceType != null) {
12047
+ setValueByPath(toObject, ['referenceType'], fromReferenceType);
12048
+ }
12049
+ return toObject;
12050
+ }
11783
12051
  function generateVideosConfigToVertex(fromObject, parentObject) {
11784
12052
  const toObject = {};
11785
12053
  const fromNumberOfVideos = getValueByPath(fromObject, [
@@ -11846,6 +12114,18 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
11846
12114
  if (parentObject !== undefined && fromLastFrame != null) {
11847
12115
  setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
11848
12116
  }
12117
+ const fromReferenceImages = getValueByPath(fromObject, [
12118
+ 'referenceImages',
12119
+ ]);
12120
+ if (parentObject !== undefined && fromReferenceImages != null) {
12121
+ let transformedList = fromReferenceImages;
12122
+ if (Array.isArray(transformedList)) {
12123
+ transformedList = transformedList.map((item) => {
12124
+ return videoGenerationReferenceImageToVertex(item);
12125
+ });
12126
+ }
12127
+ setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
12128
+ }
11849
12129
  const fromCompressionQuality = getValueByPath(fromObject, [
11850
12130
  'compressionQuality',
11851
12131
  ]);
@@ -12895,6 +13175,50 @@ function recontextImageResponseFromVertex(fromObject) {
12895
13175
  }
12896
13176
  return toObject;
12897
13177
  }
13178
+ function entityLabelFromVertex(fromObject) {
13179
+ const toObject = {};
13180
+ const fromLabel = getValueByPath(fromObject, ['label']);
13181
+ if (fromLabel != null) {
13182
+ setValueByPath(toObject, ['label'], fromLabel);
13183
+ }
13184
+ const fromScore = getValueByPath(fromObject, ['score']);
13185
+ if (fromScore != null) {
13186
+ setValueByPath(toObject, ['score'], fromScore);
13187
+ }
13188
+ return toObject;
13189
+ }
13190
+ function generatedImageMaskFromVertex(fromObject) {
13191
+ const toObject = {};
13192
+ const fromMask = getValueByPath(fromObject, ['_self']);
13193
+ if (fromMask != null) {
13194
+ setValueByPath(toObject, ['mask'], imageFromVertex(fromMask));
13195
+ }
13196
+ const fromLabels = getValueByPath(fromObject, ['labels']);
13197
+ if (fromLabels != null) {
13198
+ let transformedList = fromLabels;
13199
+ if (Array.isArray(transformedList)) {
13200
+ transformedList = transformedList.map((item) => {
13201
+ return entityLabelFromVertex(item);
13202
+ });
13203
+ }
13204
+ setValueByPath(toObject, ['labels'], transformedList);
13205
+ }
13206
+ return toObject;
13207
+ }
13208
+ function segmentImageResponseFromVertex(fromObject) {
13209
+ const toObject = {};
13210
+ const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
13211
+ if (fromGeneratedMasks != null) {
13212
+ let transformedList = fromGeneratedMasks;
13213
+ if (Array.isArray(transformedList)) {
13214
+ transformedList = transformedList.map((item) => {
13215
+ return generatedImageMaskFromVertex(item);
13216
+ });
13217
+ }
13218
+ setValueByPath(toObject, ['generatedMasks'], transformedList);
13219
+ }
13220
+ return toObject;
13221
+ }
12898
13222
  function endpointFromVertex(fromObject) {
12899
13223
  const toObject = {};
12900
13224
  const fromName = getValueByPath(fromObject, ['endpoint']);
@@ -13142,7 +13466,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
13142
13466
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
13143
13467
  const USER_AGENT_HEADER = 'User-Agent';
13144
13468
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
13145
- const SDK_VERSION = '1.13.0'; // x-release-please-version
13469
+ const SDK_VERSION = '1.15.0'; // x-release-please-version
13146
13470
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
13147
13471
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
13148
13472
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15585,6 +15909,61 @@ class Models extends BaseModule {
15585
15909
  throw new Error('This method is only supported by the Vertex AI.');
15586
15910
  }
15587
15911
  }
15912
+ /**
15913
+ * Segments an image, creating a mask of a specified area.
15914
+ *
15915
+ * @param params - The parameters for segmenting an image.
15916
+ * @return The response from the API.
15917
+ *
15918
+ * @example
15919
+ * ```ts
15920
+ * const response = await ai.models.segmentImage({
15921
+ * model: 'image-segmentation-001',
15922
+ * source: {
15923
+ * image: image,
15924
+ * },
15925
+ * config: {
15926
+ * mode: 'foreground',
15927
+ * },
15928
+ * });
15929
+ * console.log(response?.generatedMasks?.[0]?.mask?.imageBytes);
15930
+ * ```
15931
+ */
15932
+ async segmentImage(params) {
15933
+ var _a, _b;
15934
+ let response;
15935
+ let path = '';
15936
+ let queryParams = {};
15937
+ if (this.apiClient.isVertexAI()) {
15938
+ const body = segmentImageParametersToVertex(this.apiClient, params);
15939
+ path = formatMap('{model}:predict', body['_url']);
15940
+ queryParams = body['_query'];
15941
+ delete body['config'];
15942
+ delete body['_url'];
15943
+ delete body['_query'];
15944
+ response = this.apiClient
15945
+ .request({
15946
+ path: path,
15947
+ queryParams: queryParams,
15948
+ body: JSON.stringify(body),
15949
+ httpMethod: 'POST',
15950
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15951
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15952
+ })
15953
+ .then((httpResponse) => {
15954
+ return httpResponse.json();
15955
+ });
15956
+ return response.then((apiResponse) => {
15957
+ const resp = segmentImageResponseFromVertex(apiResponse);
15958
+ const typedResp = new SegmentImageResponse();
15959
+ Object.assign(typedResp, resp);
15960
+ return typedResp;
15961
+ });
15962
+ }
15963
+ else {
15964
+ throw new Error('This method is only supported by the Vertex AI.');
15965
+ }
15966
+ }
15588
15967
  /**
15589
15968
  * Fetches information about a model by name.
15590
15969
  *
@@ -16549,6 +16928,9 @@ function googleSearchToMldev(fromObject) {
16549
16928
  if (fromTimeRangeFilter != null) {
16550
16929
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(fromTimeRangeFilter));
16551
16930
  }
16931
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
16932
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
16933
+ }
16552
16934
  return toObject;
16553
16935
  }
16554
16936
  function dynamicRetrievalConfigToMldev(fromObject) {
@@ -16579,6 +16961,14 @@ function urlContextToMldev() {
16579
16961
  const toObject = {};
16580
16962
  return toObject;
16581
16963
  }
16964
+ function toolComputerUseToMldev(fromObject) {
16965
+ const toObject = {};
16966
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
16967
+ if (fromEnvironment != null) {
16968
+ setValueByPath(toObject, ['environment'], fromEnvironment);
16969
+ }
16970
+ return toObject;
16971
+ }
16582
16972
  function toolToMldev(fromObject) {
16583
16973
  const toObject = {};
16584
16974
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -16616,16 +17006,16 @@ function toolToMldev(fromObject) {
16616
17006
  if (fromUrlContext != null) {
16617
17007
  setValueByPath(toObject, ['urlContext'], urlContextToMldev());
16618
17008
  }
17009
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
17010
+ if (fromComputerUse != null) {
17011
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev(fromComputerUse));
17012
+ }
16619
17013
  const fromCodeExecution = getValueByPath(fromObject, [
16620
17014
  'codeExecution',
16621
17015
  ]);
16622
17016
  if (fromCodeExecution != null) {
16623
17017
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
16624
17018
  }
16625
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16626
- if (fromComputerUse != null) {
16627
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
16628
- }
16629
17019
  return toObject;
16630
17020
  }
16631
17021
  function sessionResumptionConfigToMldev(fromObject) {
@@ -17265,6 +17655,10 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17265
17655
  undefined) {
17266
17656
  throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
17267
17657
  }
17658
+ if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
17659
+ undefined) {
17660
+ throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
17661
+ }
17268
17662
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
17269
17663
  throw new Error('adapterSize parameter is not supported in Gemini API.');
17270
17664
  }
@@ -17278,12 +17672,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17278
17672
  }
17279
17673
  return toObject;
17280
17674
  }
17281
- function createTuningJobParametersToMldev(fromObject) {
17675
+ function createTuningJobParametersPrivateToMldev(fromObject) {
17282
17676
  const toObject = {};
17283
17677
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17284
17678
  if (fromBaseModel != null) {
17285
17679
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17286
17680
  }
17681
+ const fromPreTunedModel = getValueByPath(fromObject, [
17682
+ 'preTunedModel',
17683
+ ]);
17684
+ if (fromPreTunedModel != null) {
17685
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17686
+ }
17287
17687
  const fromTrainingDataset = getValueByPath(fromObject, [
17288
17688
  'trainingDataset',
17289
17689
  ]);
@@ -17397,6 +17797,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17397
17797
  if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
17398
17798
  setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
17399
17799
  }
17800
+ const fromPreTunedModelCheckpointId = getValueByPath(fromObject, [
17801
+ 'preTunedModelCheckpointId',
17802
+ ]);
17803
+ if (fromPreTunedModelCheckpointId != null) {
17804
+ setValueByPath(toObject, ['preTunedModel', 'checkpointId'], fromPreTunedModelCheckpointId);
17805
+ }
17400
17806
  const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
17401
17807
  if (parentObject !== undefined && fromAdapterSize != null) {
17402
17808
  setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
@@ -17409,12 +17815,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17409
17815
  }
17410
17816
  return toObject;
17411
17817
  }
17412
- function createTuningJobParametersToVertex(fromObject) {
17818
+ function createTuningJobParametersPrivateToVertex(fromObject) {
17413
17819
  const toObject = {};
17414
17820
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17415
17821
  if (fromBaseModel != null) {
17416
17822
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17417
17823
  }
17824
+ const fromPreTunedModel = getValueByPath(fromObject, [
17825
+ 'preTunedModel',
17826
+ ]);
17827
+ if (fromPreTunedModel != null) {
17828
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17829
+ }
17418
17830
  const fromTrainingDataset = getValueByPath(fromObject, [
17419
17831
  'trainingDataset',
17420
17832
  ]);
@@ -17489,11 +17901,11 @@ function tuningJobFromMldev(fromObject) {
17489
17901
  if (fromTunedModel != null) {
17490
17902
  setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
17491
17903
  }
17492
- const fromDistillationSpec = getValueByPath(fromObject, [
17493
- 'distillationSpec',
17904
+ const fromCustomBaseModel = getValueByPath(fromObject, [
17905
+ 'customBaseModel',
17494
17906
  ]);
17495
- if (fromDistillationSpec != null) {
17496
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
17907
+ if (fromCustomBaseModel != null) {
17908
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17497
17909
  }
17498
17910
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17499
17911
  if (fromExperiment != null) {
@@ -17503,18 +17915,14 @@ function tuningJobFromMldev(fromObject) {
17503
17915
  if (fromLabels != null) {
17504
17916
  setValueByPath(toObject, ['labels'], fromLabels);
17505
17917
  }
17918
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
17919
+ if (fromOutputUri != null) {
17920
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
17921
+ }
17506
17922
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17507
17923
  if (fromPipelineJob != null) {
17508
17924
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17509
17925
  }
17510
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17511
- if (fromSatisfiesPzi != null) {
17512
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17513
- }
17514
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17515
- if (fromSatisfiesPzs != null) {
17516
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17517
- }
17518
17926
  const fromServiceAccount = getValueByPath(fromObject, [
17519
17927
  'serviceAccount',
17520
17928
  ]);
@@ -17671,6 +18079,12 @@ function tuningJobFromVertex(fromObject) {
17671
18079
  if (fromTunedModel != null) {
17672
18080
  setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(fromTunedModel));
17673
18081
  }
18082
+ const fromPreTunedModel = getValueByPath(fromObject, [
18083
+ 'preTunedModel',
18084
+ ]);
18085
+ if (fromPreTunedModel != null) {
18086
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
18087
+ }
17674
18088
  const fromSupervisedTuningSpec = getValueByPath(fromObject, [
17675
18089
  'supervisedTuningSpec',
17676
18090
  ]);
@@ -17695,11 +18109,11 @@ function tuningJobFromVertex(fromObject) {
17695
18109
  if (fromPartnerModelTuningSpec != null) {
17696
18110
  setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
17697
18111
  }
17698
- const fromDistillationSpec = getValueByPath(fromObject, [
17699
- 'distillationSpec',
18112
+ const fromCustomBaseModel = getValueByPath(fromObject, [
18113
+ 'customBaseModel',
17700
18114
  ]);
17701
- if (fromDistillationSpec != null) {
17702
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18115
+ if (fromCustomBaseModel != null) {
18116
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17703
18117
  }
17704
18118
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17705
18119
  if (fromExperiment != null) {
@@ -17709,18 +18123,14 @@ function tuningJobFromVertex(fromObject) {
17709
18123
  if (fromLabels != null) {
17710
18124
  setValueByPath(toObject, ['labels'], fromLabels);
17711
18125
  }
18126
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18127
+ if (fromOutputUri != null) {
18128
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
18129
+ }
17712
18130
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17713
18131
  if (fromPipelineJob != null) {
17714
18132
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17715
18133
  }
17716
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17717
- if (fromSatisfiesPzi != null) {
17718
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17719
- }
17720
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17721
- if (fromSatisfiesPzs != null) {
17722
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17723
- }
17724
18134
  const fromServiceAccount = getValueByPath(fromObject, [
17725
18135
  'serviceAccount',
17726
18136
  ]);
@@ -17806,10 +18216,22 @@ class Tunings extends BaseModule {
17806
18216
  */
17807
18217
  this.tune = async (params) => {
17808
18218
  if (this.apiClient.isVertexAI()) {
17809
- return await this.tuneInternal(params);
18219
+ if (params.baseModel.startsWith('projects/')) {
18220
+ const preTunedModel = {
18221
+ tunedModelName: params.baseModel,
18222
+ };
18223
+ const paramsPrivate = Object.assign(Object.assign({}, params), { preTunedModel: preTunedModel });
18224
+ paramsPrivate.baseModel = undefined;
18225
+ return await this.tuneInternal(paramsPrivate);
18226
+ }
18227
+ else {
18228
+ const paramsPrivate = Object.assign({}, params);
18229
+ return await this.tuneInternal(paramsPrivate);
18230
+ }
17810
18231
  }
17811
18232
  else {
17812
- const operation = await this.tuneMldevInternal(params);
18233
+ const paramsPrivate = Object.assign({}, params);
18234
+ const operation = await this.tuneMldevInternal(paramsPrivate);
17813
18235
  let tunedModelName = '';
17814
18236
  if (operation['metadata'] !== undefined &&
17815
18237
  operation['metadata']['tunedModel'] !== undefined) {
@@ -17969,7 +18391,7 @@ class Tunings extends BaseModule {
17969
18391
  let path = '';
17970
18392
  let queryParams = {};
17971
18393
  if (this.apiClient.isVertexAI()) {
17972
- const body = createTuningJobParametersToVertex(params);
18394
+ const body = createTuningJobParametersPrivateToVertex(params);
17973
18395
  path = formatMap('tuningJobs', body['_url']);
17974
18396
  queryParams = body['_query'];
17975
18397
  delete body['config'];
@@ -18011,7 +18433,7 @@ class Tunings extends BaseModule {
18011
18433
  throw new Error('This method is only supported by the Gemini Developer API.');
18012
18434
  }
18013
18435
  else {
18014
- const body = createTuningJobParametersToMldev(params);
18436
+ const body = createTuningJobParametersPrivateToMldev(params);
18015
18437
  path = formatMap('tunedModels', body['_url']);
18016
18438
  queryParams = body['_query'];
18017
18439
  delete body['config'];
@@ -18291,5 +18713,5 @@ class GoogleGenAI {
18291
18713
  }
18292
18714
  }
18293
18715
 
18294
- 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 };
18716
+ 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 };
18295
18717
  //# sourceMappingURL=index.mjs.map