@google/genai 1.33.0 → 1.35.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.
@@ -703,18 +703,6 @@ exports.Type = void 0;
703
703
  */
704
704
  Type["NULL"] = "NULL";
705
705
  })(exports.Type || (exports.Type = {}));
706
- /** The mode of the predictor to be used in dynamic retrieval. */
707
- exports.Mode = void 0;
708
- (function (Mode) {
709
- /**
710
- * Always trigger retrieval.
711
- */
712
- Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
713
- /**
714
- * Run retrieval only when system decides it is necessary.
715
- */
716
- Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
717
- })(exports.Mode || (exports.Mode = {}));
718
706
  /** The API spec that the external API implements. This enum is not supported in Gemini API. */
719
707
  exports.ApiSpec = void 0;
720
708
  (function (ApiSpec) {
@@ -817,21 +805,81 @@ exports.PhishBlockThreshold = void 0;
817
805
  */
818
806
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
819
807
  })(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
820
- /** The level of thoughts tokens that the model should generate. */
808
+ /** Specifies the function Behavior. Currently only supported by the BidiGenerateContent method. This enum is not supported in Vertex AI. */
809
+ exports.Behavior = void 0;
810
+ (function (Behavior) {
811
+ /**
812
+ * This value is unused.
813
+ */
814
+ Behavior["UNSPECIFIED"] = "UNSPECIFIED";
815
+ /**
816
+ * If set, the system will wait to receive the function response before continuing the conversation.
817
+ */
818
+ Behavior["BLOCKING"] = "BLOCKING";
819
+ /**
820
+ * If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model.
821
+ */
822
+ Behavior["NON_BLOCKING"] = "NON_BLOCKING";
823
+ })(exports.Behavior || (exports.Behavior = {}));
824
+ /** The mode of the predictor to be used in dynamic retrieval. */
825
+ exports.DynamicRetrievalConfigMode = void 0;
826
+ (function (DynamicRetrievalConfigMode) {
827
+ /**
828
+ * Always trigger retrieval.
829
+ */
830
+ DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
831
+ /**
832
+ * Run retrieval only when system decides it is necessary.
833
+ */
834
+ DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
835
+ })(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
836
+ /** Function calling mode. */
837
+ exports.FunctionCallingConfigMode = void 0;
838
+ (function (FunctionCallingConfigMode) {
839
+ /**
840
+ * Unspecified function calling mode. This value should not be used.
841
+ */
842
+ FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
843
+ /**
844
+ * Default model behavior, model decides to predict either function calls or natural language response.
845
+ */
846
+ FunctionCallingConfigMode["AUTO"] = "AUTO";
847
+ /**
848
+ * Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
849
+ */
850
+ FunctionCallingConfigMode["ANY"] = "ANY";
851
+ /**
852
+ * Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
853
+ */
854
+ FunctionCallingConfigMode["NONE"] = "NONE";
855
+ /**
856
+ * Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
857
+ */
858
+ FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
859
+ })(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
860
+ /** The number of thoughts tokens that the model should generate. */
821
861
  exports.ThinkingLevel = void 0;
822
862
  (function (ThinkingLevel) {
823
863
  /**
824
- * Default value.
864
+ * Unspecified thinking level.
825
865
  */
826
866
  ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
827
867
  /**
828
868
  * Low thinking level.
829
869
  */
830
870
  ThinkingLevel["LOW"] = "LOW";
871
+ /**
872
+ * Medium thinking level.
873
+ */
874
+ ThinkingLevel["MEDIUM"] = "MEDIUM";
831
875
  /**
832
876
  * High thinking level.
833
877
  */
834
878
  ThinkingLevel["HIGH"] = "HIGH";
879
+ /**
880
+ * MINIMAL thinking level.
881
+ */
882
+ ThinkingLevel["MINIMAL"] = "MINIMAL";
835
883
  })(exports.ThinkingLevel || (exports.ThinkingLevel = {}));
836
884
  /** Harm category. */
837
885
  exports.HarmCategory = void 0;
@@ -1302,6 +1350,10 @@ exports.PartMediaResolutionLevel = void 0;
1302
1350
  * Media resolution set to high.
1303
1351
  */
1304
1352
  PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1353
+ /**
1354
+ * Media resolution set to ultra high.
1355
+ */
1356
+ PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
1305
1357
  })(exports.PartMediaResolutionLevel || (exports.PartMediaResolutionLevel = {}));
1306
1358
  /** Options for feature selection preference. */
1307
1359
  exports.FeatureSelectionPreference = void 0;
@@ -1311,34 +1363,6 @@ exports.FeatureSelectionPreference = void 0;
1311
1363
  FeatureSelectionPreference["BALANCED"] = "BALANCED";
1312
1364
  FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
1313
1365
  })(exports.FeatureSelectionPreference || (exports.FeatureSelectionPreference = {}));
1314
- /** Defines the function behavior. Defaults to `BLOCKING`. */
1315
- exports.Behavior = void 0;
1316
- (function (Behavior) {
1317
- /**
1318
- * This value is unused.
1319
- */
1320
- Behavior["UNSPECIFIED"] = "UNSPECIFIED";
1321
- /**
1322
- * If set, the system will wait to receive the function response before continuing the conversation.
1323
- */
1324
- Behavior["BLOCKING"] = "BLOCKING";
1325
- /**
1326
- * If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model.
1327
- */
1328
- Behavior["NON_BLOCKING"] = "NON_BLOCKING";
1329
- })(exports.Behavior || (exports.Behavior = {}));
1330
- /** Config for the dynamic retrieval config mode. */
1331
- exports.DynamicRetrievalConfigMode = void 0;
1332
- (function (DynamicRetrievalConfigMode) {
1333
- /**
1334
- * Always trigger retrieval.
1335
- */
1336
- DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1337
- /**
1338
- * Run retrieval only when system decides it is necessary.
1339
- */
1340
- DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1341
- })(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
1342
1366
  /** The environment being operated. */
1343
1367
  exports.Environment = void 0;
1344
1368
  (function (Environment) {
@@ -1351,30 +1375,6 @@ exports.Environment = void 0;
1351
1375
  */
1352
1376
  Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
1353
1377
  })(exports.Environment || (exports.Environment = {}));
1354
- /** Config for the function calling config mode. */
1355
- exports.FunctionCallingConfigMode = void 0;
1356
- (function (FunctionCallingConfigMode) {
1357
- /**
1358
- * The function calling config mode is unspecified. Should not be used.
1359
- */
1360
- FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1361
- /**
1362
- * Default model behavior, model decides to predict either function calls or natural language response.
1363
- */
1364
- FunctionCallingConfigMode["AUTO"] = "AUTO";
1365
- /**
1366
- * Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
1367
- */
1368
- FunctionCallingConfigMode["ANY"] = "ANY";
1369
- /**
1370
- * Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
1371
- */
1372
- FunctionCallingConfigMode["NONE"] = "NONE";
1373
- /**
1374
- * Model decides to predict either a function call or a natural language response, but will validate function calls with constrained decoding. If "allowed_function_names" are set, the predicted function call will be limited to any one of "allowed_function_names", else the predicted function call will be any one of the provided "function_declarations".
1375
- */
1376
- FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
1377
- })(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
1378
1378
  /** Enum that controls the safety filter level for objectionable content. */
1379
1379
  exports.SafetyFilterLevel = void 0;
1380
1380
  (function (SafetyFilterLevel) {
@@ -1571,6 +1571,7 @@ exports.FileSource = void 0;
1571
1571
  FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
1572
1572
  FileSource["UPLOADED"] = "UPLOADED";
1573
1573
  FileSource["GENERATED"] = "GENERATED";
1574
+ FileSource["REGISTERED"] = "REGISTERED";
1574
1575
  })(exports.FileSource || (exports.FileSource = {}));
1575
1576
  /** The reason why the turn is complete. */
1576
1577
  exports.TurnCompleteReason = void 0;
@@ -4000,16 +4001,16 @@ function functionCallToMldev$4(fromObject) {
4000
4001
  }
4001
4002
  function functionCallingConfigToMldev$2(fromObject) {
4002
4003
  const toObject = {};
4003
- const fromMode = getValueByPath(fromObject, ['mode']);
4004
- if (fromMode != null) {
4005
- setValueByPath(toObject, ['mode'], fromMode);
4006
- }
4007
4004
  const fromAllowedFunctionNames = getValueByPath(fromObject, [
4008
4005
  'allowedFunctionNames',
4009
4006
  ]);
4010
4007
  if (fromAllowedFunctionNames != null) {
4011
4008
  setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
4012
4009
  }
4010
+ const fromMode = getValueByPath(fromObject, ['mode']);
4011
+ if (fromMode != null) {
4012
+ setValueByPath(toObject, ['mode'], fromMode);
4013
+ }
4013
4014
  if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
4014
4015
  undefined) {
4015
4016
  throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
@@ -4269,6 +4270,9 @@ function imageConfigToMldev$1(fromObject) {
4269
4270
  if (fromImageSize != null) {
4270
4271
  setValueByPath(toObject, ['imageSize'], fromImageSize);
4271
4272
  }
4273
+ if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
4274
+ throw new Error('personGeneration parameter is not supported in Gemini API.');
4275
+ }
4272
4276
  if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
4273
4277
  throw new Error('outputMimeType parameter is not supported in Gemini API.');
4274
4278
  }
@@ -4494,43 +4498,25 @@ function safetySettingToMldev$1(fromObject) {
4494
4498
  }
4495
4499
  function toolConfigToMldev$2(fromObject) {
4496
4500
  const toObject = {};
4497
- const fromFunctionCallingConfig = getValueByPath(fromObject, [
4498
- 'functionCallingConfig',
4499
- ]);
4500
- if (fromFunctionCallingConfig != null) {
4501
- setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4502
- }
4503
4501
  const fromRetrievalConfig = getValueByPath(fromObject, [
4504
4502
  'retrievalConfig',
4505
4503
  ]);
4506
4504
  if (fromRetrievalConfig != null) {
4507
4505
  setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
4508
4506
  }
4507
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4508
+ 'functionCallingConfig',
4509
+ ]);
4510
+ if (fromFunctionCallingConfig != null) {
4511
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
4512
+ }
4509
4513
  return toObject;
4510
4514
  }
4511
4515
  function toolToMldev$4(fromObject) {
4512
4516
  const toObject = {};
4513
- const fromFunctionDeclarations = getValueByPath(fromObject, [
4514
- 'functionDeclarations',
4515
- ]);
4516
- if (fromFunctionDeclarations != null) {
4517
- let transformedList = fromFunctionDeclarations;
4518
- if (Array.isArray(transformedList)) {
4519
- transformedList = transformedList.map((item) => {
4520
- return item;
4521
- });
4522
- }
4523
- setValueByPath(toObject, ['functionDeclarations'], transformedList);
4524
- }
4525
4517
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4526
4518
  throw new Error('retrieval parameter is not supported in Gemini API.');
4527
4519
  }
4528
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4529
- 'googleSearchRetrieval',
4530
- ]);
4531
- if (fromGoogleSearchRetrieval != null) {
4532
- setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
4533
- }
4534
4520
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4535
4521
  if (fromComputerUse != null) {
4536
4522
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -4548,6 +4534,18 @@ function toolToMldev$4(fromObject) {
4548
4534
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4549
4535
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4550
4536
  }
4537
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
4538
+ 'functionDeclarations',
4539
+ ]);
4540
+ if (fromFunctionDeclarations != null) {
4541
+ let transformedList = fromFunctionDeclarations;
4542
+ if (Array.isArray(transformedList)) {
4543
+ transformedList = transformedList.map((item) => {
4544
+ return item;
4545
+ });
4546
+ }
4547
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
4548
+ }
4551
4549
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4552
4550
  if (fromGoogleMaps != null) {
4553
4551
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
@@ -4556,6 +4554,12 @@ function toolToMldev$4(fromObject) {
4556
4554
  if (fromGoogleSearch != null) {
4557
4555
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4558
4556
  }
4557
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4558
+ 'googleSearchRetrieval',
4559
+ ]);
4560
+ if (fromGoogleSearchRetrieval != null) {
4561
+ setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
4562
+ }
4559
4563
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4560
4564
  if (fromUrlContext != null) {
4561
4565
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
@@ -5486,16 +5490,16 @@ function functionCallToMldev$3(fromObject) {
5486
5490
  }
5487
5491
  function functionCallingConfigToMldev$1(fromObject) {
5488
5492
  const toObject = {};
5489
- const fromMode = getValueByPath(fromObject, ['mode']);
5490
- if (fromMode != null) {
5491
- setValueByPath(toObject, ['mode'], fromMode);
5492
- }
5493
5493
  const fromAllowedFunctionNames = getValueByPath(fromObject, [
5494
5494
  'allowedFunctionNames',
5495
5495
  ]);
5496
5496
  if (fromAllowedFunctionNames != null) {
5497
5497
  setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
5498
5498
  }
5499
+ const fromMode = getValueByPath(fromObject, ['mode']);
5500
+ if (fromMode != null) {
5501
+ setValueByPath(toObject, ['mode'], fromMode);
5502
+ }
5499
5503
  if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
5500
5504
  undefined) {
5501
5505
  throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
@@ -5504,9 +5508,6 @@ function functionCallingConfigToMldev$1(fromObject) {
5504
5508
  }
5505
5509
  function functionDeclarationToVertex$2(fromObject) {
5506
5510
  const toObject = {};
5507
- if (getValueByPath(fromObject, ['behavior']) !== undefined) {
5508
- throw new Error('behavior parameter is not supported in Vertex AI.');
5509
- }
5510
5511
  const fromDescription = getValueByPath(fromObject, ['description']);
5511
5512
  if (fromDescription != null) {
5512
5513
  setValueByPath(toObject, ['description'], fromDescription);
@@ -5535,6 +5536,9 @@ function functionDeclarationToVertex$2(fromObject) {
5535
5536
  if (fromResponseJsonSchema != null) {
5536
5537
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
5537
5538
  }
5539
+ if (getValueByPath(fromObject, ['behavior']) !== undefined) {
5540
+ throw new Error('behavior parameter is not supported in Vertex AI.');
5541
+ }
5538
5542
  return toObject;
5539
5543
  }
5540
5544
  function getCachedContentParametersToMldev(apiClient, fromObject) {
@@ -5738,43 +5742,25 @@ function partToMldev$3(fromObject) {
5738
5742
  }
5739
5743
  function toolConfigToMldev$1(fromObject) {
5740
5744
  const toObject = {};
5741
- const fromFunctionCallingConfig = getValueByPath(fromObject, [
5742
- 'functionCallingConfig',
5743
- ]);
5744
- if (fromFunctionCallingConfig != null) {
5745
- setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5746
- }
5747
5745
  const fromRetrievalConfig = getValueByPath(fromObject, [
5748
5746
  'retrievalConfig',
5749
5747
  ]);
5750
5748
  if (fromRetrievalConfig != null) {
5751
5749
  setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
5752
5750
  }
5751
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
5752
+ 'functionCallingConfig',
5753
+ ]);
5754
+ if (fromFunctionCallingConfig != null) {
5755
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
5756
+ }
5753
5757
  return toObject;
5754
5758
  }
5755
5759
  function toolToMldev$3(fromObject) {
5756
5760
  const toObject = {};
5757
- const fromFunctionDeclarations = getValueByPath(fromObject, [
5758
- 'functionDeclarations',
5759
- ]);
5760
- if (fromFunctionDeclarations != null) {
5761
- let transformedList = fromFunctionDeclarations;
5762
- if (Array.isArray(transformedList)) {
5763
- transformedList = transformedList.map((item) => {
5764
- return item;
5765
- });
5766
- }
5767
- setValueByPath(toObject, ['functionDeclarations'], transformedList);
5768
- }
5769
5761
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5770
5762
  throw new Error('retrieval parameter is not supported in Gemini API.');
5771
5763
  }
5772
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5773
- 'googleSearchRetrieval',
5774
- ]);
5775
- if (fromGoogleSearchRetrieval != null) {
5776
- setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5777
- }
5778
5764
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5779
5765
  if (fromComputerUse != null) {
5780
5766
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -5792,6 +5778,18 @@ function toolToMldev$3(fromObject) {
5792
5778
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5793
5779
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5794
5780
  }
5781
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
5782
+ 'functionDeclarations',
5783
+ ]);
5784
+ if (fromFunctionDeclarations != null) {
5785
+ let transformedList = fromFunctionDeclarations;
5786
+ if (Array.isArray(transformedList)) {
5787
+ transformedList = transformedList.map((item) => {
5788
+ return item;
5789
+ });
5790
+ }
5791
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
5792
+ }
5795
5793
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5796
5794
  if (fromGoogleMaps != null) {
5797
5795
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
@@ -5800,6 +5798,12 @@ function toolToMldev$3(fromObject) {
5800
5798
  if (fromGoogleSearch != null) {
5801
5799
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5802
5800
  }
5801
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5802
+ 'googleSearchRetrieval',
5803
+ ]);
5804
+ if (fromGoogleSearchRetrieval != null) {
5805
+ setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5806
+ }
5803
5807
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5804
5808
  if (fromUrlContext != null) {
5805
5809
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
@@ -5808,28 +5812,10 @@ function toolToMldev$3(fromObject) {
5808
5812
  }
5809
5813
  function toolToVertex$2(fromObject) {
5810
5814
  const toObject = {};
5811
- const fromFunctionDeclarations = getValueByPath(fromObject, [
5812
- 'functionDeclarations',
5813
- ]);
5814
- if (fromFunctionDeclarations != null) {
5815
- let transformedList = fromFunctionDeclarations;
5816
- if (Array.isArray(transformedList)) {
5817
- transformedList = transformedList.map((item) => {
5818
- return functionDeclarationToVertex$2(item);
5819
- });
5820
- }
5821
- setValueByPath(toObject, ['functionDeclarations'], transformedList);
5822
- }
5823
5815
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
5824
5816
  if (fromRetrieval != null) {
5825
5817
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
5826
5818
  }
5827
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5828
- 'googleSearchRetrieval',
5829
- ]);
5830
- if (fromGoogleSearchRetrieval != null) {
5831
- setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5832
- }
5833
5819
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5834
5820
  if (fromComputerUse != null) {
5835
5821
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -5849,6 +5835,18 @@ function toolToVertex$2(fromObject) {
5849
5835
  if (fromEnterpriseWebSearch != null) {
5850
5836
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
5851
5837
  }
5838
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
5839
+ 'functionDeclarations',
5840
+ ]);
5841
+ if (fromFunctionDeclarations != null) {
5842
+ let transformedList = fromFunctionDeclarations;
5843
+ if (Array.isArray(transformedList)) {
5844
+ transformedList = transformedList.map((item) => {
5845
+ return functionDeclarationToVertex$2(item);
5846
+ });
5847
+ }
5848
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
5849
+ }
5852
5850
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5853
5851
  if (fromGoogleMaps != null) {
5854
5852
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
@@ -5857,6 +5855,12 @@ function toolToVertex$2(fromObject) {
5857
5855
  if (fromGoogleSearch != null) {
5858
5856
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5859
5857
  }
5858
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5859
+ 'googleSearchRetrieval',
5860
+ ]);
5861
+ if (fromGoogleSearchRetrieval != null) {
5862
+ setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5863
+ }
5860
5864
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5861
5865
  if (fromUrlContext != null) {
5862
5866
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
@@ -7148,9 +7152,6 @@ function functionCallToMldev$2(fromObject) {
7148
7152
  }
7149
7153
  function functionDeclarationToVertex$1(fromObject) {
7150
7154
  const toObject = {};
7151
- if (getValueByPath(fromObject, ['behavior']) !== undefined) {
7152
- throw new Error('behavior parameter is not supported in Vertex AI.');
7153
- }
7154
7155
  const fromDescription = getValueByPath(fromObject, ['description']);
7155
7156
  if (fromDescription != null) {
7156
7157
  setValueByPath(toObject, ['description'], fromDescription);
@@ -7179,6 +7180,9 @@ function functionDeclarationToVertex$1(fromObject) {
7179
7180
  if (fromResponseJsonSchema != null) {
7180
7181
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
7181
7182
  }
7183
+ if (getValueByPath(fromObject, ['behavior']) !== undefined) {
7184
+ throw new Error('behavior parameter is not supported in Vertex AI.');
7185
+ }
7182
7186
  return toObject;
7183
7187
  }
7184
7188
  function generationConfigToVertex$1(fromObject) {
@@ -7277,7 +7281,7 @@ function generationConfigToVertex$1(fromObject) {
7277
7281
  }
7278
7282
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
7279
7283
  if (fromSpeechConfig != null) {
7280
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex$1(fromSpeechConfig));
7284
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
7281
7285
  }
7282
7286
  const fromStopSequences = getValueByPath(fromObject, [
7283
7287
  'stopSequences',
@@ -7493,7 +7497,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
7493
7497
  }
7494
7498
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
7495
7499
  if (parentObject !== undefined && fromSpeechConfig != null) {
7496
- setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToVertex$1(tLiveSpeechConfig(fromSpeechConfig)));
7500
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
7497
7501
  }
7498
7502
  const fromThinkingConfig = getValueByPath(fromObject, [
7499
7503
  'thinkingConfig',
@@ -7818,44 +7822,11 @@ function sessionResumptionConfigToMldev$1(fromObject) {
7818
7822
  }
7819
7823
  return toObject;
7820
7824
  }
7821
- function speechConfigToVertex$1(fromObject) {
7822
- const toObject = {};
7823
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
7824
- if (fromVoiceConfig != null) {
7825
- setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
7826
- }
7827
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7828
- if (fromLanguageCode != null) {
7829
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7830
- }
7831
- if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
7832
- throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
7833
- }
7834
- return toObject;
7835
- }
7836
7825
  function toolToMldev$2(fromObject) {
7837
7826
  const toObject = {};
7838
- const fromFunctionDeclarations = getValueByPath(fromObject, [
7839
- 'functionDeclarations',
7840
- ]);
7841
- if (fromFunctionDeclarations != null) {
7842
- let transformedList = fromFunctionDeclarations;
7843
- if (Array.isArray(transformedList)) {
7844
- transformedList = transformedList.map((item) => {
7845
- return item;
7846
- });
7847
- }
7848
- setValueByPath(toObject, ['functionDeclarations'], transformedList);
7849
- }
7850
7827
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
7851
7828
  throw new Error('retrieval parameter is not supported in Gemini API.');
7852
7829
  }
7853
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7854
- 'googleSearchRetrieval',
7855
- ]);
7856
- if (fromGoogleSearchRetrieval != null) {
7857
- setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7858
- }
7859
7830
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7860
7831
  if (fromComputerUse != null) {
7861
7832
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -7873,6 +7844,18 @@ function toolToMldev$2(fromObject) {
7873
7844
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7874
7845
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7875
7846
  }
7847
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
7848
+ 'functionDeclarations',
7849
+ ]);
7850
+ if (fromFunctionDeclarations != null) {
7851
+ let transformedList = fromFunctionDeclarations;
7852
+ if (Array.isArray(transformedList)) {
7853
+ transformedList = transformedList.map((item) => {
7854
+ return item;
7855
+ });
7856
+ }
7857
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
7858
+ }
7876
7859
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7877
7860
  if (fromGoogleMaps != null) {
7878
7861
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
@@ -7881,6 +7864,12 @@ function toolToMldev$2(fromObject) {
7881
7864
  if (fromGoogleSearch != null) {
7882
7865
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
7883
7866
  }
7867
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7868
+ 'googleSearchRetrieval',
7869
+ ]);
7870
+ if (fromGoogleSearchRetrieval != null) {
7871
+ setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7872
+ }
7884
7873
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7885
7874
  if (fromUrlContext != null) {
7886
7875
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
@@ -7889,28 +7878,10 @@ function toolToMldev$2(fromObject) {
7889
7878
  }
7890
7879
  function toolToVertex$1(fromObject) {
7891
7880
  const toObject = {};
7892
- const fromFunctionDeclarations = getValueByPath(fromObject, [
7893
- 'functionDeclarations',
7894
- ]);
7895
- if (fromFunctionDeclarations != null) {
7896
- let transformedList = fromFunctionDeclarations;
7897
- if (Array.isArray(transformedList)) {
7898
- transformedList = transformedList.map((item) => {
7899
- return functionDeclarationToVertex$1(item);
7900
- });
7901
- }
7902
- setValueByPath(toObject, ['functionDeclarations'], transformedList);
7903
- }
7904
7881
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
7905
7882
  if (fromRetrieval != null) {
7906
7883
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
7907
7884
  }
7908
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7909
- 'googleSearchRetrieval',
7910
- ]);
7911
- if (fromGoogleSearchRetrieval != null) {
7912
- setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7913
- }
7914
7885
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7915
7886
  if (fromComputerUse != null) {
7916
7887
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -7930,6 +7901,18 @@ function toolToVertex$1(fromObject) {
7930
7901
  if (fromEnterpriseWebSearch != null) {
7931
7902
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
7932
7903
  }
7904
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
7905
+ 'functionDeclarations',
7906
+ ]);
7907
+ if (fromFunctionDeclarations != null) {
7908
+ let transformedList = fromFunctionDeclarations;
7909
+ if (Array.isArray(transformedList)) {
7910
+ transformedList = transformedList.map((item) => {
7911
+ return functionDeclarationToVertex$1(item);
7912
+ });
7913
+ }
7914
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
7915
+ }
7933
7916
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7934
7917
  if (fromGoogleMaps != null) {
7935
7918
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
@@ -7938,6 +7921,12 @@ function toolToVertex$1(fromObject) {
7938
7921
  if (fromGoogleSearch != null) {
7939
7922
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
7940
7923
  }
7924
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7925
+ 'googleSearchRetrieval',
7926
+ ]);
7927
+ if (fromGoogleSearchRetrieval != null) {
7928
+ setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7929
+ }
7941
7930
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7942
7931
  if (fromUrlContext != null) {
7943
7932
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
@@ -8720,16 +8709,16 @@ function functionCallToMldev$1(fromObject) {
8720
8709
  }
8721
8710
  function functionCallingConfigToMldev(fromObject) {
8722
8711
  const toObject = {};
8723
- const fromMode = getValueByPath(fromObject, ['mode']);
8724
- if (fromMode != null) {
8725
- setValueByPath(toObject, ['mode'], fromMode);
8726
- }
8727
8712
  const fromAllowedFunctionNames = getValueByPath(fromObject, [
8728
8713
  'allowedFunctionNames',
8729
8714
  ]);
8730
8715
  if (fromAllowedFunctionNames != null) {
8731
8716
  setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
8732
8717
  }
8718
+ const fromMode = getValueByPath(fromObject, ['mode']);
8719
+ if (fromMode != null) {
8720
+ setValueByPath(toObject, ['mode'], fromMode);
8721
+ }
8733
8722
  if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
8734
8723
  undefined) {
8735
8724
  throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
@@ -8738,9 +8727,6 @@ function functionCallingConfigToMldev(fromObject) {
8738
8727
  }
8739
8728
  function functionDeclarationToVertex(fromObject) {
8740
8729
  const toObject = {};
8741
- if (getValueByPath(fromObject, ['behavior']) !== undefined) {
8742
- throw new Error('behavior parameter is not supported in Vertex AI.');
8743
- }
8744
8730
  const fromDescription = getValueByPath(fromObject, ['description']);
8745
8731
  if (fromDescription != null) {
8746
8732
  setValueByPath(toObject, ['description'], fromDescription);
@@ -8769,6 +8755,9 @@ function functionDeclarationToVertex(fromObject) {
8769
8755
  if (fromResponseJsonSchema != null) {
8770
8756
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
8771
8757
  }
8758
+ if (getValueByPath(fromObject, ['behavior']) !== undefined) {
8759
+ throw new Error('behavior parameter is not supported in Vertex AI.');
8760
+ }
8772
8761
  return toObject;
8773
8762
  }
8774
8763
  function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
@@ -9075,7 +9064,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
9075
9064
  }
9076
9065
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
9077
9066
  if (fromSpeechConfig != null) {
9078
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(tSpeechConfig(fromSpeechConfig)));
9067
+ setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
9079
9068
  }
9080
9069
  const fromAudioTimestamp = getValueByPath(fromObject, [
9081
9070
  'audioTimestamp',
@@ -10021,7 +10010,7 @@ function generationConfigToVertex(fromObject) {
10021
10010
  }
10022
10011
  const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
10023
10012
  if (fromSpeechConfig != null) {
10024
- setValueByPath(toObject, ['speechConfig'], speechConfigToVertex(fromSpeechConfig));
10013
+ setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
10025
10014
  }
10026
10015
  const fromStopSequences = getValueByPath(fromObject, [
10027
10016
  'stopSequences',
@@ -10106,6 +10095,9 @@ function imageConfigToMldev(fromObject) {
10106
10095
  if (fromImageSize != null) {
10107
10096
  setValueByPath(toObject, ['imageSize'], fromImageSize);
10108
10097
  }
10098
+ if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
10099
+ throw new Error('personGeneration parameter is not supported in Gemini API.');
10100
+ }
10109
10101
  if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
10110
10102
  throw new Error('outputMimeType parameter is not supported in Gemini API.');
10111
10103
  }
@@ -10125,6 +10117,12 @@ function imageConfigToVertex(fromObject) {
10125
10117
  if (fromImageSize != null) {
10126
10118
  setValueByPath(toObject, ['imageSize'], fromImageSize);
10127
10119
  }
10120
+ const fromPersonGeneration = getValueByPath(fromObject, [
10121
+ 'personGeneration',
10122
+ ]);
10123
+ if (fromPersonGeneration != null) {
10124
+ setValueByPath(toObject, ['personGeneration'], fromPersonGeneration);
10125
+ }
10128
10126
  const fromOutputMimeType = getValueByPath(fromObject, [
10129
10127
  'outputMimeType',
10130
10128
  ]);
@@ -10823,60 +10821,27 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
10823
10821
  }
10824
10822
  return toObject;
10825
10823
  }
10826
- function speechConfigToVertex(fromObject) {
10827
- const toObject = {};
10828
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
10829
- if (fromVoiceConfig != null) {
10830
- setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
10831
- }
10832
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10833
- if (fromLanguageCode != null) {
10834
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10835
- }
10836
- if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
10837
- throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
10838
- }
10839
- return toObject;
10840
- }
10841
10824
  function toolConfigToMldev(fromObject) {
10842
10825
  const toObject = {};
10843
- const fromFunctionCallingConfig = getValueByPath(fromObject, [
10844
- 'functionCallingConfig',
10845
- ]);
10846
- if (fromFunctionCallingConfig != null) {
10847
- setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
10848
- }
10849
10826
  const fromRetrievalConfig = getValueByPath(fromObject, [
10850
10827
  'retrievalConfig',
10851
10828
  ]);
10852
10829
  if (fromRetrievalConfig != null) {
10853
10830
  setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
10854
10831
  }
10832
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
10833
+ 'functionCallingConfig',
10834
+ ]);
10835
+ if (fromFunctionCallingConfig != null) {
10836
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
10837
+ }
10855
10838
  return toObject;
10856
10839
  }
10857
10840
  function toolToMldev$1(fromObject) {
10858
10841
  const toObject = {};
10859
- const fromFunctionDeclarations = getValueByPath(fromObject, [
10860
- 'functionDeclarations',
10861
- ]);
10862
- if (fromFunctionDeclarations != null) {
10863
- let transformedList = fromFunctionDeclarations;
10864
- if (Array.isArray(transformedList)) {
10865
- transformedList = transformedList.map((item) => {
10866
- return item;
10867
- });
10868
- }
10869
- setValueByPath(toObject, ['functionDeclarations'], transformedList);
10870
- }
10871
10842
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
10872
10843
  throw new Error('retrieval parameter is not supported in Gemini API.');
10873
10844
  }
10874
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10875
- 'googleSearchRetrieval',
10876
- ]);
10877
- if (fromGoogleSearchRetrieval != null) {
10878
- setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10879
- }
10880
10845
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10881
10846
  if (fromComputerUse != null) {
10882
10847
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -10894,6 +10859,18 @@ function toolToMldev$1(fromObject) {
10894
10859
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10895
10860
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10896
10861
  }
10862
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
10863
+ 'functionDeclarations',
10864
+ ]);
10865
+ if (fromFunctionDeclarations != null) {
10866
+ let transformedList = fromFunctionDeclarations;
10867
+ if (Array.isArray(transformedList)) {
10868
+ transformedList = transformedList.map((item) => {
10869
+ return item;
10870
+ });
10871
+ }
10872
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
10873
+ }
10897
10874
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10898
10875
  if (fromGoogleMaps != null) {
10899
10876
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
@@ -10902,6 +10879,12 @@ function toolToMldev$1(fromObject) {
10902
10879
  if (fromGoogleSearch != null) {
10903
10880
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10904
10881
  }
10882
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10883
+ 'googleSearchRetrieval',
10884
+ ]);
10885
+ if (fromGoogleSearchRetrieval != null) {
10886
+ setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10887
+ }
10905
10888
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10906
10889
  if (fromUrlContext != null) {
10907
10890
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
@@ -10910,28 +10893,10 @@ function toolToMldev$1(fromObject) {
10910
10893
  }
10911
10894
  function toolToVertex(fromObject) {
10912
10895
  const toObject = {};
10913
- const fromFunctionDeclarations = getValueByPath(fromObject, [
10914
- 'functionDeclarations',
10915
- ]);
10916
- if (fromFunctionDeclarations != null) {
10917
- let transformedList = fromFunctionDeclarations;
10918
- if (Array.isArray(transformedList)) {
10919
- transformedList = transformedList.map((item) => {
10920
- return functionDeclarationToVertex(item);
10921
- });
10922
- }
10923
- setValueByPath(toObject, ['functionDeclarations'], transformedList);
10924
- }
10925
10896
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
10926
10897
  if (fromRetrieval != null) {
10927
10898
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
10928
10899
  }
10929
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10930
- 'googleSearchRetrieval',
10931
- ]);
10932
- if (fromGoogleSearchRetrieval != null) {
10933
- setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10934
- }
10935
10900
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10936
10901
  if (fromComputerUse != null) {
10937
10902
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -10951,6 +10916,18 @@ function toolToVertex(fromObject) {
10951
10916
  if (fromEnterpriseWebSearch != null) {
10952
10917
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
10953
10918
  }
10919
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
10920
+ 'functionDeclarations',
10921
+ ]);
10922
+ if (fromFunctionDeclarations != null) {
10923
+ let transformedList = fromFunctionDeclarations;
10924
+ if (Array.isArray(transformedList)) {
10925
+ transformedList = transformedList.map((item) => {
10926
+ return functionDeclarationToVertex(item);
10927
+ });
10928
+ }
10929
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
10930
+ }
10954
10931
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10955
10932
  if (fromGoogleMaps != null) {
10956
10933
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
@@ -10959,6 +10936,12 @@ function toolToVertex(fromObject) {
10959
10936
  if (fromGoogleSearch != null) {
10960
10937
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10961
10938
  }
10939
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10940
+ 'googleSearchRetrieval',
10941
+ ]);
10942
+ if (fromGoogleSearchRetrieval != null) {
10943
+ setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10944
+ }
10962
10945
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10963
10946
  if (fromUrlContext != null) {
10964
10947
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
@@ -11519,7 +11502,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
11519
11502
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
11520
11503
  const USER_AGENT_HEADER = 'User-Agent';
11521
11504
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
11522
- const SDK_VERSION = '1.33.0'; // x-release-please-version
11505
+ const SDK_VERSION = '1.35.0'; // x-release-please-version
11523
11506
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
11524
11507
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
11525
11508
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -11593,6 +11576,11 @@ class ApiClient {
11593
11576
  getLocation() {
11594
11577
  return this.clientOptions.location;
11595
11578
  }
11579
+ async getAuthHeaders() {
11580
+ const headers = new Headers();
11581
+ await this.clientOptions.auth.addAuthHeaders(headers);
11582
+ return headers;
11583
+ }
11596
11584
  getApiVersion() {
11597
11585
  if (this.clientOptions.httpOptions &&
11598
11586
  this.clientOptions.httpOptions.apiVersion !== undefined) {
@@ -13228,7 +13216,7 @@ class Models extends BaseModule {
13228
13216
  * @example
13229
13217
  * ```ts
13230
13218
  * const response = await client.models.generateImages({
13231
- * model: 'imagen-3.0-generate-002',
13219
+ * model: 'imagen-4.0-generate-001',
13232
13220
  * prompt: 'Robot holding a red skateboard',
13233
13221
  * config: {
13234
13222
  * numberOfImages: 1,
@@ -13337,7 +13325,7 @@ class Models extends BaseModule {
13337
13325
  * @example
13338
13326
  * ```ts
13339
13327
  * const response = await client.models.upscaleImage({
13340
- * model: 'imagen-3.0-generate-002',
13328
+ * model: 'imagen-4.0-upscale-preview',
13341
13329
  * image: image,
13342
13330
  * upscaleFactor: 'x2',
13343
13331
  * config: {
@@ -13999,7 +13987,7 @@ class Models extends BaseModule {
13999
13987
  * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
14000
13988
  *
14001
13989
  * const response2 = await ai.models.recontextImage({
14002
- * model: 'virtual-try-on-preview-08-04',
13990
+ * model: 'virtual-try-on-001',
14003
13991
  * source: {
14004
13992
  * personImage: personImage,
14005
13993
  * productImages: [productImage],
@@ -15081,27 +15069,9 @@ function sessionResumptionConfigToMldev(fromObject) {
15081
15069
  }
15082
15070
  function toolToMldev(fromObject) {
15083
15071
  const toObject = {};
15084
- const fromFunctionDeclarations = getValueByPath(fromObject, [
15085
- 'functionDeclarations',
15086
- ]);
15087
- if (fromFunctionDeclarations != null) {
15088
- let transformedList = fromFunctionDeclarations;
15089
- if (Array.isArray(transformedList)) {
15090
- transformedList = transformedList.map((item) => {
15091
- return item;
15092
- });
15093
- }
15094
- setValueByPath(toObject, ['functionDeclarations'], transformedList);
15095
- }
15096
15072
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
15097
15073
  throw new Error('retrieval parameter is not supported in Gemini API.');
15098
15074
  }
15099
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
15100
- 'googleSearchRetrieval',
15101
- ]);
15102
- if (fromGoogleSearchRetrieval != null) {
15103
- setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
15104
- }
15105
15075
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
15106
15076
  if (fromComputerUse != null) {
15107
15077
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -15119,6 +15089,18 @@ function toolToMldev(fromObject) {
15119
15089
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
15120
15090
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
15121
15091
  }
15092
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
15093
+ 'functionDeclarations',
15094
+ ]);
15095
+ if (fromFunctionDeclarations != null) {
15096
+ let transformedList = fromFunctionDeclarations;
15097
+ if (Array.isArray(transformedList)) {
15098
+ transformedList = transformedList.map((item) => {
15099
+ return item;
15100
+ });
15101
+ }
15102
+ setValueByPath(toObject, ['functionDeclarations'], transformedList);
15103
+ }
15122
15104
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
15123
15105
  if (fromGoogleMaps != null) {
15124
15106
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
@@ -15127,6 +15109,12 @@ function toolToMldev(fromObject) {
15127
15109
  if (fromGoogleSearch != null) {
15128
15110
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
15129
15111
  }
15112
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
15113
+ 'googleSearchRetrieval',
15114
+ ]);
15115
+ if (fromGoogleSearchRetrieval != null) {
15116
+ setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
15117
+ }
15130
15118
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
15131
15119
  if (fromUrlContext != null) {
15132
15120
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
@@ -17465,7 +17453,7 @@ class BaseGeminiNextGenAPIClient {
17465
17453
  */
17466
17454
  constructor(_b) {
17467
17455
  var _c, _d, _e, _f, _g, _h, _j;
17468
- var _k = _b === void 0 ? {} : _b, { baseURL = readEnv('GEMINI_NEXT_GEN_API_BASE_URL'), apiKey = (_c = readEnv('GEMINI_API_KEY')) !== null && _c !== void 0 ? _c : null, apiVersion = 'v1beta' } = _k, opts = __rest(_k, ["baseURL", "apiKey", "apiVersion"]);
17456
+ var { baseURL = readEnv('GEMINI_NEXT_GEN_API_BASE_URL'), apiKey = (_c = readEnv('GEMINI_API_KEY')) !== null && _c !== void 0 ? _c : null, apiVersion = 'v1beta' } = _b, opts = __rest(_b, ["baseURL", "apiKey", "apiVersion"]);
17469
17457
  const options = Object.assign(Object.assign({ apiKey,
17470
17458
  apiVersion }, opts), { baseURL: baseURL || `https://generativelanguage.googleapis.com` });
17471
17459
  this.baseURL = options.baseURL;
@@ -17483,6 +17471,7 @@ class BaseGeminiNextGenAPIClient {
17483
17471
  this._options = options;
17484
17472
  this.apiKey = apiKey;
17485
17473
  this.apiVersion = apiVersion;
17474
+ this.clientAdapter = options.clientAdapter;
17486
17475
  }
17487
17476
  /**
17488
17477
  * Create a new client instance re-using the same options given to the current client with optional overriding.
@@ -17501,6 +17490,10 @@ class BaseGeminiNextGenAPIClient {
17501
17490
  return this._options.defaultQuery;
17502
17491
  }
17503
17492
  validateHeaders({ values, nulls }) {
17493
+ // The headers object handles case insensitivity.
17494
+ if (values.has('authorization') || values.has('x-goog-api-key')) {
17495
+ return;
17496
+ }
17504
17497
  if (this.apiKey && values.get('x-goog-api-key')) {
17505
17498
  return;
17506
17499
  }
@@ -17510,10 +17503,17 @@ class BaseGeminiNextGenAPIClient {
17510
17503
  throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted');
17511
17504
  }
17512
17505
  async authHeaders(opts) {
17513
- if (this.apiKey == null) {
17506
+ const existingHeaders = buildHeaders([opts.headers]);
17507
+ if (existingHeaders.values.has('authorization') || existingHeaders.values.has('x-goog-api-key')) {
17514
17508
  return undefined;
17515
17509
  }
17516
- return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
17510
+ if (this.apiKey) {
17511
+ return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
17512
+ }
17513
+ if (this.clientAdapter.isVertexAI()) {
17514
+ return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
17515
+ }
17516
+ return undefined;
17517
17517
  }
17518
17518
  /**
17519
17519
  * Basic re-implementation of `qs.stringify` for primitive types.
@@ -17557,8 +17557,16 @@ class BaseGeminiNextGenAPIClient {
17557
17557
  }
17558
17558
  /**
17559
17559
  * Used as a callback for mutating the given `FinalRequestOptions` object.
17560
+
17560
17561
  */
17561
- async prepareOptions(options) { }
17562
+ async prepareOptions(options) {
17563
+ if (this.clientAdapter &&
17564
+ this.clientAdapter.isVertexAI() &&
17565
+ !options.path.startsWith(`/${this.apiVersion}/projects/`)) {
17566
+ const oldPath = options.path.slice(this.apiVersion.length + 1);
17567
+ options.path = `/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${oldPath}`;
17568
+ }
17569
+ }
17562
17570
  /**
17563
17571
  * Used as a callback for mutating the given `RequestInit` object.
17564
17572
  *
@@ -17800,13 +17808,14 @@ class BaseGeminiNextGenAPIClient {
17800
17808
  options.idempotencyKey = this.defaultIdempotencyKey();
17801
17809
  idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
17802
17810
  }
17803
- const headers = buildHeaders([
17811
+ const authHeaders = await this.authHeaders(options);
17812
+ let headers = buildHeaders([
17804
17813
  idempotencyHeaders,
17805
17814
  Object.assign(Object.assign({ Accept: 'application/json', 'User-Agent': this.getUserAgent(), 'X-Stainless-Retry-Count': String(retryCount) }, (options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {})), getPlatformHeaders()),
17806
- await this.authHeaders(options),
17807
17815
  this._options.defaultHeaders,
17808
17816
  bodyHeaders,
17809
17817
  options.headers,
17818
+ authHeaders,
17810
17819
  ]);
17811
17820
  this.validateHeaders(headers);
17812
17821
  return headers.values;
@@ -19472,9 +19481,6 @@ class GoogleGenAI {
19472
19481
  return this._interactions;
19473
19482
  }
19474
19483
  console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
19475
- if (this.vertexai) {
19476
- throw new Error('This version of the GenAI SDK does not support Vertex AI API for interactions.');
19477
- }
19478
19484
  const httpOpts = this.httpOptions;
19479
19485
  // Unsupported Options Warnings
19480
19486
  if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {
@@ -19483,6 +19489,8 @@ class GoogleGenAI {
19483
19489
  const nextGenClient = new GeminiNextGenAPIClient({
19484
19490
  baseURL: this.apiClient.getBaseUrl(),
19485
19491
  apiKey: this.apiKey,
19492
+ apiVersion: this.apiClient.getApiVersion(),
19493
+ clientAdapter: this.apiClient,
19486
19494
  defaultHeaders: this.apiClient.getDefaultHeaders(),
19487
19495
  timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
19488
19496
  });