@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.
package/dist/index.cjs CHANGED
@@ -758,6 +758,22 @@ exports.PhishBlockThreshold = void 0;
758
758
  */
759
759
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
760
760
  })(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
761
+ /** The level of thoughts tokens that the model should generate. */
762
+ exports.ThinkingLevel = void 0;
763
+ (function (ThinkingLevel) {
764
+ /**
765
+ * Default value.
766
+ */
767
+ ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
768
+ /**
769
+ * Low thinking level.
770
+ */
771
+ ThinkingLevel["LOW"] = "LOW";
772
+ /**
773
+ * High thinking level.
774
+ */
775
+ ThinkingLevel["HIGH"] = "HIGH";
776
+ })(exports.ThinkingLevel || (exports.ThinkingLevel = {}));
761
777
  /** Harm category. */
762
778
  exports.HarmCategory = void 0;
763
779
  (function (HarmCategory) {
@@ -1200,6 +1216,26 @@ exports.TuningTask = void 0;
1200
1216
  */
1201
1217
  TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
1202
1218
  })(exports.TuningTask || (exports.TuningTask = {}));
1219
+ /** The tokenization quality used for given media. */
1220
+ exports.PartMediaResolutionLevel = void 0;
1221
+ (function (PartMediaResolutionLevel) {
1222
+ /**
1223
+ * Media resolution has not been set.
1224
+ */
1225
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1226
+ /**
1227
+ * Media resolution set to low.
1228
+ */
1229
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1230
+ /**
1231
+ * Media resolution set to medium.
1232
+ */
1233
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1234
+ /**
1235
+ * Media resolution set to high.
1236
+ */
1237
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1238
+ })(exports.PartMediaResolutionLevel || (exports.PartMediaResolutionLevel = {}));
1203
1239
  /** Options for feature selection preference. */
1204
1240
  exports.FeatureSelectionPreference = void 0;
1205
1241
  (function (FeatureSelectionPreference) {
@@ -1734,13 +1770,11 @@ class FunctionResponse {
1734
1770
  /**
1735
1771
  * Creates a `Part` object from a `URI` string.
1736
1772
  */
1737
- function createPartFromUri(uri, mimeType) {
1738
- return {
1739
- fileData: {
1773
+ function createPartFromUri(uri, mimeType, mediaResolution) {
1774
+ return Object.assign({ fileData: {
1740
1775
  fileUri: uri,
1741
1776
  mimeType: mimeType,
1742
- },
1743
- };
1777
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1744
1778
  }
1745
1779
  /**
1746
1780
  * Creates a `Part` object from a `text` string.
@@ -1772,13 +1806,11 @@ function createPartFromFunctionResponse(id, name, response, parts = []) {
1772
1806
  /**
1773
1807
  * Creates a `Part` object from a `base64` encoded `string`.
1774
1808
  */
1775
- function createPartFromBase64(data, mimeType) {
1776
- return {
1777
- inlineData: {
1809
+ function createPartFromBase64(data, mimeType, mediaResolution) {
1810
+ return Object.assign({ inlineData: {
1778
1811
  data: data,
1779
1812
  mimeType: mimeType,
1780
- },
1781
- };
1813
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1782
1814
  }
1783
1815
  /**
1784
1816
  * Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
@@ -1923,6 +1955,7 @@ class GenerateContentResponse {
1923
1955
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1924
1956
  if (fieldName !== 'text' &&
1925
1957
  fieldName !== 'thought' &&
1958
+ fieldName !== 'thoughtSignature' &&
1926
1959
  (fieldValue !== null || fieldValue !== undefined)) {
1927
1960
  nonTextParts.push(fieldName);
1928
1961
  }
@@ -2456,6 +2489,9 @@ function tModel(apiClient, model) {
2456
2489
  if (!model || typeof model !== 'string') {
2457
2490
  throw new Error('model is required and must be a string');
2458
2491
  }
2492
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2493
+ throw new Error('invalid model parameter');
2494
+ }
2459
2495
  if (apiClient.isVertexAI()) {
2460
2496
  if (model.startsWith('publishers/') ||
2461
2497
  model.startsWith('projects/') ||
@@ -3854,6 +3890,46 @@ function fileDataToMldev$4(fromObject) {
3854
3890
  }
3855
3891
  return toObject;
3856
3892
  }
3893
+ function functionCallToMldev$4(fromObject) {
3894
+ const toObject = {};
3895
+ const fromId = getValueByPath(fromObject, ['id']);
3896
+ if (fromId != null) {
3897
+ setValueByPath(toObject, ['id'], fromId);
3898
+ }
3899
+ const fromArgs = getValueByPath(fromObject, ['args']);
3900
+ if (fromArgs != null) {
3901
+ setValueByPath(toObject, ['args'], fromArgs);
3902
+ }
3903
+ const fromName = getValueByPath(fromObject, ['name']);
3904
+ if (fromName != null) {
3905
+ setValueByPath(toObject, ['name'], fromName);
3906
+ }
3907
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
3908
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
3909
+ }
3910
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
3911
+ throw new Error('willContinue parameter is not supported in Gemini API.');
3912
+ }
3913
+ return toObject;
3914
+ }
3915
+ function functionCallingConfigToMldev$2(fromObject) {
3916
+ const toObject = {};
3917
+ const fromMode = getValueByPath(fromObject, ['mode']);
3918
+ if (fromMode != null) {
3919
+ setValueByPath(toObject, ['mode'], fromMode);
3920
+ }
3921
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
3922
+ 'allowedFunctionNames',
3923
+ ]);
3924
+ if (fromAllowedFunctionNames != null) {
3925
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
3926
+ }
3927
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
3928
+ undefined) {
3929
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
3930
+ }
3931
+ return toObject;
3932
+ }
3857
3933
  function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3858
3934
  const toObject = {};
3859
3935
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -3966,7 +4042,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3966
4042
  }
3967
4043
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
3968
4044
  if (parentObject !== undefined && fromToolConfig != null) {
3969
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
4045
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
3970
4046
  }
3971
4047
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
3972
4048
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -4004,7 +4080,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4004
4080
  }
4005
4081
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
4006
4082
  if (fromImageConfig != null) {
4007
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
4083
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev$1(fromImageConfig));
4008
4084
  }
4009
4085
  return toObject;
4010
4086
  }
@@ -4091,6 +4167,25 @@ function googleSearchToMldev$4(fromObject) {
4091
4167
  }
4092
4168
  return toObject;
4093
4169
  }
4170
+ function imageConfigToMldev$1(fromObject) {
4171
+ const toObject = {};
4172
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
4173
+ if (fromAspectRatio != null) {
4174
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
4175
+ }
4176
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
4177
+ if (fromImageSize != null) {
4178
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
4179
+ }
4180
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
4181
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
4182
+ }
4183
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
4184
+ undefined) {
4185
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
4186
+ }
4187
+ return toObject;
4188
+ }
4094
4189
  function inlinedRequestToMldev(apiClient, fromObject) {
4095
4190
  const toObject = {};
4096
4191
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4232,9 +4327,11 @@ function listBatchJobsResponseFromVertex(fromObject) {
4232
4327
  }
4233
4328
  function partToMldev$4(fromObject) {
4234
4329
  const toObject = {};
4235
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4236
- if (fromFunctionCall != null) {
4237
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4330
+ const fromMediaResolution = getValueByPath(fromObject, [
4331
+ 'mediaResolution',
4332
+ ]);
4333
+ if (fromMediaResolution != null) {
4334
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4238
4335
  }
4239
4336
  const fromCodeExecutionResult = getValueByPath(fromObject, [
4240
4337
  'codeExecutionResult',
@@ -4252,6 +4349,10 @@ function partToMldev$4(fromObject) {
4252
4349
  if (fromFileData != null) {
4253
4350
  setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4254
4351
  }
4352
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4353
+ if (fromFunctionCall != null) {
4354
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
4355
+ }
4255
4356
  const fromFunctionResponse = getValueByPath(fromObject, [
4256
4357
  'functionResponse',
4257
4358
  ]);
@@ -4299,6 +4400,22 @@ function safetySettingToMldev$1(fromObject) {
4299
4400
  }
4300
4401
  return toObject;
4301
4402
  }
4403
+ function toolConfigToMldev$2(fromObject) {
4404
+ const toObject = {};
4405
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4406
+ 'functionCallingConfig',
4407
+ ]);
4408
+ if (fromFunctionCallingConfig != null) {
4409
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4410
+ }
4411
+ const fromRetrievalConfig = getValueByPath(fromObject, [
4412
+ 'retrievalConfig',
4413
+ ]);
4414
+ if (fromRetrievalConfig != null) {
4415
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
4416
+ }
4417
+ return toObject;
4418
+ }
4302
4419
  function toolToMldev$4(fromObject) {
4303
4420
  const toObject = {};
4304
4421
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5121,7 +5238,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
5121
5238
  }
5122
5239
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5123
5240
  if (parentObject !== undefined && fromToolConfig != null) {
5124
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
5241
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
5125
5242
  }
5126
5243
  if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
5127
5244
  throw new Error('kmsKeyName parameter is not supported in Gemini API.');
@@ -5253,6 +5370,46 @@ function fileDataToMldev$3(fromObject) {
5253
5370
  }
5254
5371
  return toObject;
5255
5372
  }
5373
+ function functionCallToMldev$3(fromObject) {
5374
+ const toObject = {};
5375
+ const fromId = getValueByPath(fromObject, ['id']);
5376
+ if (fromId != null) {
5377
+ setValueByPath(toObject, ['id'], fromId);
5378
+ }
5379
+ const fromArgs = getValueByPath(fromObject, ['args']);
5380
+ if (fromArgs != null) {
5381
+ setValueByPath(toObject, ['args'], fromArgs);
5382
+ }
5383
+ const fromName = getValueByPath(fromObject, ['name']);
5384
+ if (fromName != null) {
5385
+ setValueByPath(toObject, ['name'], fromName);
5386
+ }
5387
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
5388
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
5389
+ }
5390
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
5391
+ throw new Error('willContinue parameter is not supported in Gemini API.');
5392
+ }
5393
+ return toObject;
5394
+ }
5395
+ function functionCallingConfigToMldev$1(fromObject) {
5396
+ const toObject = {};
5397
+ const fromMode = getValueByPath(fromObject, ['mode']);
5398
+ if (fromMode != null) {
5399
+ setValueByPath(toObject, ['mode'], fromMode);
5400
+ }
5401
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
5402
+ 'allowedFunctionNames',
5403
+ ]);
5404
+ if (fromAllowedFunctionNames != null) {
5405
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
5406
+ }
5407
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
5408
+ undefined) {
5409
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
5410
+ }
5411
+ return toObject;
5412
+ }
5256
5413
  function functionDeclarationToVertex$2(fromObject) {
5257
5414
  const toObject = {};
5258
5415
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -5429,9 +5586,11 @@ function listCachedContentsResponseFromVertex(fromObject) {
5429
5586
  }
5430
5587
  function partToMldev$3(fromObject) {
5431
5588
  const toObject = {};
5432
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5433
- if (fromFunctionCall != null) {
5434
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5589
+ const fromMediaResolution = getValueByPath(fromObject, [
5590
+ 'mediaResolution',
5591
+ ]);
5592
+ if (fromMediaResolution != null) {
5593
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
5435
5594
  }
5436
5595
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5437
5596
  'codeExecutionResult',
@@ -5449,6 +5608,10 @@ function partToMldev$3(fromObject) {
5449
5608
  if (fromFileData != null) {
5450
5609
  setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5451
5610
  }
5611
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5612
+ if (fromFunctionCall != null) {
5613
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
5614
+ }
5452
5615
  const fromFunctionResponse = getValueByPath(fromObject, [
5453
5616
  'functionResponse',
5454
5617
  ]);
@@ -5481,6 +5644,22 @@ function partToMldev$3(fromObject) {
5481
5644
  }
5482
5645
  return toObject;
5483
5646
  }
5647
+ function toolConfigToMldev$1(fromObject) {
5648
+ const toObject = {};
5649
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
5650
+ 'functionCallingConfig',
5651
+ ]);
5652
+ if (fromFunctionCallingConfig != null) {
5653
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5654
+ }
5655
+ const fromRetrievalConfig = getValueByPath(fromObject, [
5656
+ 'retrievalConfig',
5657
+ ]);
5658
+ if (fromRetrievalConfig != null) {
5659
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
5660
+ }
5661
+ return toObject;
5662
+ }
5484
5663
  function toolToMldev$3(fromObject) {
5485
5664
  const toObject = {};
5486
5665
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -6426,7 +6605,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6426
6605
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6427
6606
  const USER_AGENT_HEADER = 'User-Agent';
6428
6607
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6429
- const SDK_VERSION = '1.29.0'; // x-release-please-version
6608
+ const SDK_VERSION = '1.30.0'; // x-release-please-version
6430
6609
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6431
6610
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6432
6611
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -8351,6 +8530,28 @@ function fileDataToMldev$2(fromObject) {
8351
8530
  }
8352
8531
  return toObject;
8353
8532
  }
8533
+ function functionCallToMldev$2(fromObject) {
8534
+ const toObject = {};
8535
+ const fromId = getValueByPath(fromObject, ['id']);
8536
+ if (fromId != null) {
8537
+ setValueByPath(toObject, ['id'], fromId);
8538
+ }
8539
+ const fromArgs = getValueByPath(fromObject, ['args']);
8540
+ if (fromArgs != null) {
8541
+ setValueByPath(toObject, ['args'], fromArgs);
8542
+ }
8543
+ const fromName = getValueByPath(fromObject, ['name']);
8544
+ if (fromName != null) {
8545
+ setValueByPath(toObject, ['name'], fromName);
8546
+ }
8547
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
8548
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
8549
+ }
8550
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
8551
+ throw new Error('willContinue parameter is not supported in Gemini API.');
8552
+ }
8553
+ return toObject;
8554
+ }
8354
8555
  function functionDeclarationToVertex$1(fromObject) {
8355
8556
  const toObject = {};
8356
8557
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -8939,9 +9140,11 @@ function liveServerMessageFromVertex(fromObject) {
8939
9140
  }
8940
9141
  function partToMldev$2(fromObject) {
8941
9142
  const toObject = {};
8942
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
8943
- if (fromFunctionCall != null) {
8944
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
9143
+ const fromMediaResolution = getValueByPath(fromObject, [
9144
+ 'mediaResolution',
9145
+ ]);
9146
+ if (fromMediaResolution != null) {
9147
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
8945
9148
  }
8946
9149
  const fromCodeExecutionResult = getValueByPath(fromObject, [
8947
9150
  'codeExecutionResult',
@@ -8959,6 +9162,10 @@ function partToMldev$2(fromObject) {
8959
9162
  if (fromFileData != null) {
8960
9163
  setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
8961
9164
  }
9165
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9166
+ if (fromFunctionCall != null) {
9167
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
9168
+ }
8962
9169
  const fromFunctionResponse = getValueByPath(fromObject, [
8963
9170
  'functionResponse',
8964
9171
  ]);
@@ -9880,6 +10087,46 @@ function fileDataToMldev$1(fromObject) {
9880
10087
  }
9881
10088
  return toObject;
9882
10089
  }
10090
+ function functionCallToMldev$1(fromObject) {
10091
+ const toObject = {};
10092
+ const fromId = getValueByPath(fromObject, ['id']);
10093
+ if (fromId != null) {
10094
+ setValueByPath(toObject, ['id'], fromId);
10095
+ }
10096
+ const fromArgs = getValueByPath(fromObject, ['args']);
10097
+ if (fromArgs != null) {
10098
+ setValueByPath(toObject, ['args'], fromArgs);
10099
+ }
10100
+ const fromName = getValueByPath(fromObject, ['name']);
10101
+ if (fromName != null) {
10102
+ setValueByPath(toObject, ['name'], fromName);
10103
+ }
10104
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
10105
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
10106
+ }
10107
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
10108
+ throw new Error('willContinue parameter is not supported in Gemini API.');
10109
+ }
10110
+ return toObject;
10111
+ }
10112
+ function functionCallingConfigToMldev(fromObject) {
10113
+ const toObject = {};
10114
+ const fromMode = getValueByPath(fromObject, ['mode']);
10115
+ if (fromMode != null) {
10116
+ setValueByPath(toObject, ['mode'], fromMode);
10117
+ }
10118
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
10119
+ 'allowedFunctionNames',
10120
+ ]);
10121
+ if (fromAllowedFunctionNames != null) {
10122
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
10123
+ }
10124
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
10125
+ undefined) {
10126
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
10127
+ }
10128
+ return toObject;
10129
+ }
9883
10130
  function functionDeclarationToVertex(fromObject) {
9884
10131
  const toObject = {};
9885
10132
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -10027,7 +10274,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
10027
10274
  }
10028
10275
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
10029
10276
  if (parentObject !== undefined && fromToolConfig != null) {
10030
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
10277
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
10031
10278
  }
10032
10279
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
10033
10280
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -10065,7 +10312,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
10065
10312
  }
10066
10313
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
10067
10314
  if (fromImageConfig != null) {
10068
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
10315
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev(fromImageConfig));
10069
10316
  }
10070
10317
  return toObject;
10071
10318
  }
@@ -10229,7 +10476,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
10229
10476
  }
10230
10477
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
10231
10478
  if (fromImageConfig != null) {
10232
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
10479
+ setValueByPath(toObject, ['imageConfig'], imageConfigToVertex(fromImageConfig));
10233
10480
  }
10234
10481
  return toObject;
10235
10482
  }
@@ -11230,6 +11477,49 @@ function googleSearchToMldev$1(fromObject) {
11230
11477
  }
11231
11478
  return toObject;
11232
11479
  }
11480
+ function imageConfigToMldev(fromObject) {
11481
+ const toObject = {};
11482
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
11483
+ if (fromAspectRatio != null) {
11484
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
11485
+ }
11486
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
11487
+ if (fromImageSize != null) {
11488
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
11489
+ }
11490
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
11491
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
11492
+ }
11493
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
11494
+ undefined) {
11495
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
11496
+ }
11497
+ return toObject;
11498
+ }
11499
+ function imageConfigToVertex(fromObject) {
11500
+ const toObject = {};
11501
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
11502
+ if (fromAspectRatio != null) {
11503
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
11504
+ }
11505
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
11506
+ if (fromImageSize != null) {
11507
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
11508
+ }
11509
+ const fromOutputMimeType = getValueByPath(fromObject, [
11510
+ 'outputMimeType',
11511
+ ]);
11512
+ if (fromOutputMimeType != null) {
11513
+ setValueByPath(toObject, ['imageOutputOptions', 'mimeType'], fromOutputMimeType);
11514
+ }
11515
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
11516
+ 'outputCompressionQuality',
11517
+ ]);
11518
+ if (fromOutputCompressionQuality != null) {
11519
+ setValueByPath(toObject, ['imageOutputOptions', 'compressionQuality'], fromOutputCompressionQuality);
11520
+ }
11521
+ return toObject;
11522
+ }
11233
11523
  function imageFromMldev(fromObject) {
11234
11524
  const toObject = {};
11235
11525
  const fromImageBytes = getValueByPath(fromObject, [
@@ -11459,6 +11749,28 @@ function modelFromMldev(fromObject) {
11459
11749
  if (fromSupportedActions != null) {
11460
11750
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
11461
11751
  }
11752
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
11753
+ if (fromTemperature != null) {
11754
+ setValueByPath(toObject, ['temperature'], fromTemperature);
11755
+ }
11756
+ const fromMaxTemperature = getValueByPath(fromObject, [
11757
+ 'maxTemperature',
11758
+ ]);
11759
+ if (fromMaxTemperature != null) {
11760
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
11761
+ }
11762
+ const fromTopP = getValueByPath(fromObject, ['topP']);
11763
+ if (fromTopP != null) {
11764
+ setValueByPath(toObject, ['topP'], fromTopP);
11765
+ }
11766
+ const fromTopK = getValueByPath(fromObject, ['topK']);
11767
+ if (fromTopK != null) {
11768
+ setValueByPath(toObject, ['topK'], fromTopK);
11769
+ }
11770
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
11771
+ if (fromThinking != null) {
11772
+ setValueByPath(toObject, ['thinking'], fromThinking);
11773
+ }
11462
11774
  return toObject;
11463
11775
  }
11464
11776
  function modelFromVertex(fromObject) {
@@ -11517,9 +11829,11 @@ function modelFromVertex(fromObject) {
11517
11829
  }
11518
11830
  function partToMldev$1(fromObject) {
11519
11831
  const toObject = {};
11520
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
11521
- if (fromFunctionCall != null) {
11522
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
11832
+ const fromMediaResolution = getValueByPath(fromObject, [
11833
+ 'mediaResolution',
11834
+ ]);
11835
+ if (fromMediaResolution != null) {
11836
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
11523
11837
  }
11524
11838
  const fromCodeExecutionResult = getValueByPath(fromObject, [
11525
11839
  'codeExecutionResult',
@@ -11537,6 +11851,10 @@ function partToMldev$1(fromObject) {
11537
11851
  if (fromFileData != null) {
11538
11852
  setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
11539
11853
  }
11854
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
11855
+ if (fromFunctionCall != null) {
11856
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
11857
+ }
11540
11858
  const fromFunctionResponse = getValueByPath(fromObject, [
11541
11859
  'functionResponse',
11542
11860
  ]);
@@ -11587,7 +11905,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
11587
11905
  }
11588
11906
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
11589
11907
  if (parentObject !== undefined && fromBaseSteps != null) {
11590
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
11908
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
11591
11909
  }
11592
11910
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
11593
11911
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -11901,6 +12219,22 @@ function speechConfigToVertex(fromObject) {
11901
12219
  }
11902
12220
  return toObject;
11903
12221
  }
12222
+ function toolConfigToMldev(fromObject) {
12223
+ const toObject = {};
12224
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
12225
+ 'functionCallingConfig',
12226
+ ]);
12227
+ if (fromFunctionCallingConfig != null) {
12228
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
12229
+ }
12230
+ const fromRetrievalConfig = getValueByPath(fromObject, [
12231
+ 'retrievalConfig',
12232
+ ]);
12233
+ if (fromRetrievalConfig != null) {
12234
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
12235
+ }
12236
+ return toObject;
12237
+ }
11904
12238
  function toolToMldev$1(fromObject) {
11905
12239
  const toObject = {};
11906
12240
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -13376,6 +13710,7 @@ class Models extends BaseModule {
13376
13710
  * ```
13377
13711
  */
13378
13712
  this.generateContentStream = async (params) => {
13713
+ var _a, _b, _c, _d, _e;
13379
13714
  this.maybeMoveToResponseJsonSchem(params);
13380
13715
  if (shouldDisableAfc(params.config)) {
13381
13716
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
@@ -13388,6 +13723,17 @@ class Models extends BaseModule {
13388
13723
  .join(', ');
13389
13724
  throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
13390
13725
  }
13726
+ // With tool compatibility confirmed, validate that the configuration are
13727
+ // compatible with each other and raise an error if invalid.
13728
+ 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;
13729
+ 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;
13730
+ if (streamFunctionCall && !disableAfc) {
13731
+ throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, " +
13732
+ 'this feature is not compatible with automatic function calling (AFC). ' +
13733
+ "Please set 'config.automaticFunctionCalling.disable' to true to disable AFC " +
13734
+ "or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' " +
13735
+ 'to be undefined or set to false to disable streaming function call arguments feature.');
13736
+ }
13391
13737
  return await this.processAfcStream(params);
13392
13738
  };
13393
13739
  /**
@@ -15005,6 +15351,28 @@ function fileDataToMldev(fromObject) {
15005
15351
  }
15006
15352
  return toObject;
15007
15353
  }
15354
+ function functionCallToMldev(fromObject) {
15355
+ const toObject = {};
15356
+ const fromId = getValueByPath(fromObject, ['id']);
15357
+ if (fromId != null) {
15358
+ setValueByPath(toObject, ['id'], fromId);
15359
+ }
15360
+ const fromArgs = getValueByPath(fromObject, ['args']);
15361
+ if (fromArgs != null) {
15362
+ setValueByPath(toObject, ['args'], fromArgs);
15363
+ }
15364
+ const fromName = getValueByPath(fromObject, ['name']);
15365
+ if (fromName != null) {
15366
+ setValueByPath(toObject, ['name'], fromName);
15367
+ }
15368
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
15369
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
15370
+ }
15371
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
15372
+ throw new Error('willContinue parameter is not supported in Gemini API.');
15373
+ }
15374
+ return toObject;
15375
+ }
15008
15376
  function googleMapsToMldev(fromObject) {
15009
15377
  const toObject = {};
15010
15378
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
@@ -15156,9 +15524,11 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
15156
15524
  }
15157
15525
  function partToMldev(fromObject) {
15158
15526
  const toObject = {};
15159
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
15160
- if (fromFunctionCall != null) {
15161
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
15527
+ const fromMediaResolution = getValueByPath(fromObject, [
15528
+ 'mediaResolution',
15529
+ ]);
15530
+ if (fromMediaResolution != null) {
15531
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
15162
15532
  }
15163
15533
  const fromCodeExecutionResult = getValueByPath(fromObject, [
15164
15534
  'codeExecutionResult',
@@ -15176,6 +15546,10 @@ function partToMldev(fromObject) {
15176
15546
  if (fromFileData != null) {
15177
15547
  setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
15178
15548
  }
15549
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
15550
+ if (fromFunctionCall != null) {
15551
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
15552
+ }
15179
15553
  const fromFunctionResponse = getValueByPath(fromObject, [
15180
15554
  'functionResponse',
15181
15555
  ]);