@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.
@@ -786,6 +786,22 @@ var PhishBlockThreshold;
786
786
  */
787
787
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
788
788
  })(PhishBlockThreshold || (PhishBlockThreshold = {}));
789
+ /** The level of thoughts tokens that the model should generate. */
790
+ var ThinkingLevel;
791
+ (function (ThinkingLevel) {
792
+ /**
793
+ * Default value.
794
+ */
795
+ ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
796
+ /**
797
+ * Low thinking level.
798
+ */
799
+ ThinkingLevel["LOW"] = "LOW";
800
+ /**
801
+ * High thinking level.
802
+ */
803
+ ThinkingLevel["HIGH"] = "HIGH";
804
+ })(ThinkingLevel || (ThinkingLevel = {}));
789
805
  /** Harm category. */
790
806
  var HarmCategory;
791
807
  (function (HarmCategory) {
@@ -1228,6 +1244,26 @@ var TuningTask;
1228
1244
  */
1229
1245
  TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
1230
1246
  })(TuningTask || (TuningTask = {}));
1247
+ /** The tokenization quality used for given media. */
1248
+ var PartMediaResolutionLevel;
1249
+ (function (PartMediaResolutionLevel) {
1250
+ /**
1251
+ * Media resolution has not been set.
1252
+ */
1253
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1254
+ /**
1255
+ * Media resolution set to low.
1256
+ */
1257
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1258
+ /**
1259
+ * Media resolution set to medium.
1260
+ */
1261
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1262
+ /**
1263
+ * Media resolution set to high.
1264
+ */
1265
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1266
+ })(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
1231
1267
  /** Options for feature selection preference. */
1232
1268
  var FeatureSelectionPreference;
1233
1269
  (function (FeatureSelectionPreference) {
@@ -1762,13 +1798,11 @@ class FunctionResponse {
1762
1798
  /**
1763
1799
  * Creates a `Part` object from a `URI` string.
1764
1800
  */
1765
- function createPartFromUri(uri, mimeType) {
1766
- return {
1767
- fileData: {
1801
+ function createPartFromUri(uri, mimeType, mediaResolution) {
1802
+ return Object.assign({ fileData: {
1768
1803
  fileUri: uri,
1769
1804
  mimeType: mimeType,
1770
- },
1771
- };
1805
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1772
1806
  }
1773
1807
  /**
1774
1808
  * Creates a `Part` object from a `text` string.
@@ -1800,13 +1834,11 @@ function createPartFromFunctionResponse(id, name, response, parts = []) {
1800
1834
  /**
1801
1835
  * Creates a `Part` object from a `base64` encoded `string`.
1802
1836
  */
1803
- function createPartFromBase64(data, mimeType) {
1804
- return {
1805
- inlineData: {
1837
+ function createPartFromBase64(data, mimeType, mediaResolution) {
1838
+ return Object.assign({ inlineData: {
1806
1839
  data: data,
1807
1840
  mimeType: mimeType,
1808
- },
1809
- };
1841
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1810
1842
  }
1811
1843
  /**
1812
1844
  * Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
@@ -3886,6 +3918,46 @@ function fileDataToMldev$4(fromObject) {
3886
3918
  }
3887
3919
  return toObject;
3888
3920
  }
3921
+ function functionCallToMldev$4(fromObject) {
3922
+ const toObject = {};
3923
+ const fromId = getValueByPath(fromObject, ['id']);
3924
+ if (fromId != null) {
3925
+ setValueByPath(toObject, ['id'], fromId);
3926
+ }
3927
+ const fromArgs = getValueByPath(fromObject, ['args']);
3928
+ if (fromArgs != null) {
3929
+ setValueByPath(toObject, ['args'], fromArgs);
3930
+ }
3931
+ const fromName = getValueByPath(fromObject, ['name']);
3932
+ if (fromName != null) {
3933
+ setValueByPath(toObject, ['name'], fromName);
3934
+ }
3935
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
3936
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
3937
+ }
3938
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
3939
+ throw new Error('willContinue parameter is not supported in Gemini API.');
3940
+ }
3941
+ return toObject;
3942
+ }
3943
+ function functionCallingConfigToMldev$2(fromObject) {
3944
+ const toObject = {};
3945
+ const fromMode = getValueByPath(fromObject, ['mode']);
3946
+ if (fromMode != null) {
3947
+ setValueByPath(toObject, ['mode'], fromMode);
3948
+ }
3949
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
3950
+ 'allowedFunctionNames',
3951
+ ]);
3952
+ if (fromAllowedFunctionNames != null) {
3953
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
3954
+ }
3955
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
3956
+ undefined) {
3957
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
3958
+ }
3959
+ return toObject;
3960
+ }
3889
3961
  function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3890
3962
  const toObject = {};
3891
3963
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -3998,7 +4070,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3998
4070
  }
3999
4071
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
4000
4072
  if (parentObject !== undefined && fromToolConfig != null) {
4001
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
4073
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
4002
4074
  }
4003
4075
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
4004
4076
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -4036,7 +4108,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4036
4108
  }
4037
4109
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
4038
4110
  if (fromImageConfig != null) {
4039
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
4111
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev$1(fromImageConfig));
4040
4112
  }
4041
4113
  return toObject;
4042
4114
  }
@@ -4123,6 +4195,25 @@ function googleSearchToMldev$4(fromObject) {
4123
4195
  }
4124
4196
  return toObject;
4125
4197
  }
4198
+ function imageConfigToMldev$1(fromObject) {
4199
+ const toObject = {};
4200
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
4201
+ if (fromAspectRatio != null) {
4202
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
4203
+ }
4204
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
4205
+ if (fromImageSize != null) {
4206
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
4207
+ }
4208
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
4209
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
4210
+ }
4211
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
4212
+ undefined) {
4213
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
4214
+ }
4215
+ return toObject;
4216
+ }
4126
4217
  function inlinedRequestToMldev(apiClient, fromObject) {
4127
4218
  const toObject = {};
4128
4219
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4264,9 +4355,11 @@ function listBatchJobsResponseFromVertex(fromObject) {
4264
4355
  }
4265
4356
  function partToMldev$4(fromObject) {
4266
4357
  const toObject = {};
4267
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4268
- if (fromFunctionCall != null) {
4269
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4358
+ const fromMediaResolution = getValueByPath(fromObject, [
4359
+ 'mediaResolution',
4360
+ ]);
4361
+ if (fromMediaResolution != null) {
4362
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4270
4363
  }
4271
4364
  const fromCodeExecutionResult = getValueByPath(fromObject, [
4272
4365
  'codeExecutionResult',
@@ -4284,6 +4377,10 @@ function partToMldev$4(fromObject) {
4284
4377
  if (fromFileData != null) {
4285
4378
  setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4286
4379
  }
4380
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4381
+ if (fromFunctionCall != null) {
4382
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
4383
+ }
4287
4384
  const fromFunctionResponse = getValueByPath(fromObject, [
4288
4385
  'functionResponse',
4289
4386
  ]);
@@ -4331,6 +4428,22 @@ function safetySettingToMldev$1(fromObject) {
4331
4428
  }
4332
4429
  return toObject;
4333
4430
  }
4431
+ function toolConfigToMldev$2(fromObject) {
4432
+ const toObject = {};
4433
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4434
+ 'functionCallingConfig',
4435
+ ]);
4436
+ if (fromFunctionCallingConfig != null) {
4437
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4438
+ }
4439
+ const fromRetrievalConfig = getValueByPath(fromObject, [
4440
+ 'retrievalConfig',
4441
+ ]);
4442
+ if (fromRetrievalConfig != null) {
4443
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
4444
+ }
4445
+ return toObject;
4446
+ }
4334
4447
  function toolToMldev$4(fromObject) {
4335
4448
  const toObject = {};
4336
4449
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5153,7 +5266,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
5153
5266
  }
5154
5267
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5155
5268
  if (parentObject !== undefined && fromToolConfig != null) {
5156
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
5269
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
5157
5270
  }
5158
5271
  if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
5159
5272
  throw new Error('kmsKeyName parameter is not supported in Gemini API.');
@@ -5285,6 +5398,46 @@ function fileDataToMldev$3(fromObject) {
5285
5398
  }
5286
5399
  return toObject;
5287
5400
  }
5401
+ function functionCallToMldev$3(fromObject) {
5402
+ const toObject = {};
5403
+ const fromId = getValueByPath(fromObject, ['id']);
5404
+ if (fromId != null) {
5405
+ setValueByPath(toObject, ['id'], fromId);
5406
+ }
5407
+ const fromArgs = getValueByPath(fromObject, ['args']);
5408
+ if (fromArgs != null) {
5409
+ setValueByPath(toObject, ['args'], fromArgs);
5410
+ }
5411
+ const fromName = getValueByPath(fromObject, ['name']);
5412
+ if (fromName != null) {
5413
+ setValueByPath(toObject, ['name'], fromName);
5414
+ }
5415
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
5416
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
5417
+ }
5418
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
5419
+ throw new Error('willContinue parameter is not supported in Gemini API.');
5420
+ }
5421
+ return toObject;
5422
+ }
5423
+ function functionCallingConfigToMldev$1(fromObject) {
5424
+ const toObject = {};
5425
+ const fromMode = getValueByPath(fromObject, ['mode']);
5426
+ if (fromMode != null) {
5427
+ setValueByPath(toObject, ['mode'], fromMode);
5428
+ }
5429
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
5430
+ 'allowedFunctionNames',
5431
+ ]);
5432
+ if (fromAllowedFunctionNames != null) {
5433
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
5434
+ }
5435
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
5436
+ undefined) {
5437
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
5438
+ }
5439
+ return toObject;
5440
+ }
5288
5441
  function functionDeclarationToVertex$2(fromObject) {
5289
5442
  const toObject = {};
5290
5443
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -5461,9 +5614,11 @@ function listCachedContentsResponseFromVertex(fromObject) {
5461
5614
  }
5462
5615
  function partToMldev$3(fromObject) {
5463
5616
  const toObject = {};
5464
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5465
- if (fromFunctionCall != null) {
5466
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5617
+ const fromMediaResolution = getValueByPath(fromObject, [
5618
+ 'mediaResolution',
5619
+ ]);
5620
+ if (fromMediaResolution != null) {
5621
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
5467
5622
  }
5468
5623
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5469
5624
  'codeExecutionResult',
@@ -5481,6 +5636,10 @@ function partToMldev$3(fromObject) {
5481
5636
  if (fromFileData != null) {
5482
5637
  setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5483
5638
  }
5639
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5640
+ if (fromFunctionCall != null) {
5641
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
5642
+ }
5484
5643
  const fromFunctionResponse = getValueByPath(fromObject, [
5485
5644
  'functionResponse',
5486
5645
  ]);
@@ -5513,6 +5672,22 @@ function partToMldev$3(fromObject) {
5513
5672
  }
5514
5673
  return toObject;
5515
5674
  }
5675
+ function toolConfigToMldev$1(fromObject) {
5676
+ const toObject = {};
5677
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
5678
+ 'functionCallingConfig',
5679
+ ]);
5680
+ if (fromFunctionCallingConfig != null) {
5681
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5682
+ }
5683
+ const fromRetrievalConfig = getValueByPath(fromObject, [
5684
+ 'retrievalConfig',
5685
+ ]);
5686
+ if (fromRetrievalConfig != null) {
5687
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
5688
+ }
5689
+ return toObject;
5690
+ }
5516
5691
  function toolToMldev$3(fromObject) {
5517
5692
  const toObject = {};
5518
5693
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -6876,6 +7051,28 @@ function fileDataToMldev$2(fromObject) {
6876
7051
  }
6877
7052
  return toObject;
6878
7053
  }
7054
+ function functionCallToMldev$2(fromObject) {
7055
+ const toObject = {};
7056
+ const fromId = getValueByPath(fromObject, ['id']);
7057
+ if (fromId != null) {
7058
+ setValueByPath(toObject, ['id'], fromId);
7059
+ }
7060
+ const fromArgs = getValueByPath(fromObject, ['args']);
7061
+ if (fromArgs != null) {
7062
+ setValueByPath(toObject, ['args'], fromArgs);
7063
+ }
7064
+ const fromName = getValueByPath(fromObject, ['name']);
7065
+ if (fromName != null) {
7066
+ setValueByPath(toObject, ['name'], fromName);
7067
+ }
7068
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
7069
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
7070
+ }
7071
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
7072
+ throw new Error('willContinue parameter is not supported in Gemini API.');
7073
+ }
7074
+ return toObject;
7075
+ }
6879
7076
  function functionDeclarationToVertex$1(fromObject) {
6880
7077
  const toObject = {};
6881
7078
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -7464,9 +7661,11 @@ function liveServerMessageFromVertex(fromObject) {
7464
7661
  }
7465
7662
  function partToMldev$2(fromObject) {
7466
7663
  const toObject = {};
7467
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7468
- if (fromFunctionCall != null) {
7469
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
7664
+ const fromMediaResolution = getValueByPath(fromObject, [
7665
+ 'mediaResolution',
7666
+ ]);
7667
+ if (fromMediaResolution != null) {
7668
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
7470
7669
  }
7471
7670
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7472
7671
  'codeExecutionResult',
@@ -7484,6 +7683,10 @@ function partToMldev$2(fromObject) {
7484
7683
  if (fromFileData != null) {
7485
7684
  setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7486
7685
  }
7686
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7687
+ if (fromFunctionCall != null) {
7688
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
7689
+ }
7487
7690
  const fromFunctionResponse = getValueByPath(fromObject, [
7488
7691
  'functionResponse',
7489
7692
  ]);
@@ -8405,6 +8608,46 @@ function fileDataToMldev$1(fromObject) {
8405
8608
  }
8406
8609
  return toObject;
8407
8610
  }
8611
+ function functionCallToMldev$1(fromObject) {
8612
+ const toObject = {};
8613
+ const fromId = getValueByPath(fromObject, ['id']);
8614
+ if (fromId != null) {
8615
+ setValueByPath(toObject, ['id'], fromId);
8616
+ }
8617
+ const fromArgs = getValueByPath(fromObject, ['args']);
8618
+ if (fromArgs != null) {
8619
+ setValueByPath(toObject, ['args'], fromArgs);
8620
+ }
8621
+ const fromName = getValueByPath(fromObject, ['name']);
8622
+ if (fromName != null) {
8623
+ setValueByPath(toObject, ['name'], fromName);
8624
+ }
8625
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
8626
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
8627
+ }
8628
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
8629
+ throw new Error('willContinue parameter is not supported in Gemini API.');
8630
+ }
8631
+ return toObject;
8632
+ }
8633
+ function functionCallingConfigToMldev(fromObject) {
8634
+ const toObject = {};
8635
+ const fromMode = getValueByPath(fromObject, ['mode']);
8636
+ if (fromMode != null) {
8637
+ setValueByPath(toObject, ['mode'], fromMode);
8638
+ }
8639
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
8640
+ 'allowedFunctionNames',
8641
+ ]);
8642
+ if (fromAllowedFunctionNames != null) {
8643
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
8644
+ }
8645
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
8646
+ undefined) {
8647
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
8648
+ }
8649
+ return toObject;
8650
+ }
8408
8651
  function functionDeclarationToVertex(fromObject) {
8409
8652
  const toObject = {};
8410
8653
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -8552,7 +8795,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8552
8795
  }
8553
8796
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
8554
8797
  if (parentObject !== undefined && fromToolConfig != null) {
8555
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
8798
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
8556
8799
  }
8557
8800
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
8558
8801
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -8590,7 +8833,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8590
8833
  }
8591
8834
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8592
8835
  if (fromImageConfig != null) {
8593
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
8836
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev(fromImageConfig));
8594
8837
  }
8595
8838
  return toObject;
8596
8839
  }
@@ -8754,7 +8997,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8754
8997
  }
8755
8998
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8756
8999
  if (fromImageConfig != null) {
8757
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
9000
+ setValueByPath(toObject, ['imageConfig'], imageConfigToVertex(fromImageConfig));
8758
9001
  }
8759
9002
  return toObject;
8760
9003
  }
@@ -9755,6 +9998,49 @@ function googleSearchToMldev$1(fromObject) {
9755
9998
  }
9756
9999
  return toObject;
9757
10000
  }
10001
+ function imageConfigToMldev(fromObject) {
10002
+ const toObject = {};
10003
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10004
+ if (fromAspectRatio != null) {
10005
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
10006
+ }
10007
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10008
+ if (fromImageSize != null) {
10009
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
10010
+ }
10011
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
10012
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
10013
+ }
10014
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
10015
+ undefined) {
10016
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
10017
+ }
10018
+ return toObject;
10019
+ }
10020
+ function imageConfigToVertex(fromObject) {
10021
+ const toObject = {};
10022
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10023
+ if (fromAspectRatio != null) {
10024
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
10025
+ }
10026
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10027
+ if (fromImageSize != null) {
10028
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
10029
+ }
10030
+ const fromOutputMimeType = getValueByPath(fromObject, [
10031
+ 'outputMimeType',
10032
+ ]);
10033
+ if (fromOutputMimeType != null) {
10034
+ setValueByPath(toObject, ['imageOutputOptions', 'mimeType'], fromOutputMimeType);
10035
+ }
10036
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
10037
+ 'outputCompressionQuality',
10038
+ ]);
10039
+ if (fromOutputCompressionQuality != null) {
10040
+ setValueByPath(toObject, ['imageOutputOptions', 'compressionQuality'], fromOutputCompressionQuality);
10041
+ }
10042
+ return toObject;
10043
+ }
9758
10044
  function imageFromMldev(fromObject) {
9759
10045
  const toObject = {};
9760
10046
  const fromImageBytes = getValueByPath(fromObject, [
@@ -10064,9 +10350,11 @@ function modelFromVertex(fromObject) {
10064
10350
  }
10065
10351
  function partToMldev$1(fromObject) {
10066
10352
  const toObject = {};
10067
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10068
- if (fromFunctionCall != null) {
10069
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
10353
+ const fromMediaResolution = getValueByPath(fromObject, [
10354
+ 'mediaResolution',
10355
+ ]);
10356
+ if (fromMediaResolution != null) {
10357
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
10070
10358
  }
10071
10359
  const fromCodeExecutionResult = getValueByPath(fromObject, [
10072
10360
  'codeExecutionResult',
@@ -10084,6 +10372,10 @@ function partToMldev$1(fromObject) {
10084
10372
  if (fromFileData != null) {
10085
10373
  setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10086
10374
  }
10375
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10376
+ if (fromFunctionCall != null) {
10377
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
10378
+ }
10087
10379
  const fromFunctionResponse = getValueByPath(fromObject, [
10088
10380
  'functionResponse',
10089
10381
  ]);
@@ -10448,6 +10740,22 @@ function speechConfigToVertex(fromObject) {
10448
10740
  }
10449
10741
  return toObject;
10450
10742
  }
10743
+ function toolConfigToMldev(fromObject) {
10744
+ const toObject = {};
10745
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
10746
+ 'functionCallingConfig',
10747
+ ]);
10748
+ if (fromFunctionCallingConfig != null) {
10749
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
10750
+ }
10751
+ const fromRetrievalConfig = getValueByPath(fromObject, [
10752
+ 'retrievalConfig',
10753
+ ]);
10754
+ if (fromRetrievalConfig != null) {
10755
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
10756
+ }
10757
+ return toObject;
10758
+ }
10451
10759
  function toolToMldev$1(fromObject) {
10452
10760
  const toObject = {};
10453
10761
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10878,7 +11186,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10878
11186
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10879
11187
  const USER_AGENT_HEADER = 'User-Agent';
10880
11188
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10881
- const SDK_VERSION = '1.29.1'; // x-release-please-version
11189
+ const SDK_VERSION = '1.30.0'; // x-release-please-version
10882
11190
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10883
11191
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10884
11192
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -12535,6 +12843,7 @@ class Models extends BaseModule {
12535
12843
  * ```
12536
12844
  */
12537
12845
  this.generateContentStream = async (params) => {
12846
+ var _a, _b, _c, _d, _e;
12538
12847
  this.maybeMoveToResponseJsonSchem(params);
12539
12848
  if (shouldDisableAfc(params.config)) {
12540
12849
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
@@ -12547,6 +12856,17 @@ class Models extends BaseModule {
12547
12856
  .join(', ');
12548
12857
  throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
12549
12858
  }
12859
+ // With tool compatibility confirmed, validate that the configuration are
12860
+ // compatible with each other and raise an error if invalid.
12861
+ 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;
12862
+ 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;
12863
+ if (streamFunctionCall && !disableAfc) {
12864
+ throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, " +
12865
+ 'this feature is not compatible with automatic function calling (AFC). ' +
12866
+ "Please set 'config.automaticFunctionCalling.disable' to true to disable AFC " +
12867
+ "or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' " +
12868
+ 'to be undefined or set to false to disable streaming function call arguments feature.');
12869
+ }
12550
12870
  return await this.processAfcStream(params);
12551
12871
  };
12552
12872
  /**
@@ -14164,6 +14484,28 @@ function fileDataToMldev(fromObject) {
14164
14484
  }
14165
14485
  return toObject;
14166
14486
  }
14487
+ function functionCallToMldev(fromObject) {
14488
+ const toObject = {};
14489
+ const fromId = getValueByPath(fromObject, ['id']);
14490
+ if (fromId != null) {
14491
+ setValueByPath(toObject, ['id'], fromId);
14492
+ }
14493
+ const fromArgs = getValueByPath(fromObject, ['args']);
14494
+ if (fromArgs != null) {
14495
+ setValueByPath(toObject, ['args'], fromArgs);
14496
+ }
14497
+ const fromName = getValueByPath(fromObject, ['name']);
14498
+ if (fromName != null) {
14499
+ setValueByPath(toObject, ['name'], fromName);
14500
+ }
14501
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
14502
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
14503
+ }
14504
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
14505
+ throw new Error('willContinue parameter is not supported in Gemini API.');
14506
+ }
14507
+ return toObject;
14508
+ }
14167
14509
  function googleMapsToMldev(fromObject) {
14168
14510
  const toObject = {};
14169
14511
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
@@ -14315,9 +14657,11 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
14315
14657
  }
14316
14658
  function partToMldev(fromObject) {
14317
14659
  const toObject = {};
14318
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14319
- if (fromFunctionCall != null) {
14320
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
14660
+ const fromMediaResolution = getValueByPath(fromObject, [
14661
+ 'mediaResolution',
14662
+ ]);
14663
+ if (fromMediaResolution != null) {
14664
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
14321
14665
  }
14322
14666
  const fromCodeExecutionResult = getValueByPath(fromObject, [
14323
14667
  'codeExecutionResult',
@@ -14335,6 +14679,10 @@ function partToMldev(fromObject) {
14335
14679
  if (fromFileData != null) {
14336
14680
  setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14337
14681
  }
14682
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14683
+ if (fromFunctionCall != null) {
14684
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
14685
+ }
14338
14686
  const fromFunctionResponse = getValueByPath(fromObject, [
14339
14687
  'functionResponse',
14340
14688
  ]);
@@ -16733,5 +17081,5 @@ class GoogleGenAI {
16733
17081
  }
16734
17082
  }
16735
17083
 
16736
- 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 };
17084
+ 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 };
16737
17085
  //# sourceMappingURL=index.mjs.map