@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.
package/dist/index.mjs CHANGED
@@ -387,18 +387,6 @@ var ApiSpec;
387
387
  */
388
388
  ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
389
389
  })(ApiSpec || (ApiSpec = {}));
390
- /** Required. The environment being operated. */
391
- var Environment;
392
- (function (Environment) {
393
- /**
394
- * Defaults to browser.
395
- */
396
- Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
397
- /**
398
- * Operates in a web browser.
399
- */
400
- Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
401
- })(Environment || (Environment = {}));
402
390
  /** Status of the url retrieval. */
403
391
  var UrlRetrievalStatus;
404
392
  (function (UrlRetrievalStatus) {
@@ -666,6 +654,22 @@ var JobState;
666
654
  */
667
655
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
668
656
  })(JobState || (JobState = {}));
657
+ /** Tuning mode. */
658
+ var TuningMode;
659
+ (function (TuningMode) {
660
+ /**
661
+ * Tuning mode is unspecified.
662
+ */
663
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
664
+ /**
665
+ * Full fine-tuning mode.
666
+ */
667
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
668
+ /**
669
+ * PEFT adapter tuning mode.
670
+ */
671
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
672
+ })(TuningMode || (TuningMode = {}));
669
673
  /** Optional. Adapter size for tuning. */
670
674
  var AdapterSize;
671
675
  (function (AdapterSize) {
@@ -734,6 +738,18 @@ var DynamicRetrievalConfigMode;
734
738
  */
735
739
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
736
740
  })(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
741
+ /** The environment being operated. */
742
+ var Environment;
743
+ (function (Environment) {
744
+ /**
745
+ * Defaults to browser.
746
+ */
747
+ Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
748
+ /**
749
+ * Operates in a web browser.
750
+ */
751
+ Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
752
+ })(Environment || (Environment = {}));
737
753
  /** Config for the function calling config mode. */
738
754
  var FunctionCallingConfigMode;
739
755
  (function (FunctionCallingConfigMode) {
@@ -851,6 +867,15 @@ var EditMode;
851
867
  EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
852
868
  EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
853
869
  })(EditMode || (EditMode = {}));
870
+ /** Enum that represents the segmentation mode. */
871
+ var SegmentMode;
872
+ (function (SegmentMode) {
873
+ SegmentMode["FOREGROUND"] = "FOREGROUND";
874
+ SegmentMode["BACKGROUND"] = "BACKGROUND";
875
+ SegmentMode["PROMPT"] = "PROMPT";
876
+ SegmentMode["SEMANTIC"] = "SEMANTIC";
877
+ SegmentMode["INTERACTIVE"] = "INTERACTIVE";
878
+ })(SegmentMode || (SegmentMode = {}));
854
879
  /** Enum that controls the compression quality of the generated videos. */
855
880
  var VideoCompressionQuality;
856
881
  (function (VideoCompressionQuality) {
@@ -1497,6 +1522,9 @@ class UpscaleImageResponse {
1497
1522
  /** The output images response. */
1498
1523
  class RecontextImageResponse {
1499
1524
  }
1525
+ /** The output images response. */
1526
+ class SegmentImageResponse {
1527
+ }
1500
1528
  class ListModelsResponse {
1501
1529
  }
1502
1530
  class DeleteModelResponse {
@@ -2840,6 +2868,9 @@ function googleSearchToMldev$4(fromObject) {
2840
2868
  if (fromTimeRangeFilter != null) {
2841
2869
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
2842
2870
  }
2871
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
2872
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
2873
+ }
2843
2874
  return toObject;
2844
2875
  }
2845
2876
  function dynamicRetrievalConfigToMldev$4(fromObject) {
@@ -2870,6 +2901,14 @@ function urlContextToMldev$4() {
2870
2901
  const toObject = {};
2871
2902
  return toObject;
2872
2903
  }
2904
+ function toolComputerUseToMldev$4(fromObject) {
2905
+ const toObject = {};
2906
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
2907
+ if (fromEnvironment != null) {
2908
+ setValueByPath(toObject, ['environment'], fromEnvironment);
2909
+ }
2910
+ return toObject;
2911
+ }
2873
2912
  function toolToMldev$4(fromObject) {
2874
2913
  const toObject = {};
2875
2914
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -2907,16 +2946,16 @@ function toolToMldev$4(fromObject) {
2907
2946
  if (fromUrlContext != null) {
2908
2947
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
2909
2948
  }
2949
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2950
+ if (fromComputerUse != null) {
2951
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$4(fromComputerUse));
2952
+ }
2910
2953
  const fromCodeExecution = getValueByPath(fromObject, [
2911
2954
  'codeExecution',
2912
2955
  ]);
2913
2956
  if (fromCodeExecution != null) {
2914
2957
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
2915
2958
  }
2916
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
2917
- if (fromComputerUse != null) {
2918
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
2919
- }
2920
2959
  return toObject;
2921
2960
  }
2922
2961
  function functionCallingConfigToMldev$2(fromObject) {
@@ -4224,6 +4263,7 @@ class Batches extends BaseModule {
4224
4263
  * ```
4225
4264
  */
4226
4265
  this.create = async (params) => {
4266
+ var _a, _b;
4227
4267
  if (this.apiClient.isVertexAI()) {
4228
4268
  const timestamp = Date.now();
4229
4269
  const timestampStr = timestamp.toString();
@@ -4248,6 +4288,55 @@ class Batches extends BaseModule {
4248
4288
  }
4249
4289
  }
4250
4290
  }
4291
+ else {
4292
+ if (Array.isArray(params.src) ||
4293
+ (typeof params.src !== 'string' && params.src.inlinedRequests)) {
4294
+ // Move system instruction to httpOptions extraBody.
4295
+ let path = '';
4296
+ let queryParams = {};
4297
+ const body = createBatchJobParametersToMldev(this.apiClient, params);
4298
+ path = formatMap('{model}:batchGenerateContent', body['_url']);
4299
+ queryParams = body['_query'];
4300
+ // Move system instruction to 'request':
4301
+ // {'systemInstruction': system_instruction}
4302
+ const batch = body['batch'];
4303
+ const inputConfig = batch['inputConfig'];
4304
+ const requestsWrapper = inputConfig['requests'];
4305
+ const requests = requestsWrapper['requests'];
4306
+ const newRequests = [];
4307
+ for (const request of requests) {
4308
+ const requestDict = request;
4309
+ if (requestDict['systemInstruction']) {
4310
+ const systemInstructionValue = requestDict['systemInstruction'];
4311
+ delete requestDict['systemInstruction'];
4312
+ const requestContent = requestDict['request'];
4313
+ requestContent['systemInstruction'] = systemInstructionValue;
4314
+ requestDict['request'] = requestContent;
4315
+ }
4316
+ newRequests.push(requestDict);
4317
+ }
4318
+ requestsWrapper['requests'] = newRequests;
4319
+ delete body['config'];
4320
+ delete body['_url'];
4321
+ delete body['_query'];
4322
+ const response = this.apiClient
4323
+ .request({
4324
+ path: path,
4325
+ queryParams: queryParams,
4326
+ body: JSON.stringify(body),
4327
+ httpMethod: 'POST',
4328
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4329
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4330
+ })
4331
+ .then((httpResponse) => {
4332
+ return httpResponse.json();
4333
+ });
4334
+ return response.then((apiResponse) => {
4335
+ const resp = batchJobFromMldev(apiResponse);
4336
+ return resp;
4337
+ });
4338
+ }
4339
+ }
4251
4340
  return await this.createInternal(params);
4252
4341
  };
4253
4342
  /**
@@ -4770,6 +4859,9 @@ function googleSearchToMldev$3(fromObject) {
4770
4859
  if (fromTimeRangeFilter != null) {
4771
4860
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(fromTimeRangeFilter));
4772
4861
  }
4862
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4863
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
4864
+ }
4773
4865
  return toObject;
4774
4866
  }
4775
4867
  function dynamicRetrievalConfigToMldev$3(fromObject) {
@@ -4800,6 +4892,14 @@ function urlContextToMldev$3() {
4800
4892
  const toObject = {};
4801
4893
  return toObject;
4802
4894
  }
4895
+ function toolComputerUseToMldev$3(fromObject) {
4896
+ const toObject = {};
4897
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
4898
+ if (fromEnvironment != null) {
4899
+ setValueByPath(toObject, ['environment'], fromEnvironment);
4900
+ }
4901
+ return toObject;
4902
+ }
4803
4903
  function toolToMldev$3(fromObject) {
4804
4904
  const toObject = {};
4805
4905
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -4837,16 +4937,16 @@ function toolToMldev$3(fromObject) {
4837
4937
  if (fromUrlContext != null) {
4838
4938
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
4839
4939
  }
4940
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4941
+ if (fromComputerUse != null) {
4942
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$3(fromComputerUse));
4943
+ }
4840
4944
  const fromCodeExecution = getValueByPath(fromObject, [
4841
4945
  'codeExecution',
4842
4946
  ]);
4843
4947
  if (fromCodeExecution != null) {
4844
4948
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4845
4949
  }
4846
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4847
- if (fromComputerUse != null) {
4848
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
4849
- }
4850
4950
  return toObject;
4851
4951
  }
4852
4952
  function functionCallingConfigToMldev$1(fromObject) {
@@ -5207,6 +5307,12 @@ function googleSearchToVertex$2(fromObject) {
5207
5307
  if (fromTimeRangeFilter != null) {
5208
5308
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$2(fromTimeRangeFilter));
5209
5309
  }
5310
+ const fromExcludeDomains = getValueByPath(fromObject, [
5311
+ 'excludeDomains',
5312
+ ]);
5313
+ if (fromExcludeDomains != null) {
5314
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5315
+ }
5210
5316
  return toObject;
5211
5317
  }
5212
5318
  function dynamicRetrievalConfigToVertex$2(fromObject) {
@@ -5233,8 +5339,14 @@ function googleSearchRetrievalToVertex$2(fromObject) {
5233
5339
  }
5234
5340
  return toObject;
5235
5341
  }
5236
- function enterpriseWebSearchToVertex$2() {
5342
+ function enterpriseWebSearchToVertex$2(fromObject) {
5237
5343
  const toObject = {};
5344
+ const fromExcludeDomains = getValueByPath(fromObject, [
5345
+ 'excludeDomains',
5346
+ ]);
5347
+ if (fromExcludeDomains != null) {
5348
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
5349
+ }
5238
5350
  return toObject;
5239
5351
  }
5240
5352
  function apiKeyConfigToVertex$2(fromObject) {
@@ -5289,6 +5401,14 @@ function urlContextToVertex$2() {
5289
5401
  const toObject = {};
5290
5402
  return toObject;
5291
5403
  }
5404
+ function toolComputerUseToVertex$2(fromObject) {
5405
+ const toObject = {};
5406
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
5407
+ if (fromEnvironment != null) {
5408
+ setValueByPath(toObject, ['environment'], fromEnvironment);
5409
+ }
5410
+ return toObject;
5411
+ }
5292
5412
  function toolToVertex$2(fromObject) {
5293
5413
  const toObject = {};
5294
5414
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5321,7 +5441,7 @@ function toolToVertex$2(fromObject) {
5321
5441
  'enterpriseWebSearch',
5322
5442
  ]);
5323
5443
  if (fromEnterpriseWebSearch != null) {
5324
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
5444
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2(fromEnterpriseWebSearch));
5325
5445
  }
5326
5446
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5327
5447
  if (fromGoogleMaps != null) {
@@ -5331,16 +5451,16 @@ function toolToVertex$2(fromObject) {
5331
5451
  if (fromUrlContext != null) {
5332
5452
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
5333
5453
  }
5454
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5455
+ if (fromComputerUse != null) {
5456
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$2(fromComputerUse));
5457
+ }
5334
5458
  const fromCodeExecution = getValueByPath(fromObject, [
5335
5459
  'codeExecution',
5336
5460
  ]);
5337
5461
  if (fromCodeExecution != null) {
5338
5462
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5339
5463
  }
5340
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5341
- if (fromComputerUse != null) {
5342
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5343
- }
5344
5464
  return toObject;
5345
5465
  }
5346
5466
  function functionCallingConfigToVertex$1(fromObject) {
@@ -6127,9 +6247,6 @@ function isValidContent(content) {
6127
6247
  if (part === undefined || Object.keys(part).length === 0) {
6128
6248
  return false;
6129
6249
  }
6130
- if (!part.thought && part.text !== undefined && part.text === '') {
6131
- return false;
6132
- }
6133
6250
  }
6134
6251
  return true;
6135
6252
  }
@@ -6452,7 +6569,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6452
6569
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6453
6570
  const USER_AGENT_HEADER = 'User-Agent';
6454
6571
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6455
- const SDK_VERSION = '1.13.0'; // x-release-please-version
6572
+ const SDK_VERSION = '1.15.0'; // x-release-please-version
6456
6573
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6457
6574
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6458
6575
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -7923,6 +8040,9 @@ function googleSearchToMldev$2(fromObject) {
7923
8040
  if (fromTimeRangeFilter != null) {
7924
8041
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(fromTimeRangeFilter));
7925
8042
  }
8043
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
8044
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
8045
+ }
7926
8046
  return toObject;
7927
8047
  }
7928
8048
  function dynamicRetrievalConfigToMldev$2(fromObject) {
@@ -7953,6 +8073,14 @@ function urlContextToMldev$2() {
7953
8073
  const toObject = {};
7954
8074
  return toObject;
7955
8075
  }
8076
+ function toolComputerUseToMldev$2(fromObject) {
8077
+ const toObject = {};
8078
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8079
+ if (fromEnvironment != null) {
8080
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8081
+ }
8082
+ return toObject;
8083
+ }
7956
8084
  function toolToMldev$2(fromObject) {
7957
8085
  const toObject = {};
7958
8086
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -7990,16 +8118,16 @@ function toolToMldev$2(fromObject) {
7990
8118
  if (fromUrlContext != null) {
7991
8119
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
7992
8120
  }
8121
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8122
+ if (fromComputerUse != null) {
8123
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$2(fromComputerUse));
8124
+ }
7993
8125
  const fromCodeExecution = getValueByPath(fromObject, [
7994
8126
  'codeExecution',
7995
8127
  ]);
7996
8128
  if (fromCodeExecution != null) {
7997
8129
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7998
8130
  }
7999
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8000
- if (fromComputerUse != null) {
8001
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
8002
- }
8003
8131
  return toObject;
8004
8132
  }
8005
8133
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -8615,6 +8743,12 @@ function googleSearchToVertex$1(fromObject) {
8615
8743
  if (fromTimeRangeFilter != null) {
8616
8744
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$1(fromTimeRangeFilter));
8617
8745
  }
8746
+ const fromExcludeDomains = getValueByPath(fromObject, [
8747
+ 'excludeDomains',
8748
+ ]);
8749
+ if (fromExcludeDomains != null) {
8750
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8751
+ }
8618
8752
  return toObject;
8619
8753
  }
8620
8754
  function dynamicRetrievalConfigToVertex$1(fromObject) {
@@ -8641,8 +8775,14 @@ function googleSearchRetrievalToVertex$1(fromObject) {
8641
8775
  }
8642
8776
  return toObject;
8643
8777
  }
8644
- function enterpriseWebSearchToVertex$1() {
8778
+ function enterpriseWebSearchToVertex$1(fromObject) {
8645
8779
  const toObject = {};
8780
+ const fromExcludeDomains = getValueByPath(fromObject, [
8781
+ 'excludeDomains',
8782
+ ]);
8783
+ if (fromExcludeDomains != null) {
8784
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
8785
+ }
8646
8786
  return toObject;
8647
8787
  }
8648
8788
  function apiKeyConfigToVertex$1(fromObject) {
@@ -8697,6 +8837,14 @@ function urlContextToVertex$1() {
8697
8837
  const toObject = {};
8698
8838
  return toObject;
8699
8839
  }
8840
+ function toolComputerUseToVertex$1(fromObject) {
8841
+ const toObject = {};
8842
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
8843
+ if (fromEnvironment != null) {
8844
+ setValueByPath(toObject, ['environment'], fromEnvironment);
8845
+ }
8846
+ return toObject;
8847
+ }
8700
8848
  function toolToVertex$1(fromObject) {
8701
8849
  const toObject = {};
8702
8850
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -8729,7 +8877,7 @@ function toolToVertex$1(fromObject) {
8729
8877
  'enterpriseWebSearch',
8730
8878
  ]);
8731
8879
  if (fromEnterpriseWebSearch != null) {
8732
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
8880
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1(fromEnterpriseWebSearch));
8733
8881
  }
8734
8882
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
8735
8883
  if (fromGoogleMaps != null) {
@@ -8739,16 +8887,16 @@ function toolToVertex$1(fromObject) {
8739
8887
  if (fromUrlContext != null) {
8740
8888
  setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
8741
8889
  }
8890
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8891
+ if (fromComputerUse != null) {
8892
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$1(fromComputerUse));
8893
+ }
8742
8894
  const fromCodeExecution = getValueByPath(fromObject, [
8743
8895
  'codeExecution',
8744
8896
  ]);
8745
8897
  if (fromCodeExecution != null) {
8746
8898
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8747
8899
  }
8748
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8749
- if (fromComputerUse != null) {
8750
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
8751
- }
8752
8900
  return toObject;
8753
8901
  }
8754
8902
  function sessionResumptionConfigToVertex(fromObject) {
@@ -10276,6 +10424,9 @@ function googleSearchToMldev$1(fromObject) {
10276
10424
  if (fromTimeRangeFilter != null) {
10277
10425
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(fromTimeRangeFilter));
10278
10426
  }
10427
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
10428
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
10429
+ }
10279
10430
  return toObject;
10280
10431
  }
10281
10432
  function dynamicRetrievalConfigToMldev$1(fromObject) {
@@ -10306,6 +10457,14 @@ function urlContextToMldev$1() {
10306
10457
  const toObject = {};
10307
10458
  return toObject;
10308
10459
  }
10460
+ function toolComputerUseToMldev$1(fromObject) {
10461
+ const toObject = {};
10462
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
10463
+ if (fromEnvironment != null) {
10464
+ setValueByPath(toObject, ['environment'], fromEnvironment);
10465
+ }
10466
+ return toObject;
10467
+ }
10309
10468
  function toolToMldev$1(fromObject) {
10310
10469
  const toObject = {};
10311
10470
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10343,16 +10502,16 @@ function toolToMldev$1(fromObject) {
10343
10502
  if (fromUrlContext != null) {
10344
10503
  setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
10345
10504
  }
10505
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10506
+ if (fromComputerUse != null) {
10507
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$1(fromComputerUse));
10508
+ }
10346
10509
  const fromCodeExecution = getValueByPath(fromObject, [
10347
10510
  'codeExecution',
10348
10511
  ]);
10349
10512
  if (fromCodeExecution != null) {
10350
10513
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10351
10514
  }
10352
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10353
- if (fromComputerUse != null) {
10354
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10355
- }
10356
10515
  return toObject;
10357
10516
  }
10358
10517
  function functionCallingConfigToMldev(fromObject) {
@@ -10989,6 +11148,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
10989
11148
  if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
10990
11149
  throw new Error('lastFrame parameter is not supported in Gemini API.');
10991
11150
  }
11151
+ if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
11152
+ throw new Error('referenceImages parameter is not supported in Gemini API.');
11153
+ }
10992
11154
  if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
10993
11155
  throw new Error('compressionQuality parameter is not supported in Gemini API.');
10994
11156
  }
@@ -11316,6 +11478,12 @@ function googleSearchToVertex(fromObject) {
11316
11478
  if (fromTimeRangeFilter != null) {
11317
11479
  setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex(fromTimeRangeFilter));
11318
11480
  }
11481
+ const fromExcludeDomains = getValueByPath(fromObject, [
11482
+ 'excludeDomains',
11483
+ ]);
11484
+ if (fromExcludeDomains != null) {
11485
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
11486
+ }
11319
11487
  return toObject;
11320
11488
  }
11321
11489
  function dynamicRetrievalConfigToVertex(fromObject) {
@@ -11342,8 +11510,14 @@ function googleSearchRetrievalToVertex(fromObject) {
11342
11510
  }
11343
11511
  return toObject;
11344
11512
  }
11345
- function enterpriseWebSearchToVertex() {
11513
+ function enterpriseWebSearchToVertex(fromObject) {
11346
11514
  const toObject = {};
11515
+ const fromExcludeDomains = getValueByPath(fromObject, [
11516
+ 'excludeDomains',
11517
+ ]);
11518
+ if (fromExcludeDomains != null) {
11519
+ setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
11520
+ }
11347
11521
  return toObject;
11348
11522
  }
11349
11523
  function apiKeyConfigToVertex(fromObject) {
@@ -11398,6 +11572,14 @@ function urlContextToVertex() {
11398
11572
  const toObject = {};
11399
11573
  return toObject;
11400
11574
  }
11575
+ function toolComputerUseToVertex(fromObject) {
11576
+ const toObject = {};
11577
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
11578
+ if (fromEnvironment != null) {
11579
+ setValueByPath(toObject, ['environment'], fromEnvironment);
11580
+ }
11581
+ return toObject;
11582
+ }
11401
11583
  function toolToVertex(fromObject) {
11402
11584
  const toObject = {};
11403
11585
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -11430,7 +11612,7 @@ function toolToVertex(fromObject) {
11430
11612
  'enterpriseWebSearch',
11431
11613
  ]);
11432
11614
  if (fromEnterpriseWebSearch != null) {
11433
- setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
11615
+ setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex(fromEnterpriseWebSearch));
11434
11616
  }
11435
11617
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
11436
11618
  if (fromGoogleMaps != null) {
@@ -11440,16 +11622,16 @@ function toolToVertex(fromObject) {
11440
11622
  if (fromUrlContext != null) {
11441
11623
  setValueByPath(toObject, ['urlContext'], urlContextToVertex());
11442
11624
  }
11625
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
11626
+ if (fromComputerUse != null) {
11627
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex(fromComputerUse));
11628
+ }
11443
11629
  const fromCodeExecution = getValueByPath(fromObject, [
11444
11630
  'codeExecution',
11445
11631
  ]);
11446
11632
  if (fromCodeExecution != null) {
11447
11633
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
11448
11634
  }
11449
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
11450
- if (fromComputerUse != null) {
11451
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
11452
- }
11453
11635
  return toObject;
11454
11636
  }
11455
11637
  function functionCallingConfigToVertex(fromObject) {
@@ -12279,6 +12461,78 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
12279
12461
  }
12280
12462
  return toObject;
12281
12463
  }
12464
+ function scribbleImageToVertex(fromObject) {
12465
+ const toObject = {};
12466
+ const fromImage = getValueByPath(fromObject, ['image']);
12467
+ if (fromImage != null) {
12468
+ setValueByPath(toObject, ['image'], imageToVertex(fromImage));
12469
+ }
12470
+ return toObject;
12471
+ }
12472
+ function segmentImageSourceToVertex(fromObject, parentObject) {
12473
+ const toObject = {};
12474
+ const fromPrompt = getValueByPath(fromObject, ['prompt']);
12475
+ if (parentObject !== undefined && fromPrompt != null) {
12476
+ setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
12477
+ }
12478
+ const fromImage = getValueByPath(fromObject, ['image']);
12479
+ if (parentObject !== undefined && fromImage != null) {
12480
+ setValueByPath(parentObject, ['instances[0]', 'image'], imageToVertex(fromImage));
12481
+ }
12482
+ const fromScribbleImage = getValueByPath(fromObject, [
12483
+ 'scribbleImage',
12484
+ ]);
12485
+ if (parentObject !== undefined && fromScribbleImage != null) {
12486
+ setValueByPath(parentObject, ['instances[0]', 'scribble'], scribbleImageToVertex(fromScribbleImage));
12487
+ }
12488
+ return toObject;
12489
+ }
12490
+ function segmentImageConfigToVertex(fromObject, parentObject) {
12491
+ const toObject = {};
12492
+ const fromMode = getValueByPath(fromObject, ['mode']);
12493
+ if (parentObject !== undefined && fromMode != null) {
12494
+ setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
12495
+ }
12496
+ const fromMaxPredictions = getValueByPath(fromObject, [
12497
+ 'maxPredictions',
12498
+ ]);
12499
+ if (parentObject !== undefined && fromMaxPredictions != null) {
12500
+ setValueByPath(parentObject, ['parameters', 'maxPredictions'], fromMaxPredictions);
12501
+ }
12502
+ const fromConfidenceThreshold = getValueByPath(fromObject, [
12503
+ 'confidenceThreshold',
12504
+ ]);
12505
+ if (parentObject !== undefined && fromConfidenceThreshold != null) {
12506
+ setValueByPath(parentObject, ['parameters', 'confidenceThreshold'], fromConfidenceThreshold);
12507
+ }
12508
+ const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
12509
+ if (parentObject !== undefined && fromMaskDilation != null) {
12510
+ setValueByPath(parentObject, ['parameters', 'maskDilation'], fromMaskDilation);
12511
+ }
12512
+ const fromBinaryColorThreshold = getValueByPath(fromObject, [
12513
+ 'binaryColorThreshold',
12514
+ ]);
12515
+ if (parentObject !== undefined && fromBinaryColorThreshold != null) {
12516
+ setValueByPath(parentObject, ['parameters', 'binaryColorThreshold'], fromBinaryColorThreshold);
12517
+ }
12518
+ return toObject;
12519
+ }
12520
+ function segmentImageParametersToVertex(apiClient, fromObject) {
12521
+ const toObject = {};
12522
+ const fromModel = getValueByPath(fromObject, ['model']);
12523
+ if (fromModel != null) {
12524
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
12525
+ }
12526
+ const fromSource = getValueByPath(fromObject, ['source']);
12527
+ if (fromSource != null) {
12528
+ setValueByPath(toObject, ['config'], segmentImageSourceToVertex(fromSource, toObject));
12529
+ }
12530
+ const fromConfig = getValueByPath(fromObject, ['config']);
12531
+ if (fromConfig != null) {
12532
+ setValueByPath(toObject, ['config'], segmentImageConfigToVertex(fromConfig, toObject));
12533
+ }
12534
+ return toObject;
12535
+ }
12282
12536
  function getModelParametersToVertex(apiClient, fromObject) {
12283
12537
  const toObject = {};
12284
12538
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -12447,6 +12701,20 @@ function videoToVertex(fromObject) {
12447
12701
  }
12448
12702
  return toObject;
12449
12703
  }
12704
+ function videoGenerationReferenceImageToVertex(fromObject) {
12705
+ const toObject = {};
12706
+ const fromImage = getValueByPath(fromObject, ['image']);
12707
+ if (fromImage != null) {
12708
+ setValueByPath(toObject, ['image'], imageToVertex(fromImage));
12709
+ }
12710
+ const fromReferenceType = getValueByPath(fromObject, [
12711
+ 'referenceType',
12712
+ ]);
12713
+ if (fromReferenceType != null) {
12714
+ setValueByPath(toObject, ['referenceType'], fromReferenceType);
12715
+ }
12716
+ return toObject;
12717
+ }
12450
12718
  function generateVideosConfigToVertex(fromObject, parentObject) {
12451
12719
  const toObject = {};
12452
12720
  const fromNumberOfVideos = getValueByPath(fromObject, [
@@ -12513,6 +12781,18 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
12513
12781
  if (parentObject !== undefined && fromLastFrame != null) {
12514
12782
  setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
12515
12783
  }
12784
+ const fromReferenceImages = getValueByPath(fromObject, [
12785
+ 'referenceImages',
12786
+ ]);
12787
+ if (parentObject !== undefined && fromReferenceImages != null) {
12788
+ let transformedList = fromReferenceImages;
12789
+ if (Array.isArray(transformedList)) {
12790
+ transformedList = transformedList.map((item) => {
12791
+ return videoGenerationReferenceImageToVertex(item);
12792
+ });
12793
+ }
12794
+ setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
12795
+ }
12516
12796
  const fromCompressionQuality = getValueByPath(fromObject, [
12517
12797
  'compressionQuality',
12518
12798
  ]);
@@ -13562,6 +13842,50 @@ function recontextImageResponseFromVertex(fromObject) {
13562
13842
  }
13563
13843
  return toObject;
13564
13844
  }
13845
+ function entityLabelFromVertex(fromObject) {
13846
+ const toObject = {};
13847
+ const fromLabel = getValueByPath(fromObject, ['label']);
13848
+ if (fromLabel != null) {
13849
+ setValueByPath(toObject, ['label'], fromLabel);
13850
+ }
13851
+ const fromScore = getValueByPath(fromObject, ['score']);
13852
+ if (fromScore != null) {
13853
+ setValueByPath(toObject, ['score'], fromScore);
13854
+ }
13855
+ return toObject;
13856
+ }
13857
+ function generatedImageMaskFromVertex(fromObject) {
13858
+ const toObject = {};
13859
+ const fromMask = getValueByPath(fromObject, ['_self']);
13860
+ if (fromMask != null) {
13861
+ setValueByPath(toObject, ['mask'], imageFromVertex(fromMask));
13862
+ }
13863
+ const fromLabels = getValueByPath(fromObject, ['labels']);
13864
+ if (fromLabels != null) {
13865
+ let transformedList = fromLabels;
13866
+ if (Array.isArray(transformedList)) {
13867
+ transformedList = transformedList.map((item) => {
13868
+ return entityLabelFromVertex(item);
13869
+ });
13870
+ }
13871
+ setValueByPath(toObject, ['labels'], transformedList);
13872
+ }
13873
+ return toObject;
13874
+ }
13875
+ function segmentImageResponseFromVertex(fromObject) {
13876
+ const toObject = {};
13877
+ const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
13878
+ if (fromGeneratedMasks != null) {
13879
+ let transformedList = fromGeneratedMasks;
13880
+ if (Array.isArray(transformedList)) {
13881
+ transformedList = transformedList.map((item) => {
13882
+ return generatedImageMaskFromVertex(item);
13883
+ });
13884
+ }
13885
+ setValueByPath(toObject, ['generatedMasks'], transformedList);
13886
+ }
13887
+ return toObject;
13888
+ }
13565
13889
  function endpointFromVertex(fromObject) {
13566
13890
  const toObject = {};
13567
13891
  const fromName = getValueByPath(fromObject, ['endpoint']);
@@ -15678,6 +16002,61 @@ class Models extends BaseModule {
15678
16002
  throw new Error('This method is only supported by the Vertex AI.');
15679
16003
  }
15680
16004
  }
16005
+ /**
16006
+ * Segments an image, creating a mask of a specified area.
16007
+ *
16008
+ * @param params - The parameters for segmenting an image.
16009
+ * @return The response from the API.
16010
+ *
16011
+ * @example
16012
+ * ```ts
16013
+ * const response = await ai.models.segmentImage({
16014
+ * model: 'image-segmentation-001',
16015
+ * source: {
16016
+ * image: image,
16017
+ * },
16018
+ * config: {
16019
+ * mode: 'foreground',
16020
+ * },
16021
+ * });
16022
+ * console.log(response?.generatedMasks?.[0]?.mask?.imageBytes);
16023
+ * ```
16024
+ */
16025
+ async segmentImage(params) {
16026
+ var _a, _b;
16027
+ let response;
16028
+ let path = '';
16029
+ let queryParams = {};
16030
+ if (this.apiClient.isVertexAI()) {
16031
+ const body = segmentImageParametersToVertex(this.apiClient, params);
16032
+ path = formatMap('{model}:predict', body['_url']);
16033
+ queryParams = body['_query'];
16034
+ delete body['config'];
16035
+ delete body['_url'];
16036
+ delete body['_query'];
16037
+ response = this.apiClient
16038
+ .request({
16039
+ path: path,
16040
+ queryParams: queryParams,
16041
+ body: JSON.stringify(body),
16042
+ httpMethod: 'POST',
16043
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
16044
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
16045
+ })
16046
+ .then((httpResponse) => {
16047
+ return httpResponse.json();
16048
+ });
16049
+ return response.then((apiResponse) => {
16050
+ const resp = segmentImageResponseFromVertex(apiResponse);
16051
+ const typedResp = new SegmentImageResponse();
16052
+ Object.assign(typedResp, resp);
16053
+ return typedResp;
16054
+ });
16055
+ }
16056
+ else {
16057
+ throw new Error('This method is only supported by the Vertex AI.');
16058
+ }
16059
+ }
15681
16060
  /**
15682
16061
  * Fetches information about a model by name.
15683
16062
  *
@@ -16642,6 +17021,9 @@ function googleSearchToMldev(fromObject) {
16642
17021
  if (fromTimeRangeFilter != null) {
16643
17022
  setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(fromTimeRangeFilter));
16644
17023
  }
17024
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
17025
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
17026
+ }
16645
17027
  return toObject;
16646
17028
  }
16647
17029
  function dynamicRetrievalConfigToMldev(fromObject) {
@@ -16672,6 +17054,14 @@ function urlContextToMldev() {
16672
17054
  const toObject = {};
16673
17055
  return toObject;
16674
17056
  }
17057
+ function toolComputerUseToMldev(fromObject) {
17058
+ const toObject = {};
17059
+ const fromEnvironment = getValueByPath(fromObject, ['environment']);
17060
+ if (fromEnvironment != null) {
17061
+ setValueByPath(toObject, ['environment'], fromEnvironment);
17062
+ }
17063
+ return toObject;
17064
+ }
16675
17065
  function toolToMldev(fromObject) {
16676
17066
  const toObject = {};
16677
17067
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -16709,16 +17099,16 @@ function toolToMldev(fromObject) {
16709
17099
  if (fromUrlContext != null) {
16710
17100
  setValueByPath(toObject, ['urlContext'], urlContextToMldev());
16711
17101
  }
17102
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
17103
+ if (fromComputerUse != null) {
17104
+ setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev(fromComputerUse));
17105
+ }
16712
17106
  const fromCodeExecution = getValueByPath(fromObject, [
16713
17107
  'codeExecution',
16714
17108
  ]);
16715
17109
  if (fromCodeExecution != null) {
16716
17110
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
16717
17111
  }
16718
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16719
- if (fromComputerUse != null) {
16720
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
16721
- }
16722
17112
  return toObject;
16723
17113
  }
16724
17114
  function sessionResumptionConfigToMldev(fromObject) {
@@ -17358,6 +17748,10 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17358
17748
  undefined) {
17359
17749
  throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
17360
17750
  }
17751
+ if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
17752
+ undefined) {
17753
+ throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
17754
+ }
17361
17755
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
17362
17756
  throw new Error('adapterSize parameter is not supported in Gemini API.');
17363
17757
  }
@@ -17371,12 +17765,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
17371
17765
  }
17372
17766
  return toObject;
17373
17767
  }
17374
- function createTuningJobParametersToMldev(fromObject) {
17768
+ function createTuningJobParametersPrivateToMldev(fromObject) {
17375
17769
  const toObject = {};
17376
17770
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17377
17771
  if (fromBaseModel != null) {
17378
17772
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17379
17773
  }
17774
+ const fromPreTunedModel = getValueByPath(fromObject, [
17775
+ 'preTunedModel',
17776
+ ]);
17777
+ if (fromPreTunedModel != null) {
17778
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17779
+ }
17380
17780
  const fromTrainingDataset = getValueByPath(fromObject, [
17381
17781
  'trainingDataset',
17382
17782
  ]);
@@ -17490,6 +17890,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17490
17890
  if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
17491
17891
  setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
17492
17892
  }
17893
+ const fromPreTunedModelCheckpointId = getValueByPath(fromObject, [
17894
+ 'preTunedModelCheckpointId',
17895
+ ]);
17896
+ if (fromPreTunedModelCheckpointId != null) {
17897
+ setValueByPath(toObject, ['preTunedModel', 'checkpointId'], fromPreTunedModelCheckpointId);
17898
+ }
17493
17899
  const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
17494
17900
  if (parentObject !== undefined && fromAdapterSize != null) {
17495
17901
  setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
@@ -17502,12 +17908,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
17502
17908
  }
17503
17909
  return toObject;
17504
17910
  }
17505
- function createTuningJobParametersToVertex(fromObject) {
17911
+ function createTuningJobParametersPrivateToVertex(fromObject) {
17506
17912
  const toObject = {};
17507
17913
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
17508
17914
  if (fromBaseModel != null) {
17509
17915
  setValueByPath(toObject, ['baseModel'], fromBaseModel);
17510
17916
  }
17917
+ const fromPreTunedModel = getValueByPath(fromObject, [
17918
+ 'preTunedModel',
17919
+ ]);
17920
+ if (fromPreTunedModel != null) {
17921
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
17922
+ }
17511
17923
  const fromTrainingDataset = getValueByPath(fromObject, [
17512
17924
  'trainingDataset',
17513
17925
  ]);
@@ -17582,11 +17994,11 @@ function tuningJobFromMldev(fromObject) {
17582
17994
  if (fromTunedModel != null) {
17583
17995
  setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
17584
17996
  }
17585
- const fromDistillationSpec = getValueByPath(fromObject, [
17586
- 'distillationSpec',
17997
+ const fromCustomBaseModel = getValueByPath(fromObject, [
17998
+ 'customBaseModel',
17587
17999
  ]);
17588
- if (fromDistillationSpec != null) {
17589
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18000
+ if (fromCustomBaseModel != null) {
18001
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17590
18002
  }
17591
18003
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17592
18004
  if (fromExperiment != null) {
@@ -17596,18 +18008,14 @@ function tuningJobFromMldev(fromObject) {
17596
18008
  if (fromLabels != null) {
17597
18009
  setValueByPath(toObject, ['labels'], fromLabels);
17598
18010
  }
18011
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18012
+ if (fromOutputUri != null) {
18013
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
18014
+ }
17599
18015
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17600
18016
  if (fromPipelineJob != null) {
17601
18017
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17602
18018
  }
17603
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17604
- if (fromSatisfiesPzi != null) {
17605
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17606
- }
17607
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17608
- if (fromSatisfiesPzs != null) {
17609
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17610
- }
17611
18019
  const fromServiceAccount = getValueByPath(fromObject, [
17612
18020
  'serviceAccount',
17613
18021
  ]);
@@ -17764,6 +18172,12 @@ function tuningJobFromVertex(fromObject) {
17764
18172
  if (fromTunedModel != null) {
17765
18173
  setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(fromTunedModel));
17766
18174
  }
18175
+ const fromPreTunedModel = getValueByPath(fromObject, [
18176
+ 'preTunedModel',
18177
+ ]);
18178
+ if (fromPreTunedModel != null) {
18179
+ setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
18180
+ }
17767
18181
  const fromSupervisedTuningSpec = getValueByPath(fromObject, [
17768
18182
  'supervisedTuningSpec',
17769
18183
  ]);
@@ -17788,11 +18202,11 @@ function tuningJobFromVertex(fromObject) {
17788
18202
  if (fromPartnerModelTuningSpec != null) {
17789
18203
  setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
17790
18204
  }
17791
- const fromDistillationSpec = getValueByPath(fromObject, [
17792
- 'distillationSpec',
18205
+ const fromCustomBaseModel = getValueByPath(fromObject, [
18206
+ 'customBaseModel',
17793
18207
  ]);
17794
- if (fromDistillationSpec != null) {
17795
- setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
18208
+ if (fromCustomBaseModel != null) {
18209
+ setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
17796
18210
  }
17797
18211
  const fromExperiment = getValueByPath(fromObject, ['experiment']);
17798
18212
  if (fromExperiment != null) {
@@ -17802,18 +18216,14 @@ function tuningJobFromVertex(fromObject) {
17802
18216
  if (fromLabels != null) {
17803
18217
  setValueByPath(toObject, ['labels'], fromLabels);
17804
18218
  }
18219
+ const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
18220
+ if (fromOutputUri != null) {
18221
+ setValueByPath(toObject, ['outputUri'], fromOutputUri);
18222
+ }
17805
18223
  const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
17806
18224
  if (fromPipelineJob != null) {
17807
18225
  setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
17808
18226
  }
17809
- const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
17810
- if (fromSatisfiesPzi != null) {
17811
- setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
17812
- }
17813
- const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
17814
- if (fromSatisfiesPzs != null) {
17815
- setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
17816
- }
17817
18227
  const fromServiceAccount = getValueByPath(fromObject, [
17818
18228
  'serviceAccount',
17819
18229
  ]);
@@ -17899,10 +18309,22 @@ class Tunings extends BaseModule {
17899
18309
  */
17900
18310
  this.tune = async (params) => {
17901
18311
  if (this.apiClient.isVertexAI()) {
17902
- return await this.tuneInternal(params);
18312
+ if (params.baseModel.startsWith('projects/')) {
18313
+ const preTunedModel = {
18314
+ tunedModelName: params.baseModel,
18315
+ };
18316
+ const paramsPrivate = Object.assign(Object.assign({}, params), { preTunedModel: preTunedModel });
18317
+ paramsPrivate.baseModel = undefined;
18318
+ return await this.tuneInternal(paramsPrivate);
18319
+ }
18320
+ else {
18321
+ const paramsPrivate = Object.assign({}, params);
18322
+ return await this.tuneInternal(paramsPrivate);
18323
+ }
17903
18324
  }
17904
18325
  else {
17905
- const operation = await this.tuneMldevInternal(params);
18326
+ const paramsPrivate = Object.assign({}, params);
18327
+ const operation = await this.tuneMldevInternal(paramsPrivate);
17906
18328
  let tunedModelName = '';
17907
18329
  if (operation['metadata'] !== undefined &&
17908
18330
  operation['metadata']['tunedModel'] !== undefined) {
@@ -18062,7 +18484,7 @@ class Tunings extends BaseModule {
18062
18484
  let path = '';
18063
18485
  let queryParams = {};
18064
18486
  if (this.apiClient.isVertexAI()) {
18065
- const body = createTuningJobParametersToVertex(params);
18487
+ const body = createTuningJobParametersPrivateToVertex(params);
18066
18488
  path = formatMap('tuningJobs', body['_url']);
18067
18489
  queryParams = body['_query'];
18068
18490
  delete body['config'];
@@ -18104,7 +18526,7 @@ class Tunings extends BaseModule {
18104
18526
  throw new Error('This method is only supported by the Gemini Developer API.');
18105
18527
  }
18106
18528
  else {
18107
- const body = createTuningJobParametersToMldev(params);
18529
+ const body = createTuningJobParametersPrivateToMldev(params);
18108
18530
  path = formatMap('tunedModels', body['_url']);
18109
18531
  queryParams = body['_query'];
18110
18532
  delete body['config'];
@@ -18231,5 +18653,5 @@ class GoogleGenAI {
18231
18653
  }
18232
18654
  }
18233
18655
 
18234
- 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 };
18656
+ 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 };
18235
18657
  //# sourceMappingURL=index.mjs.map