@google/genai 2.0.1 → 2.2.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.
@@ -818,11 +818,11 @@ exports.PhishBlockThreshold = void 0;
818
818
  */
819
819
  PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
820
820
  })(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
821
- /** Specifies the function Behavior. Currently only supported by the BidiGenerateContent method. This enum is not supported in Vertex AI. */
821
+ /** Specifies the function Behavior. Currently only non-blocking functions are supported. If not specified, the system keeps the current function call behavior. This field is currently only supported by the BidiGenerateContent method. */
822
822
  exports.Behavior = void 0;
823
823
  (function (Behavior) {
824
824
  /**
825
- * This value is unused.
825
+ * This value is unspecified.
826
826
  */
827
827
  Behavior["UNSPECIFIED"] = "UNSPECIFIED";
828
828
  /**
@@ -3797,23 +3797,23 @@ function authConfigToMldev$4(fromObject) {
3797
3797
  setValueByPath(toObject, ['apiKey'], fromApiKey);
3798
3798
  }
3799
3799
  if (getValueByPath(fromObject, ['apiKeyConfig']) !== undefined) {
3800
- throw new Error('apiKeyConfig parameter is not supported in Gemini API.');
3800
+ throw new Error('apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
3801
3801
  }
3802
3802
  if (getValueByPath(fromObject, ['authType']) !== undefined) {
3803
- throw new Error('authType parameter is not supported in Gemini API.');
3803
+ throw new Error('authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
3804
3804
  }
3805
3805
  if (getValueByPath(fromObject, ['googleServiceAccountConfig']) !==
3806
3806
  undefined) {
3807
- throw new Error('googleServiceAccountConfig parameter is not supported in Gemini API.');
3807
+ throw new Error('googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
3808
3808
  }
3809
3809
  if (getValueByPath(fromObject, ['httpBasicAuthConfig']) !== undefined) {
3810
- throw new Error('httpBasicAuthConfig parameter is not supported in Gemini API.');
3810
+ throw new Error('httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
3811
3811
  }
3812
3812
  if (getValueByPath(fromObject, ['oauthConfig']) !== undefined) {
3813
- throw new Error('oauthConfig parameter is not supported in Gemini API.');
3813
+ throw new Error('oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
3814
3814
  }
3815
3815
  if (getValueByPath(fromObject, ['oidcConfig']) !== undefined) {
3816
- throw new Error('oidcConfig parameter is not supported in Gemini API.');
3816
+ throw new Error('oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
3817
3817
  }
3818
3818
  return toObject;
3819
3819
  }
@@ -3894,14 +3894,14 @@ function batchJobDestinationToVertex(fromObject) {
3894
3894
  setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryUri);
3895
3895
  }
3896
3896
  if (getValueByPath(fromObject, ['fileName']) !== undefined) {
3897
- throw new Error('fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3897
+ throw new Error('fileName parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
3898
3898
  }
3899
3899
  if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
3900
- throw new Error('inlinedResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3900
+ throw new Error('inlinedResponses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
3901
3901
  }
3902
3902
  if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
3903
3903
  undefined) {
3904
- throw new Error('inlinedEmbedContentResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3904
+ throw new Error('inlinedEmbedContentResponses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
3905
3905
  }
3906
3906
  const fromVertexDataset = getValueByPath(fromObject, [
3907
3907
  'vertexDataset',
@@ -4046,13 +4046,13 @@ function batchJobSourceFromVertex(fromObject) {
4046
4046
  function batchJobSourceToMldev(apiClient, fromObject) {
4047
4047
  const toObject = {};
4048
4048
  if (getValueByPath(fromObject, ['format']) !== undefined) {
4049
- throw new Error('format parameter is not supported in Gemini API.');
4049
+ throw new Error('format parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4050
4050
  }
4051
4051
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
4052
- throw new Error('gcsUri parameter is not supported in Gemini API.');
4052
+ throw new Error('gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4053
4053
  }
4054
4054
  if (getValueByPath(fromObject, ['bigqueryUri']) !== undefined) {
4055
- throw new Error('bigqueryUri parameter is not supported in Gemini API.');
4055
+ throw new Error('bigqueryUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4056
4056
  }
4057
4057
  const fromFileName = getValueByPath(fromObject, ['fileName']);
4058
4058
  if (fromFileName != null) {
@@ -4071,7 +4071,7 @@ function batchJobSourceToMldev(apiClient, fromObject) {
4071
4071
  setValueByPath(toObject, ['requests', 'requests'], transformedList);
4072
4072
  }
4073
4073
  if (getValueByPath(fromObject, ['vertexDatasetName']) !== undefined) {
4074
- throw new Error('vertexDatasetName parameter is not supported in Gemini API.');
4074
+ throw new Error('vertexDatasetName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4075
4075
  }
4076
4076
  return toObject;
4077
4077
  }
@@ -4090,10 +4090,10 @@ function batchJobSourceToVertex(fromObject) {
4090
4090
  setValueByPath(toObject, ['bigquerySource', 'inputUri'], fromBigqueryUri);
4091
4091
  }
4092
4092
  if (getValueByPath(fromObject, ['fileName']) !== undefined) {
4093
- throw new Error('fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
4093
+ throw new Error('fileName parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
4094
4094
  }
4095
4095
  if (getValueByPath(fromObject, ['inlinedRequests']) !== undefined) {
4096
- throw new Error('inlinedRequests parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
4096
+ throw new Error('inlinedRequests parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
4097
4097
  }
4098
4098
  const fromVertexDatasetName = getValueByPath(fromObject, [
4099
4099
  'vertexDatasetName',
@@ -4110,7 +4110,7 @@ function blobToMldev$4(fromObject) {
4110
4110
  setValueByPath(toObject, ['data'], fromData);
4111
4111
  }
4112
4112
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
4113
- throw new Error('displayName parameter is not supported in Gemini API.');
4113
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4114
4114
  }
4115
4115
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
4116
4116
  if (fromMimeType != null) {
@@ -4233,7 +4233,7 @@ function createBatchJobConfigToMldev(fromObject, parentObject) {
4233
4233
  setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
4234
4234
  }
4235
4235
  if (getValueByPath(fromObject, ['dest']) !== undefined) {
4236
- throw new Error('dest parameter is not supported in Gemini API.');
4236
+ throw new Error('dest parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4237
4237
  }
4238
4238
  const fromWebhookConfig = getValueByPath(fromObject, [
4239
4239
  'webhookConfig',
@@ -4254,7 +4254,7 @@ function createBatchJobConfigToVertex(fromObject, parentObject) {
4254
4254
  setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
4255
4255
  }
4256
4256
  if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
4257
- throw new Error('webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
4257
+ throw new Error('webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
4258
4258
  }
4259
4259
  return toObject;
4260
4260
  }
@@ -4410,16 +4410,16 @@ function embedContentConfigToMldev$1(fromObject, parentObject) {
4410
4410
  setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
4411
4411
  }
4412
4412
  if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
4413
- throw new Error('mimeType parameter is not supported in Gemini API.');
4413
+ throw new Error('mimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4414
4414
  }
4415
4415
  if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
4416
- throw new Error('autoTruncate parameter is not supported in Gemini API.');
4416
+ throw new Error('autoTruncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4417
4417
  }
4418
4418
  if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
4419
- throw new Error('documentOcr parameter is not supported in Gemini API.');
4419
+ throw new Error('documentOcr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4420
4420
  }
4421
4421
  if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
4422
- throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
4422
+ throw new Error('audioTrackExtraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4423
4423
  }
4424
4424
  return toObject;
4425
4425
  }
@@ -4440,7 +4440,7 @@ function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
4440
4440
  function fileDataToMldev$4(fromObject) {
4441
4441
  const toObject = {};
4442
4442
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
4443
- throw new Error('displayName parameter is not supported in Gemini API.');
4443
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4444
4444
  }
4445
4445
  const fromFileUri = getValueByPath(fromObject, ['fileUri']);
4446
4446
  if (fromFileUri != null) {
@@ -4467,10 +4467,10 @@ function functionCallToMldev$4(fromObject) {
4467
4467
  setValueByPath(toObject, ['name'], fromName);
4468
4468
  }
4469
4469
  if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
4470
- throw new Error('partialArgs parameter is not supported in Gemini API.');
4470
+ throw new Error('partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4471
4471
  }
4472
4472
  if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
4473
- throw new Error('willContinue parameter is not supported in Gemini API.');
4473
+ throw new Error('willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4474
4474
  }
4475
4475
  return toObject;
4476
4476
  }
@@ -4488,7 +4488,7 @@ function functionCallingConfigToMldev$2(fromObject) {
4488
4488
  }
4489
4489
  if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
4490
4490
  undefined) {
4491
- throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
4491
+ throw new Error('streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4492
4492
  }
4493
4493
  return toObject;
4494
4494
  }
@@ -4575,10 +4575,10 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4575
4575
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
4576
4576
  }
4577
4577
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
4578
- throw new Error('routingConfig parameter is not supported in Gemini API.');
4578
+ throw new Error('routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4579
4579
  }
4580
4580
  if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
4581
- throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
4581
+ throw new Error('modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4582
4582
  }
4583
4583
  const fromSafetySettings = getValueByPath(fromObject, [
4584
4584
  'safetySettings',
@@ -4607,7 +4607,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4607
4607
  setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
4608
4608
  }
4609
4609
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
4610
- throw new Error('labels parameter is not supported in Gemini API.');
4610
+ throw new Error('labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4611
4611
  }
4612
4612
  const fromCachedContent = getValueByPath(fromObject, [
4613
4613
  'cachedContent',
@@ -4632,7 +4632,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4632
4632
  setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
4633
4633
  }
4634
4634
  if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
4635
- throw new Error('audioTimestamp parameter is not supported in Gemini API.');
4635
+ throw new Error('audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4636
4636
  }
4637
4637
  const fromThinkingConfig = getValueByPath(fromObject, [
4638
4638
  'thinkingConfig',
@@ -4651,7 +4651,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
4651
4651
  setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
4652
4652
  }
4653
4653
  if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
4654
- throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
4654
+ throw new Error('modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4655
4655
  }
4656
4656
  const fromServiceTier = getValueByPath(fromObject, ['serviceTier']);
4657
4657
  if (parentObject !== undefined && fromServiceTier != null) {
@@ -4738,10 +4738,10 @@ function googleSearchToMldev$4(fromObject) {
4738
4738
  setValueByPath(toObject, ['searchTypes'], fromSearchTypes);
4739
4739
  }
4740
4740
  if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
4741
- throw new Error('blockingConfidence parameter is not supported in Gemini API.');
4741
+ throw new Error('blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4742
4742
  }
4743
4743
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4744
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
4744
+ throw new Error('excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4745
4745
  }
4746
4746
  const fromTimeRangeFilter = getValueByPath(fromObject, [
4747
4747
  'timeRangeFilter',
@@ -4762,20 +4762,20 @@ function imageConfigToMldev$1(fromObject) {
4762
4762
  setValueByPath(toObject, ['imageSize'], fromImageSize);
4763
4763
  }
4764
4764
  if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
4765
- throw new Error('personGeneration parameter is not supported in Gemini API.');
4765
+ throw new Error('personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4766
4766
  }
4767
4767
  if (getValueByPath(fromObject, ['prominentPeople']) !== undefined) {
4768
- throw new Error('prominentPeople parameter is not supported in Gemini API.');
4768
+ throw new Error('prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4769
4769
  }
4770
4770
  if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
4771
- throw new Error('outputMimeType parameter is not supported in Gemini API.');
4771
+ throw new Error('outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4772
4772
  }
4773
4773
  if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
4774
4774
  undefined) {
4775
- throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
4775
+ throw new Error('outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4776
4776
  }
4777
4777
  if (getValueByPath(fromObject, ['imageOutputOptions']) !== undefined) {
4778
- throw new Error('imageOutputOptions parameter is not supported in Gemini API.');
4778
+ throw new Error('imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4779
4779
  }
4780
4780
  return toObject;
4781
4781
  }
@@ -4832,7 +4832,7 @@ function listBatchJobsConfigToMldev(fromObject, parentObject) {
4832
4832
  setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
4833
4833
  }
4834
4834
  if (getValueByPath(fromObject, ['filter']) !== undefined) {
4835
- throw new Error('filter parameter is not supported in Gemini API.');
4835
+ throw new Error('filter parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
4836
4836
  }
4837
4837
  return toObject;
4838
4838
  }
@@ -5001,7 +5001,7 @@ function safetySettingToMldev$3(fromObject) {
5001
5001
  setValueByPath(toObject, ['category'], fromCategory);
5002
5002
  }
5003
5003
  if (getValueByPath(fromObject, ['method']) !== undefined) {
5004
- throw new Error('method parameter is not supported in Gemini API.');
5004
+ throw new Error('method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5005
5005
  }
5006
5006
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
5007
5007
  if (fromThreshold != null) {
@@ -5032,7 +5032,7 @@ function toolConfigToMldev$2(fromObject) {
5032
5032
  function toolToMldev$4(fromObject) {
5033
5033
  const toObject = {};
5034
5034
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5035
- throw new Error('retrieval parameter is not supported in Gemini API.');
5035
+ throw new Error('retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5036
5036
  }
5037
5037
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5038
5038
  if (fromComputerUse != null) {
@@ -5057,7 +5057,7 @@ function toolToMldev$4(fromObject) {
5057
5057
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5058
5058
  }
5059
5059
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5060
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5060
+ throw new Error('enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5061
5061
  }
5062
5062
  const fromFunctionDeclarations = getValueByPath(fromObject, [
5063
5063
  'functionDeclarations',
@@ -5078,7 +5078,7 @@ function toolToMldev$4(fromObject) {
5078
5078
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5079
5079
  }
5080
5080
  if (getValueByPath(fromObject, ['parallelAiSearch']) !== undefined) {
5081
- throw new Error('parallelAiSearch parameter is not supported in Gemini API.');
5081
+ throw new Error('parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5082
5082
  }
5083
5083
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5084
5084
  if (fromUrlContext != null) {
@@ -5825,23 +5825,23 @@ function authConfigToMldev$3(fromObject) {
5825
5825
  setValueByPath(toObject, ['apiKey'], fromApiKey);
5826
5826
  }
5827
5827
  if (getValueByPath(fromObject, ['apiKeyConfig']) !== undefined) {
5828
- throw new Error('apiKeyConfig parameter is not supported in Gemini API.');
5828
+ throw new Error('apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5829
5829
  }
5830
5830
  if (getValueByPath(fromObject, ['authType']) !== undefined) {
5831
- throw new Error('authType parameter is not supported in Gemini API.');
5831
+ throw new Error('authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5832
5832
  }
5833
5833
  if (getValueByPath(fromObject, ['googleServiceAccountConfig']) !==
5834
5834
  undefined) {
5835
- throw new Error('googleServiceAccountConfig parameter is not supported in Gemini API.');
5835
+ throw new Error('googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5836
5836
  }
5837
5837
  if (getValueByPath(fromObject, ['httpBasicAuthConfig']) !== undefined) {
5838
- throw new Error('httpBasicAuthConfig parameter is not supported in Gemini API.');
5838
+ throw new Error('httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5839
5839
  }
5840
5840
  if (getValueByPath(fromObject, ['oauthConfig']) !== undefined) {
5841
- throw new Error('oauthConfig parameter is not supported in Gemini API.');
5841
+ throw new Error('oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5842
5842
  }
5843
5843
  if (getValueByPath(fromObject, ['oidcConfig']) !== undefined) {
5844
- throw new Error('oidcConfig parameter is not supported in Gemini API.');
5844
+ throw new Error('oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5845
5845
  }
5846
5846
  return toObject;
5847
5847
  }
@@ -5852,7 +5852,7 @@ function blobToMldev$3(fromObject) {
5852
5852
  setValueByPath(toObject, ['data'], fromData);
5853
5853
  }
5854
5854
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
5855
- throw new Error('displayName parameter is not supported in Gemini API.');
5855
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5856
5856
  }
5857
5857
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5858
5858
  if (fromMimeType != null) {
@@ -5941,7 +5941,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
5941
5941
  setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
5942
5942
  }
5943
5943
  if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
5944
- throw new Error('kmsKeyName parameter is not supported in Gemini API.');
5944
+ throw new Error('kmsKeyName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
5945
5945
  }
5946
5946
  return toObject;
5947
5947
  }
@@ -6058,7 +6058,7 @@ function deleteCachedContentResponseFromVertex(fromObject) {
6058
6058
  function fileDataToMldev$3(fromObject) {
6059
6059
  const toObject = {};
6060
6060
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
6061
- throw new Error('displayName parameter is not supported in Gemini API.');
6061
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6062
6062
  }
6063
6063
  const fromFileUri = getValueByPath(fromObject, ['fileUri']);
6064
6064
  if (fromFileUri != null) {
@@ -6085,10 +6085,10 @@ function functionCallToMldev$3(fromObject) {
6085
6085
  setValueByPath(toObject, ['name'], fromName);
6086
6086
  }
6087
6087
  if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
6088
- throw new Error('partialArgs parameter is not supported in Gemini API.');
6088
+ throw new Error('partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6089
6089
  }
6090
6090
  if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
6091
- throw new Error('willContinue parameter is not supported in Gemini API.');
6091
+ throw new Error('willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6092
6092
  }
6093
6093
  return toObject;
6094
6094
  }
@@ -6106,42 +6106,7 @@ function functionCallingConfigToMldev$1(fromObject) {
6106
6106
  }
6107
6107
  if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
6108
6108
  undefined) {
6109
- throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
6110
- }
6111
- return toObject;
6112
- }
6113
- function functionDeclarationToVertex$2(fromObject) {
6114
- const toObject = {};
6115
- const fromDescription = getValueByPath(fromObject, ['description']);
6116
- if (fromDescription != null) {
6117
- setValueByPath(toObject, ['description'], fromDescription);
6118
- }
6119
- const fromName = getValueByPath(fromObject, ['name']);
6120
- if (fromName != null) {
6121
- setValueByPath(toObject, ['name'], fromName);
6122
- }
6123
- const fromParameters = getValueByPath(fromObject, ['parameters']);
6124
- if (fromParameters != null) {
6125
- setValueByPath(toObject, ['parameters'], fromParameters);
6126
- }
6127
- const fromParametersJsonSchema = getValueByPath(fromObject, [
6128
- 'parametersJsonSchema',
6129
- ]);
6130
- if (fromParametersJsonSchema != null) {
6131
- setValueByPath(toObject, ['parametersJsonSchema'], fromParametersJsonSchema);
6132
- }
6133
- const fromResponse = getValueByPath(fromObject, ['response']);
6134
- if (fromResponse != null) {
6135
- setValueByPath(toObject, ['response'], fromResponse);
6136
- }
6137
- const fromResponseJsonSchema = getValueByPath(fromObject, [
6138
- 'responseJsonSchema',
6139
- ]);
6140
- if (fromResponseJsonSchema != null) {
6141
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6142
- }
6143
- if (getValueByPath(fromObject, ['behavior']) !== undefined) {
6144
- throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6109
+ throw new Error('streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6145
6110
  }
6146
6111
  return toObject;
6147
6112
  }
@@ -6180,10 +6145,10 @@ function googleSearchToMldev$3(fromObject) {
6180
6145
  setValueByPath(toObject, ['searchTypes'], fromSearchTypes);
6181
6146
  }
6182
6147
  if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
6183
- throw new Error('blockingConfidence parameter is not supported in Gemini API.');
6148
+ throw new Error('blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6184
6149
  }
6185
6150
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
6186
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
6151
+ throw new Error('excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6187
6152
  }
6188
6153
  const fromTimeRangeFilter = getValueByPath(fromObject, [
6189
6154
  'timeRangeFilter',
@@ -6420,13 +6385,13 @@ function partToVertex$2(fromObject) {
6420
6385
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
6421
6386
  }
6422
6387
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
6423
- throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6388
+ throw new Error('toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
6424
6389
  }
6425
6390
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
6426
- throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6391
+ throw new Error('toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
6427
6392
  }
6428
6393
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
6429
- throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6394
+ throw new Error('partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
6430
6395
  }
6431
6396
  return toObject;
6432
6397
  }
@@ -6466,14 +6431,14 @@ function toolConfigToVertex$1(fromObject) {
6466
6431
  }
6467
6432
  if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
6468
6433
  undefined) {
6469
- throw new Error('includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6434
+ throw new Error('includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
6470
6435
  }
6471
6436
  return toObject;
6472
6437
  }
6473
6438
  function toolToMldev$3(fromObject) {
6474
6439
  const toObject = {};
6475
6440
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
6476
- throw new Error('retrieval parameter is not supported in Gemini API.');
6441
+ throw new Error('retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6477
6442
  }
6478
6443
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
6479
6444
  if (fromComputerUse != null) {
@@ -6498,7 +6463,7 @@ function toolToMldev$3(fromObject) {
6498
6463
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
6499
6464
  }
6500
6465
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
6501
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
6466
+ throw new Error('enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6502
6467
  }
6503
6468
  const fromFunctionDeclarations = getValueByPath(fromObject, [
6504
6469
  'functionDeclarations',
@@ -6519,7 +6484,7 @@ function toolToMldev$3(fromObject) {
6519
6484
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
6520
6485
  }
6521
6486
  if (getValueByPath(fromObject, ['parallelAiSearch']) !== undefined) {
6522
- throw new Error('parallelAiSearch parameter is not supported in Gemini API.');
6487
+ throw new Error('parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
6523
6488
  }
6524
6489
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
6525
6490
  if (fromUrlContext != null) {
@@ -6548,7 +6513,7 @@ function toolToVertex$2(fromObject) {
6548
6513
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
6549
6514
  }
6550
6515
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
6551
- throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6516
+ throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
6552
6517
  }
6553
6518
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
6554
6519
  if (fromGoogleSearch != null) {
@@ -6577,7 +6542,7 @@ function toolToVertex$2(fromObject) {
6577
6542
  let transformedList = fromFunctionDeclarations;
6578
6543
  if (Array.isArray(transformedList)) {
6579
6544
  transformedList = transformedList.map((item) => {
6580
- return functionDeclarationToVertex$2(item);
6545
+ return item;
6581
6546
  });
6582
6547
  }
6583
6548
  setValueByPath(toObject, ['functionDeclarations'], transformedList);
@@ -6599,7 +6564,7 @@ function toolToVertex$2(fromObject) {
6599
6564
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
6600
6565
  }
6601
6566
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
6602
- throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6567
+ throw new Error('mcpServers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
6603
6568
  }
6604
6569
  return toObject;
6605
6570
  }
@@ -7891,7 +7856,7 @@ class Files extends BaseModule {
7891
7856
  function audioTranscriptionConfigToMldev$1(fromObject) {
7892
7857
  const toObject = {};
7893
7858
  if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
7894
- throw new Error('languageCodes parameter is not supported in Gemini API.');
7859
+ throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7895
7860
  }
7896
7861
  return toObject;
7897
7862
  }
@@ -7902,23 +7867,23 @@ function authConfigToMldev$2(fromObject) {
7902
7867
  setValueByPath(toObject, ['apiKey'], fromApiKey);
7903
7868
  }
7904
7869
  if (getValueByPath(fromObject, ['apiKeyConfig']) !== undefined) {
7905
- throw new Error('apiKeyConfig parameter is not supported in Gemini API.');
7870
+ throw new Error('apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7906
7871
  }
7907
7872
  if (getValueByPath(fromObject, ['authType']) !== undefined) {
7908
- throw new Error('authType parameter is not supported in Gemini API.');
7873
+ throw new Error('authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7909
7874
  }
7910
7875
  if (getValueByPath(fromObject, ['googleServiceAccountConfig']) !==
7911
7876
  undefined) {
7912
- throw new Error('googleServiceAccountConfig parameter is not supported in Gemini API.');
7877
+ throw new Error('googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7913
7878
  }
7914
7879
  if (getValueByPath(fromObject, ['httpBasicAuthConfig']) !== undefined) {
7915
- throw new Error('httpBasicAuthConfig parameter is not supported in Gemini API.');
7880
+ throw new Error('httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7916
7881
  }
7917
7882
  if (getValueByPath(fromObject, ['oauthConfig']) !== undefined) {
7918
- throw new Error('oauthConfig parameter is not supported in Gemini API.');
7883
+ throw new Error('oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7919
7884
  }
7920
7885
  if (getValueByPath(fromObject, ['oidcConfig']) !== undefined) {
7921
- throw new Error('oidcConfig parameter is not supported in Gemini API.');
7886
+ throw new Error('oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7922
7887
  }
7923
7888
  return toObject;
7924
7889
  }
@@ -7929,7 +7894,7 @@ function blobToMldev$2(fromObject) {
7929
7894
  setValueByPath(toObject, ['data'], fromData);
7930
7895
  }
7931
7896
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7932
- throw new Error('displayName parameter is not supported in Gemini API.');
7897
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7933
7898
  }
7934
7899
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7935
7900
  if (fromMimeType != null) {
@@ -7976,7 +7941,7 @@ function contentToVertex$1(fromObject) {
7976
7941
  function fileDataToMldev$2(fromObject) {
7977
7942
  const toObject = {};
7978
7943
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7979
- throw new Error('displayName parameter is not supported in Gemini API.');
7944
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7980
7945
  }
7981
7946
  const fromFileUri = getValueByPath(fromObject, ['fileUri']);
7982
7947
  if (fromFileUri != null) {
@@ -8003,45 +7968,10 @@ function functionCallToMldev$2(fromObject) {
8003
7968
  setValueByPath(toObject, ['name'], fromName);
8004
7969
  }
8005
7970
  if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
8006
- throw new Error('partialArgs parameter is not supported in Gemini API.');
7971
+ throw new Error('partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8007
7972
  }
8008
7973
  if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
8009
- throw new Error('willContinue parameter is not supported in Gemini API.');
8010
- }
8011
- return toObject;
8012
- }
8013
- function functionDeclarationToVertex$1(fromObject) {
8014
- const toObject = {};
8015
- const fromDescription = getValueByPath(fromObject, ['description']);
8016
- if (fromDescription != null) {
8017
- setValueByPath(toObject, ['description'], fromDescription);
8018
- }
8019
- const fromName = getValueByPath(fromObject, ['name']);
8020
- if (fromName != null) {
8021
- setValueByPath(toObject, ['name'], fromName);
8022
- }
8023
- const fromParameters = getValueByPath(fromObject, ['parameters']);
8024
- if (fromParameters != null) {
8025
- setValueByPath(toObject, ['parameters'], fromParameters);
8026
- }
8027
- const fromParametersJsonSchema = getValueByPath(fromObject, [
8028
- 'parametersJsonSchema',
8029
- ]);
8030
- if (fromParametersJsonSchema != null) {
8031
- setValueByPath(toObject, ['parametersJsonSchema'], fromParametersJsonSchema);
8032
- }
8033
- const fromResponse = getValueByPath(fromObject, ['response']);
8034
- if (fromResponse != null) {
8035
- setValueByPath(toObject, ['response'], fromResponse);
8036
- }
8037
- const fromResponseJsonSchema = getValueByPath(fromObject, [
8038
- 'responseJsonSchema',
8039
- ]);
8040
- if (fromResponseJsonSchema != null) {
8041
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
8042
- }
8043
- if (getValueByPath(fromObject, ['behavior']) !== undefined) {
8044
- throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
7974
+ throw new Error('willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8045
7975
  }
8046
7976
  return toObject;
8047
7977
  }
@@ -8169,7 +8099,7 @@ function generationConfigToVertex$1(fromObject) {
8169
8099
  }
8170
8100
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
8171
8101
  undefined) {
8172
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8102
+ throw new Error('enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
8173
8103
  }
8174
8104
  return toObject;
8175
8105
  }
@@ -8192,10 +8122,10 @@ function googleSearchToMldev$2(fromObject) {
8192
8122
  setValueByPath(toObject, ['searchTypes'], fromSearchTypes);
8193
8123
  }
8194
8124
  if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
8195
- throw new Error('blockingConfidence parameter is not supported in Gemini API.');
8125
+ throw new Error('blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8196
8126
  }
8197
8127
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
8198
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
8128
+ throw new Error('excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8199
8129
  }
8200
8130
  const fromTimeRangeFilter = getValueByPath(fromObject, [
8201
8131
  'timeRangeFilter',
@@ -8314,7 +8244,7 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
8314
8244
  setValueByPath(parentObject, ['setup', 'proactivity'], fromProactivity);
8315
8245
  }
8316
8246
  if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
8317
- throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
8247
+ throw new Error('explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8318
8248
  }
8319
8249
  const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
8320
8250
  if (parentObject !== undefined && fromAvatarConfig != null) {
@@ -8785,13 +8715,13 @@ function partToVertex$1(fromObject) {
8785
8715
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
8786
8716
  }
8787
8717
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
8788
- throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8718
+ throw new Error('toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
8789
8719
  }
8790
8720
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
8791
- throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8721
+ throw new Error('toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
8792
8722
  }
8793
8723
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
8794
- throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8724
+ throw new Error('partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
8795
8725
  }
8796
8726
  return toObject;
8797
8727
  }
@@ -8802,7 +8732,7 @@ function safetySettingToMldev$2(fromObject) {
8802
8732
  setValueByPath(toObject, ['category'], fromCategory);
8803
8733
  }
8804
8734
  if (getValueByPath(fromObject, ['method']) !== undefined) {
8805
- throw new Error('method parameter is not supported in Gemini API.');
8735
+ throw new Error('method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8806
8736
  }
8807
8737
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
8808
8738
  if (fromThreshold != null) {
@@ -8817,14 +8747,14 @@ function sessionResumptionConfigToMldev$1(fromObject) {
8817
8747
  setValueByPath(toObject, ['handle'], fromHandle);
8818
8748
  }
8819
8749
  if (getValueByPath(fromObject, ['transparent']) !== undefined) {
8820
- throw new Error('transparent parameter is not supported in Gemini API.');
8750
+ throw new Error('transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8821
8751
  }
8822
8752
  return toObject;
8823
8753
  }
8824
8754
  function toolToMldev$2(fromObject) {
8825
8755
  const toObject = {};
8826
8756
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
8827
- throw new Error('retrieval parameter is not supported in Gemini API.');
8757
+ throw new Error('retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8828
8758
  }
8829
8759
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8830
8760
  if (fromComputerUse != null) {
@@ -8849,7 +8779,7 @@ function toolToMldev$2(fromObject) {
8849
8779
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8850
8780
  }
8851
8781
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
8852
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
8782
+ throw new Error('enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8853
8783
  }
8854
8784
  const fromFunctionDeclarations = getValueByPath(fromObject, [
8855
8785
  'functionDeclarations',
@@ -8870,7 +8800,7 @@ function toolToMldev$2(fromObject) {
8870
8800
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
8871
8801
  }
8872
8802
  if (getValueByPath(fromObject, ['parallelAiSearch']) !== undefined) {
8873
- throw new Error('parallelAiSearch parameter is not supported in Gemini API.');
8803
+ throw new Error('parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8874
8804
  }
8875
8805
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
8876
8806
  if (fromUrlContext != null) {
@@ -8899,7 +8829,7 @@ function toolToVertex$1(fromObject) {
8899
8829
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
8900
8830
  }
8901
8831
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
8902
- throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8832
+ throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
8903
8833
  }
8904
8834
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
8905
8835
  if (fromGoogleSearch != null) {
@@ -8928,7 +8858,7 @@ function toolToVertex$1(fromObject) {
8928
8858
  let transformedList = fromFunctionDeclarations;
8929
8859
  if (Array.isArray(transformedList)) {
8930
8860
  transformedList = transformedList.map((item) => {
8931
- return functionDeclarationToVertex$1(item);
8861
+ return item;
8932
8862
  });
8933
8863
  }
8934
8864
  setValueByPath(toObject, ['functionDeclarations'], transformedList);
@@ -8950,7 +8880,7 @@ function toolToVertex$1(fromObject) {
8950
8880
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
8951
8881
  }
8952
8882
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
8953
- throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8883
+ throw new Error('mcpServers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
8954
8884
  }
8955
8885
  return toObject;
8956
8886
  }
@@ -9067,23 +8997,23 @@ function authConfigToMldev$1(fromObject, _rootObject) {
9067
8997
  setValueByPath(toObject, ['apiKey'], fromApiKey);
9068
8998
  }
9069
8999
  if (getValueByPath(fromObject, ['apiKeyConfig']) !== undefined) {
9070
- throw new Error('apiKeyConfig parameter is not supported in Gemini API.');
9000
+ throw new Error('apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9071
9001
  }
9072
9002
  if (getValueByPath(fromObject, ['authType']) !== undefined) {
9073
- throw new Error('authType parameter is not supported in Gemini API.');
9003
+ throw new Error('authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9074
9004
  }
9075
9005
  if (getValueByPath(fromObject, ['googleServiceAccountConfig']) !==
9076
9006
  undefined) {
9077
- throw new Error('googleServiceAccountConfig parameter is not supported in Gemini API.');
9007
+ throw new Error('googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9078
9008
  }
9079
9009
  if (getValueByPath(fromObject, ['httpBasicAuthConfig']) !== undefined) {
9080
- throw new Error('httpBasicAuthConfig parameter is not supported in Gemini API.');
9010
+ throw new Error('httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9081
9011
  }
9082
9012
  if (getValueByPath(fromObject, ['oauthConfig']) !== undefined) {
9083
- throw new Error('oauthConfig parameter is not supported in Gemini API.');
9013
+ throw new Error('oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9084
9014
  }
9085
9015
  if (getValueByPath(fromObject, ['oidcConfig']) !== undefined) {
9086
- throw new Error('oidcConfig parameter is not supported in Gemini API.');
9016
+ throw new Error('oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9087
9017
  }
9088
9018
  return toObject;
9089
9019
  }
@@ -9094,7 +9024,7 @@ function blobToMldev$1(fromObject, _rootObject) {
9094
9024
  setValueByPath(toObject, ['data'], fromData);
9095
9025
  }
9096
9026
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
9097
- throw new Error('displayName parameter is not supported in Gemini API.');
9027
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9098
9028
  }
9099
9029
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
9100
9030
  if (fromMimeType != null) {
@@ -9291,13 +9221,13 @@ function controlReferenceConfigToVertex(fromObject, _rootObject) {
9291
9221
  function countTokensConfigToMldev(fromObject, _rootObject) {
9292
9222
  const toObject = {};
9293
9223
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
9294
- throw new Error('systemInstruction parameter is not supported in Gemini API.');
9224
+ throw new Error('systemInstruction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9295
9225
  }
9296
9226
  if (getValueByPath(fromObject, ['tools']) !== undefined) {
9297
- throw new Error('tools parameter is not supported in Gemini API.');
9227
+ throw new Error('tools parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9298
9228
  }
9299
9229
  if (getValueByPath(fromObject, ['generationConfig']) !== undefined) {
9300
- throw new Error('generationConfig parameter is not supported in Gemini API.');
9230
+ throw new Error('generationConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9301
9231
  }
9302
9232
  return toObject;
9303
9233
  }
@@ -9598,16 +9528,16 @@ function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
9598
9528
  setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
9599
9529
  }
9600
9530
  if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
9601
- throw new Error('mimeType parameter is not supported in Gemini API.');
9531
+ throw new Error('mimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9602
9532
  }
9603
9533
  if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
9604
- throw new Error('autoTruncate parameter is not supported in Gemini API.');
9534
+ throw new Error('autoTruncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9605
9535
  }
9606
9536
  if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
9607
- throw new Error('documentOcr parameter is not supported in Gemini API.');
9537
+ throw new Error('documentOcr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9608
9538
  }
9609
9539
  if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
9610
- throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
9540
+ throw new Error('audioTrackExtraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9611
9541
  }
9612
9542
  return toObject;
9613
9543
  }
@@ -9891,7 +9821,7 @@ function endpointFromVertex(fromObject, _rootObject) {
9891
9821
  function fileDataToMldev$1(fromObject, _rootObject) {
9892
9822
  const toObject = {};
9893
9823
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
9894
- throw new Error('displayName parameter is not supported in Gemini API.');
9824
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9895
9825
  }
9896
9826
  const fromFileUri = getValueByPath(fromObject, ['fileUri']);
9897
9827
  if (fromFileUri != null) {
@@ -9918,10 +9848,10 @@ function functionCallToMldev$1(fromObject, _rootObject) {
9918
9848
  setValueByPath(toObject, ['name'], fromName);
9919
9849
  }
9920
9850
  if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
9921
- throw new Error('partialArgs parameter is not supported in Gemini API.');
9851
+ throw new Error('partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9922
9852
  }
9923
9853
  if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
9924
- throw new Error('willContinue parameter is not supported in Gemini API.');
9854
+ throw new Error('willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9925
9855
  }
9926
9856
  return toObject;
9927
9857
  }
@@ -9939,42 +9869,7 @@ function functionCallingConfigToMldev(fromObject, _rootObject) {
9939
9869
  }
9940
9870
  if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
9941
9871
  undefined) {
9942
- throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
9943
- }
9944
- return toObject;
9945
- }
9946
- function functionDeclarationToVertex(fromObject, _rootObject) {
9947
- const toObject = {};
9948
- const fromDescription = getValueByPath(fromObject, ['description']);
9949
- if (fromDescription != null) {
9950
- setValueByPath(toObject, ['description'], fromDescription);
9951
- }
9952
- const fromName = getValueByPath(fromObject, ['name']);
9953
- if (fromName != null) {
9954
- setValueByPath(toObject, ['name'], fromName);
9955
- }
9956
- const fromParameters = getValueByPath(fromObject, ['parameters']);
9957
- if (fromParameters != null) {
9958
- setValueByPath(toObject, ['parameters'], fromParameters);
9959
- }
9960
- const fromParametersJsonSchema = getValueByPath(fromObject, [
9961
- 'parametersJsonSchema',
9962
- ]);
9963
- if (fromParametersJsonSchema != null) {
9964
- setValueByPath(toObject, ['parametersJsonSchema'], fromParametersJsonSchema);
9965
- }
9966
- const fromResponse = getValueByPath(fromObject, ['response']);
9967
- if (fromResponse != null) {
9968
- setValueByPath(toObject, ['response'], fromResponse);
9969
- }
9970
- const fromResponseJsonSchema = getValueByPath(fromObject, [
9971
- 'responseJsonSchema',
9972
- ]);
9973
- if (fromResponseJsonSchema != null) {
9974
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9975
- }
9976
- if (getValueByPath(fromObject, ['behavior']) !== undefined) {
9977
- throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
9872
+ throw new Error('streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
9978
9873
  }
9979
9874
  return toObject;
9980
9875
  }
@@ -10061,10 +9956,10 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootO
10061
9956
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
10062
9957
  }
10063
9958
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
10064
- throw new Error('routingConfig parameter is not supported in Gemini API.');
9959
+ throw new Error('routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10065
9960
  }
10066
9961
  if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
10067
- throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
9962
+ throw new Error('modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10068
9963
  }
10069
9964
  const fromSafetySettings = getValueByPath(fromObject, [
10070
9965
  'safetySettings',
@@ -10093,7 +9988,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootO
10093
9988
  setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
10094
9989
  }
10095
9990
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
10096
- throw new Error('labels parameter is not supported in Gemini API.');
9991
+ throw new Error('labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10097
9992
  }
10098
9993
  const fromCachedContent = getValueByPath(fromObject, [
10099
9994
  'cachedContent',
@@ -10118,7 +10013,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootO
10118
10013
  setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
10119
10014
  }
10120
10015
  if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
10121
- throw new Error('audioTimestamp parameter is not supported in Gemini API.');
10016
+ throw new Error('audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10122
10017
  }
10123
10018
  const fromThinkingConfig = getValueByPath(fromObject, [
10124
10019
  'thinkingConfig',
@@ -10137,7 +10032,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootO
10137
10032
  setValueByPath(toObject, ['enableEnhancedCivicAnswers'], fromEnableEnhancedCivicAnswers);
10138
10033
  }
10139
10034
  if (getValueByPath(fromObject, ['modelArmorConfig']) !== undefined) {
10140
- throw new Error('modelArmorConfig parameter is not supported in Gemini API.');
10035
+ throw new Error('modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10141
10036
  }
10142
10037
  const fromServiceTier = getValueByPath(fromObject, ['serviceTier']);
10143
10038
  if (parentObject !== undefined && fromServiceTier != null) {
@@ -10309,7 +10204,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
10309
10204
  }
10310
10205
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
10311
10206
  undefined) {
10312
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
10207
+ throw new Error('enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
10313
10208
  }
10314
10209
  const fromModelArmorConfig = getValueByPath(fromObject, [
10315
10210
  'modelArmorConfig',
@@ -10458,10 +10353,10 @@ function generateContentResponseFromVertex(fromObject, _rootObject) {
10458
10353
  function generateImagesConfigToMldev(fromObject, parentObject, _rootObject) {
10459
10354
  const toObject = {};
10460
10355
  if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
10461
- throw new Error('outputGcsUri parameter is not supported in Gemini API.');
10356
+ throw new Error('outputGcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10462
10357
  }
10463
10358
  if (getValueByPath(fromObject, ['negativePrompt']) !== undefined) {
10464
- throw new Error('negativePrompt parameter is not supported in Gemini API.');
10359
+ throw new Error('negativePrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10465
10360
  }
10466
10361
  const fromNumberOfImages = getValueByPath(fromObject, [
10467
10362
  'numberOfImages',
@@ -10480,7 +10375,7 @@ function generateImagesConfigToMldev(fromObject, parentObject, _rootObject) {
10480
10375
  setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
10481
10376
  }
10482
10377
  if (getValueByPath(fromObject, ['seed']) !== undefined) {
10483
- throw new Error('seed parameter is not supported in Gemini API.');
10378
+ throw new Error('seed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10484
10379
  }
10485
10380
  const fromSafetyFilterLevel = getValueByPath(fromObject, [
10486
10381
  'safetyFilterLevel',
@@ -10523,17 +10418,17 @@ function generateImagesConfigToMldev(fromObject, parentObject, _rootObject) {
10523
10418
  setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
10524
10419
  }
10525
10420
  if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
10526
- throw new Error('addWatermark parameter is not supported in Gemini API.');
10421
+ throw new Error('addWatermark parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10527
10422
  }
10528
10423
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
10529
- throw new Error('labels parameter is not supported in Gemini API.');
10424
+ throw new Error('labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10530
10425
  }
10531
10426
  const fromImageSize = getValueByPath(fromObject, ['imageSize']);
10532
10427
  if (parentObject !== undefined && fromImageSize != null) {
10533
10428
  setValueByPath(parentObject, ['parameters', 'sampleImageSize'], fromImageSize);
10534
10429
  }
10535
10430
  if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
10536
- throw new Error('enhancePrompt parameter is not supported in Gemini API.');
10431
+ throw new Error('enhancePrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10537
10432
  }
10538
10433
  return toObject;
10539
10434
  }
@@ -10726,10 +10621,10 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
10726
10621
  setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfVideos);
10727
10622
  }
10728
10623
  if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
10729
- throw new Error('outputGcsUri parameter is not supported in Gemini API.');
10624
+ throw new Error('outputGcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10730
10625
  }
10731
10626
  if (getValueByPath(fromObject, ['fps']) !== undefined) {
10732
- throw new Error('fps parameter is not supported in Gemini API.');
10627
+ throw new Error('fps parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10733
10628
  }
10734
10629
  const fromDurationSeconds = getValueByPath(fromObject, [
10735
10630
  'durationSeconds',
@@ -10738,7 +10633,7 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
10738
10633
  setValueByPath(parentObject, ['parameters', 'durationSeconds'], fromDurationSeconds);
10739
10634
  }
10740
10635
  if (getValueByPath(fromObject, ['seed']) !== undefined) {
10741
- throw new Error('seed parameter is not supported in Gemini API.');
10636
+ throw new Error('seed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10742
10637
  }
10743
10638
  const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
10744
10639
  if (parentObject !== undefined && fromAspectRatio != null) {
@@ -10755,7 +10650,7 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
10755
10650
  setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
10756
10651
  }
10757
10652
  if (getValueByPath(fromObject, ['pubsubTopic']) !== undefined) {
10758
- throw new Error('pubsubTopic parameter is not supported in Gemini API.');
10653
+ throw new Error('pubsubTopic parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10759
10654
  }
10760
10655
  const fromNegativePrompt = getValueByPath(fromObject, [
10761
10656
  'negativePrompt',
@@ -10770,7 +10665,7 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
10770
10665
  setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
10771
10666
  }
10772
10667
  if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
10773
- throw new Error('generateAudio parameter is not supported in Gemini API.');
10668
+ throw new Error('generateAudio parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10774
10669
  }
10775
10670
  const fromLastFrame = getValueByPath(fromObject, ['lastFrame']);
10776
10671
  if (parentObject !== undefined && fromLastFrame != null) {
@@ -10789,13 +10684,13 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
10789
10684
  setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
10790
10685
  }
10791
10686
  if (getValueByPath(fromObject, ['mask']) !== undefined) {
10792
- throw new Error('mask parameter is not supported in Gemini API.');
10687
+ throw new Error('mask parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10793
10688
  }
10794
10689
  if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
10795
- throw new Error('compressionQuality parameter is not supported in Gemini API.');
10690
+ throw new Error('compressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10796
10691
  }
10797
10692
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
10798
- throw new Error('labels parameter is not supported in Gemini API.');
10693
+ throw new Error('labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10799
10694
  }
10800
10695
  const fromWebhookConfig = getValueByPath(fromObject, [
10801
10696
  'webhookConfig',
@@ -10804,7 +10699,7 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
10804
10699
  setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
10805
10700
  }
10806
10701
  if (getValueByPath(fromObject, ['resizeMode']) !== undefined) {
10807
- throw new Error('resizeMode parameter is not supported in Gemini API.');
10702
+ throw new Error('resizeMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
10808
10703
  }
10809
10704
  return toObject;
10810
10705
  }
@@ -10901,7 +10796,7 @@ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
10901
10796
  setValueByPath(parentObject, ['labels'], fromLabels);
10902
10797
  }
10903
10798
  if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
10904
- throw new Error('webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
10799
+ throw new Error('webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
10905
10800
  }
10906
10801
  const fromResizeMode = getValueByPath(fromObject, ['resizeMode']);
10907
10802
  if (parentObject !== undefined && fromResizeMode != null) {
@@ -11300,7 +11195,7 @@ function generationConfigToVertex(fromObject, _rootObject) {
11300
11195
  }
11301
11196
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
11302
11197
  undefined) {
11303
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11198
+ throw new Error('enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
11304
11199
  }
11305
11200
  return toObject;
11306
11201
  }
@@ -11339,10 +11234,10 @@ function googleSearchToMldev$1(fromObject, _rootObject) {
11339
11234
  setValueByPath(toObject, ['searchTypes'], fromSearchTypes);
11340
11235
  }
11341
11236
  if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
11342
- throw new Error('blockingConfidence parameter is not supported in Gemini API.');
11237
+ throw new Error('blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
11343
11238
  }
11344
11239
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
11345
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
11240
+ throw new Error('excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
11346
11241
  }
11347
11242
  const fromTimeRangeFilter = getValueByPath(fromObject, [
11348
11243
  'timeRangeFilter',
@@ -11363,20 +11258,20 @@ function imageConfigToMldev(fromObject, _rootObject) {
11363
11258
  setValueByPath(toObject, ['imageSize'], fromImageSize);
11364
11259
  }
11365
11260
  if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
11366
- throw new Error('personGeneration parameter is not supported in Gemini API.');
11261
+ throw new Error('personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
11367
11262
  }
11368
11263
  if (getValueByPath(fromObject, ['prominentPeople']) !== undefined) {
11369
- throw new Error('prominentPeople parameter is not supported in Gemini API.');
11264
+ throw new Error('prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
11370
11265
  }
11371
11266
  if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
11372
- throw new Error('outputMimeType parameter is not supported in Gemini API.');
11267
+ throw new Error('outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
11373
11268
  }
11374
11269
  if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
11375
11270
  undefined) {
11376
- throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
11271
+ throw new Error('outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
11377
11272
  }
11378
11273
  if (getValueByPath(fromObject, ['imageOutputOptions']) !== undefined) {
11379
- throw new Error('imageOutputOptions parameter is not supported in Gemini API.');
11274
+ throw new Error('imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
11380
11275
  }
11381
11276
  return toObject;
11382
11277
  }
@@ -11457,7 +11352,7 @@ function imageFromVertex(fromObject, _rootObject) {
11457
11352
  function imageToMldev(fromObject, _rootObject) {
11458
11353
  const toObject = {};
11459
11354
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
11460
- throw new Error('gcsUri parameter is not supported in Gemini API.');
11355
+ throw new Error('gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
11461
11356
  }
11462
11357
  const fromImageBytes = getValueByPath(fromObject, ['imageBytes']);
11463
11358
  if (fromImageBytes != null) {
@@ -11860,13 +11755,13 @@ function partToVertex(fromObject, _rootObject) {
11860
11755
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
11861
11756
  }
11862
11757
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
11863
- throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11758
+ throw new Error('toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
11864
11759
  }
11865
11760
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
11866
- throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11761
+ throw new Error('toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
11867
11762
  }
11868
11763
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
11869
- throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11764
+ throw new Error('partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
11870
11765
  }
11871
11766
  return toObject;
11872
11767
  }
@@ -12089,7 +11984,7 @@ function safetySettingToMldev$1(fromObject, _rootObject) {
12089
11984
  setValueByPath(toObject, ['category'], fromCategory);
12090
11985
  }
12091
11986
  if (getValueByPath(fromObject, ['method']) !== undefined) {
12092
- throw new Error('method parameter is not supported in Gemini API.');
11987
+ throw new Error('method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
12093
11988
  }
12094
11989
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
12095
11990
  if (fromThreshold != null) {
@@ -12223,14 +12118,14 @@ function toolConfigToVertex(fromObject, _rootObject) {
12223
12118
  }
12224
12119
  if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
12225
12120
  undefined) {
12226
- throw new Error('includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12121
+ throw new Error('includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
12227
12122
  }
12228
12123
  return toObject;
12229
12124
  }
12230
12125
  function toolToMldev$1(fromObject, rootObject) {
12231
12126
  const toObject = {};
12232
12127
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
12233
- throw new Error('retrieval parameter is not supported in Gemini API.');
12128
+ throw new Error('retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
12234
12129
  }
12235
12130
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
12236
12131
  if (fromComputerUse != null) {
@@ -12255,7 +12150,7 @@ function toolToMldev$1(fromObject, rootObject) {
12255
12150
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
12256
12151
  }
12257
12152
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
12258
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
12153
+ throw new Error('enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
12259
12154
  }
12260
12155
  const fromFunctionDeclarations = getValueByPath(fromObject, [
12261
12156
  'functionDeclarations',
@@ -12276,7 +12171,7 @@ function toolToMldev$1(fromObject, rootObject) {
12276
12171
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
12277
12172
  }
12278
12173
  if (getValueByPath(fromObject, ['parallelAiSearch']) !== undefined) {
12279
- throw new Error('parallelAiSearch parameter is not supported in Gemini API.');
12174
+ throw new Error('parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
12280
12175
  }
12281
12176
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
12282
12177
  if (fromUrlContext != null) {
@@ -12294,7 +12189,7 @@ function toolToMldev$1(fromObject, rootObject) {
12294
12189
  }
12295
12190
  return toObject;
12296
12191
  }
12297
- function toolToVertex(fromObject, rootObject) {
12192
+ function toolToVertex(fromObject, _rootObject) {
12298
12193
  const toObject = {};
12299
12194
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
12300
12195
  if (fromRetrieval != null) {
@@ -12305,7 +12200,7 @@ function toolToVertex(fromObject, rootObject) {
12305
12200
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
12306
12201
  }
12307
12202
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
12308
- throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12203
+ throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
12309
12204
  }
12310
12205
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
12311
12206
  if (fromGoogleSearch != null) {
@@ -12334,7 +12229,7 @@ function toolToVertex(fromObject, rootObject) {
12334
12229
  let transformedList = fromFunctionDeclarations;
12335
12230
  if (Array.isArray(transformedList)) {
12336
12231
  transformedList = transformedList.map((item) => {
12337
- return functionDeclarationToVertex(item);
12232
+ return item;
12338
12233
  });
12339
12234
  }
12340
12235
  setValueByPath(toObject, ['functionDeclarations'], transformedList);
@@ -12356,7 +12251,7 @@ function toolToVertex(fromObject, rootObject) {
12356
12251
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
12357
12252
  }
12358
12253
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
12359
- throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12254
+ throw new Error('mcpServers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
12360
12255
  }
12361
12256
  return toObject;
12362
12257
  }
@@ -12919,7 +12814,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
12919
12814
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
12920
12815
  const USER_AGENT_HEADER = 'User-Agent';
12921
12816
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
12922
- const SDK_VERSION = '2.0.1'; // x-release-please-version
12817
+ const SDK_VERSION = '2.2.0'; // x-release-please-version
12923
12818
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
12924
12819
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
12925
12820
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -14815,7 +14710,7 @@ class Models extends BaseModule {
14815
14710
  if (this.apiClient.isVertexAI()) {
14816
14711
  if (!actualParams.config.queryBase) {
14817
14712
  if ((_a = actualParams.config) === null || _a === void 0 ? void 0 : _a.filter) {
14818
- throw new Error('Filtering tuned models list for Gemini Enterprise Agent Platform (previously known as Vertex AI) is not currently supported');
14713
+ throw new Error('Filtering tuned models list is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
14819
14714
  }
14820
14715
  else {
14821
14716
  actualParams.config.filter = 'labels.tune-type:*';
@@ -16271,7 +16166,7 @@ class Operations extends BaseModule {
16271
16166
  function audioTranscriptionConfigToMldev(fromObject) {
16272
16167
  const toObject = {};
16273
16168
  if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
16274
- throw new Error('languageCodes parameter is not supported in Gemini API.');
16169
+ throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16275
16170
  }
16276
16171
  return toObject;
16277
16172
  }
@@ -16282,23 +16177,23 @@ function authConfigToMldev(fromObject) {
16282
16177
  setValueByPath(toObject, ['apiKey'], fromApiKey);
16283
16178
  }
16284
16179
  if (getValueByPath(fromObject, ['apiKeyConfig']) !== undefined) {
16285
- throw new Error('apiKeyConfig parameter is not supported in Gemini API.');
16180
+ throw new Error('apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16286
16181
  }
16287
16182
  if (getValueByPath(fromObject, ['authType']) !== undefined) {
16288
- throw new Error('authType parameter is not supported in Gemini API.');
16183
+ throw new Error('authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16289
16184
  }
16290
16185
  if (getValueByPath(fromObject, ['googleServiceAccountConfig']) !==
16291
16186
  undefined) {
16292
- throw new Error('googleServiceAccountConfig parameter is not supported in Gemini API.');
16187
+ throw new Error('googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16293
16188
  }
16294
16189
  if (getValueByPath(fromObject, ['httpBasicAuthConfig']) !== undefined) {
16295
- throw new Error('httpBasicAuthConfig parameter is not supported in Gemini API.');
16190
+ throw new Error('httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16296
16191
  }
16297
16192
  if (getValueByPath(fromObject, ['oauthConfig']) !== undefined) {
16298
- throw new Error('oauthConfig parameter is not supported in Gemini API.');
16193
+ throw new Error('oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16299
16194
  }
16300
16195
  if (getValueByPath(fromObject, ['oidcConfig']) !== undefined) {
16301
- throw new Error('oidcConfig parameter is not supported in Gemini API.');
16196
+ throw new Error('oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16302
16197
  }
16303
16198
  return toObject;
16304
16199
  }
@@ -16309,7 +16204,7 @@ function blobToMldev(fromObject) {
16309
16204
  setValueByPath(toObject, ['data'], fromData);
16310
16205
  }
16311
16206
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
16312
- throw new Error('displayName parameter is not supported in Gemini API.');
16207
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16313
16208
  }
16314
16209
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
16315
16210
  if (fromMimeType != null) {
@@ -16376,7 +16271,7 @@ function createAuthTokenParametersToMldev(apiClient, fromObject) {
16376
16271
  function fileDataToMldev(fromObject) {
16377
16272
  const toObject = {};
16378
16273
  if (getValueByPath(fromObject, ['displayName']) !== undefined) {
16379
- throw new Error('displayName parameter is not supported in Gemini API.');
16274
+ throw new Error('displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16380
16275
  }
16381
16276
  const fromFileUri = getValueByPath(fromObject, ['fileUri']);
16382
16277
  if (fromFileUri != null) {
@@ -16403,10 +16298,10 @@ function functionCallToMldev(fromObject) {
16403
16298
  setValueByPath(toObject, ['name'], fromName);
16404
16299
  }
16405
16300
  if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
16406
- throw new Error('partialArgs parameter is not supported in Gemini API.');
16301
+ throw new Error('partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16407
16302
  }
16408
16303
  if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
16409
- throw new Error('willContinue parameter is not supported in Gemini API.');
16304
+ throw new Error('willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16410
16305
  }
16411
16306
  return toObject;
16412
16307
  }
@@ -16429,10 +16324,10 @@ function googleSearchToMldev(fromObject) {
16429
16324
  setValueByPath(toObject, ['searchTypes'], fromSearchTypes);
16430
16325
  }
16431
16326
  if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
16432
- throw new Error('blockingConfidence parameter is not supported in Gemini API.');
16327
+ throw new Error('blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16433
16328
  }
16434
16329
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
16435
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
16330
+ throw new Error('excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16436
16331
  }
16437
16332
  const fromTimeRangeFilter = getValueByPath(fromObject, [
16438
16333
  'timeRangeFilter',
@@ -16551,7 +16446,7 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
16551
16446
  setValueByPath(parentObject, ['setup', 'proactivity'], fromProactivity);
16552
16447
  }
16553
16448
  if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
16554
- throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
16449
+ throw new Error('explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16555
16450
  }
16556
16451
  const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
16557
16452
  if (parentObject !== undefined && fromAvatarConfig != null) {
@@ -16662,7 +16557,7 @@ function safetySettingToMldev(fromObject) {
16662
16557
  setValueByPath(toObject, ['category'], fromCategory);
16663
16558
  }
16664
16559
  if (getValueByPath(fromObject, ['method']) !== undefined) {
16665
- throw new Error('method parameter is not supported in Gemini API.');
16560
+ throw new Error('method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16666
16561
  }
16667
16562
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
16668
16563
  if (fromThreshold != null) {
@@ -16677,14 +16572,14 @@ function sessionResumptionConfigToMldev(fromObject) {
16677
16572
  setValueByPath(toObject, ['handle'], fromHandle);
16678
16573
  }
16679
16574
  if (getValueByPath(fromObject, ['transparent']) !== undefined) {
16680
- throw new Error('transparent parameter is not supported in Gemini API.');
16575
+ throw new Error('transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16681
16576
  }
16682
16577
  return toObject;
16683
16578
  }
16684
16579
  function toolToMldev(fromObject) {
16685
16580
  const toObject = {};
16686
16581
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
16687
- throw new Error('retrieval parameter is not supported in Gemini API.');
16582
+ throw new Error('retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16688
16583
  }
16689
16584
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
16690
16585
  if (fromComputerUse != null) {
@@ -16709,7 +16604,7 @@ function toolToMldev(fromObject) {
16709
16604
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
16710
16605
  }
16711
16606
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
16712
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
16607
+ throw new Error('enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16713
16608
  }
16714
16609
  const fromFunctionDeclarations = getValueByPath(fromObject, [
16715
16610
  'functionDeclarations',
@@ -16730,7 +16625,7 @@ function toolToMldev(fromObject) {
16730
16625
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
16731
16626
  }
16732
16627
  if (getValueByPath(fromObject, ['parallelAiSearch']) !== undefined) {
16733
- throw new Error('parallelAiSearch parameter is not supported in Gemini API.');
16628
+ throw new Error('parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16734
16629
  }
16735
16630
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
16736
16631
  if (fromUrlContext != null) {
@@ -18066,325 +17961,128 @@ class APIResource {
18066
17961
  */
18067
17962
  APIResource._key = [];
18068
17963
 
17964
+ /**
17965
+ * @license
17966
+ * Copyright 2025 Google LLC
17967
+ * SPDX-License-Identifier: Apache-2.0
17968
+ */
17969
+ function concatBytes(buffers) {
17970
+ let length = 0;
17971
+ for (const buffer of buffers) {
17972
+ length += buffer.length;
17973
+ }
17974
+ const output = new Uint8Array(length);
17975
+ let index = 0;
17976
+ for (const buffer of buffers) {
17977
+ output.set(buffer, index);
17978
+ index += buffer.length;
17979
+ }
17980
+ return output;
17981
+ }
17982
+ let encodeUTF8_;
17983
+ function encodeUTF8(str) {
17984
+ let encoder;
17985
+ return (encodeUTF8_ !== null && encodeUTF8_ !== void 0 ? encodeUTF8_ : ((encoder = new globalThis.TextEncoder()), (encodeUTF8_ = encoder.encode.bind(encoder))))(str);
17986
+ }
17987
+ let decodeUTF8_;
17988
+ function decodeUTF8(bytes) {
17989
+ let decoder;
17990
+ return (decodeUTF8_ !== null && decodeUTF8_ !== void 0 ? decodeUTF8_ : ((decoder = new globalThis.TextDecoder()), (decodeUTF8_ = decoder.decode.bind(decoder))))(bytes);
17991
+ }
17992
+
18069
17993
  /**
18070
17994
  * @license
18071
17995
  * Copyright 2025 Google LLC
18072
17996
  * SPDX-License-Identifier: Apache-2.0
18073
17997
  */
18074
17998
  /**
18075
- * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
17999
+ * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
18000
+ * reading lines from text.
18076
18001
  *
18077
- * Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
18078
- * > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
18079
- * > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
18080
- * > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
18002
+ * https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
18081
18003
  */
18082
- function encodeURIPath(str) {
18083
- return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
18084
- }
18085
- const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
18086
- const createPathTagFunction = (pathEncoder = encodeURIPath) => (function path(statics, ...params) {
18087
- // If there are no params, no processing is needed.
18088
- if (statics.length === 1)
18089
- return statics[0];
18090
- let postPath = false;
18091
- const invalidSegments = [];
18092
- const path = statics.reduce((previousValue, currentValue, index) => {
18093
- var _a, _b, _c;
18094
- if (/[?#]/.test(currentValue)) {
18095
- postPath = true;
18004
+ class LineDecoder {
18005
+ constructor() {
18006
+ this.buffer = new Uint8Array();
18007
+ this.carriageReturnIndex = null;
18008
+ this.searchIndex = 0;
18009
+ }
18010
+ decode(chunk) {
18011
+ var _a;
18012
+ if (chunk == null) {
18013
+ return [];
18096
18014
  }
18097
- const value = params[index];
18098
- let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
18099
- if (index !== params.length &&
18100
- (value == null ||
18101
- (typeof value === 'object' &&
18102
- // handle values from other realms
18103
- value.toString ===
18104
- ((_c = Object.getPrototypeOf((_b = Object.getPrototypeOf((_a = value.hasOwnProperty) !== null && _a !== void 0 ? _a : EMPTY)) !== null && _b !== void 0 ? _b : EMPTY)) === null || _c === void 0 ? void 0 : _c.toString)))) {
18105
- encoded = value + '';
18106
- invalidSegments.push({
18107
- start: previousValue.length + currentValue.length,
18108
- length: encoded.length,
18109
- error: `Value of type ${Object.prototype.toString
18110
- .call(value)
18111
- .slice(8, -1)} is not a valid path parameter`,
18112
- });
18015
+ const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
18016
+ : typeof chunk === 'string' ? encodeUTF8(chunk)
18017
+ : chunk;
18018
+ this.buffer = concatBytes([this.buffer, binaryChunk]);
18019
+ const lines = [];
18020
+ let patternIndex;
18021
+ while ((patternIndex = findNewlineIndex(this.buffer, (_a = this.carriageReturnIndex) !== null && _a !== void 0 ? _a : this.searchIndex)) != null) {
18022
+ if (patternIndex.carriage && this.carriageReturnIndex == null) {
18023
+ // skip until we either get a corresponding `\n`, a new `\r` or nothing
18024
+ this.carriageReturnIndex = patternIndex.index;
18025
+ continue;
18026
+ }
18027
+ // we got double \r or \rtext\n
18028
+ if (this.carriageReturnIndex != null &&
18029
+ (patternIndex.index !== this.carriageReturnIndex + 1 || patternIndex.carriage)) {
18030
+ lines.push(decodeUTF8(this.buffer.subarray(0, this.carriageReturnIndex - 1)));
18031
+ this.buffer = this.buffer.subarray(this.carriageReturnIndex);
18032
+ this.carriageReturnIndex = null;
18033
+ this.searchIndex = 0;
18034
+ continue;
18035
+ }
18036
+ const endIndex = this.carriageReturnIndex !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
18037
+ const line = decodeUTF8(this.buffer.subarray(0, endIndex));
18038
+ lines.push(line);
18039
+ this.buffer = this.buffer.subarray(patternIndex.index);
18040
+ this.carriageReturnIndex = null;
18041
+ this.searchIndex = 0;
18113
18042
  }
18114
- return previousValue + currentValue + (index === params.length ? '' : encoded);
18115
- }, '');
18116
- const pathOnly = path.split(/[?#]/, 1)[0];
18117
- const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
18118
- let match;
18119
- // Find all invalid segments
18120
- while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
18121
- const hasLeadingSlash = match[0].startsWith('/');
18122
- const offset = hasLeadingSlash ? 1 : 0;
18123
- const cleanMatch = hasLeadingSlash ? match[0].slice(1) : match[0];
18124
- invalidSegments.push({
18125
- start: match.index + offset,
18126
- length: cleanMatch.length,
18127
- error: `Value "${cleanMatch}" can\'t be safely passed as a path parameter`,
18128
- });
18043
+ this.searchIndex = Math.max(0, this.buffer.length - 1);
18044
+ return lines;
18129
18045
  }
18130
- invalidSegments.sort((a, b) => a.start - b.start);
18131
- if (invalidSegments.length > 0) {
18132
- let lastEnd = 0;
18133
- const underline = invalidSegments.reduce((acc, segment) => {
18134
- const spaces = ' '.repeat(segment.start - lastEnd);
18135
- const arrows = '^'.repeat(segment.length);
18136
- lastEnd = segment.start + segment.length;
18137
- return acc + spaces + arrows;
18138
- }, '');
18139
- throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:\n${invalidSegments
18140
- .map((e) => e.error)
18141
- .join('\n')}\n${path}\n${underline}`);
18046
+ flush() {
18047
+ if (!this.buffer.length) {
18048
+ return [];
18049
+ }
18050
+ return this.decode('\n');
18142
18051
  }
18143
- return path;
18144
- });
18052
+ }
18053
+ // prettier-ignore
18054
+ LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r']);
18055
+ LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
18145
18056
  /**
18146
- * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
18057
+ * This function searches the buffer for the end patterns, (\r or \n)
18058
+ * and returns an object with the index preceding the matched newline and the
18059
+ * index after the newline char. `null` is returned if no new line is found.
18060
+ *
18061
+ * ```ts
18062
+ * findNewLineIndex('abc\ndef') -> { preceding: 2, index: 3 }
18063
+ * ```
18147
18064
  */
18148
- const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
18149
-
18150
- /**
18151
- * @license
18152
- * Copyright 2025 Google LLC
18153
- * SPDX-License-Identifier: Apache-2.0
18154
- */
18155
- class BaseInteractions extends APIResource {
18156
- create(params, options) {
18157
- var _a;
18158
- const { api_version = this._client.apiVersion } = params, body = __rest(params, ["api_version"]);
18159
- if ('model' in body && 'agent_config' in body) {
18160
- throw new GeminiNextGenAPIClientError(`Invalid request: specified \`model\` and \`agent_config\`. If specifying \`model\`, use \`generation_config\`.`);
18161
- }
18162
- if ('agent' in body && 'generation_config' in body) {
18163
- throw new GeminiNextGenAPIClientError(`Invalid request: specified \`agent\` and \`generation_config\`. If specifying \`agent\`, use \`agent_config\`.`);
18164
- }
18165
- return this._client.post(path `/${api_version}/interactions`, Object.assign(Object.assign({ body }, options), { stream: (_a = params.stream) !== null && _a !== void 0 ? _a : false }));
18166
- }
18167
- /**
18168
- * Deletes the interaction by id.
18169
- *
18170
- * @example
18171
- * ```ts
18172
- * const interaction = await client.interactions.delete('id', {
18173
- * api_version: 'api_version',
18174
- * });
18175
- * ```
18176
- */
18177
- delete(id, params = {}, options) {
18178
- const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18179
- return this._client.delete(path `/${api_version}/interactions/${id}`, options);
18180
- }
18181
- /**
18182
- * Cancels an interaction by id. This only applies to background interactions that
18183
- * are still running.
18184
- *
18185
- * @example
18186
- * ```ts
18187
- * const interaction = await client.interactions.cancel('id', {
18188
- * api_version: 'api_version',
18189
- * });
18190
- * ```
18191
- */
18192
- cancel(id, params = {}, options) {
18193
- const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18194
- return this._client.post(path `/${api_version}/interactions/${id}/cancel`, options);
18195
- }
18196
- get(id, params = {}, options) {
18197
- var _a;
18198
- const _b = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _b, query = __rest(_b, ["api_version"]);
18199
- return this._client.get(path `/${api_version}/interactions/${id}`, Object.assign(Object.assign({ query }, options), { stream: (_a = params === null || params === void 0 ? void 0 : params.stream) !== null && _a !== void 0 ? _a : false }));
18200
- }
18201
- }
18202
- BaseInteractions._key = Object.freeze(['interactions']);
18203
- class Interactions extends BaseInteractions {
18204
- }
18205
-
18206
- /**
18207
- * @license
18208
- * Copyright 2025 Google LLC
18209
- * SPDX-License-Identifier: Apache-2.0
18210
- */
18211
- class BaseWebhooks extends APIResource {
18212
- /**
18213
- * Creates a new Webhook.
18214
- */
18215
- create(params, options) {
18216
- const { api_version = this._client.apiVersion } = params, body = __rest(params, ["api_version"]);
18217
- return this._client.post(path `/${api_version}/webhooks`, Object.assign({ body }, options));
18218
- }
18219
- /**
18220
- * Updates an existing Webhook.
18221
- */
18222
- update(id, params = {}, options) {
18223
- const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion, update_mask } = _a, body = __rest(_a, ["api_version", "update_mask"]);
18224
- return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
18225
- }
18226
- /**
18227
- * Lists all Webhooks.
18228
- */
18229
- list(params = {}, options) {
18230
- const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
18231
- return this._client.get(path `/${api_version}/webhooks`, Object.assign({ query }, options));
18232
- }
18233
- /**
18234
- * Deletes a Webhook.
18235
- */
18236
- delete(id, params = {}, options) {
18237
- const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18238
- return this._client.delete(path `/${api_version}/webhooks/${id}`, options);
18239
- }
18240
- /**
18241
- * Gets a specific Webhook.
18242
- */
18243
- get(id, params = {}, options) {
18244
- const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18245
- return this._client.get(path `/${api_version}/webhooks/${id}`, options);
18246
- }
18247
- /**
18248
- * Sends a ping event to a Webhook.
18249
- */
18250
- ping(id, params = undefined, options) {
18251
- const { api_version = this._client.apiVersion, body } = params !== null && params !== void 0 ? params : {};
18252
- return this._client.post(path `/${api_version}/webhooks/${id}:ping`, Object.assign({ body: body }, options));
18253
- }
18254
- /**
18255
- * Generates a new signing secret for a Webhook.
18256
- */
18257
- rotateSigningSecret(id, params = {}, options) {
18258
- const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
18259
- return this._client.post(path `/${api_version}/webhooks/${id}:rotateSigningSecret`, Object.assign({ body }, options));
18260
- }
18261
- }
18262
- BaseWebhooks._key = Object.freeze(['webhooks']);
18263
- class Webhooks extends BaseWebhooks {
18264
- }
18265
-
18266
- /**
18267
- * @license
18268
- * Copyright 2025 Google LLC
18269
- * SPDX-License-Identifier: Apache-2.0
18270
- */
18271
- function concatBytes(buffers) {
18272
- let length = 0;
18273
- for (const buffer of buffers) {
18274
- length += buffer.length;
18275
- }
18276
- const output = new Uint8Array(length);
18277
- let index = 0;
18278
- for (const buffer of buffers) {
18279
- output.set(buffer, index);
18280
- index += buffer.length;
18281
- }
18282
- return output;
18283
- }
18284
- let encodeUTF8_;
18285
- function encodeUTF8(str) {
18286
- let encoder;
18287
- return (encodeUTF8_ !== null && encodeUTF8_ !== void 0 ? encodeUTF8_ : ((encoder = new globalThis.TextEncoder()), (encodeUTF8_ = encoder.encode.bind(encoder))))(str);
18288
- }
18289
- let decodeUTF8_;
18290
- function decodeUTF8(bytes) {
18291
- let decoder;
18292
- return (decodeUTF8_ !== null && decodeUTF8_ !== void 0 ? decodeUTF8_ : ((decoder = new globalThis.TextDecoder()), (decodeUTF8_ = decoder.decode.bind(decoder))))(bytes);
18293
- }
18294
-
18295
- /**
18296
- * @license
18297
- * Copyright 2025 Google LLC
18298
- * SPDX-License-Identifier: Apache-2.0
18299
- */
18300
- /**
18301
- * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
18302
- * reading lines from text.
18303
- *
18304
- * https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
18305
- */
18306
- class LineDecoder {
18307
- constructor() {
18308
- this.buffer = new Uint8Array();
18309
- this.carriageReturnIndex = null;
18310
- this.searchIndex = 0;
18311
- }
18312
- decode(chunk) {
18313
- var _a;
18314
- if (chunk == null) {
18315
- return [];
18316
- }
18317
- const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
18318
- : typeof chunk === 'string' ? encodeUTF8(chunk)
18319
- : chunk;
18320
- this.buffer = concatBytes([this.buffer, binaryChunk]);
18321
- const lines = [];
18322
- let patternIndex;
18323
- while ((patternIndex = findNewlineIndex(this.buffer, (_a = this.carriageReturnIndex) !== null && _a !== void 0 ? _a : this.searchIndex)) != null) {
18324
- if (patternIndex.carriage && this.carriageReturnIndex == null) {
18325
- // skip until we either get a corresponding `\n`, a new `\r` or nothing
18326
- this.carriageReturnIndex = patternIndex.index;
18327
- continue;
18328
- }
18329
- // we got double \r or \rtext\n
18330
- if (this.carriageReturnIndex != null &&
18331
- (patternIndex.index !== this.carriageReturnIndex + 1 || patternIndex.carriage)) {
18332
- lines.push(decodeUTF8(this.buffer.subarray(0, this.carriageReturnIndex - 1)));
18333
- this.buffer = this.buffer.subarray(this.carriageReturnIndex);
18334
- this.carriageReturnIndex = null;
18335
- this.searchIndex = 0;
18336
- continue;
18337
- }
18338
- const endIndex = this.carriageReturnIndex !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
18339
- const line = decodeUTF8(this.buffer.subarray(0, endIndex));
18340
- lines.push(line);
18341
- this.buffer = this.buffer.subarray(patternIndex.index);
18342
- this.carriageReturnIndex = null;
18343
- this.searchIndex = 0;
18344
- }
18345
- this.searchIndex = Math.max(0, this.buffer.length - 1);
18346
- return lines;
18347
- }
18348
- flush() {
18349
- if (!this.buffer.length) {
18350
- return [];
18351
- }
18352
- return this.decode('\n');
18353
- }
18354
- }
18355
- // prettier-ignore
18356
- LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r']);
18357
- LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
18358
- /**
18359
- * This function searches the buffer for the end patterns, (\r or \n)
18360
- * and returns an object with the index preceding the matched newline and the
18361
- * index after the newline char. `null` is returned if no new line is found.
18362
- *
18363
- * ```ts
18364
- * findNewLineIndex('abc\ndef') -> { preceding: 2, index: 3 }
18365
- * ```
18366
- */
18367
- function findNewlineIndex(buffer, startIndex) {
18368
- const newline = 0x0a; // \n
18369
- const carriage = 0x0d; // \r
18370
- const start = startIndex !== null && startIndex !== void 0 ? startIndex : 0;
18371
- const nextNewline = buffer.indexOf(newline, start);
18372
- const nextCarriage = buffer.indexOf(carriage, start);
18373
- if (nextNewline === -1 && nextCarriage === -1) {
18374
- return null;
18375
- }
18376
- let i;
18377
- if (nextNewline !== -1 && nextCarriage !== -1) {
18378
- i = Math.min(nextNewline, nextCarriage);
18379
- }
18380
- else {
18381
- i = nextNewline !== -1 ? nextNewline : nextCarriage;
18382
- }
18383
- if (buffer[i] === newline) {
18384
- return { preceding: i, index: i + 1, carriage: false };
18385
- }
18386
- return { preceding: i, index: i + 1, carriage: true };
18387
- }
18065
+ function findNewlineIndex(buffer, startIndex) {
18066
+ const newline = 0x0a; // \n
18067
+ const carriage = 0x0d; // \r
18068
+ const start = startIndex !== null && startIndex !== void 0 ? startIndex : 0;
18069
+ const nextNewline = buffer.indexOf(newline, start);
18070
+ const nextCarriage = buffer.indexOf(carriage, start);
18071
+ if (nextNewline === -1 && nextCarriage === -1) {
18072
+ return null;
18073
+ }
18074
+ let i;
18075
+ if (nextNewline !== -1 && nextCarriage !== -1) {
18076
+ i = Math.min(nextNewline, nextCarriage);
18077
+ }
18078
+ else {
18079
+ i = nextNewline !== -1 ? nextNewline : nextCarriage;
18080
+ }
18081
+ if (buffer[i] === newline) {
18082
+ return { preceding: i, index: i + 1, carriage: false };
18083
+ }
18084
+ return { preceding: i, index: i + 1, carriage: true };
18085
+ }
18388
18086
 
18389
18087
  /**
18390
18088
  * @license
@@ -18798,6 +18496,338 @@ function partition(str, delimiter) {
18798
18496
  return [str, '', ''];
18799
18497
  }
18800
18498
 
18499
+ /**
18500
+ * @license
18501
+ * Copyright 2025 Google LLC
18502
+ * SPDX-License-Identifier: Apache-2.0
18503
+ */
18504
+ const LEGACY_LYRIA_MODELS = new Set([
18505
+ 'lyria-3-pro-preview',
18506
+ 'lyria-3-clip-preview',
18507
+ ]);
18508
+ const LEGACY_EVENT_TYPE_RENAMES = {
18509
+ 'interaction.start': 'interaction.created',
18510
+ 'content.start': 'step.start',
18511
+ 'content.delta': 'step.delta',
18512
+ 'content.stop': 'step.stop',
18513
+ 'interaction.complete': 'interaction.completed',
18514
+ };
18515
+ function isLegacyLyriaRequest({ isVertex, model }) {
18516
+ return Boolean(isVertex) && typeof model === 'string' && LEGACY_LYRIA_MODELS.has(model);
18517
+ }
18518
+ /**
18519
+ * Detect whether a client is in vertex mode. Reads the `clientAdapter` field
18520
+ * directly because `BaseGeminiNextGenAPIClient` keeps it `private`; centralizing
18521
+ * the runtime cast here avoids leaking it into resource files.
18522
+ */
18523
+ function isVertexClient(client) {
18524
+ const adapter = client.clientAdapter;
18525
+ return Boolean(adapter && adapter.isVertexAI());
18526
+ }
18527
+ function isPlainObject(value) {
18528
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
18529
+ }
18530
+ /**
18531
+ * Wrap a legacy `outputs: Array<Content>` payload into the modern
18532
+ * `steps: [{type: 'model_output', content: outputs}]` shape. Returns the input
18533
+ * unchanged when `steps` already wins or `outputs` is absent.
18534
+ */
18535
+ function wrapOutputsAsSteps(data) {
18536
+ if (!('outputs' in data) || 'steps' in data) {
18537
+ return data;
18538
+ }
18539
+ const { outputs } = data, rest = __rest(data, ["outputs"]);
18540
+ return Object.assign(Object.assign({}, rest), { steps: [{ type: 'model_output', content: outputs }] });
18541
+ }
18542
+ /**
18543
+ * Non-streaming: rewrite a legacy interaction response so consumers see the
18544
+ * modern `steps` shape.
18545
+ */
18546
+ function coerceLegacyInteractionResponse(data) {
18547
+ if (!isPlainObject(data))
18548
+ return data;
18549
+ return wrapOutputsAsSteps(data);
18550
+ }
18551
+ /**
18552
+ * Streaming: translate one legacy SSE event to its modern equivalent.
18553
+ *
18554
+ * Returns the input unchanged when the `event_type` is not one of the legacy
18555
+ * ones we know how to map. Two non-trivial cases:
18556
+ * 1. `content.start` carries `content: <Content>` — the modern `step.start`
18557
+ * expects `step: {type: 'model_output', content: [<Content>]}`.
18558
+ * 2. `interaction.start` / `interaction.complete` wrap an `interaction`
18559
+ * object that may itself carry the legacy `outputs` field; recurse.
18560
+ */
18561
+ function maybeRemapLegacyStreamEvent(data) {
18562
+ if (!isPlainObject(data))
18563
+ return data;
18564
+ const eventType = data['event_type'];
18565
+ if (typeof eventType !== 'string' || !(eventType in LEGACY_EVENT_TYPE_RENAMES)) {
18566
+ return data;
18567
+ }
18568
+ const renamed = Object.assign(Object.assign({}, data), { event_type: LEGACY_EVENT_TYPE_RENAMES[eventType] });
18569
+ if (eventType === 'content.start') {
18570
+ const { content } = renamed, rest = __rest(renamed, ["content"]);
18571
+ let stepContent;
18572
+ if (content == null) {
18573
+ stepContent = [];
18574
+ }
18575
+ else if (Array.isArray(content)) {
18576
+ stepContent = content;
18577
+ }
18578
+ else {
18579
+ stepContent = [content];
18580
+ }
18581
+ return Object.assign(Object.assign({}, rest), { step: { type: 'model_output', content: stepContent } });
18582
+ }
18583
+ if (eventType === 'interaction.start' || eventType === 'interaction.complete') {
18584
+ const inner = renamed['interaction'];
18585
+ if (isPlainObject(inner)) {
18586
+ renamed['interaction'] = wrapOutputsAsSteps(inner);
18587
+ }
18588
+ }
18589
+ return renamed;
18590
+ }
18591
+ /**
18592
+ * Stream subclass that runs each yielded SSE event through
18593
+ * `maybeRemapLegacyStreamEvent` so consumers always see modern event shapes.
18594
+ *
18595
+ * Wired in via the `__streamClass` request option from `resources/interactions.ts`
18596
+ * (read by `src/internal/parse.ts:defaultParseResponse`).
18597
+ */
18598
+ class LegacyLyriaStream extends Stream {
18599
+ static fromSSEResponse(response, controller, client) {
18600
+ const base = Stream.fromSSEResponse(response, controller, client);
18601
+ function wrappedIterator() {
18602
+ return __asyncGenerator(this, arguments, function* wrappedIterator_1() {
18603
+ var _a, e_1, _b, _c;
18604
+ try {
18605
+ for (var _d = true, base_1 = __asyncValues(base), base_1_1; base_1_1 = yield __await(base_1.next()), _a = base_1_1.done, !_a; _d = true) {
18606
+ _c = base_1_1.value;
18607
+ _d = false;
18608
+ const item = _c;
18609
+ yield yield __await(maybeRemapLegacyStreamEvent(item));
18610
+ }
18611
+ }
18612
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
18613
+ finally {
18614
+ try {
18615
+ if (!_d && !_a && (_b = base_1.return)) yield __await(_b.call(base_1));
18616
+ }
18617
+ finally { if (e_1) throw e_1.error; }
18618
+ }
18619
+ });
18620
+ }
18621
+ return new LegacyLyriaStream(wrappedIterator, controller, client);
18622
+ }
18623
+ }
18624
+
18625
+ /**
18626
+ * @license
18627
+ * Copyright 2025 Google LLC
18628
+ * SPDX-License-Identifier: Apache-2.0
18629
+ */
18630
+ /**
18631
+ * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
18632
+ *
18633
+ * Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
18634
+ * > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
18635
+ * > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
18636
+ * > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
18637
+ */
18638
+ function encodeURIPath(str) {
18639
+ return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
18640
+ }
18641
+ const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
18642
+ const createPathTagFunction = (pathEncoder = encodeURIPath) => (function path(statics, ...params) {
18643
+ // If there are no params, no processing is needed.
18644
+ if (statics.length === 1)
18645
+ return statics[0];
18646
+ let postPath = false;
18647
+ const invalidSegments = [];
18648
+ const path = statics.reduce((previousValue, currentValue, index) => {
18649
+ var _a, _b, _c;
18650
+ if (/[?#]/.test(currentValue)) {
18651
+ postPath = true;
18652
+ }
18653
+ const value = params[index];
18654
+ let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
18655
+ if (index !== params.length &&
18656
+ (value == null ||
18657
+ (typeof value === 'object' &&
18658
+ // handle values from other realms
18659
+ value.toString ===
18660
+ ((_c = Object.getPrototypeOf((_b = Object.getPrototypeOf((_a = value.hasOwnProperty) !== null && _a !== void 0 ? _a : EMPTY)) !== null && _b !== void 0 ? _b : EMPTY)) === null || _c === void 0 ? void 0 : _c.toString)))) {
18661
+ encoded = value + '';
18662
+ invalidSegments.push({
18663
+ start: previousValue.length + currentValue.length,
18664
+ length: encoded.length,
18665
+ error: `Value of type ${Object.prototype.toString
18666
+ .call(value)
18667
+ .slice(8, -1)} is not a valid path parameter`,
18668
+ });
18669
+ }
18670
+ return previousValue + currentValue + (index === params.length ? '' : encoded);
18671
+ }, '');
18672
+ const pathOnly = path.split(/[?#]/, 1)[0];
18673
+ const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
18674
+ let match;
18675
+ // Find all invalid segments
18676
+ while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
18677
+ const hasLeadingSlash = match[0].startsWith('/');
18678
+ const offset = hasLeadingSlash ? 1 : 0;
18679
+ const cleanMatch = hasLeadingSlash ? match[0].slice(1) : match[0];
18680
+ invalidSegments.push({
18681
+ start: match.index + offset,
18682
+ length: cleanMatch.length,
18683
+ error: `Value "${cleanMatch}" can\'t be safely passed as a path parameter`,
18684
+ });
18685
+ }
18686
+ invalidSegments.sort((a, b) => a.start - b.start);
18687
+ if (invalidSegments.length > 0) {
18688
+ let lastEnd = 0;
18689
+ const underline = invalidSegments.reduce((acc, segment) => {
18690
+ const spaces = ' '.repeat(segment.start - lastEnd);
18691
+ const arrows = '^'.repeat(segment.length);
18692
+ lastEnd = segment.start + segment.length;
18693
+ return acc + spaces + arrows;
18694
+ }, '');
18695
+ throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:\n${invalidSegments
18696
+ .map((e) => e.error)
18697
+ .join('\n')}\n${path}\n${underline}`);
18698
+ }
18699
+ return path;
18700
+ });
18701
+ /**
18702
+ * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
18703
+ */
18704
+ const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
18705
+
18706
+ /**
18707
+ * @license
18708
+ * Copyright 2025 Google LLC
18709
+ * SPDX-License-Identifier: Apache-2.0
18710
+ */
18711
+ class BaseInteractions extends APIResource {
18712
+ create(params, options) {
18713
+ var _a;
18714
+ const { api_version = this._client.apiVersion } = params, body = __rest(params, ["api_version"]);
18715
+ if ('model' in body && 'agent_config' in body) {
18716
+ throw new GeminiNextGenAPIClientError(`Invalid request: specified \`model\` and \`agent_config\`. If specifying \`model\`, use \`generation_config\`.`);
18717
+ }
18718
+ if ('agent' in body && 'generation_config' in body) {
18719
+ throw new GeminiNextGenAPIClientError(`Invalid request: specified \`agent\` and \`generation_config\`. If specifying \`agent\`, use \`agent_config\`.`);
18720
+ }
18721
+ const needsLegacyLyriaShim = isLegacyLyriaRequest({
18722
+ isVertex: isVertexClient(this._client),
18723
+ model: 'model' in body ? body.model : undefined,
18724
+ });
18725
+ const isStreaming = (_a = params.stream) !== null && _a !== void 0 ? _a : false;
18726
+ const promise = this._client.post(path `/${api_version}/interactions`, Object.assign(Object.assign(Object.assign({ body }, options), { stream: isStreaming }), (needsLegacyLyriaShim && isStreaming ? { __streamClass: LegacyLyriaStream } : {})));
18727
+ if (needsLegacyLyriaShim && !isStreaming) {
18728
+ return promise._thenUnwrap((data) => coerceLegacyInteractionResponse(data));
18729
+ }
18730
+ return promise;
18731
+ }
18732
+ /**
18733
+ * Deletes the interaction by id.
18734
+ *
18735
+ * @example
18736
+ * ```ts
18737
+ * const interaction = await client.interactions.delete('id', {
18738
+ * api_version: 'api_version',
18739
+ * });
18740
+ * ```
18741
+ */
18742
+ delete(id, params = {}, options) {
18743
+ const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18744
+ return this._client.delete(path `/${api_version}/interactions/${id}`, options);
18745
+ }
18746
+ /**
18747
+ * Cancels an interaction by id. This only applies to background interactions that
18748
+ * are still running.
18749
+ *
18750
+ * @example
18751
+ * ```ts
18752
+ * const interaction = await client.interactions.cancel('id', {
18753
+ * api_version: 'api_version',
18754
+ * });
18755
+ * ```
18756
+ */
18757
+ cancel(id, params = {}, options) {
18758
+ const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18759
+ return this._client.post(path `/${api_version}/interactions/${id}/cancel`, options);
18760
+ }
18761
+ get(id, params = {}, options) {
18762
+ var _a;
18763
+ const _b = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _b, query = __rest(_b, ["api_version"]);
18764
+ return this._client.get(path `/${api_version}/interactions/${id}`, Object.assign(Object.assign({ query }, options), { stream: (_a = params === null || params === void 0 ? void 0 : params.stream) !== null && _a !== void 0 ? _a : false }));
18765
+ }
18766
+ }
18767
+ BaseInteractions._key = Object.freeze(['interactions']);
18768
+ class Interactions extends BaseInteractions {
18769
+ }
18770
+
18771
+ /**
18772
+ * @license
18773
+ * Copyright 2025 Google LLC
18774
+ * SPDX-License-Identifier: Apache-2.0
18775
+ */
18776
+ class BaseWebhooks extends APIResource {
18777
+ /**
18778
+ * Creates a new Webhook.
18779
+ */
18780
+ create(params, options) {
18781
+ const { api_version = this._client.apiVersion } = params, body = __rest(params, ["api_version"]);
18782
+ return this._client.post(path `/${api_version}/webhooks`, Object.assign({ body }, options));
18783
+ }
18784
+ /**
18785
+ * Updates an existing Webhook.
18786
+ */
18787
+ update(id, params = {}, options) {
18788
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion, update_mask } = _a, body = __rest(_a, ["api_version", "update_mask"]);
18789
+ return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
18790
+ }
18791
+ /**
18792
+ * Lists all Webhooks.
18793
+ */
18794
+ list(params = {}, options) {
18795
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
18796
+ return this._client.get(path `/${api_version}/webhooks`, Object.assign({ query }, options));
18797
+ }
18798
+ /**
18799
+ * Deletes a Webhook.
18800
+ */
18801
+ delete(id, params = {}, options) {
18802
+ const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18803
+ return this._client.delete(path `/${api_version}/webhooks/${id}`, options);
18804
+ }
18805
+ /**
18806
+ * Gets a specific Webhook.
18807
+ */
18808
+ get(id, params = {}, options) {
18809
+ const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
18810
+ return this._client.get(path `/${api_version}/webhooks/${id}`, options);
18811
+ }
18812
+ /**
18813
+ * Sends a ping event to a Webhook.
18814
+ */
18815
+ ping(id, params = undefined, options) {
18816
+ const { api_version = this._client.apiVersion, body } = params !== null && params !== void 0 ? params : {};
18817
+ return this._client.post(path `/${api_version}/webhooks/${id}:ping`, Object.assign({ body: body }, options));
18818
+ }
18819
+ /**
18820
+ * Generates a new signing secret for a Webhook.
18821
+ */
18822
+ rotateSigningSecret(id, params = {}, options) {
18823
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
18824
+ return this._client.post(path `/${api_version}/webhooks/${id}:rotateSigningSecret`, Object.assign({ body }, options));
18825
+ }
18826
+ }
18827
+ BaseWebhooks._key = Object.freeze(['webhooks']);
18828
+ class Webhooks extends BaseWebhooks {
18829
+ }
18830
+
18801
18831
  /**
18802
18832
  * @license
18803
18833
  * Copyright 2025 Google LLC
@@ -19696,7 +19726,7 @@ function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
19696
19726
  function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
19697
19727
  const toObject = {};
19698
19728
  if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
19699
- throw new Error('validationDataset parameter is not supported in Gemini API.');
19729
+ throw new Error('validationDataset parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19700
19730
  }
19701
19731
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
19702
19732
  'tunedModelDisplayName',
@@ -19705,7 +19735,7 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
19705
19735
  setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
19706
19736
  }
19707
19737
  if (getValueByPath(fromObject, ['description']) !== undefined) {
19708
- throw new Error('description parameter is not supported in Gemini API.');
19738
+ throw new Error('description parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19709
19739
  }
19710
19740
  const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
19711
19741
  if (parentObject !== undefined && fromEpochCount != null) {
@@ -19719,20 +19749,20 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
19719
19749
  }
19720
19750
  if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
19721
19751
  undefined) {
19722
- throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
19752
+ throw new Error('exportLastCheckpointOnly parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19723
19753
  }
19724
19754
  if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
19725
19755
  undefined) {
19726
- throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
19756
+ throw new Error('preTunedModelCheckpointId parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19727
19757
  }
19728
19758
  if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
19729
- throw new Error('adapterSize parameter is not supported in Gemini API.');
19759
+ throw new Error('adapterSize parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19730
19760
  }
19731
19761
  if (getValueByPath(fromObject, ['tuningMode']) !== undefined) {
19732
- throw new Error('tuningMode parameter is not supported in Gemini API.');
19762
+ throw new Error('tuningMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19733
19763
  }
19734
19764
  if (getValueByPath(fromObject, ['customBaseModel']) !== undefined) {
19735
- throw new Error('customBaseModel parameter is not supported in Gemini API.');
19765
+ throw new Error('customBaseModel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19736
19766
  }
19737
19767
  const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
19738
19768
  if (parentObject !== undefined && fromBatchSize != null) {
@@ -19743,25 +19773,25 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
19743
19773
  setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
19744
19774
  }
19745
19775
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
19746
- throw new Error('labels parameter is not supported in Gemini API.');
19776
+ throw new Error('labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19747
19777
  }
19748
19778
  if (getValueByPath(fromObject, ['beta']) !== undefined) {
19749
- throw new Error('beta parameter is not supported in Gemini API.');
19779
+ throw new Error('beta parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19750
19780
  }
19751
19781
  if (getValueByPath(fromObject, ['baseTeacherModel']) !== undefined) {
19752
- throw new Error('baseTeacherModel parameter is not supported in Gemini API.');
19782
+ throw new Error('baseTeacherModel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19753
19783
  }
19754
19784
  if (getValueByPath(fromObject, ['tunedTeacherModelSource']) !== undefined) {
19755
- throw new Error('tunedTeacherModelSource parameter is not supported in Gemini API.');
19785
+ throw new Error('tunedTeacherModelSource parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19756
19786
  }
19757
19787
  if (getValueByPath(fromObject, ['sftLossWeightMultiplier']) !== undefined) {
19758
- throw new Error('sftLossWeightMultiplier parameter is not supported in Gemini API.');
19788
+ throw new Error('sftLossWeightMultiplier parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19759
19789
  }
19760
19790
  if (getValueByPath(fromObject, ['outputUri']) !== undefined) {
19761
- throw new Error('outputUri parameter is not supported in Gemini API.');
19791
+ throw new Error('outputUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19762
19792
  }
19763
19793
  if (getValueByPath(fromObject, ['encryptionSpec']) !== undefined) {
19764
- throw new Error('encryptionSpec parameter is not supported in Gemini API.');
19794
+ throw new Error('encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
19765
19795
  }
19766
19796
  return toObject;
19767
19797
  }
@@ -20155,10 +20185,10 @@ function tunedModelFromMldev(fromObject, _rootObject) {
20155
20185
  function tuningDatasetToMldev(fromObject, _rootObject) {
20156
20186
  const toObject = {};
20157
20187
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
20158
- throw new Error('gcsUri parameter is not supported in Gemini API.');
20188
+ throw new Error('gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
20159
20189
  }
20160
20190
  if (getValueByPath(fromObject, ['vertexDatasetResource']) !== undefined) {
20161
- throw new Error('vertexDatasetResource parameter is not supported in Gemini API.');
20191
+ throw new Error('vertexDatasetResource parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
20162
20192
  }
20163
20193
  const fromExamples = getValueByPath(fromObject, ['examples']);
20164
20194
  if (fromExamples != null) {
@@ -20231,7 +20261,7 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
20231
20261
  }
20232
20262
  }
20233
20263
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
20234
- throw new Error('examples parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
20264
+ throw new Error('examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
20235
20265
  }
20236
20266
  return toObject;
20237
20267
  }