@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.
@@ -795,6 +795,22 @@ var PhishBlockThreshold;
795
795
  */
796
796
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
797
797
  })(PhishBlockThreshold || (PhishBlockThreshold = {}));
798
+ /** The level of thoughts tokens that the model should generate. */
799
+ var ThinkingLevel;
800
+ (function (ThinkingLevel) {
801
+ /**
802
+ * Default value.
803
+ */
804
+ ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
805
+ /**
806
+ * Low thinking level.
807
+ */
808
+ ThinkingLevel["LOW"] = "LOW";
809
+ /**
810
+ * High thinking level.
811
+ */
812
+ ThinkingLevel["HIGH"] = "HIGH";
813
+ })(ThinkingLevel || (ThinkingLevel = {}));
798
814
  /** Harm category. */
799
815
  var HarmCategory;
800
816
  (function (HarmCategory) {
@@ -1237,6 +1253,26 @@ var TuningTask;
1237
1253
  */
1238
1254
  TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
1239
1255
  })(TuningTask || (TuningTask = {}));
1256
+ /** The tokenization quality used for given media. */
1257
+ var PartMediaResolutionLevel;
1258
+ (function (PartMediaResolutionLevel) {
1259
+ /**
1260
+ * Media resolution has not been set.
1261
+ */
1262
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1263
+ /**
1264
+ * Media resolution set to low.
1265
+ */
1266
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1267
+ /**
1268
+ * Media resolution set to medium.
1269
+ */
1270
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1271
+ /**
1272
+ * Media resolution set to high.
1273
+ */
1274
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1275
+ })(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
1240
1276
  /** Options for feature selection preference. */
1241
1277
  var FeatureSelectionPreference;
1242
1278
  (function (FeatureSelectionPreference) {
@@ -1771,13 +1807,11 @@ class FunctionResponse {
1771
1807
  /**
1772
1808
  * Creates a `Part` object from a `URI` string.
1773
1809
  */
1774
- function createPartFromUri(uri, mimeType) {
1775
- return {
1776
- fileData: {
1810
+ function createPartFromUri(uri, mimeType, mediaResolution) {
1811
+ return Object.assign({ fileData: {
1777
1812
  fileUri: uri,
1778
1813
  mimeType: mimeType,
1779
- },
1780
- };
1814
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1781
1815
  }
1782
1816
  /**
1783
1817
  * Creates a `Part` object from a `text` string.
@@ -1809,13 +1843,11 @@ function createPartFromFunctionResponse(id, name, response, parts = []) {
1809
1843
  /**
1810
1844
  * Creates a `Part` object from a `base64` encoded `string`.
1811
1845
  */
1812
- function createPartFromBase64(data, mimeType) {
1813
- return {
1814
- inlineData: {
1846
+ function createPartFromBase64(data, mimeType, mediaResolution) {
1847
+ return Object.assign({ inlineData: {
1815
1848
  data: data,
1816
1849
  mimeType: mimeType,
1817
- },
1818
- };
1850
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1819
1851
  }
1820
1852
  /**
1821
1853
  * Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
@@ -3895,6 +3927,46 @@ function fileDataToMldev$4(fromObject) {
3895
3927
  }
3896
3928
  return toObject;
3897
3929
  }
3930
+ function functionCallToMldev$4(fromObject) {
3931
+ const toObject = {};
3932
+ const fromId = getValueByPath(fromObject, ['id']);
3933
+ if (fromId != null) {
3934
+ setValueByPath(toObject, ['id'], fromId);
3935
+ }
3936
+ const fromArgs = getValueByPath(fromObject, ['args']);
3937
+ if (fromArgs != null) {
3938
+ setValueByPath(toObject, ['args'], fromArgs);
3939
+ }
3940
+ const fromName = getValueByPath(fromObject, ['name']);
3941
+ if (fromName != null) {
3942
+ setValueByPath(toObject, ['name'], fromName);
3943
+ }
3944
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
3945
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
3946
+ }
3947
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
3948
+ throw new Error('willContinue parameter is not supported in Gemini API.');
3949
+ }
3950
+ return toObject;
3951
+ }
3952
+ function functionCallingConfigToMldev$2(fromObject) {
3953
+ const toObject = {};
3954
+ const fromMode = getValueByPath(fromObject, ['mode']);
3955
+ if (fromMode != null) {
3956
+ setValueByPath(toObject, ['mode'], fromMode);
3957
+ }
3958
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
3959
+ 'allowedFunctionNames',
3960
+ ]);
3961
+ if (fromAllowedFunctionNames != null) {
3962
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
3963
+ }
3964
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
3965
+ undefined) {
3966
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
3967
+ }
3968
+ return toObject;
3969
+ }
3898
3970
  function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3899
3971
  const toObject = {};
3900
3972
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -4007,7 +4079,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4007
4079
  }
4008
4080
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
4009
4081
  if (parentObject !== undefined && fromToolConfig != null) {
4010
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
4082
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
4011
4083
  }
4012
4084
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
4013
4085
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -4045,7 +4117,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4045
4117
  }
4046
4118
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
4047
4119
  if (fromImageConfig != null) {
4048
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
4120
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev$1(fromImageConfig));
4049
4121
  }
4050
4122
  return toObject;
4051
4123
  }
@@ -4132,6 +4204,25 @@ function googleSearchToMldev$4(fromObject) {
4132
4204
  }
4133
4205
  return toObject;
4134
4206
  }
4207
+ function imageConfigToMldev$1(fromObject) {
4208
+ const toObject = {};
4209
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
4210
+ if (fromAspectRatio != null) {
4211
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
4212
+ }
4213
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
4214
+ if (fromImageSize != null) {
4215
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
4216
+ }
4217
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
4218
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
4219
+ }
4220
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
4221
+ undefined) {
4222
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
4223
+ }
4224
+ return toObject;
4225
+ }
4135
4226
  function inlinedRequestToMldev(apiClient, fromObject) {
4136
4227
  const toObject = {};
4137
4228
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4273,9 +4364,11 @@ function listBatchJobsResponseFromVertex(fromObject) {
4273
4364
  }
4274
4365
  function partToMldev$4(fromObject) {
4275
4366
  const toObject = {};
4276
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4277
- if (fromFunctionCall != null) {
4278
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4367
+ const fromMediaResolution = getValueByPath(fromObject, [
4368
+ 'mediaResolution',
4369
+ ]);
4370
+ if (fromMediaResolution != null) {
4371
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4279
4372
  }
4280
4373
  const fromCodeExecutionResult = getValueByPath(fromObject, [
4281
4374
  'codeExecutionResult',
@@ -4293,6 +4386,10 @@ function partToMldev$4(fromObject) {
4293
4386
  if (fromFileData != null) {
4294
4387
  setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4295
4388
  }
4389
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4390
+ if (fromFunctionCall != null) {
4391
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
4392
+ }
4296
4393
  const fromFunctionResponse = getValueByPath(fromObject, [
4297
4394
  'functionResponse',
4298
4395
  ]);
@@ -4340,6 +4437,22 @@ function safetySettingToMldev$1(fromObject) {
4340
4437
  }
4341
4438
  return toObject;
4342
4439
  }
4440
+ function toolConfigToMldev$2(fromObject) {
4441
+ const toObject = {};
4442
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4443
+ 'functionCallingConfig',
4444
+ ]);
4445
+ if (fromFunctionCallingConfig != null) {
4446
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4447
+ }
4448
+ const fromRetrievalConfig = getValueByPath(fromObject, [
4449
+ 'retrievalConfig',
4450
+ ]);
4451
+ if (fromRetrievalConfig != null) {
4452
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
4453
+ }
4454
+ return toObject;
4455
+ }
4343
4456
  function toolToMldev$4(fromObject) {
4344
4457
  const toObject = {};
4345
4458
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5162,7 +5275,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
5162
5275
  }
5163
5276
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5164
5277
  if (parentObject !== undefined && fromToolConfig != null) {
5165
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
5278
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
5166
5279
  }
5167
5280
  if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
5168
5281
  throw new Error('kmsKeyName parameter is not supported in Gemini API.');
@@ -5294,6 +5407,46 @@ function fileDataToMldev$3(fromObject) {
5294
5407
  }
5295
5408
  return toObject;
5296
5409
  }
5410
+ function functionCallToMldev$3(fromObject) {
5411
+ const toObject = {};
5412
+ const fromId = getValueByPath(fromObject, ['id']);
5413
+ if (fromId != null) {
5414
+ setValueByPath(toObject, ['id'], fromId);
5415
+ }
5416
+ const fromArgs = getValueByPath(fromObject, ['args']);
5417
+ if (fromArgs != null) {
5418
+ setValueByPath(toObject, ['args'], fromArgs);
5419
+ }
5420
+ const fromName = getValueByPath(fromObject, ['name']);
5421
+ if (fromName != null) {
5422
+ setValueByPath(toObject, ['name'], fromName);
5423
+ }
5424
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
5425
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
5426
+ }
5427
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
5428
+ throw new Error('willContinue parameter is not supported in Gemini API.');
5429
+ }
5430
+ return toObject;
5431
+ }
5432
+ function functionCallingConfigToMldev$1(fromObject) {
5433
+ const toObject = {};
5434
+ const fromMode = getValueByPath(fromObject, ['mode']);
5435
+ if (fromMode != null) {
5436
+ setValueByPath(toObject, ['mode'], fromMode);
5437
+ }
5438
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
5439
+ 'allowedFunctionNames',
5440
+ ]);
5441
+ if (fromAllowedFunctionNames != null) {
5442
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
5443
+ }
5444
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
5445
+ undefined) {
5446
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
5447
+ }
5448
+ return toObject;
5449
+ }
5297
5450
  function functionDeclarationToVertex$2(fromObject) {
5298
5451
  const toObject = {};
5299
5452
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -5470,9 +5623,11 @@ function listCachedContentsResponseFromVertex(fromObject) {
5470
5623
  }
5471
5624
  function partToMldev$3(fromObject) {
5472
5625
  const toObject = {};
5473
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5474
- if (fromFunctionCall != null) {
5475
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5626
+ const fromMediaResolution = getValueByPath(fromObject, [
5627
+ 'mediaResolution',
5628
+ ]);
5629
+ if (fromMediaResolution != null) {
5630
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
5476
5631
  }
5477
5632
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5478
5633
  'codeExecutionResult',
@@ -5490,6 +5645,10 @@ function partToMldev$3(fromObject) {
5490
5645
  if (fromFileData != null) {
5491
5646
  setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5492
5647
  }
5648
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5649
+ if (fromFunctionCall != null) {
5650
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
5651
+ }
5493
5652
  const fromFunctionResponse = getValueByPath(fromObject, [
5494
5653
  'functionResponse',
5495
5654
  ]);
@@ -5522,6 +5681,22 @@ function partToMldev$3(fromObject) {
5522
5681
  }
5523
5682
  return toObject;
5524
5683
  }
5684
+ function toolConfigToMldev$1(fromObject) {
5685
+ const toObject = {};
5686
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
5687
+ 'functionCallingConfig',
5688
+ ]);
5689
+ if (fromFunctionCallingConfig != null) {
5690
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5691
+ }
5692
+ const fromRetrievalConfig = getValueByPath(fromObject, [
5693
+ 'retrievalConfig',
5694
+ ]);
5695
+ if (fromRetrievalConfig != null) {
5696
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
5697
+ }
5698
+ return toObject;
5699
+ }
5525
5700
  function toolToMldev$3(fromObject) {
5526
5701
  const toObject = {};
5527
5702
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -6885,6 +7060,28 @@ function fileDataToMldev$2(fromObject) {
6885
7060
  }
6886
7061
  return toObject;
6887
7062
  }
7063
+ function functionCallToMldev$2(fromObject) {
7064
+ const toObject = {};
7065
+ const fromId = getValueByPath(fromObject, ['id']);
7066
+ if (fromId != null) {
7067
+ setValueByPath(toObject, ['id'], fromId);
7068
+ }
7069
+ const fromArgs = getValueByPath(fromObject, ['args']);
7070
+ if (fromArgs != null) {
7071
+ setValueByPath(toObject, ['args'], fromArgs);
7072
+ }
7073
+ const fromName = getValueByPath(fromObject, ['name']);
7074
+ if (fromName != null) {
7075
+ setValueByPath(toObject, ['name'], fromName);
7076
+ }
7077
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
7078
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
7079
+ }
7080
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
7081
+ throw new Error('willContinue parameter is not supported in Gemini API.');
7082
+ }
7083
+ return toObject;
7084
+ }
6888
7085
  function functionDeclarationToVertex$1(fromObject) {
6889
7086
  const toObject = {};
6890
7087
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -7473,9 +7670,11 @@ function liveServerMessageFromVertex(fromObject) {
7473
7670
  }
7474
7671
  function partToMldev$2(fromObject) {
7475
7672
  const toObject = {};
7476
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7477
- if (fromFunctionCall != null) {
7478
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
7673
+ const fromMediaResolution = getValueByPath(fromObject, [
7674
+ 'mediaResolution',
7675
+ ]);
7676
+ if (fromMediaResolution != null) {
7677
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
7479
7678
  }
7480
7679
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7481
7680
  'codeExecutionResult',
@@ -7493,6 +7692,10 @@ function partToMldev$2(fromObject) {
7493
7692
  if (fromFileData != null) {
7494
7693
  setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7495
7694
  }
7695
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7696
+ if (fromFunctionCall != null) {
7697
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
7698
+ }
7496
7699
  const fromFunctionResponse = getValueByPath(fromObject, [
7497
7700
  'functionResponse',
7498
7701
  ]);
@@ -8414,6 +8617,46 @@ function fileDataToMldev$1(fromObject) {
8414
8617
  }
8415
8618
  return toObject;
8416
8619
  }
8620
+ function functionCallToMldev$1(fromObject) {
8621
+ const toObject = {};
8622
+ const fromId = getValueByPath(fromObject, ['id']);
8623
+ if (fromId != null) {
8624
+ setValueByPath(toObject, ['id'], fromId);
8625
+ }
8626
+ const fromArgs = getValueByPath(fromObject, ['args']);
8627
+ if (fromArgs != null) {
8628
+ setValueByPath(toObject, ['args'], fromArgs);
8629
+ }
8630
+ const fromName = getValueByPath(fromObject, ['name']);
8631
+ if (fromName != null) {
8632
+ setValueByPath(toObject, ['name'], fromName);
8633
+ }
8634
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
8635
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
8636
+ }
8637
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
8638
+ throw new Error('willContinue parameter is not supported in Gemini API.');
8639
+ }
8640
+ return toObject;
8641
+ }
8642
+ function functionCallingConfigToMldev(fromObject) {
8643
+ const toObject = {};
8644
+ const fromMode = getValueByPath(fromObject, ['mode']);
8645
+ if (fromMode != null) {
8646
+ setValueByPath(toObject, ['mode'], fromMode);
8647
+ }
8648
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
8649
+ 'allowedFunctionNames',
8650
+ ]);
8651
+ if (fromAllowedFunctionNames != null) {
8652
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
8653
+ }
8654
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
8655
+ undefined) {
8656
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
8657
+ }
8658
+ return toObject;
8659
+ }
8417
8660
  function functionDeclarationToVertex(fromObject) {
8418
8661
  const toObject = {};
8419
8662
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -8561,7 +8804,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8561
8804
  }
8562
8805
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
8563
8806
  if (parentObject !== undefined && fromToolConfig != null) {
8564
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
8807
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
8565
8808
  }
8566
8809
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
8567
8810
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -8599,7 +8842,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8599
8842
  }
8600
8843
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8601
8844
  if (fromImageConfig != null) {
8602
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
8845
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev(fromImageConfig));
8603
8846
  }
8604
8847
  return toObject;
8605
8848
  }
@@ -8763,7 +9006,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8763
9006
  }
8764
9007
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8765
9008
  if (fromImageConfig != null) {
8766
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
9009
+ setValueByPath(toObject, ['imageConfig'], imageConfigToVertex(fromImageConfig));
8767
9010
  }
8768
9011
  return toObject;
8769
9012
  }
@@ -9764,6 +10007,49 @@ function googleSearchToMldev$1(fromObject) {
9764
10007
  }
9765
10008
  return toObject;
9766
10009
  }
10010
+ function imageConfigToMldev(fromObject) {
10011
+ const toObject = {};
10012
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10013
+ if (fromAspectRatio != null) {
10014
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
10015
+ }
10016
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10017
+ if (fromImageSize != null) {
10018
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
10019
+ }
10020
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
10021
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
10022
+ }
10023
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
10024
+ undefined) {
10025
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
10026
+ }
10027
+ return toObject;
10028
+ }
10029
+ function imageConfigToVertex(fromObject) {
10030
+ const toObject = {};
10031
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10032
+ if (fromAspectRatio != null) {
10033
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
10034
+ }
10035
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10036
+ if (fromImageSize != null) {
10037
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
10038
+ }
10039
+ const fromOutputMimeType = getValueByPath(fromObject, [
10040
+ 'outputMimeType',
10041
+ ]);
10042
+ if (fromOutputMimeType != null) {
10043
+ setValueByPath(toObject, ['imageOutputOptions', 'mimeType'], fromOutputMimeType);
10044
+ }
10045
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
10046
+ 'outputCompressionQuality',
10047
+ ]);
10048
+ if (fromOutputCompressionQuality != null) {
10049
+ setValueByPath(toObject, ['imageOutputOptions', 'compressionQuality'], fromOutputCompressionQuality);
10050
+ }
10051
+ return toObject;
10052
+ }
9767
10053
  function imageFromMldev(fromObject) {
9768
10054
  const toObject = {};
9769
10055
  const fromImageBytes = getValueByPath(fromObject, [
@@ -10073,9 +10359,11 @@ function modelFromVertex(fromObject) {
10073
10359
  }
10074
10360
  function partToMldev$1(fromObject) {
10075
10361
  const toObject = {};
10076
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10077
- if (fromFunctionCall != null) {
10078
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
10362
+ const fromMediaResolution = getValueByPath(fromObject, [
10363
+ 'mediaResolution',
10364
+ ]);
10365
+ if (fromMediaResolution != null) {
10366
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
10079
10367
  }
10080
10368
  const fromCodeExecutionResult = getValueByPath(fromObject, [
10081
10369
  'codeExecutionResult',
@@ -10093,6 +10381,10 @@ function partToMldev$1(fromObject) {
10093
10381
  if (fromFileData != null) {
10094
10382
  setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10095
10383
  }
10384
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10385
+ if (fromFunctionCall != null) {
10386
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
10387
+ }
10096
10388
  const fromFunctionResponse = getValueByPath(fromObject, [
10097
10389
  'functionResponse',
10098
10390
  ]);
@@ -10457,6 +10749,22 @@ function speechConfigToVertex(fromObject) {
10457
10749
  }
10458
10750
  return toObject;
10459
10751
  }
10752
+ function toolConfigToMldev(fromObject) {
10753
+ const toObject = {};
10754
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
10755
+ 'functionCallingConfig',
10756
+ ]);
10757
+ if (fromFunctionCallingConfig != null) {
10758
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
10759
+ }
10760
+ const fromRetrievalConfig = getValueByPath(fromObject, [
10761
+ 'retrievalConfig',
10762
+ ]);
10763
+ if (fromRetrievalConfig != null) {
10764
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
10765
+ }
10766
+ return toObject;
10767
+ }
10460
10768
  function toolToMldev$1(fromObject) {
10461
10769
  const toObject = {};
10462
10770
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10887,7 +11195,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10887
11195
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10888
11196
  const USER_AGENT_HEADER = 'User-Agent';
10889
11197
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10890
- const SDK_VERSION = '1.29.1'; // x-release-please-version
11198
+ const SDK_VERSION = '1.30.0'; // x-release-please-version
10891
11199
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10892
11200
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10893
11201
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -12544,6 +12852,7 @@ class Models extends BaseModule {
12544
12852
  * ```
12545
12853
  */
12546
12854
  this.generateContentStream = async (params) => {
12855
+ var _a, _b, _c, _d, _e;
12547
12856
  this.maybeMoveToResponseJsonSchem(params);
12548
12857
  if (shouldDisableAfc(params.config)) {
12549
12858
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
@@ -12556,6 +12865,17 @@ class Models extends BaseModule {
12556
12865
  .join(', ');
12557
12866
  throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
12558
12867
  }
12868
+ // With tool compatibility confirmed, validate that the configuration are
12869
+ // compatible with each other and raise an error if invalid.
12870
+ 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;
12871
+ 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;
12872
+ if (streamFunctionCall && !disableAfc) {
12873
+ throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, " +
12874
+ 'this feature is not compatible with automatic function calling (AFC). ' +
12875
+ "Please set 'config.automaticFunctionCalling.disable' to true to disable AFC " +
12876
+ "or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' " +
12877
+ 'to be undefined or set to false to disable streaming function call arguments feature.');
12878
+ }
12559
12879
  return await this.processAfcStream(params);
12560
12880
  };
12561
12881
  /**
@@ -14173,6 +14493,28 @@ function fileDataToMldev(fromObject) {
14173
14493
  }
14174
14494
  return toObject;
14175
14495
  }
14496
+ function functionCallToMldev(fromObject) {
14497
+ const toObject = {};
14498
+ const fromId = getValueByPath(fromObject, ['id']);
14499
+ if (fromId != null) {
14500
+ setValueByPath(toObject, ['id'], fromId);
14501
+ }
14502
+ const fromArgs = getValueByPath(fromObject, ['args']);
14503
+ if (fromArgs != null) {
14504
+ setValueByPath(toObject, ['args'], fromArgs);
14505
+ }
14506
+ const fromName = getValueByPath(fromObject, ['name']);
14507
+ if (fromName != null) {
14508
+ setValueByPath(toObject, ['name'], fromName);
14509
+ }
14510
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
14511
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
14512
+ }
14513
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
14514
+ throw new Error('willContinue parameter is not supported in Gemini API.');
14515
+ }
14516
+ return toObject;
14517
+ }
14176
14518
  function googleMapsToMldev(fromObject) {
14177
14519
  const toObject = {};
14178
14520
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
@@ -14324,9 +14666,11 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
14324
14666
  }
14325
14667
  function partToMldev(fromObject) {
14326
14668
  const toObject = {};
14327
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14328
- if (fromFunctionCall != null) {
14329
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
14669
+ const fromMediaResolution = getValueByPath(fromObject, [
14670
+ 'mediaResolution',
14671
+ ]);
14672
+ if (fromMediaResolution != null) {
14673
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
14330
14674
  }
14331
14675
  const fromCodeExecutionResult = getValueByPath(fromObject, [
14332
14676
  'codeExecutionResult',
@@ -14344,6 +14688,10 @@ function partToMldev(fromObject) {
14344
14688
  if (fromFileData != null) {
14345
14689
  setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14346
14690
  }
14691
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14692
+ if (fromFunctionCall != null) {
14693
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
14694
+ }
14347
14695
  const fromFunctionResponse = getValueByPath(fromObject, [
14348
14696
  'functionResponse',
14349
14697
  ]);
@@ -17102,5 +17450,5 @@ function getApiKeyFromEnv() {
17102
17450
  return envGoogleApiKey || envGeminiApiKey || undefined;
17103
17451
  }
17104
17452
 
17105
- export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, PhishBlockThreshold, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
17453
+ export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
17106
17454
  //# sourceMappingURL=index.mjs.map