@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.
@@ -817,6 +817,22 @@ exports.PhishBlockThreshold = void 0;
817
817
  */
818
818
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
819
819
  })(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
820
+ /** The level of thoughts tokens that the model should generate. */
821
+ exports.ThinkingLevel = void 0;
822
+ (function (ThinkingLevel) {
823
+ /**
824
+ * Default value.
825
+ */
826
+ ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
827
+ /**
828
+ * Low thinking level.
829
+ */
830
+ ThinkingLevel["LOW"] = "LOW";
831
+ /**
832
+ * High thinking level.
833
+ */
834
+ ThinkingLevel["HIGH"] = "HIGH";
835
+ })(exports.ThinkingLevel || (exports.ThinkingLevel = {}));
820
836
  /** Harm category. */
821
837
  exports.HarmCategory = void 0;
822
838
  (function (HarmCategory) {
@@ -1259,6 +1275,26 @@ exports.TuningTask = void 0;
1259
1275
  */
1260
1276
  TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
1261
1277
  })(exports.TuningTask || (exports.TuningTask = {}));
1278
+ /** The tokenization quality used for given media. */
1279
+ exports.PartMediaResolutionLevel = void 0;
1280
+ (function (PartMediaResolutionLevel) {
1281
+ /**
1282
+ * Media resolution has not been set.
1283
+ */
1284
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1285
+ /**
1286
+ * Media resolution set to low.
1287
+ */
1288
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1289
+ /**
1290
+ * Media resolution set to medium.
1291
+ */
1292
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1293
+ /**
1294
+ * Media resolution set to high.
1295
+ */
1296
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1297
+ })(exports.PartMediaResolutionLevel || (exports.PartMediaResolutionLevel = {}));
1262
1298
  /** Options for feature selection preference. */
1263
1299
  exports.FeatureSelectionPreference = void 0;
1264
1300
  (function (FeatureSelectionPreference) {
@@ -1793,13 +1829,11 @@ class FunctionResponse {
1793
1829
  /**
1794
1830
  * Creates a `Part` object from a `URI` string.
1795
1831
  */
1796
- function createPartFromUri(uri, mimeType) {
1797
- return {
1798
- fileData: {
1832
+ function createPartFromUri(uri, mimeType, mediaResolution) {
1833
+ return Object.assign({ fileData: {
1799
1834
  fileUri: uri,
1800
1835
  mimeType: mimeType,
1801
- },
1802
- };
1836
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1803
1837
  }
1804
1838
  /**
1805
1839
  * Creates a `Part` object from a `text` string.
@@ -1831,13 +1865,11 @@ function createPartFromFunctionResponse(id, name, response, parts = []) {
1831
1865
  /**
1832
1866
  * Creates a `Part` object from a `base64` encoded `string`.
1833
1867
  */
1834
- function createPartFromBase64(data, mimeType) {
1835
- return {
1836
- inlineData: {
1868
+ function createPartFromBase64(data, mimeType, mediaResolution) {
1869
+ return Object.assign({ inlineData: {
1837
1870
  data: data,
1838
1871
  mimeType: mimeType,
1839
- },
1840
- };
1872
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1841
1873
  }
1842
1874
  /**
1843
1875
  * Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
@@ -1982,6 +2014,7 @@ class GenerateContentResponse {
1982
2014
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1983
2015
  if (fieldName !== 'text' &&
1984
2016
  fieldName !== 'thought' &&
2017
+ fieldName !== 'thoughtSignature' &&
1985
2018
  (fieldValue !== null || fieldValue !== undefined)) {
1986
2019
  nonTextParts.push(fieldName);
1987
2020
  }
@@ -2515,6 +2548,9 @@ function tModel(apiClient, model) {
2515
2548
  if (!model || typeof model !== 'string') {
2516
2549
  throw new Error('model is required and must be a string');
2517
2550
  }
2551
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2552
+ throw new Error('invalid model parameter');
2553
+ }
2518
2554
  if (apiClient.isVertexAI()) {
2519
2555
  if (model.startsWith('publishers/') ||
2520
2556
  model.startsWith('projects/') ||
@@ -3913,6 +3949,46 @@ function fileDataToMldev$4(fromObject) {
3913
3949
  }
3914
3950
  return toObject;
3915
3951
  }
3952
+ function functionCallToMldev$4(fromObject) {
3953
+ const toObject = {};
3954
+ const fromId = getValueByPath(fromObject, ['id']);
3955
+ if (fromId != null) {
3956
+ setValueByPath(toObject, ['id'], fromId);
3957
+ }
3958
+ const fromArgs = getValueByPath(fromObject, ['args']);
3959
+ if (fromArgs != null) {
3960
+ setValueByPath(toObject, ['args'], fromArgs);
3961
+ }
3962
+ const fromName = getValueByPath(fromObject, ['name']);
3963
+ if (fromName != null) {
3964
+ setValueByPath(toObject, ['name'], fromName);
3965
+ }
3966
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
3967
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
3968
+ }
3969
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
3970
+ throw new Error('willContinue parameter is not supported in Gemini API.');
3971
+ }
3972
+ return toObject;
3973
+ }
3974
+ function functionCallingConfigToMldev$2(fromObject) {
3975
+ const toObject = {};
3976
+ const fromMode = getValueByPath(fromObject, ['mode']);
3977
+ if (fromMode != null) {
3978
+ setValueByPath(toObject, ['mode'], fromMode);
3979
+ }
3980
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
3981
+ 'allowedFunctionNames',
3982
+ ]);
3983
+ if (fromAllowedFunctionNames != null) {
3984
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
3985
+ }
3986
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
3987
+ undefined) {
3988
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
3989
+ }
3990
+ return toObject;
3991
+ }
3916
3992
  function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3917
3993
  const toObject = {};
3918
3994
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -4025,7 +4101,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4025
4101
  }
4026
4102
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
4027
4103
  if (parentObject !== undefined && fromToolConfig != null) {
4028
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
4104
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
4029
4105
  }
4030
4106
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
4031
4107
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -4063,7 +4139,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4063
4139
  }
4064
4140
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
4065
4141
  if (fromImageConfig != null) {
4066
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
4142
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev$1(fromImageConfig));
4067
4143
  }
4068
4144
  return toObject;
4069
4145
  }
@@ -4150,6 +4226,25 @@ function googleSearchToMldev$4(fromObject) {
4150
4226
  }
4151
4227
  return toObject;
4152
4228
  }
4229
+ function imageConfigToMldev$1(fromObject) {
4230
+ const toObject = {};
4231
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
4232
+ if (fromAspectRatio != null) {
4233
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
4234
+ }
4235
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
4236
+ if (fromImageSize != null) {
4237
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
4238
+ }
4239
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
4240
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
4241
+ }
4242
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
4243
+ undefined) {
4244
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
4245
+ }
4246
+ return toObject;
4247
+ }
4153
4248
  function inlinedRequestToMldev(apiClient, fromObject) {
4154
4249
  const toObject = {};
4155
4250
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4291,9 +4386,11 @@ function listBatchJobsResponseFromVertex(fromObject) {
4291
4386
  }
4292
4387
  function partToMldev$4(fromObject) {
4293
4388
  const toObject = {};
4294
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4295
- if (fromFunctionCall != null) {
4296
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4389
+ const fromMediaResolution = getValueByPath(fromObject, [
4390
+ 'mediaResolution',
4391
+ ]);
4392
+ if (fromMediaResolution != null) {
4393
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4297
4394
  }
4298
4395
  const fromCodeExecutionResult = getValueByPath(fromObject, [
4299
4396
  'codeExecutionResult',
@@ -4311,6 +4408,10 @@ function partToMldev$4(fromObject) {
4311
4408
  if (fromFileData != null) {
4312
4409
  setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4313
4410
  }
4411
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4412
+ if (fromFunctionCall != null) {
4413
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
4414
+ }
4314
4415
  const fromFunctionResponse = getValueByPath(fromObject, [
4315
4416
  'functionResponse',
4316
4417
  ]);
@@ -4358,6 +4459,22 @@ function safetySettingToMldev$1(fromObject) {
4358
4459
  }
4359
4460
  return toObject;
4360
4461
  }
4462
+ function toolConfigToMldev$2(fromObject) {
4463
+ const toObject = {};
4464
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4465
+ 'functionCallingConfig',
4466
+ ]);
4467
+ if (fromFunctionCallingConfig != null) {
4468
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4469
+ }
4470
+ const fromRetrievalConfig = getValueByPath(fromObject, [
4471
+ 'retrievalConfig',
4472
+ ]);
4473
+ if (fromRetrievalConfig != null) {
4474
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
4475
+ }
4476
+ return toObject;
4477
+ }
4361
4478
  function toolToMldev$4(fromObject) {
4362
4479
  const toObject = {};
4363
4480
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5180,7 +5297,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
5180
5297
  }
5181
5298
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5182
5299
  if (parentObject !== undefined && fromToolConfig != null) {
5183
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
5300
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
5184
5301
  }
5185
5302
  if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
5186
5303
  throw new Error('kmsKeyName parameter is not supported in Gemini API.');
@@ -5312,6 +5429,46 @@ function fileDataToMldev$3(fromObject) {
5312
5429
  }
5313
5430
  return toObject;
5314
5431
  }
5432
+ function functionCallToMldev$3(fromObject) {
5433
+ const toObject = {};
5434
+ const fromId = getValueByPath(fromObject, ['id']);
5435
+ if (fromId != null) {
5436
+ setValueByPath(toObject, ['id'], fromId);
5437
+ }
5438
+ const fromArgs = getValueByPath(fromObject, ['args']);
5439
+ if (fromArgs != null) {
5440
+ setValueByPath(toObject, ['args'], fromArgs);
5441
+ }
5442
+ const fromName = getValueByPath(fromObject, ['name']);
5443
+ if (fromName != null) {
5444
+ setValueByPath(toObject, ['name'], fromName);
5445
+ }
5446
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
5447
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
5448
+ }
5449
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
5450
+ throw new Error('willContinue parameter is not supported in Gemini API.');
5451
+ }
5452
+ return toObject;
5453
+ }
5454
+ function functionCallingConfigToMldev$1(fromObject) {
5455
+ const toObject = {};
5456
+ const fromMode = getValueByPath(fromObject, ['mode']);
5457
+ if (fromMode != null) {
5458
+ setValueByPath(toObject, ['mode'], fromMode);
5459
+ }
5460
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
5461
+ 'allowedFunctionNames',
5462
+ ]);
5463
+ if (fromAllowedFunctionNames != null) {
5464
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
5465
+ }
5466
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
5467
+ undefined) {
5468
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
5469
+ }
5470
+ return toObject;
5471
+ }
5315
5472
  function functionDeclarationToVertex$2(fromObject) {
5316
5473
  const toObject = {};
5317
5474
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -5488,9 +5645,11 @@ function listCachedContentsResponseFromVertex(fromObject) {
5488
5645
  }
5489
5646
  function partToMldev$3(fromObject) {
5490
5647
  const toObject = {};
5491
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5492
- if (fromFunctionCall != null) {
5493
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5648
+ const fromMediaResolution = getValueByPath(fromObject, [
5649
+ 'mediaResolution',
5650
+ ]);
5651
+ if (fromMediaResolution != null) {
5652
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
5494
5653
  }
5495
5654
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5496
5655
  'codeExecutionResult',
@@ -5508,6 +5667,10 @@ function partToMldev$3(fromObject) {
5508
5667
  if (fromFileData != null) {
5509
5668
  setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5510
5669
  }
5670
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5671
+ if (fromFunctionCall != null) {
5672
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
5673
+ }
5511
5674
  const fromFunctionResponse = getValueByPath(fromObject, [
5512
5675
  'functionResponse',
5513
5676
  ]);
@@ -5540,6 +5703,22 @@ function partToMldev$3(fromObject) {
5540
5703
  }
5541
5704
  return toObject;
5542
5705
  }
5706
+ function toolConfigToMldev$1(fromObject) {
5707
+ const toObject = {};
5708
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
5709
+ 'functionCallingConfig',
5710
+ ]);
5711
+ if (fromFunctionCallingConfig != null) {
5712
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5713
+ }
5714
+ const fromRetrievalConfig = getValueByPath(fromObject, [
5715
+ 'retrievalConfig',
5716
+ ]);
5717
+ if (fromRetrievalConfig != null) {
5718
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
5719
+ }
5720
+ return toObject;
5721
+ }
5543
5722
  function toolToMldev$3(fromObject) {
5544
5723
  const toObject = {};
5545
5724
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -6903,6 +7082,28 @@ function fileDataToMldev$2(fromObject) {
6903
7082
  }
6904
7083
  return toObject;
6905
7084
  }
7085
+ function functionCallToMldev$2(fromObject) {
7086
+ const toObject = {};
7087
+ const fromId = getValueByPath(fromObject, ['id']);
7088
+ if (fromId != null) {
7089
+ setValueByPath(toObject, ['id'], fromId);
7090
+ }
7091
+ const fromArgs = getValueByPath(fromObject, ['args']);
7092
+ if (fromArgs != null) {
7093
+ setValueByPath(toObject, ['args'], fromArgs);
7094
+ }
7095
+ const fromName = getValueByPath(fromObject, ['name']);
7096
+ if (fromName != null) {
7097
+ setValueByPath(toObject, ['name'], fromName);
7098
+ }
7099
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
7100
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
7101
+ }
7102
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
7103
+ throw new Error('willContinue parameter is not supported in Gemini API.');
7104
+ }
7105
+ return toObject;
7106
+ }
6906
7107
  function functionDeclarationToVertex$1(fromObject) {
6907
7108
  const toObject = {};
6908
7109
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -7491,9 +7692,11 @@ function liveServerMessageFromVertex(fromObject) {
7491
7692
  }
7492
7693
  function partToMldev$2(fromObject) {
7493
7694
  const toObject = {};
7494
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7495
- if (fromFunctionCall != null) {
7496
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
7695
+ const fromMediaResolution = getValueByPath(fromObject, [
7696
+ 'mediaResolution',
7697
+ ]);
7698
+ if (fromMediaResolution != null) {
7699
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
7497
7700
  }
7498
7701
  const fromCodeExecutionResult = getValueByPath(fromObject, [
7499
7702
  'codeExecutionResult',
@@ -7511,6 +7714,10 @@ function partToMldev$2(fromObject) {
7511
7714
  if (fromFileData != null) {
7512
7715
  setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7513
7716
  }
7717
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7718
+ if (fromFunctionCall != null) {
7719
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
7720
+ }
7514
7721
  const fromFunctionResponse = getValueByPath(fromObject, [
7515
7722
  'functionResponse',
7516
7723
  ]);
@@ -8432,6 +8639,46 @@ function fileDataToMldev$1(fromObject) {
8432
8639
  }
8433
8640
  return toObject;
8434
8641
  }
8642
+ function functionCallToMldev$1(fromObject) {
8643
+ const toObject = {};
8644
+ const fromId = getValueByPath(fromObject, ['id']);
8645
+ if (fromId != null) {
8646
+ setValueByPath(toObject, ['id'], fromId);
8647
+ }
8648
+ const fromArgs = getValueByPath(fromObject, ['args']);
8649
+ if (fromArgs != null) {
8650
+ setValueByPath(toObject, ['args'], fromArgs);
8651
+ }
8652
+ const fromName = getValueByPath(fromObject, ['name']);
8653
+ if (fromName != null) {
8654
+ setValueByPath(toObject, ['name'], fromName);
8655
+ }
8656
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
8657
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
8658
+ }
8659
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
8660
+ throw new Error('willContinue parameter is not supported in Gemini API.');
8661
+ }
8662
+ return toObject;
8663
+ }
8664
+ function functionCallingConfigToMldev(fromObject) {
8665
+ const toObject = {};
8666
+ const fromMode = getValueByPath(fromObject, ['mode']);
8667
+ if (fromMode != null) {
8668
+ setValueByPath(toObject, ['mode'], fromMode);
8669
+ }
8670
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
8671
+ 'allowedFunctionNames',
8672
+ ]);
8673
+ if (fromAllowedFunctionNames != null) {
8674
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
8675
+ }
8676
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
8677
+ undefined) {
8678
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
8679
+ }
8680
+ return toObject;
8681
+ }
8435
8682
  function functionDeclarationToVertex(fromObject) {
8436
8683
  const toObject = {};
8437
8684
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -8579,7 +8826,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8579
8826
  }
8580
8827
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
8581
8828
  if (parentObject !== undefined && fromToolConfig != null) {
8582
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
8829
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
8583
8830
  }
8584
8831
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
8585
8832
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -8617,7 +8864,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
8617
8864
  }
8618
8865
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8619
8866
  if (fromImageConfig != null) {
8620
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
8867
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev(fromImageConfig));
8621
8868
  }
8622
8869
  return toObject;
8623
8870
  }
@@ -8781,7 +9028,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
8781
9028
  }
8782
9029
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
8783
9030
  if (fromImageConfig != null) {
8784
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
9031
+ setValueByPath(toObject, ['imageConfig'], imageConfigToVertex(fromImageConfig));
8785
9032
  }
8786
9033
  return toObject;
8787
9034
  }
@@ -9782,6 +10029,49 @@ function googleSearchToMldev$1(fromObject) {
9782
10029
  }
9783
10030
  return toObject;
9784
10031
  }
10032
+ function imageConfigToMldev(fromObject) {
10033
+ const toObject = {};
10034
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10035
+ if (fromAspectRatio != null) {
10036
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
10037
+ }
10038
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10039
+ if (fromImageSize != null) {
10040
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
10041
+ }
10042
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
10043
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
10044
+ }
10045
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
10046
+ undefined) {
10047
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
10048
+ }
10049
+ return toObject;
10050
+ }
10051
+ function imageConfigToVertex(fromObject) {
10052
+ const toObject = {};
10053
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10054
+ if (fromAspectRatio != null) {
10055
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
10056
+ }
10057
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10058
+ if (fromImageSize != null) {
10059
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
10060
+ }
10061
+ const fromOutputMimeType = getValueByPath(fromObject, [
10062
+ 'outputMimeType',
10063
+ ]);
10064
+ if (fromOutputMimeType != null) {
10065
+ setValueByPath(toObject, ['imageOutputOptions', 'mimeType'], fromOutputMimeType);
10066
+ }
10067
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
10068
+ 'outputCompressionQuality',
10069
+ ]);
10070
+ if (fromOutputCompressionQuality != null) {
10071
+ setValueByPath(toObject, ['imageOutputOptions', 'compressionQuality'], fromOutputCompressionQuality);
10072
+ }
10073
+ return toObject;
10074
+ }
9785
10075
  function imageFromMldev(fromObject) {
9786
10076
  const toObject = {};
9787
10077
  const fromImageBytes = getValueByPath(fromObject, [
@@ -10011,6 +10301,28 @@ function modelFromMldev(fromObject) {
10011
10301
  if (fromSupportedActions != null) {
10012
10302
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
10013
10303
  }
10304
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
10305
+ if (fromTemperature != null) {
10306
+ setValueByPath(toObject, ['temperature'], fromTemperature);
10307
+ }
10308
+ const fromMaxTemperature = getValueByPath(fromObject, [
10309
+ 'maxTemperature',
10310
+ ]);
10311
+ if (fromMaxTemperature != null) {
10312
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
10313
+ }
10314
+ const fromTopP = getValueByPath(fromObject, ['topP']);
10315
+ if (fromTopP != null) {
10316
+ setValueByPath(toObject, ['topP'], fromTopP);
10317
+ }
10318
+ const fromTopK = getValueByPath(fromObject, ['topK']);
10319
+ if (fromTopK != null) {
10320
+ setValueByPath(toObject, ['topK'], fromTopK);
10321
+ }
10322
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
10323
+ if (fromThinking != null) {
10324
+ setValueByPath(toObject, ['thinking'], fromThinking);
10325
+ }
10014
10326
  return toObject;
10015
10327
  }
10016
10328
  function modelFromVertex(fromObject) {
@@ -10069,9 +10381,11 @@ function modelFromVertex(fromObject) {
10069
10381
  }
10070
10382
  function partToMldev$1(fromObject) {
10071
10383
  const toObject = {};
10072
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10073
- if (fromFunctionCall != null) {
10074
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
10384
+ const fromMediaResolution = getValueByPath(fromObject, [
10385
+ 'mediaResolution',
10386
+ ]);
10387
+ if (fromMediaResolution != null) {
10388
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
10075
10389
  }
10076
10390
  const fromCodeExecutionResult = getValueByPath(fromObject, [
10077
10391
  'codeExecutionResult',
@@ -10089,6 +10403,10 @@ function partToMldev$1(fromObject) {
10089
10403
  if (fromFileData != null) {
10090
10404
  setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10091
10405
  }
10406
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10407
+ if (fromFunctionCall != null) {
10408
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
10409
+ }
10092
10410
  const fromFunctionResponse = getValueByPath(fromObject, [
10093
10411
  'functionResponse',
10094
10412
  ]);
@@ -10139,7 +10457,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
10139
10457
  }
10140
10458
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
10141
10459
  if (parentObject !== undefined && fromBaseSteps != null) {
10142
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
10460
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
10143
10461
  }
10144
10462
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
10145
10463
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -10453,6 +10771,22 @@ function speechConfigToVertex(fromObject) {
10453
10771
  }
10454
10772
  return toObject;
10455
10773
  }
10774
+ function toolConfigToMldev(fromObject) {
10775
+ const toObject = {};
10776
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
10777
+ 'functionCallingConfig',
10778
+ ]);
10779
+ if (fromFunctionCallingConfig != null) {
10780
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
10781
+ }
10782
+ const fromRetrievalConfig = getValueByPath(fromObject, [
10783
+ 'retrievalConfig',
10784
+ ]);
10785
+ if (fromRetrievalConfig != null) {
10786
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
10787
+ }
10788
+ return toObject;
10789
+ }
10456
10790
  function toolToMldev$1(fromObject) {
10457
10791
  const toObject = {};
10458
10792
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -10883,7 +11217,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10883
11217
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10884
11218
  const USER_AGENT_HEADER = 'User-Agent';
10885
11219
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10886
- const SDK_VERSION = '1.29.0'; // x-release-please-version
11220
+ const SDK_VERSION = '1.30.0'; // x-release-please-version
10887
11221
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10888
11222
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10889
11223
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -12540,6 +12874,7 @@ class Models extends BaseModule {
12540
12874
  * ```
12541
12875
  */
12542
12876
  this.generateContentStream = async (params) => {
12877
+ var _a, _b, _c, _d, _e;
12543
12878
  this.maybeMoveToResponseJsonSchem(params);
12544
12879
  if (shouldDisableAfc(params.config)) {
12545
12880
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
@@ -12552,6 +12887,17 @@ class Models extends BaseModule {
12552
12887
  .join(', ');
12553
12888
  throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
12554
12889
  }
12890
+ // With tool compatibility confirmed, validate that the configuration are
12891
+ // compatible with each other and raise an error if invalid.
12892
+ const streamFunctionCall = (_c = (_b = (_a = params === null || params === void 0 ? void 0 : params.config) === null || _a === void 0 ? void 0 : _a.toolConfig) === null || _b === void 0 ? void 0 : _b.functionCallingConfig) === null || _c === void 0 ? void 0 : _c.streamFunctionCallArguments;
12893
+ const disableAfc = (_e = (_d = params === null || params === void 0 ? void 0 : params.config) === null || _d === void 0 ? void 0 : _d.automaticFunctionCalling) === null || _e === void 0 ? void 0 : _e.disable;
12894
+ if (streamFunctionCall && !disableAfc) {
12895
+ throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, " +
12896
+ 'this feature is not compatible with automatic function calling (AFC). ' +
12897
+ "Please set 'config.automaticFunctionCalling.disable' to true to disable AFC " +
12898
+ "or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' " +
12899
+ 'to be undefined or set to false to disable streaming function call arguments feature.');
12900
+ }
12555
12901
  return await this.processAfcStream(params);
12556
12902
  };
12557
12903
  /**
@@ -14169,6 +14515,28 @@ function fileDataToMldev(fromObject) {
14169
14515
  }
14170
14516
  return toObject;
14171
14517
  }
14518
+ function functionCallToMldev(fromObject) {
14519
+ const toObject = {};
14520
+ const fromId = getValueByPath(fromObject, ['id']);
14521
+ if (fromId != null) {
14522
+ setValueByPath(toObject, ['id'], fromId);
14523
+ }
14524
+ const fromArgs = getValueByPath(fromObject, ['args']);
14525
+ if (fromArgs != null) {
14526
+ setValueByPath(toObject, ['args'], fromArgs);
14527
+ }
14528
+ const fromName = getValueByPath(fromObject, ['name']);
14529
+ if (fromName != null) {
14530
+ setValueByPath(toObject, ['name'], fromName);
14531
+ }
14532
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
14533
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
14534
+ }
14535
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
14536
+ throw new Error('willContinue parameter is not supported in Gemini API.');
14537
+ }
14538
+ return toObject;
14539
+ }
14172
14540
  function googleMapsToMldev(fromObject) {
14173
14541
  const toObject = {};
14174
14542
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
@@ -14320,9 +14688,11 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
14320
14688
  }
14321
14689
  function partToMldev(fromObject) {
14322
14690
  const toObject = {};
14323
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14324
- if (fromFunctionCall != null) {
14325
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
14691
+ const fromMediaResolution = getValueByPath(fromObject, [
14692
+ 'mediaResolution',
14693
+ ]);
14694
+ if (fromMediaResolution != null) {
14695
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
14326
14696
  }
14327
14697
  const fromCodeExecutionResult = getValueByPath(fromObject, [
14328
14698
  'codeExecutionResult',
@@ -14340,6 +14710,10 @@ function partToMldev(fromObject) {
14340
14710
  if (fromFileData != null) {
14341
14711
  setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14342
14712
  }
14713
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14714
+ if (fromFunctionCall != null) {
14715
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
14716
+ }
14343
14717
  const fromFunctionResponse = getValueByPath(fromObject, [
14344
14718
  'functionResponse',
14345
14719
  ]);