@google/genai 1.29.1 → 1.30.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.
@@ -817,6 +817,22 @@ exports.PhishBlockThreshold = void 0;
817
817
  */
818
818
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
819
819
  })(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
820
+ /** The level of thoughts tokens that the model should generate. */
821
+ exports.ThinkingLevel = void 0;
822
+ (function (ThinkingLevel) {
823
+ /**
824
+ * Default value.
825
+ */
826
+ ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
827
+ /**
828
+ * Low thinking level.
829
+ */
830
+ ThinkingLevel["LOW"] = "LOW";
831
+ /**
832
+ * High thinking level.
833
+ */
834
+ ThinkingLevel["HIGH"] = "HIGH";
835
+ })(exports.ThinkingLevel || (exports.ThinkingLevel = {}));
820
836
  /** Harm category. */
821
837
  exports.HarmCategory = void 0;
822
838
  (function (HarmCategory) {
@@ -1259,6 +1275,26 @@ exports.TuningTask = void 0;
1259
1275
  */
1260
1276
  TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
1261
1277
  })(exports.TuningTask || (exports.TuningTask = {}));
1278
+ /** The tokenization quality used for given media. */
1279
+ exports.PartMediaResolutionLevel = void 0;
1280
+ (function (PartMediaResolutionLevel) {
1281
+ /**
1282
+ * Media resolution has not been set.
1283
+ */
1284
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1285
+ /**
1286
+ * Media resolution set to low.
1287
+ */
1288
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1289
+ /**
1290
+ * Media resolution set to medium.
1291
+ */
1292
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1293
+ /**
1294
+ * Media resolution set to high.
1295
+ */
1296
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1297
+ })(exports.PartMediaResolutionLevel || (exports.PartMediaResolutionLevel = {}));
1262
1298
  /** Options for feature selection preference. */
1263
1299
  exports.FeatureSelectionPreference = void 0;
1264
1300
  (function (FeatureSelectionPreference) {
@@ -1793,13 +1829,11 @@ class FunctionResponse {
1793
1829
  /**
1794
1830
  * Creates a `Part` object from a `URI` string.
1795
1831
  */
1796
- function createPartFromUri(uri, mimeType) {
1797
- return {
1798
- fileData: {
1832
+ function createPartFromUri(uri, mimeType, mediaResolution) {
1833
+ return Object.assign({ fileData: {
1799
1834
  fileUri: uri,
1800
1835
  mimeType: mimeType,
1801
- },
1802
- };
1836
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1803
1837
  }
1804
1838
  /**
1805
1839
  * Creates a `Part` object from a `text` string.
@@ -1831,13 +1865,11 @@ function createPartFromFunctionResponse(id, name, response, parts = []) {
1831
1865
  /**
1832
1866
  * Creates a `Part` object from a `base64` encoded `string`.
1833
1867
  */
1834
- function createPartFromBase64(data, mimeType) {
1835
- return {
1836
- inlineData: {
1868
+ function createPartFromBase64(data, mimeType, mediaResolution) {
1869
+ return Object.assign({ inlineData: {
1837
1870
  data: data,
1838
1871
  mimeType: mimeType,
1839
- },
1840
- };
1872
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1841
1873
  }
1842
1874
  /**
1843
1875
  * Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
@@ -3917,6 +3949,46 @@ function fileDataToMldev$4(fromObject) {
3917
3949
  }
3918
3950
  return toObject;
3919
3951
  }
3952
+ function functionCallToMldev$4(fromObject) {
3953
+ const toObject = {};
3954
+ const fromId = getValueByPath(fromObject, ['id']);
3955
+ if (fromId != null) {
3956
+ setValueByPath(toObject, ['id'], fromId);
3957
+ }
3958
+ const fromArgs = getValueByPath(fromObject, ['args']);
3959
+ if (fromArgs != null) {
3960
+ setValueByPath(toObject, ['args'], fromArgs);
3961
+ }
3962
+ const fromName = getValueByPath(fromObject, ['name']);
3963
+ if (fromName != null) {
3964
+ setValueByPath(toObject, ['name'], fromName);
3965
+ }
3966
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
3967
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
3968
+ }
3969
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
3970
+ throw new Error('willContinue parameter is not supported in Gemini API.');
3971
+ }
3972
+ return toObject;
3973
+ }
3974
+ function functionCallingConfigToMldev$2(fromObject) {
3975
+ const toObject = {};
3976
+ const fromMode = getValueByPath(fromObject, ['mode']);
3977
+ if (fromMode != null) {
3978
+ setValueByPath(toObject, ['mode'], fromMode);
3979
+ }
3980
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
3981
+ 'allowedFunctionNames',
3982
+ ]);
3983
+ if (fromAllowedFunctionNames != null) {
3984
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
3985
+ }
3986
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
3987
+ undefined) {
3988
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
3989
+ }
3990
+ return toObject;
3991
+ }
3920
3992
  function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3921
3993
  const toObject = {};
3922
3994
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -4029,7 +4101,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4029
4101
  }
4030
4102
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
4031
4103
  if (parentObject !== undefined && fromToolConfig != null) {
4032
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
4104
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
4033
4105
  }
4034
4106
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
4035
4107
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -4067,7 +4139,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4067
4139
  }
4068
4140
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
4069
4141
  if (fromImageConfig != null) {
4070
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
4142
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev$1(fromImageConfig));
4071
4143
  }
4072
4144
  return toObject;
4073
4145
  }
@@ -4154,6 +4226,25 @@ function googleSearchToMldev$4(fromObject) {
4154
4226
  }
4155
4227
  return toObject;
4156
4228
  }
4229
+ function imageConfigToMldev$1(fromObject) {
4230
+ const toObject = {};
4231
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
4232
+ if (fromAspectRatio != null) {
4233
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
4234
+ }
4235
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
4236
+ if (fromImageSize != null) {
4237
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
4238
+ }
4239
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
4240
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
4241
+ }
4242
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
4243
+ undefined) {
4244
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
4245
+ }
4246
+ return toObject;
4247
+ }
4157
4248
  function inlinedRequestToMldev(apiClient, fromObject) {
4158
4249
  const toObject = {};
4159
4250
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4295,9 +4386,11 @@ function listBatchJobsResponseFromVertex(fromObject) {
4295
4386
  }
4296
4387
  function partToMldev$4(fromObject) {
4297
4388
  const toObject = {};
4298
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4299
- if (fromFunctionCall != null) {
4300
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4389
+ const fromMediaResolution = getValueByPath(fromObject, [
4390
+ 'mediaResolution',
4391
+ ]);
4392
+ if (fromMediaResolution != null) {
4393
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4301
4394
  }
4302
4395
  const fromCodeExecutionResult = getValueByPath(fromObject, [
4303
4396
  'codeExecutionResult',
@@ -4315,6 +4408,10 @@ function partToMldev$4(fromObject) {
4315
4408
  if (fromFileData != null) {
4316
4409
  setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4317
4410
  }
4411
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4412
+ if (fromFunctionCall != null) {
4413
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
4414
+ }
4318
4415
  const fromFunctionResponse = getValueByPath(fromObject, [
4319
4416
  'functionResponse',
4320
4417
  ]);
@@ -4362,6 +4459,22 @@ function safetySettingToMldev$1(fromObject) {
4362
4459
  }
4363
4460
  return toObject;
4364
4461
  }
4462
+ function toolConfigToMldev$2(fromObject) {
4463
+ const toObject = {};
4464
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4465
+ 'functionCallingConfig',
4466
+ ]);
4467
+ if (fromFunctionCallingConfig != null) {
4468
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4469
+ }
4470
+ const fromRetrievalConfig = getValueByPath(fromObject, [
4471
+ 'retrievalConfig',
4472
+ ]);
4473
+ if (fromRetrievalConfig != null) {
4474
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
4475
+ }
4476
+ return toObject;
4477
+ }
4365
4478
  function toolToMldev$4(fromObject) {
4366
4479
  const toObject = {};
4367
4480
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5184,7 +5297,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
5184
5297
  }
5185
5298
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5186
5299
  if (parentObject !== undefined && fromToolConfig != null) {
5187
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
5300
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
5188
5301
  }
5189
5302
  if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
5190
5303
  throw new Error('kmsKeyName parameter is not supported in Gemini API.');
@@ -5316,6 +5429,46 @@ function fileDataToMldev$3(fromObject) {
5316
5429
  }
5317
5430
  return toObject;
5318
5431
  }
5432
+ function functionCallToMldev$3(fromObject) {
5433
+ const toObject = {};
5434
+ const fromId = getValueByPath(fromObject, ['id']);
5435
+ if (fromId != null) {
5436
+ setValueByPath(toObject, ['id'], fromId);
5437
+ }
5438
+ const fromArgs = getValueByPath(fromObject, ['args']);
5439
+ if (fromArgs != null) {
5440
+ setValueByPath(toObject, ['args'], fromArgs);
5441
+ }
5442
+ const fromName = getValueByPath(fromObject, ['name']);
5443
+ if (fromName != null) {
5444
+ setValueByPath(toObject, ['name'], fromName);
5445
+ }
5446
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
5447
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
5448
+ }
5449
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
5450
+ throw new Error('willContinue parameter is not supported in Gemini API.');
5451
+ }
5452
+ return toObject;
5453
+ }
5454
+ function functionCallingConfigToMldev$1(fromObject) {
5455
+ const toObject = {};
5456
+ const fromMode = getValueByPath(fromObject, ['mode']);
5457
+ if (fromMode != null) {
5458
+ setValueByPath(toObject, ['mode'], fromMode);
5459
+ }
5460
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
5461
+ 'allowedFunctionNames',
5462
+ ]);
5463
+ if (fromAllowedFunctionNames != null) {
5464
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
5465
+ }
5466
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
5467
+ undefined) {
5468
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
5469
+ }
5470
+ return toObject;
5471
+ }
5319
5472
  function functionDeclarationToVertex$2(fromObject) {
5320
5473
  const toObject = {};
5321
5474
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -5492,9 +5645,11 @@ function listCachedContentsResponseFromVertex(fromObject) {
5492
5645
  }
5493
5646
  function partToMldev$3(fromObject) {
5494
5647
  const toObject = {};
5495
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5496
- if (fromFunctionCall != null) {
5497
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5648
+ const fromMediaResolution = getValueByPath(fromObject, [
5649
+ 'mediaResolution',
5650
+ ]);
5651
+ if (fromMediaResolution != null) {
5652
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
5498
5653
  }
5499
5654
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5500
5655
  'codeExecutionResult',
@@ -5512,6 +5667,10 @@ function partToMldev$3(fromObject) {
5512
5667
  if (fromFileData != null) {
5513
5668
  setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5514
5669
  }
5670
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5671
+ if (fromFunctionCall != null) {
5672
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
5673
+ }
5515
5674
  const fromFunctionResponse = getValueByPath(fromObject, [
5516
5675
  'functionResponse',
5517
5676
  ]);
@@ -5544,6 +5703,22 @@ function partToMldev$3(fromObject) {
5544
5703
  }
5545
5704
  return toObject;
5546
5705
  }
5706
+ function toolConfigToMldev$1(fromObject) {
5707
+ const toObject = {};
5708
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
5709
+ 'functionCallingConfig',
5710
+ ]);
5711
+ if (fromFunctionCallingConfig != null) {
5712
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5713
+ }
5714
+ const fromRetrievalConfig = getValueByPath(fromObject, [
5715
+ 'retrievalConfig',
5716
+ ]);
5717
+ if (fromRetrievalConfig != null) {
5718
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
5719
+ }
5720
+ return toObject;
5721
+ }
5547
5722
  function toolToMldev$3(fromObject) {
5548
5723
  const toObject = {};
5549
5724
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -6907,6 +7082,28 @@ function fileDataToMldev$2(fromObject) {
6907
7082
  }
6908
7083
  return toObject;
6909
7084
  }
7085
+ function functionCallToMldev$2(fromObject) {
7086
+ const toObject = {};
7087
+ const fromId = getValueByPath(fromObject, ['id']);
7088
+ if (fromId != null) {
7089
+ setValueByPath(toObject, ['id'], fromId);
7090
+ }
7091
+ const fromArgs = getValueByPath(fromObject, ['args']);
7092
+ if (fromArgs != null) {
7093
+ setValueByPath(toObject, ['args'], fromArgs);
7094
+ }
7095
+ const fromName = getValueByPath(fromObject, ['name']);
7096
+ if (fromName != null) {
7097
+ setValueByPath(toObject, ['name'], fromName);
7098
+ }
7099
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
7100
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
7101
+ }
7102
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
7103
+ throw new Error('willContinue parameter is not supported in Gemini API.');
7104
+ }
7105
+ return toObject;
7106
+ }
6910
7107
  function functionDeclarationToVertex$1(fromObject) {
6911
7108
  const toObject = {};
6912
7109
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -7495,9 +7692,11 @@ function liveServerMessageFromVertex(fromObject) {
7495
7692
  }
7496
7693
  function partToMldev$2(fromObject) {
7497
7694
  const toObject = {};
7498
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7499
- if (fromFunctionCall != null) {
7500
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
7695
+ const fromMediaResolution = getValueByPath(fromObject, [
7696
+ 'mediaResolution',
7697
+ ]);
7698
+ if (fromMediaResolution != null) {
7699
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
7501
7700
  }
7502
7701
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7503
7702
  'codeExecutionResult',
@@ -7515,6 +7714,10 @@ function partToMldev$2(fromObject) {
7515
7714
  if (fromFileData != null) {
7516
7715
  setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7517
7716
  }
7717
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7718
+ if (fromFunctionCall != null) {
7719
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
7720
+ }
7518
7721
  const fromFunctionResponse = getValueByPath(fromObject, [
7519
7722
  'functionResponse',
7520
7723
  ]);
@@ -8436,6 +8639,46 @@ function fileDataToMldev$1(fromObject) {
8436
8639
  }
8437
8640
  return toObject;
8438
8641
  }
8642
+ function functionCallToMldev$1(fromObject) {
8643
+ const toObject = {};
8644
+ const fromId = getValueByPath(fromObject, ['id']);
8645
+ if (fromId != null) {
8646
+ setValueByPath(toObject, ['id'], fromId);
8647
+ }
8648
+ const fromArgs = getValueByPath(fromObject, ['args']);
8649
+ if (fromArgs != null) {
8650
+ setValueByPath(toObject, ['args'], fromArgs);
8651
+ }
8652
+ const fromName = getValueByPath(fromObject, ['name']);
8653
+ if (fromName != null) {
8654
+ setValueByPath(toObject, ['name'], fromName);
8655
+ }
8656
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
8657
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
8658
+ }
8659
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
8660
+ throw new Error('willContinue parameter is not supported in Gemini API.');
8661
+ }
8662
+ return toObject;
8663
+ }
8664
+ function functionCallingConfigToMldev(fromObject) {
8665
+ const toObject = {};
8666
+ const fromMode = getValueByPath(fromObject, ['mode']);
8667
+ if (fromMode != null) {
8668
+ setValueByPath(toObject, ['mode'], fromMode);
8669
+ }
8670
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
8671
+ 'allowedFunctionNames',
8672
+ ]);
8673
+ if (fromAllowedFunctionNames != null) {
8674
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
8675
+ }
8676
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
8677
+ undefined) {
8678
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
8679
+ }
8680
+ return toObject;
8681
+ }
8439
8682
  function functionDeclarationToVertex(fromObject) {
8440
8683
  const toObject = {};
8441
8684
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -8583,7 +8826,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8583
8826
  }
8584
8827
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
8585
8828
  if (parentObject !== undefined && fromToolConfig != null) {
8586
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
8829
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
8587
8830
  }
8588
8831
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
8589
8832
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -8621,7 +8864,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8621
8864
  }
8622
8865
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8623
8866
  if (fromImageConfig != null) {
8624
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
8867
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev(fromImageConfig));
8625
8868
  }
8626
8869
  return toObject;
8627
8870
  }
@@ -8785,7 +9028,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8785
9028
  }
8786
9029
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8787
9030
  if (fromImageConfig != null) {
8788
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
9031
+ setValueByPath(toObject, ['imageConfig'], imageConfigToVertex(fromImageConfig));
8789
9032
  }
8790
9033
  return toObject;
8791
9034
  }
@@ -9786,6 +10029,49 @@ function googleSearchToMldev$1(fromObject) {
9786
10029
  }
9787
10030
  return toObject;
9788
10031
  }
10032
+ function imageConfigToMldev(fromObject) {
10033
+ const toObject = {};
10034
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10035
+ if (fromAspectRatio != null) {
10036
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
10037
+ }
10038
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10039
+ if (fromImageSize != null) {
10040
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
10041
+ }
10042
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
10043
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
10044
+ }
10045
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
10046
+ undefined) {
10047
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
10048
+ }
10049
+ return toObject;
10050
+ }
10051
+ function imageConfigToVertex(fromObject) {
10052
+ const toObject = {};
10053
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10054
+ if (fromAspectRatio != null) {
10055
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
10056
+ }
10057
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10058
+ if (fromImageSize != null) {
10059
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
10060
+ }
10061
+ const fromOutputMimeType = getValueByPath(fromObject, [
10062
+ 'outputMimeType',
10063
+ ]);
10064
+ if (fromOutputMimeType != null) {
10065
+ setValueByPath(toObject, ['imageOutputOptions', 'mimeType'], fromOutputMimeType);
10066
+ }
10067
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
10068
+ 'outputCompressionQuality',
10069
+ ]);
10070
+ if (fromOutputCompressionQuality != null) {
10071
+ setValueByPath(toObject, ['imageOutputOptions', 'compressionQuality'], fromOutputCompressionQuality);
10072
+ }
10073
+ return toObject;
10074
+ }
9789
10075
  function imageFromMldev(fromObject) {
9790
10076
  const toObject = {};
9791
10077
  const fromImageBytes = getValueByPath(fromObject, [
@@ -10095,9 +10381,11 @@ function modelFromVertex(fromObject) {
10095
10381
  }
10096
10382
  function partToMldev$1(fromObject) {
10097
10383
  const toObject = {};
10098
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10099
- if (fromFunctionCall != null) {
10100
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
10384
+ const fromMediaResolution = getValueByPath(fromObject, [
10385
+ 'mediaResolution',
10386
+ ]);
10387
+ if (fromMediaResolution != null) {
10388
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
10101
10389
  }
10102
10390
  const fromCodeExecutionResult = getValueByPath(fromObject, [
10103
10391
  'codeExecutionResult',
@@ -10115,6 +10403,10 @@ function partToMldev$1(fromObject) {
10115
10403
  if (fromFileData != null) {
10116
10404
  setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10117
10405
  }
10406
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10407
+ if (fromFunctionCall != null) {
10408
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
10409
+ }
10118
10410
  const fromFunctionResponse = getValueByPath(fromObject, [
10119
10411
  'functionResponse',
10120
10412
  ]);
@@ -10479,6 +10771,22 @@ function speechConfigToVertex(fromObject) {
10479
10771
  }
10480
10772
  return toObject;
10481
10773
  }
10774
+ function toolConfigToMldev(fromObject) {
10775
+ const toObject = {};
10776
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
10777
+ 'functionCallingConfig',
10778
+ ]);
10779
+ if (fromFunctionCallingConfig != null) {
10780
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
10781
+ }
10782
+ const fromRetrievalConfig = getValueByPath(fromObject, [
10783
+ 'retrievalConfig',
10784
+ ]);
10785
+ if (fromRetrievalConfig != null) {
10786
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
10787
+ }
10788
+ return toObject;
10789
+ }
10482
10790
  function toolToMldev$1(fromObject) {
10483
10791
  const toObject = {};
10484
10792
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10909,7 +11217,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10909
11217
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10910
11218
  const USER_AGENT_HEADER = 'User-Agent';
10911
11219
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10912
- const SDK_VERSION = '1.29.1'; // x-release-please-version
11220
+ const SDK_VERSION = '1.30.0'; // x-release-please-version
10913
11221
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10914
11222
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10915
11223
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -12566,6 +12874,7 @@ class Models extends BaseModule {
12566
12874
  * ```
12567
12875
  */
12568
12876
  this.generateContentStream = async (params) => {
12877
+ var _a, _b, _c, _d, _e;
12569
12878
  this.maybeMoveToResponseJsonSchem(params);
12570
12879
  if (shouldDisableAfc(params.config)) {
12571
12880
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
@@ -12578,6 +12887,17 @@ class Models extends BaseModule {
12578
12887
  .join(', ');
12579
12888
  throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
12580
12889
  }
12890
+ // With tool compatibility confirmed, validate that the configuration are
12891
+ // compatible with each other and raise an error if invalid.
12892
+ const streamFunctionCall = (_c = (_b = (_a = params === null || params === void 0 ? void 0 : params.config) === null || _a === void 0 ? void 0 : _a.toolConfig) === null || _b === void 0 ? void 0 : _b.functionCallingConfig) === null || _c === void 0 ? void 0 : _c.streamFunctionCallArguments;
12893
+ const disableAfc = (_e = (_d = params === null || params === void 0 ? void 0 : params.config) === null || _d === void 0 ? void 0 : _d.automaticFunctionCalling) === null || _e === void 0 ? void 0 : _e.disable;
12894
+ if (streamFunctionCall && !disableAfc) {
12895
+ throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, " +
12896
+ 'this feature is not compatible with automatic function calling (AFC). ' +
12897
+ "Please set 'config.automaticFunctionCalling.disable' to true to disable AFC " +
12898
+ "or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' " +
12899
+ 'to be undefined or set to false to disable streaming function call arguments feature.');
12900
+ }
12581
12901
  return await this.processAfcStream(params);
12582
12902
  };
12583
12903
  /**
@@ -14195,6 +14515,28 @@ function fileDataToMldev(fromObject) {
14195
14515
  }
14196
14516
  return toObject;
14197
14517
  }
14518
+ function functionCallToMldev(fromObject) {
14519
+ const toObject = {};
14520
+ const fromId = getValueByPath(fromObject, ['id']);
14521
+ if (fromId != null) {
14522
+ setValueByPath(toObject, ['id'], fromId);
14523
+ }
14524
+ const fromArgs = getValueByPath(fromObject, ['args']);
14525
+ if (fromArgs != null) {
14526
+ setValueByPath(toObject, ['args'], fromArgs);
14527
+ }
14528
+ const fromName = getValueByPath(fromObject, ['name']);
14529
+ if (fromName != null) {
14530
+ setValueByPath(toObject, ['name'], fromName);
14531
+ }
14532
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
14533
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
14534
+ }
14535
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
14536
+ throw new Error('willContinue parameter is not supported in Gemini API.');
14537
+ }
14538
+ return toObject;
14539
+ }
14198
14540
  function googleMapsToMldev(fromObject) {
14199
14541
  const toObject = {};
14200
14542
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
@@ -14346,9 +14688,11 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
14346
14688
  }
14347
14689
  function partToMldev(fromObject) {
14348
14690
  const toObject = {};
14349
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14350
- if (fromFunctionCall != null) {
14351
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
14691
+ const fromMediaResolution = getValueByPath(fromObject, [
14692
+ 'mediaResolution',
14693
+ ]);
14694
+ if (fromMediaResolution != null) {
14695
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
14352
14696
  }
14353
14697
  const fromCodeExecutionResult = getValueByPath(fromObject, [
14354
14698
  'codeExecutionResult',
@@ -14366,6 +14710,10 @@ function partToMldev(fromObject) {
14366
14710
  if (fromFileData != null) {
14367
14711
  setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14368
14712
  }
14713
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14714
+ if (fromFunctionCall != null) {
14715
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
14716
+ }
14369
14717
  const fromFunctionResponse = getValueByPath(fromObject, [
14370
14718
  'functionResponse',
14371
14719
  ]);