@google/genai 1.29.0 → 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.
@@ -1951,6 +1983,7 @@ class GenerateContentResponse {
1951
1983
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1952
1984
  if (fieldName !== 'text' &&
1953
1985
  fieldName !== 'thought' &&
1986
+ fieldName !== 'thoughtSignature' &&
1954
1987
  (fieldValue !== null || fieldValue !== undefined)) {
1955
1988
  nonTextParts.push(fieldName);
1956
1989
  }
@@ -2484,6 +2517,9 @@ function tModel(apiClient, model) {
2484
2517
  if (!model || typeof model !== 'string') {
2485
2518
  throw new Error('model is required and must be a string');
2486
2519
  }
2520
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2521
+ throw new Error('invalid model parameter');
2522
+ }
2487
2523
  if (apiClient.isVertexAI()) {
2488
2524
  if (model.startsWith('publishers/') ||
2489
2525
  model.startsWith('projects/') ||
@@ -3882,6 +3918,46 @@ function fileDataToMldev$4(fromObject) {
3882
3918
  }
3883
3919
  return toObject;
3884
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
+ }
3885
3961
  function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3886
3962
  const toObject = {};
3887
3963
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -3994,7 +4070,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3994
4070
  }
3995
4071
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
3996
4072
  if (parentObject !== undefined && fromToolConfig != null) {
3997
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
4073
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
3998
4074
  }
3999
4075
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
4000
4076
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -4032,7 +4108,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4032
4108
  }
4033
4109
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
4034
4110
  if (fromImageConfig != null) {
4035
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
4111
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev$1(fromImageConfig));
4036
4112
  }
4037
4113
  return toObject;
4038
4114
  }
@@ -4119,6 +4195,25 @@ function googleSearchToMldev$4(fromObject) {
4119
4195
  }
4120
4196
  return toObject;
4121
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
+ }
4122
4217
  function inlinedRequestToMldev(apiClient, fromObject) {
4123
4218
  const toObject = {};
4124
4219
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4260,9 +4355,11 @@ function listBatchJobsResponseFromVertex(fromObject) {
4260
4355
  }
4261
4356
  function partToMldev$4(fromObject) {
4262
4357
  const toObject = {};
4263
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4264
- if (fromFunctionCall != null) {
4265
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4358
+ const fromMediaResolution = getValueByPath(fromObject, [
4359
+ 'mediaResolution',
4360
+ ]);
4361
+ if (fromMediaResolution != null) {
4362
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4266
4363
  }
4267
4364
  const fromCodeExecutionResult = getValueByPath(fromObject, [
4268
4365
  'codeExecutionResult',
@@ -4280,6 +4377,10 @@ function partToMldev$4(fromObject) {
4280
4377
  if (fromFileData != null) {
4281
4378
  setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4282
4379
  }
4380
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4381
+ if (fromFunctionCall != null) {
4382
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
4383
+ }
4283
4384
  const fromFunctionResponse = getValueByPath(fromObject, [
4284
4385
  'functionResponse',
4285
4386
  ]);
@@ -4327,6 +4428,22 @@ function safetySettingToMldev$1(fromObject) {
4327
4428
  }
4328
4429
  return toObject;
4329
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
+ }
4330
4447
  function toolToMldev$4(fromObject) {
4331
4448
  const toObject = {};
4332
4449
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5149,7 +5266,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
5149
5266
  }
5150
5267
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5151
5268
  if (parentObject !== undefined && fromToolConfig != null) {
5152
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
5269
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
5153
5270
  }
5154
5271
  if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
5155
5272
  throw new Error('kmsKeyName parameter is not supported in Gemini API.');
@@ -5281,6 +5398,46 @@ function fileDataToMldev$3(fromObject) {
5281
5398
  }
5282
5399
  return toObject;
5283
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
+ }
5284
5441
  function functionDeclarationToVertex$2(fromObject) {
5285
5442
  const toObject = {};
5286
5443
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -5457,9 +5614,11 @@ function listCachedContentsResponseFromVertex(fromObject) {
5457
5614
  }
5458
5615
  function partToMldev$3(fromObject) {
5459
5616
  const toObject = {};
5460
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5461
- if (fromFunctionCall != null) {
5462
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5617
+ const fromMediaResolution = getValueByPath(fromObject, [
5618
+ 'mediaResolution',
5619
+ ]);
5620
+ if (fromMediaResolution != null) {
5621
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
5463
5622
  }
5464
5623
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5465
5624
  'codeExecutionResult',
@@ -5477,6 +5636,10 @@ function partToMldev$3(fromObject) {
5477
5636
  if (fromFileData != null) {
5478
5637
  setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5479
5638
  }
5639
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5640
+ if (fromFunctionCall != null) {
5641
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
5642
+ }
5480
5643
  const fromFunctionResponse = getValueByPath(fromObject, [
5481
5644
  'functionResponse',
5482
5645
  ]);
@@ -5509,6 +5672,22 @@ function partToMldev$3(fromObject) {
5509
5672
  }
5510
5673
  return toObject;
5511
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
+ }
5512
5691
  function toolToMldev$3(fromObject) {
5513
5692
  const toObject = {};
5514
5693
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -6872,6 +7051,28 @@ function fileDataToMldev$2(fromObject) {
6872
7051
  }
6873
7052
  return toObject;
6874
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
+ }
6875
7076
  function functionDeclarationToVertex$1(fromObject) {
6876
7077
  const toObject = {};
6877
7078
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -7460,9 +7661,11 @@ function liveServerMessageFromVertex(fromObject) {
7460
7661
  }
7461
7662
  function partToMldev$2(fromObject) {
7462
7663
  const toObject = {};
7463
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7464
- if (fromFunctionCall != null) {
7465
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
7664
+ const fromMediaResolution = getValueByPath(fromObject, [
7665
+ 'mediaResolution',
7666
+ ]);
7667
+ if (fromMediaResolution != null) {
7668
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
7466
7669
  }
7467
7670
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7468
7671
  'codeExecutionResult',
@@ -7480,6 +7683,10 @@ function partToMldev$2(fromObject) {
7480
7683
  if (fromFileData != null) {
7481
7684
  setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7482
7685
  }
7686
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7687
+ if (fromFunctionCall != null) {
7688
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
7689
+ }
7483
7690
  const fromFunctionResponse = getValueByPath(fromObject, [
7484
7691
  'functionResponse',
7485
7692
  ]);
@@ -8401,6 +8608,46 @@ function fileDataToMldev$1(fromObject) {
8401
8608
  }
8402
8609
  return toObject;
8403
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
+ }
8404
8651
  function functionDeclarationToVertex(fromObject) {
8405
8652
  const toObject = {};
8406
8653
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -8548,7 +8795,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8548
8795
  }
8549
8796
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
8550
8797
  if (parentObject !== undefined && fromToolConfig != null) {
8551
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
8798
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
8552
8799
  }
8553
8800
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
8554
8801
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -8586,7 +8833,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8586
8833
  }
8587
8834
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8588
8835
  if (fromImageConfig != null) {
8589
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
8836
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev(fromImageConfig));
8590
8837
  }
8591
8838
  return toObject;
8592
8839
  }
@@ -8750,7 +8997,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8750
8997
  }
8751
8998
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8752
8999
  if (fromImageConfig != null) {
8753
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
9000
+ setValueByPath(toObject, ['imageConfig'], imageConfigToVertex(fromImageConfig));
8754
9001
  }
8755
9002
  return toObject;
8756
9003
  }
@@ -9751,6 +9998,49 @@ function googleSearchToMldev$1(fromObject) {
9751
9998
  }
9752
9999
  return toObject;
9753
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
+ }
9754
10044
  function imageFromMldev(fromObject) {
9755
10045
  const toObject = {};
9756
10046
  const fromImageBytes = getValueByPath(fromObject, [
@@ -9980,6 +10270,28 @@ function modelFromMldev(fromObject) {
9980
10270
  if (fromSupportedActions != null) {
9981
10271
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
9982
10272
  }
10273
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
10274
+ if (fromTemperature != null) {
10275
+ setValueByPath(toObject, ['temperature'], fromTemperature);
10276
+ }
10277
+ const fromMaxTemperature = getValueByPath(fromObject, [
10278
+ 'maxTemperature',
10279
+ ]);
10280
+ if (fromMaxTemperature != null) {
10281
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
10282
+ }
10283
+ const fromTopP = getValueByPath(fromObject, ['topP']);
10284
+ if (fromTopP != null) {
10285
+ setValueByPath(toObject, ['topP'], fromTopP);
10286
+ }
10287
+ const fromTopK = getValueByPath(fromObject, ['topK']);
10288
+ if (fromTopK != null) {
10289
+ setValueByPath(toObject, ['topK'], fromTopK);
10290
+ }
10291
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
10292
+ if (fromThinking != null) {
10293
+ setValueByPath(toObject, ['thinking'], fromThinking);
10294
+ }
9983
10295
  return toObject;
9984
10296
  }
9985
10297
  function modelFromVertex(fromObject) {
@@ -10038,9 +10350,11 @@ function modelFromVertex(fromObject) {
10038
10350
  }
10039
10351
  function partToMldev$1(fromObject) {
10040
10352
  const toObject = {};
10041
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10042
- if (fromFunctionCall != null) {
10043
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
10353
+ const fromMediaResolution = getValueByPath(fromObject, [
10354
+ 'mediaResolution',
10355
+ ]);
10356
+ if (fromMediaResolution != null) {
10357
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
10044
10358
  }
10045
10359
  const fromCodeExecutionResult = getValueByPath(fromObject, [
10046
10360
  'codeExecutionResult',
@@ -10058,6 +10372,10 @@ function partToMldev$1(fromObject) {
10058
10372
  if (fromFileData != null) {
10059
10373
  setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10060
10374
  }
10375
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10376
+ if (fromFunctionCall != null) {
10377
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
10378
+ }
10061
10379
  const fromFunctionResponse = getValueByPath(fromObject, [
10062
10380
  'functionResponse',
10063
10381
  ]);
@@ -10108,7 +10426,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
10108
10426
  }
10109
10427
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
10110
10428
  if (parentObject !== undefined && fromBaseSteps != null) {
10111
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
10429
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
10112
10430
  }
10113
10431
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
10114
10432
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -10422,6 +10740,22 @@ function speechConfigToVertex(fromObject) {
10422
10740
  }
10423
10741
  return toObject;
10424
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
+ }
10425
10759
  function toolToMldev$1(fromObject) {
10426
10760
  const toObject = {};
10427
10761
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10852,7 +11186,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10852
11186
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10853
11187
  const USER_AGENT_HEADER = 'User-Agent';
10854
11188
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10855
- const SDK_VERSION = '1.29.0'; // x-release-please-version
11189
+ const SDK_VERSION = '1.30.0'; // x-release-please-version
10856
11190
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10857
11191
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10858
11192
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -12509,6 +12843,7 @@ class Models extends BaseModule {
12509
12843
  * ```
12510
12844
  */
12511
12845
  this.generateContentStream = async (params) => {
12846
+ var _a, _b, _c, _d, _e;
12512
12847
  this.maybeMoveToResponseJsonSchem(params);
12513
12848
  if (shouldDisableAfc(params.config)) {
12514
12849
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
@@ -12521,6 +12856,17 @@ class Models extends BaseModule {
12521
12856
  .join(', ');
12522
12857
  throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
12523
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
+ }
12524
12870
  return await this.processAfcStream(params);
12525
12871
  };
12526
12872
  /**
@@ -14138,6 +14484,28 @@ function fileDataToMldev(fromObject) {
14138
14484
  }
14139
14485
  return toObject;
14140
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
+ }
14141
14509
  function googleMapsToMldev(fromObject) {
14142
14510
  const toObject = {};
14143
14511
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
@@ -14289,9 +14657,11 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
14289
14657
  }
14290
14658
  function partToMldev(fromObject) {
14291
14659
  const toObject = {};
14292
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14293
- if (fromFunctionCall != null) {
14294
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
14660
+ const fromMediaResolution = getValueByPath(fromObject, [
14661
+ 'mediaResolution',
14662
+ ]);
14663
+ if (fromMediaResolution != null) {
14664
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
14295
14665
  }
14296
14666
  const fromCodeExecutionResult = getValueByPath(fromObject, [
14297
14667
  'codeExecutionResult',
@@ -14309,6 +14679,10 @@ function partToMldev(fromObject) {
14309
14679
  if (fromFileData != null) {
14310
14680
  setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14311
14681
  }
14682
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14683
+ if (fromFunctionCall != null) {
14684
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
14685
+ }
14312
14686
  const fromFunctionResponse = getValueByPath(fromObject, [
14313
14687
  'functionResponse',
14314
14688
  ]);
@@ -16707,5 +17081,5 @@ class GoogleGenAI {
16707
17081
  }
16708
17082
  }
16709
17083
 
16710
- 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 };
16711
17085
  //# sourceMappingURL=index.mjs.map