@google/genai 1.29.1 → 1.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -756,6 +756,22 @@ var PhishBlockThreshold;
756
756
  */
757
757
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
758
758
  })(PhishBlockThreshold || (PhishBlockThreshold = {}));
759
+ /** The level of thoughts tokens that the model should generate. */
760
+ var ThinkingLevel;
761
+ (function (ThinkingLevel) {
762
+ /**
763
+ * Default value.
764
+ */
765
+ ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
766
+ /**
767
+ * Low thinking level.
768
+ */
769
+ ThinkingLevel["LOW"] = "LOW";
770
+ /**
771
+ * High thinking level.
772
+ */
773
+ ThinkingLevel["HIGH"] = "HIGH";
774
+ })(ThinkingLevel || (ThinkingLevel = {}));
759
775
  /** Harm category. */
760
776
  var HarmCategory;
761
777
  (function (HarmCategory) {
@@ -1198,6 +1214,26 @@ var TuningTask;
1198
1214
  */
1199
1215
  TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
1200
1216
  })(TuningTask || (TuningTask = {}));
1217
+ /** The tokenization quality used for given media. */
1218
+ var PartMediaResolutionLevel;
1219
+ (function (PartMediaResolutionLevel) {
1220
+ /**
1221
+ * Media resolution has not been set.
1222
+ */
1223
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1224
+ /**
1225
+ * Media resolution set to low.
1226
+ */
1227
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1228
+ /**
1229
+ * Media resolution set to medium.
1230
+ */
1231
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1232
+ /**
1233
+ * Media resolution set to high.
1234
+ */
1235
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1236
+ })(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
1201
1237
  /** Options for feature selection preference. */
1202
1238
  var FeatureSelectionPreference;
1203
1239
  (function (FeatureSelectionPreference) {
@@ -1732,13 +1768,11 @@ class FunctionResponse {
1732
1768
  /**
1733
1769
  * Creates a `Part` object from a `URI` string.
1734
1770
  */
1735
- function createPartFromUri(uri, mimeType) {
1736
- return {
1737
- fileData: {
1771
+ function createPartFromUri(uri, mimeType, mediaResolution) {
1772
+ return Object.assign({ fileData: {
1738
1773
  fileUri: uri,
1739
1774
  mimeType: mimeType,
1740
- },
1741
- };
1775
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1742
1776
  }
1743
1777
  /**
1744
1778
  * Creates a `Part` object from a `text` string.
@@ -1770,13 +1804,11 @@ function createPartFromFunctionResponse(id, name, response, parts = []) {
1770
1804
  /**
1771
1805
  * Creates a `Part` object from a `base64` encoded `string`.
1772
1806
  */
1773
- function createPartFromBase64(data, mimeType) {
1774
- return {
1775
- inlineData: {
1807
+ function createPartFromBase64(data, mimeType, mediaResolution) {
1808
+ return Object.assign({ inlineData: {
1776
1809
  data: data,
1777
1810
  mimeType: mimeType,
1778
- },
1779
- };
1811
+ } }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
1780
1812
  }
1781
1813
  /**
1782
1814
  * Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
@@ -3856,6 +3888,46 @@ function fileDataToMldev$4(fromObject) {
3856
3888
  }
3857
3889
  return toObject;
3858
3890
  }
3891
+ function functionCallToMldev$4(fromObject) {
3892
+ const toObject = {};
3893
+ const fromId = getValueByPath(fromObject, ['id']);
3894
+ if (fromId != null) {
3895
+ setValueByPath(toObject, ['id'], fromId);
3896
+ }
3897
+ const fromArgs = getValueByPath(fromObject, ['args']);
3898
+ if (fromArgs != null) {
3899
+ setValueByPath(toObject, ['args'], fromArgs);
3900
+ }
3901
+ const fromName = getValueByPath(fromObject, ['name']);
3902
+ if (fromName != null) {
3903
+ setValueByPath(toObject, ['name'], fromName);
3904
+ }
3905
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
3906
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
3907
+ }
3908
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
3909
+ throw new Error('willContinue parameter is not supported in Gemini API.');
3910
+ }
3911
+ return toObject;
3912
+ }
3913
+ function functionCallingConfigToMldev$2(fromObject) {
3914
+ const toObject = {};
3915
+ const fromMode = getValueByPath(fromObject, ['mode']);
3916
+ if (fromMode != null) {
3917
+ setValueByPath(toObject, ['mode'], fromMode);
3918
+ }
3919
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
3920
+ 'allowedFunctionNames',
3921
+ ]);
3922
+ if (fromAllowedFunctionNames != null) {
3923
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
3924
+ }
3925
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
3926
+ undefined) {
3927
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
3928
+ }
3929
+ return toObject;
3930
+ }
3859
3931
  function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3860
3932
  const toObject = {};
3861
3933
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -3968,7 +4040,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
3968
4040
  }
3969
4041
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
3970
4042
  if (parentObject !== undefined && fromToolConfig != null) {
3971
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
4043
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
3972
4044
  }
3973
4045
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
3974
4046
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -4006,7 +4078,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4006
4078
  }
4007
4079
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
4008
4080
  if (fromImageConfig != null) {
4009
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
4081
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev$1(fromImageConfig));
4010
4082
  }
4011
4083
  return toObject;
4012
4084
  }
@@ -4093,6 +4165,25 @@ function googleSearchToMldev$4(fromObject) {
4093
4165
  }
4094
4166
  return toObject;
4095
4167
  }
4168
+ function imageConfigToMldev$1(fromObject) {
4169
+ const toObject = {};
4170
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
4171
+ if (fromAspectRatio != null) {
4172
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
4173
+ }
4174
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
4175
+ if (fromImageSize != null) {
4176
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
4177
+ }
4178
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
4179
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
4180
+ }
4181
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
4182
+ undefined) {
4183
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
4184
+ }
4185
+ return toObject;
4186
+ }
4096
4187
  function inlinedRequestToMldev(apiClient, fromObject) {
4097
4188
  const toObject = {};
4098
4189
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4234,9 +4325,11 @@ function listBatchJobsResponseFromVertex(fromObject) {
4234
4325
  }
4235
4326
  function partToMldev$4(fromObject) {
4236
4327
  const toObject = {};
4237
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4238
- if (fromFunctionCall != null) {
4239
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4328
+ const fromMediaResolution = getValueByPath(fromObject, [
4329
+ 'mediaResolution',
4330
+ ]);
4331
+ if (fromMediaResolution != null) {
4332
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4240
4333
  }
4241
4334
  const fromCodeExecutionResult = getValueByPath(fromObject, [
4242
4335
  'codeExecutionResult',
@@ -4254,6 +4347,10 @@ function partToMldev$4(fromObject) {
4254
4347
  if (fromFileData != null) {
4255
4348
  setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4256
4349
  }
4350
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4351
+ if (fromFunctionCall != null) {
4352
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
4353
+ }
4257
4354
  const fromFunctionResponse = getValueByPath(fromObject, [
4258
4355
  'functionResponse',
4259
4356
  ]);
@@ -4301,6 +4398,22 @@ function safetySettingToMldev$1(fromObject) {
4301
4398
  }
4302
4399
  return toObject;
4303
4400
  }
4401
+ function toolConfigToMldev$2(fromObject) {
4402
+ const toObject = {};
4403
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4404
+ 'functionCallingConfig',
4405
+ ]);
4406
+ if (fromFunctionCallingConfig != null) {
4407
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4408
+ }
4409
+ const fromRetrievalConfig = getValueByPath(fromObject, [
4410
+ 'retrievalConfig',
4411
+ ]);
4412
+ if (fromRetrievalConfig != null) {
4413
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
4414
+ }
4415
+ return toObject;
4416
+ }
4304
4417
  function toolToMldev$4(fromObject) {
4305
4418
  const toObject = {};
4306
4419
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -5123,7 +5236,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
5123
5236
  }
5124
5237
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5125
5238
  if (parentObject !== undefined && fromToolConfig != null) {
5126
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
5239
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
5127
5240
  }
5128
5241
  if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
5129
5242
  throw new Error('kmsKeyName parameter is not supported in Gemini API.');
@@ -5255,6 +5368,46 @@ function fileDataToMldev$3(fromObject) {
5255
5368
  }
5256
5369
  return toObject;
5257
5370
  }
5371
+ function functionCallToMldev$3(fromObject) {
5372
+ const toObject = {};
5373
+ const fromId = getValueByPath(fromObject, ['id']);
5374
+ if (fromId != null) {
5375
+ setValueByPath(toObject, ['id'], fromId);
5376
+ }
5377
+ const fromArgs = getValueByPath(fromObject, ['args']);
5378
+ if (fromArgs != null) {
5379
+ setValueByPath(toObject, ['args'], fromArgs);
5380
+ }
5381
+ const fromName = getValueByPath(fromObject, ['name']);
5382
+ if (fromName != null) {
5383
+ setValueByPath(toObject, ['name'], fromName);
5384
+ }
5385
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
5386
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
5387
+ }
5388
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
5389
+ throw new Error('willContinue parameter is not supported in Gemini API.');
5390
+ }
5391
+ return toObject;
5392
+ }
5393
+ function functionCallingConfigToMldev$1(fromObject) {
5394
+ const toObject = {};
5395
+ const fromMode = getValueByPath(fromObject, ['mode']);
5396
+ if (fromMode != null) {
5397
+ setValueByPath(toObject, ['mode'], fromMode);
5398
+ }
5399
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
5400
+ 'allowedFunctionNames',
5401
+ ]);
5402
+ if (fromAllowedFunctionNames != null) {
5403
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
5404
+ }
5405
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
5406
+ undefined) {
5407
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
5408
+ }
5409
+ return toObject;
5410
+ }
5258
5411
  function functionDeclarationToVertex$2(fromObject) {
5259
5412
  const toObject = {};
5260
5413
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -5431,9 +5584,11 @@ function listCachedContentsResponseFromVertex(fromObject) {
5431
5584
  }
5432
5585
  function partToMldev$3(fromObject) {
5433
5586
  const toObject = {};
5434
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5435
- if (fromFunctionCall != null) {
5436
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5587
+ const fromMediaResolution = getValueByPath(fromObject, [
5588
+ 'mediaResolution',
5589
+ ]);
5590
+ if (fromMediaResolution != null) {
5591
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
5437
5592
  }
5438
5593
  const fromCodeExecutionResult = getValueByPath(fromObject, [
5439
5594
  'codeExecutionResult',
@@ -5451,6 +5606,10 @@ function partToMldev$3(fromObject) {
5451
5606
  if (fromFileData != null) {
5452
5607
  setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5453
5608
  }
5609
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5610
+ if (fromFunctionCall != null) {
5611
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
5612
+ }
5454
5613
  const fromFunctionResponse = getValueByPath(fromObject, [
5455
5614
  'functionResponse',
5456
5615
  ]);
@@ -5483,6 +5642,22 @@ function partToMldev$3(fromObject) {
5483
5642
  }
5484
5643
  return toObject;
5485
5644
  }
5645
+ function toolConfigToMldev$1(fromObject) {
5646
+ const toObject = {};
5647
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
5648
+ 'functionCallingConfig',
5649
+ ]);
5650
+ if (fromFunctionCallingConfig != null) {
5651
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5652
+ }
5653
+ const fromRetrievalConfig = getValueByPath(fromObject, [
5654
+ 'retrievalConfig',
5655
+ ]);
5656
+ if (fromRetrievalConfig != null) {
5657
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
5658
+ }
5659
+ return toObject;
5660
+ }
5486
5661
  function toolToMldev$3(fromObject) {
5487
5662
  const toObject = {};
5488
5663
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -6428,7 +6603,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6428
6603
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6429
6604
  const USER_AGENT_HEADER = 'User-Agent';
6430
6605
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6431
- const SDK_VERSION = '1.29.1'; // x-release-please-version
6606
+ const SDK_VERSION = '1.30.0'; // x-release-please-version
6432
6607
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6433
6608
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6434
6609
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -8353,6 +8528,28 @@ function fileDataToMldev$2(fromObject) {
8353
8528
  }
8354
8529
  return toObject;
8355
8530
  }
8531
+ function functionCallToMldev$2(fromObject) {
8532
+ const toObject = {};
8533
+ const fromId = getValueByPath(fromObject, ['id']);
8534
+ if (fromId != null) {
8535
+ setValueByPath(toObject, ['id'], fromId);
8536
+ }
8537
+ const fromArgs = getValueByPath(fromObject, ['args']);
8538
+ if (fromArgs != null) {
8539
+ setValueByPath(toObject, ['args'], fromArgs);
8540
+ }
8541
+ const fromName = getValueByPath(fromObject, ['name']);
8542
+ if (fromName != null) {
8543
+ setValueByPath(toObject, ['name'], fromName);
8544
+ }
8545
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
8546
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
8547
+ }
8548
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
8549
+ throw new Error('willContinue parameter is not supported in Gemini API.');
8550
+ }
8551
+ return toObject;
8552
+ }
8356
8553
  function functionDeclarationToVertex$1(fromObject) {
8357
8554
  const toObject = {};
8358
8555
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -8941,9 +9138,11 @@ function liveServerMessageFromVertex(fromObject) {
8941
9138
  }
8942
9139
  function partToMldev$2(fromObject) {
8943
9140
  const toObject = {};
8944
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
8945
- if (fromFunctionCall != null) {
8946
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
9141
+ const fromMediaResolution = getValueByPath(fromObject, [
9142
+ 'mediaResolution',
9143
+ ]);
9144
+ if (fromMediaResolution != null) {
9145
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
8947
9146
  }
8948
9147
  const fromCodeExecutionResult = getValueByPath(fromObject, [
8949
9148
  'codeExecutionResult',
@@ -8961,6 +9160,10 @@ function partToMldev$2(fromObject) {
8961
9160
  if (fromFileData != null) {
8962
9161
  setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
8963
9162
  }
9163
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9164
+ if (fromFunctionCall != null) {
9165
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
9166
+ }
8964
9167
  const fromFunctionResponse = getValueByPath(fromObject, [
8965
9168
  'functionResponse',
8966
9169
  ]);
@@ -9882,6 +10085,46 @@ function fileDataToMldev$1(fromObject) {
9882
10085
  }
9883
10086
  return toObject;
9884
10087
  }
10088
+ function functionCallToMldev$1(fromObject) {
10089
+ const toObject = {};
10090
+ const fromId = getValueByPath(fromObject, ['id']);
10091
+ if (fromId != null) {
10092
+ setValueByPath(toObject, ['id'], fromId);
10093
+ }
10094
+ const fromArgs = getValueByPath(fromObject, ['args']);
10095
+ if (fromArgs != null) {
10096
+ setValueByPath(toObject, ['args'], fromArgs);
10097
+ }
10098
+ const fromName = getValueByPath(fromObject, ['name']);
10099
+ if (fromName != null) {
10100
+ setValueByPath(toObject, ['name'], fromName);
10101
+ }
10102
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
10103
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
10104
+ }
10105
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
10106
+ throw new Error('willContinue parameter is not supported in Gemini API.');
10107
+ }
10108
+ return toObject;
10109
+ }
10110
+ function functionCallingConfigToMldev(fromObject) {
10111
+ const toObject = {};
10112
+ const fromMode = getValueByPath(fromObject, ['mode']);
10113
+ if (fromMode != null) {
10114
+ setValueByPath(toObject, ['mode'], fromMode);
10115
+ }
10116
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
10117
+ 'allowedFunctionNames',
10118
+ ]);
10119
+ if (fromAllowedFunctionNames != null) {
10120
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
10121
+ }
10122
+ if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
10123
+ undefined) {
10124
+ throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
10125
+ }
10126
+ return toObject;
10127
+ }
9885
10128
  function functionDeclarationToVertex(fromObject) {
9886
10129
  const toObject = {};
9887
10130
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
@@ -10029,7 +10272,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
10029
10272
  }
10030
10273
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
10031
10274
  if (parentObject !== undefined && fromToolConfig != null) {
10032
- setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
10275
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
10033
10276
  }
10034
10277
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
10035
10278
  throw new Error('labels parameter is not supported in Gemini API.');
@@ -10067,7 +10310,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
10067
10310
  }
10068
10311
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
10069
10312
  if (fromImageConfig != null) {
10070
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
10313
+ setValueByPath(toObject, ['imageConfig'], imageConfigToMldev(fromImageConfig));
10071
10314
  }
10072
10315
  return toObject;
10073
10316
  }
@@ -10231,7 +10474,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
10231
10474
  }
10232
10475
  const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
10233
10476
  if (fromImageConfig != null) {
10234
- setValueByPath(toObject, ['imageConfig'], fromImageConfig);
10477
+ setValueByPath(toObject, ['imageConfig'], imageConfigToVertex(fromImageConfig));
10235
10478
  }
10236
10479
  return toObject;
10237
10480
  }
@@ -11232,6 +11475,49 @@ function googleSearchToMldev$1(fromObject) {
11232
11475
  }
11233
11476
  return toObject;
11234
11477
  }
11478
+ function imageConfigToMldev(fromObject) {
11479
+ const toObject = {};
11480
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
11481
+ if (fromAspectRatio != null) {
11482
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
11483
+ }
11484
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
11485
+ if (fromImageSize != null) {
11486
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
11487
+ }
11488
+ if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
11489
+ throw new Error('outputMimeType parameter is not supported in Gemini API.');
11490
+ }
11491
+ if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
11492
+ undefined) {
11493
+ throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
11494
+ }
11495
+ return toObject;
11496
+ }
11497
+ function imageConfigToVertex(fromObject) {
11498
+ const toObject = {};
11499
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
11500
+ if (fromAspectRatio != null) {
11501
+ setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
11502
+ }
11503
+ const fromImageSize = getValueByPath(fromObject, ['imageSize']);
11504
+ if (fromImageSize != null) {
11505
+ setValueByPath(toObject, ['imageSize'], fromImageSize);
11506
+ }
11507
+ const fromOutputMimeType = getValueByPath(fromObject, [
11508
+ 'outputMimeType',
11509
+ ]);
11510
+ if (fromOutputMimeType != null) {
11511
+ setValueByPath(toObject, ['imageOutputOptions', 'mimeType'], fromOutputMimeType);
11512
+ }
11513
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
11514
+ 'outputCompressionQuality',
11515
+ ]);
11516
+ if (fromOutputCompressionQuality != null) {
11517
+ setValueByPath(toObject, ['imageOutputOptions', 'compressionQuality'], fromOutputCompressionQuality);
11518
+ }
11519
+ return toObject;
11520
+ }
11235
11521
  function imageFromMldev(fromObject) {
11236
11522
  const toObject = {};
11237
11523
  const fromImageBytes = getValueByPath(fromObject, [
@@ -11541,9 +11827,11 @@ function modelFromVertex(fromObject) {
11541
11827
  }
11542
11828
  function partToMldev$1(fromObject) {
11543
11829
  const toObject = {};
11544
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
11545
- if (fromFunctionCall != null) {
11546
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
11830
+ const fromMediaResolution = getValueByPath(fromObject, [
11831
+ 'mediaResolution',
11832
+ ]);
11833
+ if (fromMediaResolution != null) {
11834
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
11547
11835
  }
11548
11836
  const fromCodeExecutionResult = getValueByPath(fromObject, [
11549
11837
  'codeExecutionResult',
@@ -11561,6 +11849,10 @@ function partToMldev$1(fromObject) {
11561
11849
  if (fromFileData != null) {
11562
11850
  setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
11563
11851
  }
11852
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
11853
+ if (fromFunctionCall != null) {
11854
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
11855
+ }
11564
11856
  const fromFunctionResponse = getValueByPath(fromObject, [
11565
11857
  'functionResponse',
11566
11858
  ]);
@@ -11925,6 +12217,22 @@ function speechConfigToVertex(fromObject) {
11925
12217
  }
11926
12218
  return toObject;
11927
12219
  }
12220
+ function toolConfigToMldev(fromObject) {
12221
+ const toObject = {};
12222
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
12223
+ 'functionCallingConfig',
12224
+ ]);
12225
+ if (fromFunctionCallingConfig != null) {
12226
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
12227
+ }
12228
+ const fromRetrievalConfig = getValueByPath(fromObject, [
12229
+ 'retrievalConfig',
12230
+ ]);
12231
+ if (fromRetrievalConfig != null) {
12232
+ setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
12233
+ }
12234
+ return toObject;
12235
+ }
11928
12236
  function toolToMldev$1(fromObject) {
11929
12237
  const toObject = {};
11930
12238
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -13400,6 +13708,7 @@ class Models extends BaseModule {
13400
13708
  * ```
13401
13709
  */
13402
13710
  this.generateContentStream = async (params) => {
13711
+ var _a, _b, _c, _d, _e;
13403
13712
  this.maybeMoveToResponseJsonSchem(params);
13404
13713
  if (shouldDisableAfc(params.config)) {
13405
13714
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
@@ -13412,6 +13721,17 @@ class Models extends BaseModule {
13412
13721
  .join(', ');
13413
13722
  throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
13414
13723
  }
13724
+ // With tool compatibility confirmed, validate that the configuration are
13725
+ // compatible with each other and raise an error if invalid.
13726
+ 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;
13727
+ 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;
13728
+ if (streamFunctionCall && !disableAfc) {
13729
+ throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, " +
13730
+ 'this feature is not compatible with automatic function calling (AFC). ' +
13731
+ "Please set 'config.automaticFunctionCalling.disable' to true to disable AFC " +
13732
+ "or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' " +
13733
+ 'to be undefined or set to false to disable streaming function call arguments feature.');
13734
+ }
13415
13735
  return await this.processAfcStream(params);
13416
13736
  };
13417
13737
  /**
@@ -15029,6 +15349,28 @@ function fileDataToMldev(fromObject) {
15029
15349
  }
15030
15350
  return toObject;
15031
15351
  }
15352
+ function functionCallToMldev(fromObject) {
15353
+ const toObject = {};
15354
+ const fromId = getValueByPath(fromObject, ['id']);
15355
+ if (fromId != null) {
15356
+ setValueByPath(toObject, ['id'], fromId);
15357
+ }
15358
+ const fromArgs = getValueByPath(fromObject, ['args']);
15359
+ if (fromArgs != null) {
15360
+ setValueByPath(toObject, ['args'], fromArgs);
15361
+ }
15362
+ const fromName = getValueByPath(fromObject, ['name']);
15363
+ if (fromName != null) {
15364
+ setValueByPath(toObject, ['name'], fromName);
15365
+ }
15366
+ if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
15367
+ throw new Error('partialArgs parameter is not supported in Gemini API.');
15368
+ }
15369
+ if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
15370
+ throw new Error('willContinue parameter is not supported in Gemini API.');
15371
+ }
15372
+ return toObject;
15373
+ }
15032
15374
  function googleMapsToMldev(fromObject) {
15033
15375
  const toObject = {};
15034
15376
  if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
@@ -15180,9 +15522,11 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
15180
15522
  }
15181
15523
  function partToMldev(fromObject) {
15182
15524
  const toObject = {};
15183
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
15184
- if (fromFunctionCall != null) {
15185
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
15525
+ const fromMediaResolution = getValueByPath(fromObject, [
15526
+ 'mediaResolution',
15527
+ ]);
15528
+ if (fromMediaResolution != null) {
15529
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
15186
15530
  }
15187
15531
  const fromCodeExecutionResult = getValueByPath(fromObject, [
15188
15532
  'codeExecutionResult',
@@ -15200,6 +15544,10 @@ function partToMldev(fromObject) {
15200
15544
  if (fromFileData != null) {
15201
15545
  setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
15202
15546
  }
15547
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
15548
+ if (fromFunctionCall != null) {
15549
+ setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
15550
+ }
15203
15551
  const fromFunctionResponse = getValueByPath(fromObject, [
15204
15552
  'functionResponse',
15205
15553
  ]);
@@ -16675,5 +17023,5 @@ class GoogleGenAI {
16675
17023
  }
16676
17024
  }
16677
17025
 
16678
- 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 };
17026
+ 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 };
16679
17027
  //# sourceMappingURL=index.mjs.map