@google/genai 1.48.0 → 1.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/genai.d.ts +812 -85
- package/dist/index.cjs +348 -203
- package/dist/index.mjs +348 -203
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +348 -200
- package/dist/node/index.mjs +348 -200
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +812 -85
- package/dist/tokenizer/node.cjs +100 -0
- package/dist/tokenizer/node.d.ts +5 -1
- package/dist/tokenizer/node.mjs +100 -0
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +103 -2
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +169 -3
- package/dist/vertex_internal/index.js +103 -2
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +349 -200
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +812 -85
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -1243,6 +1243,10 @@ exports.Modality = void 0;
|
|
|
1243
1243
|
* Indicates the model should return audio.
|
|
1244
1244
|
*/
|
|
1245
1245
|
Modality["AUDIO"] = "AUDIO";
|
|
1246
|
+
/**
|
|
1247
|
+
* Indicates the model should return video.
|
|
1248
|
+
*/
|
|
1249
|
+
Modality["VIDEO"] = "VIDEO";
|
|
1246
1250
|
})(exports.Modality || (exports.Modality = {}));
|
|
1247
1251
|
/** The stage of the underlying model. This enum is not supported in Vertex AI. */
|
|
1248
1252
|
exports.ModelStage = void 0;
|
|
@@ -1837,6 +1841,102 @@ exports.TurnCompleteReason = void 0;
|
|
|
1837
1841
|
* Needs more input from the user.
|
|
1838
1842
|
*/
|
|
1839
1843
|
TurnCompleteReason["NEED_MORE_INPUT"] = "NEED_MORE_INPUT";
|
|
1844
|
+
/**
|
|
1845
|
+
* Input content is prohibited.
|
|
1846
|
+
*/
|
|
1847
|
+
TurnCompleteReason["PROHIBITED_INPUT_CONTENT"] = "PROHIBITED_INPUT_CONTENT";
|
|
1848
|
+
/**
|
|
1849
|
+
* Input image contains prohibited content.
|
|
1850
|
+
*/
|
|
1851
|
+
TurnCompleteReason["IMAGE_PROHIBITED_INPUT_CONTENT"] = "IMAGE_PROHIBITED_INPUT_CONTENT";
|
|
1852
|
+
/**
|
|
1853
|
+
* Input text contains prominent person reference.
|
|
1854
|
+
*/
|
|
1855
|
+
TurnCompleteReason["INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED"] = "INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED";
|
|
1856
|
+
/**
|
|
1857
|
+
* Input image contains celebrity.
|
|
1858
|
+
*/
|
|
1859
|
+
TurnCompleteReason["INPUT_IMAGE_CELEBRITY"] = "INPUT_IMAGE_CELEBRITY";
|
|
1860
|
+
/**
|
|
1861
|
+
* Input image contains photo realistic child.
|
|
1862
|
+
*/
|
|
1863
|
+
TurnCompleteReason["INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED"] = "INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED";
|
|
1864
|
+
/**
|
|
1865
|
+
* Input text contains NCII content.
|
|
1866
|
+
*/
|
|
1867
|
+
TurnCompleteReason["INPUT_TEXT_NCII_PROHIBITED"] = "INPUT_TEXT_NCII_PROHIBITED";
|
|
1868
|
+
/**
|
|
1869
|
+
* Other input safety issue.
|
|
1870
|
+
*/
|
|
1871
|
+
TurnCompleteReason["INPUT_OTHER"] = "INPUT_OTHER";
|
|
1872
|
+
/**
|
|
1873
|
+
* Input contains IP violation.
|
|
1874
|
+
*/
|
|
1875
|
+
TurnCompleteReason["INPUT_IP_PROHIBITED"] = "INPUT_IP_PROHIBITED";
|
|
1876
|
+
/**
|
|
1877
|
+
* Input matched blocklist.
|
|
1878
|
+
*/
|
|
1879
|
+
TurnCompleteReason["BLOCKLIST"] = "BLOCKLIST";
|
|
1880
|
+
/**
|
|
1881
|
+
* Input is unsafe for image generation.
|
|
1882
|
+
*/
|
|
1883
|
+
TurnCompleteReason["UNSAFE_PROMPT_FOR_IMAGE_GENERATION"] = "UNSAFE_PROMPT_FOR_IMAGE_GENERATION";
|
|
1884
|
+
/**
|
|
1885
|
+
* Generated image failed safety check.
|
|
1886
|
+
*/
|
|
1887
|
+
TurnCompleteReason["GENERATED_IMAGE_SAFETY"] = "GENERATED_IMAGE_SAFETY";
|
|
1888
|
+
/**
|
|
1889
|
+
* Generated content failed safety check.
|
|
1890
|
+
*/
|
|
1891
|
+
TurnCompleteReason["GENERATED_CONTENT_SAFETY"] = "GENERATED_CONTENT_SAFETY";
|
|
1892
|
+
/**
|
|
1893
|
+
* Generated audio failed safety check.
|
|
1894
|
+
*/
|
|
1895
|
+
TurnCompleteReason["GENERATED_AUDIO_SAFETY"] = "GENERATED_AUDIO_SAFETY";
|
|
1896
|
+
/**
|
|
1897
|
+
* Generated video failed safety check.
|
|
1898
|
+
*/
|
|
1899
|
+
TurnCompleteReason["GENERATED_VIDEO_SAFETY"] = "GENERATED_VIDEO_SAFETY";
|
|
1900
|
+
/**
|
|
1901
|
+
* Generated content is prohibited.
|
|
1902
|
+
*/
|
|
1903
|
+
TurnCompleteReason["GENERATED_CONTENT_PROHIBITED"] = "GENERATED_CONTENT_PROHIBITED";
|
|
1904
|
+
/**
|
|
1905
|
+
* Generated content matched blocklist.
|
|
1906
|
+
*/
|
|
1907
|
+
TurnCompleteReason["GENERATED_CONTENT_BLOCKLIST"] = "GENERATED_CONTENT_BLOCKLIST";
|
|
1908
|
+
/**
|
|
1909
|
+
* Generated image is prohibited.
|
|
1910
|
+
*/
|
|
1911
|
+
TurnCompleteReason["GENERATED_IMAGE_PROHIBITED"] = "GENERATED_IMAGE_PROHIBITED";
|
|
1912
|
+
/**
|
|
1913
|
+
* Generated image contains celebrity.
|
|
1914
|
+
*/
|
|
1915
|
+
TurnCompleteReason["GENERATED_IMAGE_CELEBRITY"] = "GENERATED_IMAGE_CELEBRITY";
|
|
1916
|
+
/**
|
|
1917
|
+
* Generated image contains prominent people detected by rewriter.
|
|
1918
|
+
*/
|
|
1919
|
+
TurnCompleteReason["GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER"] = "GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER";
|
|
1920
|
+
/**
|
|
1921
|
+
* Generated image contains identifiable people.
|
|
1922
|
+
*/
|
|
1923
|
+
TurnCompleteReason["GENERATED_IMAGE_IDENTIFIABLE_PEOPLE"] = "GENERATED_IMAGE_IDENTIFIABLE_PEOPLE";
|
|
1924
|
+
/**
|
|
1925
|
+
* Generated image contains minors.
|
|
1926
|
+
*/
|
|
1927
|
+
TurnCompleteReason["GENERATED_IMAGE_MINORS"] = "GENERATED_IMAGE_MINORS";
|
|
1928
|
+
/**
|
|
1929
|
+
* Generated image contains IP violation.
|
|
1930
|
+
*/
|
|
1931
|
+
TurnCompleteReason["OUTPUT_IMAGE_IP_PROHIBITED"] = "OUTPUT_IMAGE_IP_PROHIBITED";
|
|
1932
|
+
/**
|
|
1933
|
+
* Other generated content issue.
|
|
1934
|
+
*/
|
|
1935
|
+
TurnCompleteReason["GENERATED_OTHER"] = "GENERATED_OTHER";
|
|
1936
|
+
/**
|
|
1937
|
+
* Max regeneration attempts reached.
|
|
1938
|
+
*/
|
|
1939
|
+
TurnCompleteReason["MAX_REGENERATION_REACHED"] = "MAX_REGENERATION_REACHED";
|
|
1840
1940
|
})(exports.TurnCompleteReason || (exports.TurnCompleteReason = {}));
|
|
1841
1941
|
/** Server content modalities. */
|
|
1842
1942
|
exports.MediaModality = void 0;
|
|
@@ -4082,6 +4182,12 @@ function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
|
4082
4182
|
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
4083
4183
|
throw new Error('dest parameter is not supported in Gemini API.');
|
|
4084
4184
|
}
|
|
4185
|
+
const fromWebhookConfig = getValueByPath(fromObject, [
|
|
4186
|
+
'webhookConfig',
|
|
4187
|
+
]);
|
|
4188
|
+
if (parentObject !== undefined && fromWebhookConfig != null) {
|
|
4189
|
+
setValueByPath(parentObject, ['batch', 'webhookConfig'], fromWebhookConfig);
|
|
4190
|
+
}
|
|
4085
4191
|
return toObject;
|
|
4086
4192
|
}
|
|
4087
4193
|
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -4094,6 +4200,9 @@ function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
|
4094
4200
|
if (parentObject !== undefined && fromDest != null) {
|
|
4095
4201
|
setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
|
|
4096
4202
|
}
|
|
4203
|
+
if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
|
|
4204
|
+
throw new Error('webhookConfig parameter is not supported in Vertex AI.');
|
|
4205
|
+
}
|
|
4097
4206
|
return toObject;
|
|
4098
4207
|
}
|
|
4099
4208
|
function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
@@ -4253,6 +4362,12 @@ function embedContentConfigToMldev$1(fromObject, parentObject) {
|
|
|
4253
4362
|
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
4254
4363
|
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
4255
4364
|
}
|
|
4365
|
+
if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
|
|
4366
|
+
throw new Error('documentOcr parameter is not supported in Gemini API.');
|
|
4367
|
+
}
|
|
4368
|
+
if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
|
|
4369
|
+
throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
|
|
4370
|
+
}
|
|
4256
4371
|
return toObject;
|
|
4257
4372
|
}
|
|
4258
4373
|
function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
|
|
@@ -4419,7 +4534,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
|
4419
4534
|
let transformedList = fromSafetySettings;
|
|
4420
4535
|
if (Array.isArray(transformedList)) {
|
|
4421
4536
|
transformedList = transformedList.map((item) => {
|
|
4422
|
-
return safetySettingToMldev$
|
|
4537
|
+
return safetySettingToMldev$3(item);
|
|
4423
4538
|
});
|
|
4424
4539
|
}
|
|
4425
4540
|
setValueByPath(parentObject, ['safetySettings'], transformedList);
|
|
@@ -4826,7 +4941,7 @@ function partToMldev$4(fromObject) {
|
|
|
4826
4941
|
}
|
|
4827
4942
|
return toObject;
|
|
4828
4943
|
}
|
|
4829
|
-
function safetySettingToMldev$
|
|
4944
|
+
function safetySettingToMldev$3(fromObject) {
|
|
4830
4945
|
const toObject = {};
|
|
4831
4946
|
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
4832
4947
|
if (fromCategory != null) {
|
|
@@ -7944,7 +8059,7 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7944
8059
|
}
|
|
7945
8060
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7946
8061
|
if (fromSpeechConfig != null) {
|
|
7947
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
8062
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
7948
8063
|
}
|
|
7949
8064
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
7950
8065
|
'stopSequences',
|
|
@@ -8119,6 +8234,22 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
8119
8234
|
if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
|
|
8120
8235
|
throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
|
|
8121
8236
|
}
|
|
8237
|
+
const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
|
|
8238
|
+
if (parentObject !== undefined && fromAvatarConfig != null) {
|
|
8239
|
+
setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
|
|
8240
|
+
}
|
|
8241
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
8242
|
+
'safetySettings',
|
|
8243
|
+
]);
|
|
8244
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
8245
|
+
let transformedList = fromSafetySettings;
|
|
8246
|
+
if (Array.isArray(transformedList)) {
|
|
8247
|
+
transformedList = transformedList.map((item) => {
|
|
8248
|
+
return safetySettingToMldev$2(item);
|
|
8249
|
+
});
|
|
8250
|
+
}
|
|
8251
|
+
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8252
|
+
}
|
|
8122
8253
|
return toObject;
|
|
8123
8254
|
}
|
|
8124
8255
|
function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
@@ -8165,7 +8296,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8165
8296
|
}
|
|
8166
8297
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
8167
8298
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
8168
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'],
|
|
8299
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
|
|
8169
8300
|
}
|
|
8170
8301
|
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
8171
8302
|
'thinkingConfig',
|
|
@@ -8235,6 +8366,22 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8235
8366
|
if (parentObject !== undefined && fromExplicitVadSignal != null) {
|
|
8236
8367
|
setValueByPath(parentObject, ['setup', 'explicitVadSignal'], fromExplicitVadSignal);
|
|
8237
8368
|
}
|
|
8369
|
+
const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
|
|
8370
|
+
if (parentObject !== undefined && fromAvatarConfig != null) {
|
|
8371
|
+
setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
|
|
8372
|
+
}
|
|
8373
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
8374
|
+
'safetySettings',
|
|
8375
|
+
]);
|
|
8376
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
8377
|
+
let transformedList = fromSafetySettings;
|
|
8378
|
+
if (Array.isArray(transformedList)) {
|
|
8379
|
+
transformedList = transformedList.map((item) => {
|
|
8380
|
+
return item;
|
|
8381
|
+
});
|
|
8382
|
+
}
|
|
8383
|
+
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8384
|
+
}
|
|
8238
8385
|
return toObject;
|
|
8239
8386
|
}
|
|
8240
8387
|
function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
@@ -8425,22 +8572,6 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
8425
8572
|
}
|
|
8426
8573
|
return toObject;
|
|
8427
8574
|
}
|
|
8428
|
-
function multiSpeakerVoiceConfigToVertex$1(fromObject) {
|
|
8429
|
-
const toObject = {};
|
|
8430
|
-
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
8431
|
-
'speakerVoiceConfigs',
|
|
8432
|
-
]);
|
|
8433
|
-
if (fromSpeakerVoiceConfigs != null) {
|
|
8434
|
-
let transformedList = fromSpeakerVoiceConfigs;
|
|
8435
|
-
if (Array.isArray(transformedList)) {
|
|
8436
|
-
transformedList = transformedList.map((item) => {
|
|
8437
|
-
return speakerVoiceConfigToVertex$1(item);
|
|
8438
|
-
});
|
|
8439
|
-
}
|
|
8440
|
-
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
8441
|
-
}
|
|
8442
|
-
return toObject;
|
|
8443
|
-
}
|
|
8444
8575
|
function partToMldev$2(fromObject) {
|
|
8445
8576
|
const toObject = {};
|
|
8446
8577
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -8582,17 +8713,18 @@ function partToVertex$1(fromObject) {
|
|
|
8582
8713
|
}
|
|
8583
8714
|
return toObject;
|
|
8584
8715
|
}
|
|
8585
|
-
function
|
|
8716
|
+
function safetySettingToMldev$2(fromObject) {
|
|
8586
8717
|
const toObject = {};
|
|
8587
|
-
const
|
|
8588
|
-
if (
|
|
8589
|
-
setValueByPath(toObject, ['
|
|
8718
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
8719
|
+
if (fromCategory != null) {
|
|
8720
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
8590
8721
|
}
|
|
8591
|
-
|
|
8592
|
-
'
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8722
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
8723
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
8724
|
+
}
|
|
8725
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
8726
|
+
if (fromThreshold != null) {
|
|
8727
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
8596
8728
|
}
|
|
8597
8729
|
return toObject;
|
|
8598
8730
|
}
|
|
@@ -8607,36 +8739,6 @@ function sessionResumptionConfigToMldev$1(fromObject) {
|
|
|
8607
8739
|
}
|
|
8608
8740
|
return toObject;
|
|
8609
8741
|
}
|
|
8610
|
-
function speakerVoiceConfigToVertex$1(fromObject) {
|
|
8611
|
-
const toObject = {};
|
|
8612
|
-
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
8613
|
-
if (fromSpeaker != null) {
|
|
8614
|
-
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
8615
|
-
}
|
|
8616
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
8617
|
-
if (fromVoiceConfig != null) {
|
|
8618
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex$1(fromVoiceConfig));
|
|
8619
|
-
}
|
|
8620
|
-
return toObject;
|
|
8621
|
-
}
|
|
8622
|
-
function speechConfigToVertex$1(fromObject) {
|
|
8623
|
-
const toObject = {};
|
|
8624
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
8625
|
-
if (fromVoiceConfig != null) {
|
|
8626
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex$1(fromVoiceConfig));
|
|
8627
|
-
}
|
|
8628
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
8629
|
-
if (fromLanguageCode != null) {
|
|
8630
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
8631
|
-
}
|
|
8632
|
-
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
8633
|
-
'multiSpeakerVoiceConfig',
|
|
8634
|
-
]);
|
|
8635
|
-
if (fromMultiSpeakerVoiceConfig != null) {
|
|
8636
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToVertex$1(fromMultiSpeakerVoiceConfig));
|
|
8637
|
-
}
|
|
8638
|
-
return toObject;
|
|
8639
|
-
}
|
|
8640
8742
|
function toolToMldev$2(fromObject) {
|
|
8641
8743
|
const toObject = {};
|
|
8642
8744
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
@@ -8870,22 +8972,6 @@ function voiceActivityFromVertex(fromObject) {
|
|
|
8870
8972
|
}
|
|
8871
8973
|
return toObject;
|
|
8872
8974
|
}
|
|
8873
|
-
function voiceConfigToVertex$1(fromObject) {
|
|
8874
|
-
const toObject = {};
|
|
8875
|
-
const fromReplicatedVoiceConfig = getValueByPath(fromObject, [
|
|
8876
|
-
'replicatedVoiceConfig',
|
|
8877
|
-
]);
|
|
8878
|
-
if (fromReplicatedVoiceConfig != null) {
|
|
8879
|
-
setValueByPath(toObject, ['replicatedVoiceConfig'], replicatedVoiceConfigToVertex$1(fromReplicatedVoiceConfig));
|
|
8880
|
-
}
|
|
8881
|
-
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
8882
|
-
'prebuiltVoiceConfig',
|
|
8883
|
-
]);
|
|
8884
|
-
if (fromPrebuiltVoiceConfig != null) {
|
|
8885
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], fromPrebuiltVoiceConfig);
|
|
8886
|
-
}
|
|
8887
|
-
return toObject;
|
|
8888
|
-
}
|
|
8889
8975
|
|
|
8890
8976
|
/**
|
|
8891
8977
|
* @license
|
|
@@ -9435,6 +9521,12 @@ function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
9435
9521
|
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
9436
9522
|
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
9437
9523
|
}
|
|
9524
|
+
if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
|
|
9525
|
+
throw new Error('documentOcr parameter is not supported in Gemini API.');
|
|
9526
|
+
}
|
|
9527
|
+
if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
|
|
9528
|
+
throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
|
|
9529
|
+
}
|
|
9438
9530
|
return toObject;
|
|
9439
9531
|
}
|
|
9440
9532
|
function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -9454,7 +9546,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
9454
9546
|
else if (discriminatorTaskType === 'EMBED_CONTENT') {
|
|
9455
9547
|
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
9456
9548
|
if (parentObject !== undefined && fromTaskType != null) {
|
|
9457
|
-
setValueByPath(parentObject, ['taskType'], fromTaskType);
|
|
9549
|
+
setValueByPath(parentObject, ['embedContentConfig', 'taskType'], fromTaskType);
|
|
9458
9550
|
}
|
|
9459
9551
|
}
|
|
9460
9552
|
let discriminatorTitle = getValueByPath(rootObject, [
|
|
@@ -9472,7 +9564,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
9472
9564
|
else if (discriminatorTitle === 'EMBED_CONTENT') {
|
|
9473
9565
|
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
9474
9566
|
if (parentObject !== undefined && fromTitle != null) {
|
|
9475
|
-
setValueByPath(parentObject, ['title'], fromTitle);
|
|
9567
|
+
setValueByPath(parentObject, ['embedContentConfig', 'title'], fromTitle);
|
|
9476
9568
|
}
|
|
9477
9569
|
}
|
|
9478
9570
|
let discriminatorOutputDimensionality = getValueByPath(rootObject, [
|
|
@@ -9494,7 +9586,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
9494
9586
|
'outputDimensionality',
|
|
9495
9587
|
]);
|
|
9496
9588
|
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
9497
|
-
setValueByPath(parentObject, ['outputDimensionality'], fromOutputDimensionality);
|
|
9589
|
+
setValueByPath(parentObject, ['embedContentConfig', 'outputDimensionality'], fromOutputDimensionality);
|
|
9498
9590
|
}
|
|
9499
9591
|
}
|
|
9500
9592
|
let discriminatorMimeType = getValueByPath(rootObject, [
|
|
@@ -9528,7 +9620,33 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
9528
9620
|
'autoTruncate',
|
|
9529
9621
|
]);
|
|
9530
9622
|
if (parentObject !== undefined && fromAutoTruncate != null) {
|
|
9531
|
-
setValueByPath(parentObject, ['autoTruncate'], fromAutoTruncate);
|
|
9623
|
+
setValueByPath(parentObject, ['embedContentConfig', 'autoTruncate'], fromAutoTruncate);
|
|
9624
|
+
}
|
|
9625
|
+
}
|
|
9626
|
+
let discriminatorDocumentOcr = getValueByPath(rootObject, [
|
|
9627
|
+
'embeddingApiType',
|
|
9628
|
+
]);
|
|
9629
|
+
if (discriminatorDocumentOcr === undefined) {
|
|
9630
|
+
discriminatorDocumentOcr = 'PREDICT';
|
|
9631
|
+
}
|
|
9632
|
+
if (discriminatorDocumentOcr === 'EMBED_CONTENT') {
|
|
9633
|
+
const fromDocumentOcr = getValueByPath(fromObject, ['documentOcr']);
|
|
9634
|
+
if (parentObject !== undefined && fromDocumentOcr != null) {
|
|
9635
|
+
setValueByPath(parentObject, ['embedContentConfig', 'documentOcr'], fromDocumentOcr);
|
|
9636
|
+
}
|
|
9637
|
+
}
|
|
9638
|
+
let discriminatorAudioTrackExtraction = getValueByPath(rootObject, [
|
|
9639
|
+
'embeddingApiType',
|
|
9640
|
+
]);
|
|
9641
|
+
if (discriminatorAudioTrackExtraction === undefined) {
|
|
9642
|
+
discriminatorAudioTrackExtraction = 'PREDICT';
|
|
9643
|
+
}
|
|
9644
|
+
if (discriminatorAudioTrackExtraction === 'EMBED_CONTENT') {
|
|
9645
|
+
const fromAudioTrackExtraction = getValueByPath(fromObject, [
|
|
9646
|
+
'audioTrackExtraction',
|
|
9647
|
+
]);
|
|
9648
|
+
if (parentObject !== undefined && fromAudioTrackExtraction != null) {
|
|
9649
|
+
setValueByPath(parentObject, ['embedContentConfig', 'audioTrackExtraction'], fromAudioTrackExtraction);
|
|
9532
9650
|
}
|
|
9533
9651
|
}
|
|
9534
9652
|
return toObject;
|
|
@@ -9873,7 +9991,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootO
|
|
|
9873
9991
|
let transformedList = fromSafetySettings;
|
|
9874
9992
|
if (Array.isArray(transformedList)) {
|
|
9875
9993
|
transformedList = transformedList.map((item) => {
|
|
9876
|
-
return safetySettingToMldev(item);
|
|
9994
|
+
return safetySettingToMldev$1(item);
|
|
9877
9995
|
});
|
|
9878
9996
|
}
|
|
9879
9997
|
setValueByPath(parentObject, ['safetySettings'], transformedList);
|
|
@@ -10089,7 +10207,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
10089
10207
|
}
|
|
10090
10208
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
10091
10209
|
if (fromSpeechConfig != null) {
|
|
10092
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
10210
|
+
setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
|
|
10093
10211
|
}
|
|
10094
10212
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
10095
10213
|
'audioTimestamp',
|
|
@@ -10597,6 +10715,12 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
|
|
|
10597
10715
|
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
10598
10716
|
throw new Error('labels parameter is not supported in Gemini API.');
|
|
10599
10717
|
}
|
|
10718
|
+
const fromWebhookConfig = getValueByPath(fromObject, [
|
|
10719
|
+
'webhookConfig',
|
|
10720
|
+
]);
|
|
10721
|
+
if (parentObject !== undefined && fromWebhookConfig != null) {
|
|
10722
|
+
setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
|
|
10723
|
+
}
|
|
10600
10724
|
return toObject;
|
|
10601
10725
|
}
|
|
10602
10726
|
function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -10691,6 +10815,9 @@ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
10691
10815
|
if (parentObject !== undefined && fromLabels != null) {
|
|
10692
10816
|
setValueByPath(parentObject, ['labels'], fromLabels);
|
|
10693
10817
|
}
|
|
10818
|
+
if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
|
|
10819
|
+
throw new Error('webhookConfig parameter is not supported in Vertex AI.');
|
|
10820
|
+
}
|
|
10694
10821
|
return toObject;
|
|
10695
10822
|
}
|
|
10696
10823
|
function generateVideosOperationFromMldev(fromObject, rootObject) {
|
|
@@ -10960,7 +11087,7 @@ function generatedVideoFromVertex(fromObject, rootObject) {
|
|
|
10960
11087
|
}
|
|
10961
11088
|
return toObject;
|
|
10962
11089
|
}
|
|
10963
|
-
function generationConfigToVertex(fromObject,
|
|
11090
|
+
function generationConfigToVertex(fromObject, _rootObject) {
|
|
10964
11091
|
const toObject = {};
|
|
10965
11092
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
10966
11093
|
'modelSelectionConfig',
|
|
@@ -11056,7 +11183,7 @@ function generationConfigToVertex(fromObject, rootObject) {
|
|
|
11056
11183
|
}
|
|
11057
11184
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
11058
11185
|
if (fromSpeechConfig != null) {
|
|
11059
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
11186
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
11060
11187
|
}
|
|
11061
11188
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
11062
11189
|
'stopSequences',
|
|
@@ -11513,22 +11640,6 @@ function modelFromVertex(fromObject, rootObject) {
|
|
|
11513
11640
|
}
|
|
11514
11641
|
return toObject;
|
|
11515
11642
|
}
|
|
11516
|
-
function multiSpeakerVoiceConfigToVertex(fromObject, rootObject) {
|
|
11517
|
-
const toObject = {};
|
|
11518
|
-
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
11519
|
-
'speakerVoiceConfigs',
|
|
11520
|
-
]);
|
|
11521
|
-
if (fromSpeakerVoiceConfigs != null) {
|
|
11522
|
-
let transformedList = fromSpeakerVoiceConfigs;
|
|
11523
|
-
if (Array.isArray(transformedList)) {
|
|
11524
|
-
transformedList = transformedList.map((item) => {
|
|
11525
|
-
return speakerVoiceConfigToVertex(item);
|
|
11526
|
-
});
|
|
11527
|
-
}
|
|
11528
|
-
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
11529
|
-
}
|
|
11530
|
-
return toObject;
|
|
11531
|
-
}
|
|
11532
11643
|
function partToMldev$1(fromObject, rootObject) {
|
|
11533
11644
|
const toObject = {};
|
|
11534
11645
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -11838,20 +11949,6 @@ function referenceImageAPIInternalToVertex(fromObject, rootObject) {
|
|
|
11838
11949
|
}
|
|
11839
11950
|
return toObject;
|
|
11840
11951
|
}
|
|
11841
|
-
function replicatedVoiceConfigToVertex(fromObject, _rootObject) {
|
|
11842
|
-
const toObject = {};
|
|
11843
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
11844
|
-
if (fromMimeType != null) {
|
|
11845
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
11846
|
-
}
|
|
11847
|
-
const fromVoiceSampleAudio = getValueByPath(fromObject, [
|
|
11848
|
-
'voiceSampleAudio',
|
|
11849
|
-
]);
|
|
11850
|
-
if (fromVoiceSampleAudio != null) {
|
|
11851
|
-
setValueByPath(toObject, ['voiceSampleAudio'], fromVoiceSampleAudio);
|
|
11852
|
-
}
|
|
11853
|
-
return toObject;
|
|
11854
|
-
}
|
|
11855
11952
|
function safetyAttributesFromMldev(fromObject, _rootObject) {
|
|
11856
11953
|
const toObject = {};
|
|
11857
11954
|
const fromCategories = getValueByPath(fromObject, [
|
|
@@ -11896,7 +11993,7 @@ function safetyAttributesFromVertex(fromObject, _rootObject) {
|
|
|
11896
11993
|
}
|
|
11897
11994
|
return toObject;
|
|
11898
11995
|
}
|
|
11899
|
-
function safetySettingToMldev(fromObject, _rootObject) {
|
|
11996
|
+
function safetySettingToMldev$1(fromObject, _rootObject) {
|
|
11900
11997
|
const toObject = {};
|
|
11901
11998
|
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
11902
11999
|
if (fromCategory != null) {
|
|
@@ -12001,36 +12098,6 @@ function segmentImageSourceToVertex(fromObject, parentObject, rootObject) {
|
|
|
12001
12098
|
}
|
|
12002
12099
|
return toObject;
|
|
12003
12100
|
}
|
|
12004
|
-
function speakerVoiceConfigToVertex(fromObject, rootObject) {
|
|
12005
|
-
const toObject = {};
|
|
12006
|
-
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
12007
|
-
if (fromSpeaker != null) {
|
|
12008
|
-
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
12009
|
-
}
|
|
12010
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
12011
|
-
if (fromVoiceConfig != null) {
|
|
12012
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(fromVoiceConfig));
|
|
12013
|
-
}
|
|
12014
|
-
return toObject;
|
|
12015
|
-
}
|
|
12016
|
-
function speechConfigToVertex(fromObject, rootObject) {
|
|
12017
|
-
const toObject = {};
|
|
12018
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
12019
|
-
if (fromVoiceConfig != null) {
|
|
12020
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(fromVoiceConfig));
|
|
12021
|
-
}
|
|
12022
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
12023
|
-
if (fromLanguageCode != null) {
|
|
12024
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
12025
|
-
}
|
|
12026
|
-
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
12027
|
-
'multiSpeakerVoiceConfig',
|
|
12028
|
-
]);
|
|
12029
|
-
if (fromMultiSpeakerVoiceConfig != null) {
|
|
12030
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToVertex(fromMultiSpeakerVoiceConfig));
|
|
12031
|
-
}
|
|
12032
|
-
return toObject;
|
|
12033
|
-
}
|
|
12034
12101
|
function toolConfigToMldev(fromObject, rootObject) {
|
|
12035
12102
|
const toObject = {};
|
|
12036
12103
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
@@ -12513,22 +12580,6 @@ function videoToVertex(fromObject, _rootObject) {
|
|
|
12513
12580
|
}
|
|
12514
12581
|
return toObject;
|
|
12515
12582
|
}
|
|
12516
|
-
function voiceConfigToVertex(fromObject, rootObject) {
|
|
12517
|
-
const toObject = {};
|
|
12518
|
-
const fromReplicatedVoiceConfig = getValueByPath(fromObject, [
|
|
12519
|
-
'replicatedVoiceConfig',
|
|
12520
|
-
]);
|
|
12521
|
-
if (fromReplicatedVoiceConfig != null) {
|
|
12522
|
-
setValueByPath(toObject, ['replicatedVoiceConfig'], replicatedVoiceConfigToVertex(fromReplicatedVoiceConfig));
|
|
12523
|
-
}
|
|
12524
|
-
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
12525
|
-
'prebuiltVoiceConfig',
|
|
12526
|
-
]);
|
|
12527
|
-
if (fromPrebuiltVoiceConfig != null) {
|
|
12528
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], fromPrebuiltVoiceConfig);
|
|
12529
|
-
}
|
|
12530
|
-
return toObject;
|
|
12531
|
-
}
|
|
12532
12583
|
|
|
12533
12584
|
/**
|
|
12534
12585
|
* @license
|
|
@@ -12774,10 +12825,11 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12774
12825
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12775
12826
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12776
12827
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12777
|
-
const SDK_VERSION = '1.
|
|
12828
|
+
const SDK_VERSION = '1.50.0'; // x-release-please-version
|
|
12778
12829
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12779
12830
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12780
12831
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
12832
|
+
const MULTI_REGIONAL_LOCATIONS = new Set(['us', 'eu']);
|
|
12781
12833
|
// Default retry options.
|
|
12782
12834
|
// The config is based on https://cloud.google.com/storage/docs/retry-strategy.
|
|
12783
12835
|
const DEFAULT_RETRY_ATTEMPTS = 5; // Including the initial call
|
|
@@ -12836,7 +12888,7 @@ class ApiClient {
|
|
|
12836
12888
|
}
|
|
12837
12889
|
else if (this.clientOptions.project &&
|
|
12838
12890
|
this.clientOptions.location &&
|
|
12839
|
-
this.clientOptions.location
|
|
12891
|
+
MULTI_REGIONAL_LOCATIONS.has(this.clientOptions.location)) {
|
|
12840
12892
|
initHttpOptions.baseUrl = `https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`;
|
|
12841
12893
|
}
|
|
12842
12894
|
else if (this.clientOptions.project && this.clientOptions.location) {
|
|
@@ -14403,6 +14455,10 @@ class Models extends BaseModule {
|
|
|
14403
14455
|
*/
|
|
14404
14456
|
this.embedContent = async (params) => {
|
|
14405
14457
|
if (!this.apiClient.isVertexAI()) {
|
|
14458
|
+
const isGeminiEmbedding2Model = params.model.includes('gemini-embedding-2');
|
|
14459
|
+
if (isGeminiEmbedding2Model) {
|
|
14460
|
+
params.contents = tContents(params.contents);
|
|
14461
|
+
}
|
|
14406
14462
|
return await this.embedContentInternal(params);
|
|
14407
14463
|
}
|
|
14408
14464
|
const isVertexEmbedContentModel = (params.model.includes('gemini') &&
|
|
@@ -15339,29 +15395,15 @@ class Models extends BaseModule {
|
|
|
15339
15395
|
/**
|
|
15340
15396
|
* Recontextualizes an image.
|
|
15341
15397
|
*
|
|
15342
|
-
* There
|
|
15343
|
-
* 1)
|
|
15344
|
-
* and contexts.
|
|
15345
|
-
* 2) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
15398
|
+
* There is one type of recontextualization currently supported:
|
|
15399
|
+
* 1) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
15346
15400
|
*
|
|
15347
15401
|
* @param params - The parameters for recontextualizing an image.
|
|
15348
15402
|
* @return The response from the API.
|
|
15349
15403
|
*
|
|
15350
15404
|
* @example
|
|
15351
15405
|
* ```ts
|
|
15352
|
-
* const
|
|
15353
|
-
* model: 'imagen-product-recontext-preview-06-30',
|
|
15354
|
-
* source: {
|
|
15355
|
-
* prompt: 'In a modern kitchen setting.',
|
|
15356
|
-
* productImages: [productImage],
|
|
15357
|
-
* },
|
|
15358
|
-
* config: {
|
|
15359
|
-
* numberOfImages: 1,
|
|
15360
|
-
* },
|
|
15361
|
-
* });
|
|
15362
|
-
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
15363
|
-
*
|
|
15364
|
-
* const response2 = await ai.models.recontextImage({
|
|
15406
|
+
* const response = await ai.models.recontextImage({
|
|
15365
15407
|
* model: 'virtual-try-on-001',
|
|
15366
15408
|
* source: {
|
|
15367
15409
|
* personImage: personImage,
|
|
@@ -15371,7 +15413,7 @@ class Models extends BaseModule {
|
|
|
15371
15413
|
* numberOfImages: 1,
|
|
15372
15414
|
* },
|
|
15373
15415
|
* });
|
|
15374
|
-
* console.log(
|
|
15416
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
15375
15417
|
* ```
|
|
15376
15418
|
*/
|
|
15377
15419
|
async recontextImage(params) {
|
|
@@ -16396,6 +16438,22 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
16396
16438
|
if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
|
|
16397
16439
|
throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
|
|
16398
16440
|
}
|
|
16441
|
+
const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
|
|
16442
|
+
if (parentObject !== undefined && fromAvatarConfig != null) {
|
|
16443
|
+
setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
|
|
16444
|
+
}
|
|
16445
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
16446
|
+
'safetySettings',
|
|
16447
|
+
]);
|
|
16448
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
16449
|
+
let transformedList = fromSafetySettings;
|
|
16450
|
+
if (Array.isArray(transformedList)) {
|
|
16451
|
+
transformedList = transformedList.map((item) => {
|
|
16452
|
+
return safetySettingToMldev(item);
|
|
16453
|
+
});
|
|
16454
|
+
}
|
|
16455
|
+
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
16456
|
+
}
|
|
16399
16457
|
return toObject;
|
|
16400
16458
|
}
|
|
16401
16459
|
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
@@ -16482,6 +16540,21 @@ function partToMldev(fromObject) {
|
|
|
16482
16540
|
}
|
|
16483
16541
|
return toObject;
|
|
16484
16542
|
}
|
|
16543
|
+
function safetySettingToMldev(fromObject) {
|
|
16544
|
+
const toObject = {};
|
|
16545
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
16546
|
+
if (fromCategory != null) {
|
|
16547
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
16548
|
+
}
|
|
16549
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
16550
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
16551
|
+
}
|
|
16552
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
16553
|
+
if (fromThreshold != null) {
|
|
16554
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
16555
|
+
}
|
|
16556
|
+
return toObject;
|
|
16557
|
+
}
|
|
16485
16558
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
16486
16559
|
const toObject = {};
|
|
16487
16560
|
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
@@ -17951,7 +18024,8 @@ class BaseInteractions extends APIResource {
|
|
|
17951
18024
|
return this._client.delete(path `/${api_version}/interactions/${id}`, options);
|
|
17952
18025
|
}
|
|
17953
18026
|
/**
|
|
17954
|
-
* Cancels an interaction by id. This only applies to background interactions that
|
|
18027
|
+
* Cancels an interaction by id. This only applies to background interactions that
|
|
18028
|
+
* are still running.
|
|
17955
18029
|
*
|
|
17956
18030
|
* @example
|
|
17957
18031
|
* ```ts
|
|
@@ -17974,6 +18048,66 @@ BaseInteractions._key = Object.freeze(['interactions']);
|
|
|
17974
18048
|
class Interactions extends BaseInteractions {
|
|
17975
18049
|
}
|
|
17976
18050
|
|
|
18051
|
+
/**
|
|
18052
|
+
* @license
|
|
18053
|
+
* Copyright 2025 Google LLC
|
|
18054
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
18055
|
+
*/
|
|
18056
|
+
class BaseWebhooks extends APIResource {
|
|
18057
|
+
/**
|
|
18058
|
+
* Creates a new Webhook.
|
|
18059
|
+
*/
|
|
18060
|
+
create(params, options) {
|
|
18061
|
+
const { api_version = this._client.apiVersion, webhook_id } = params, body = __rest(params, ["api_version", "webhook_id"]);
|
|
18062
|
+
return this._client.post(path `/${api_version}/webhooks`, Object.assign({ query: { webhook_id }, body }, options));
|
|
18063
|
+
}
|
|
18064
|
+
/**
|
|
18065
|
+
* Gets a specific Webhook.
|
|
18066
|
+
*/
|
|
18067
|
+
retrieve(id, params = {}, options) {
|
|
18068
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18069
|
+
return this._client.get(path `/${api_version}/webhooks/${id}`, options);
|
|
18070
|
+
}
|
|
18071
|
+
/**
|
|
18072
|
+
* Updates an existing Webhook.
|
|
18073
|
+
*/
|
|
18074
|
+
update(id, params, options) {
|
|
18075
|
+
const { api_version = this._client.apiVersion, update_mask } = params, body = __rest(params, ["api_version", "update_mask"]);
|
|
18076
|
+
return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
|
|
18077
|
+
}
|
|
18078
|
+
/**
|
|
18079
|
+
* Lists all Webhooks.
|
|
18080
|
+
*/
|
|
18081
|
+
list(params = {}, options) {
|
|
18082
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
|
|
18083
|
+
return this._client.get(path `/${api_version}/webhooks`, Object.assign({ query }, options));
|
|
18084
|
+
}
|
|
18085
|
+
/**
|
|
18086
|
+
* Deletes a Webhook.
|
|
18087
|
+
*/
|
|
18088
|
+
delete(id, params = {}, options) {
|
|
18089
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18090
|
+
return this._client.delete(path `/${api_version}/webhooks/${id}`, options);
|
|
18091
|
+
}
|
|
18092
|
+
/**
|
|
18093
|
+
* Sends a ping event to a Webhook.
|
|
18094
|
+
*/
|
|
18095
|
+
ping(id, params = undefined, options) {
|
|
18096
|
+
const { api_version = this._client.apiVersion, body } = params !== null && params !== void 0 ? params : {};
|
|
18097
|
+
return this._client.post(path `/${api_version}/webhooks/${id}:ping`, Object.assign({ body: body }, options));
|
|
18098
|
+
}
|
|
18099
|
+
/**
|
|
18100
|
+
* Generates a new signing secret for a Webhook.
|
|
18101
|
+
*/
|
|
18102
|
+
rotateSigningSecret(id, params = {}, options) {
|
|
18103
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
|
|
18104
|
+
return this._client.post(path `/${api_version}/webhooks/${id}:rotateSigningSecret`, Object.assign({ body }, options));
|
|
18105
|
+
}
|
|
18106
|
+
}
|
|
18107
|
+
BaseWebhooks._key = Object.freeze(['webhooks']);
|
|
18108
|
+
class Webhooks extends BaseWebhooks {
|
|
18109
|
+
}
|
|
18110
|
+
|
|
17977
18111
|
/**
|
|
17978
18112
|
* @license
|
|
17979
18113
|
* Copyright 2025 Google LLC
|
|
@@ -18715,12 +18849,12 @@ const buildHeaders = (newHeaders) => {
|
|
|
18715
18849
|
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
|
18716
18850
|
*/
|
|
18717
18851
|
const readEnv = (env) => {
|
|
18718
|
-
var _a, _b, _c, _d, _e
|
|
18852
|
+
var _a, _b, _c, _d, _e;
|
|
18719
18853
|
if (typeof globalThis.process !== 'undefined') {
|
|
18720
|
-
return (
|
|
18854
|
+
return ((_b = (_a = globalThis.process.env) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.trim()) || undefined;
|
|
18721
18855
|
}
|
|
18722
18856
|
if (typeof globalThis.Deno !== 'undefined') {
|
|
18723
|
-
return (
|
|
18857
|
+
return ((_e = (_d = (_c = globalThis.Deno.env) === null || _c === void 0 ? void 0 : _c.get) === null || _d === void 0 ? void 0 : _d.call(_c, env)) === null || _e === void 0 ? void 0 : _e.trim()) || undefined;
|
|
18724
18858
|
}
|
|
18725
18859
|
return undefined;
|
|
18726
18860
|
};
|
|
@@ -18807,7 +18941,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
18807
18941
|
if (this.apiKey) {
|
|
18808
18942
|
return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
|
|
18809
18943
|
}
|
|
18810
|
-
if (this.clientAdapter.isVertexAI()) {
|
|
18944
|
+
if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
|
|
18811
18945
|
return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
|
|
18812
18946
|
}
|
|
18813
18947
|
return undefined;
|
|
@@ -19161,6 +19295,7 @@ class GeminiNextGenAPIClient extends BaseGeminiNextGenAPIClient {
|
|
|
19161
19295
|
constructor() {
|
|
19162
19296
|
super(...arguments);
|
|
19163
19297
|
this.interactions = new Interactions(this);
|
|
19298
|
+
this.webhooks = new Webhooks(this);
|
|
19164
19299
|
}
|
|
19165
19300
|
}
|
|
19166
19301
|
_a = GeminiNextGenAPIClient;
|
|
@@ -19180,6 +19315,7 @@ GeminiNextGenAPIClient.PermissionDeniedError = PermissionDeniedError;
|
|
|
19180
19315
|
GeminiNextGenAPIClient.UnprocessableEntityError = UnprocessableEntityError;
|
|
19181
19316
|
GeminiNextGenAPIClient.toFile = toFile;
|
|
19182
19317
|
GeminiNextGenAPIClient.Interactions = Interactions;
|
|
19318
|
+
GeminiNextGenAPIClient.Webhooks = Webhooks;
|
|
19183
19319
|
|
|
19184
19320
|
/**
|
|
19185
19321
|
* @license
|
|
@@ -21025,29 +21161,41 @@ const LANGUAGE_LABEL_PREFIX = 'gl-node/';
|
|
|
21025
21161
|
*
|
|
21026
21162
|
*/
|
|
21027
21163
|
class GoogleGenAI {
|
|
21028
|
-
|
|
21164
|
+
getNextGenClient() {
|
|
21029
21165
|
var _a;
|
|
21030
|
-
if (this._interactions !== undefined) {
|
|
21031
|
-
return this._interactions;
|
|
21032
|
-
}
|
|
21033
|
-
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
21034
21166
|
const httpOpts = this.httpOptions;
|
|
21167
|
+
if (this._nextGenClient === undefined) {
|
|
21168
|
+
this._nextGenClient = new GeminiNextGenAPIClient({
|
|
21169
|
+
baseURL: this.apiClient.getBaseUrl(),
|
|
21170
|
+
apiKey: this.apiKey,
|
|
21171
|
+
apiVersion: this.apiClient.getApiVersion(),
|
|
21172
|
+
clientAdapter: this.apiClient,
|
|
21173
|
+
defaultHeaders: this.apiClient.getDefaultHeaders(),
|
|
21174
|
+
timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
|
|
21175
|
+
maxRetries: (_a = httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.retryOptions) === null || _a === void 0 ? void 0 : _a.attempts,
|
|
21176
|
+
});
|
|
21177
|
+
}
|
|
21035
21178
|
// Unsupported Options Warnings
|
|
21036
21179
|
if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {
|
|
21037
21180
|
console.warn('GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.');
|
|
21038
21181
|
}
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
|
|
21042
|
-
|
|
21043
|
-
|
|
21044
|
-
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
});
|
|
21048
|
-
this._interactions = nextGenClient.interactions;
|
|
21182
|
+
return this._nextGenClient;
|
|
21183
|
+
}
|
|
21184
|
+
get interactions() {
|
|
21185
|
+
if (this._interactions !== undefined) {
|
|
21186
|
+
return this._interactions;
|
|
21187
|
+
}
|
|
21188
|
+
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
21189
|
+
this._interactions = this.getNextGenClient().interactions;
|
|
21049
21190
|
return this._interactions;
|
|
21050
21191
|
}
|
|
21192
|
+
get webhooks() {
|
|
21193
|
+
if (this._webhooks !== undefined) {
|
|
21194
|
+
return this._webhooks;
|
|
21195
|
+
}
|
|
21196
|
+
this._webhooks = this.getNextGenClient().webhooks;
|
|
21197
|
+
return this._webhooks;
|
|
21198
|
+
}
|
|
21051
21199
|
constructor(options) {
|
|
21052
21200
|
var _a, _b, _c, _d, _e, _f;
|
|
21053
21201
|
// Validate explicitly set initializer values.
|