@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/index.mjs
CHANGED
|
@@ -1183,6 +1183,10 @@ var Modality;
|
|
|
1183
1183
|
* Indicates the model should return audio.
|
|
1184
1184
|
*/
|
|
1185
1185
|
Modality["AUDIO"] = "AUDIO";
|
|
1186
|
+
/**
|
|
1187
|
+
* Indicates the model should return video.
|
|
1188
|
+
*/
|
|
1189
|
+
Modality["VIDEO"] = "VIDEO";
|
|
1186
1190
|
})(Modality || (Modality = {}));
|
|
1187
1191
|
/** The stage of the underlying model. This enum is not supported in Vertex AI. */
|
|
1188
1192
|
var ModelStage;
|
|
@@ -1777,6 +1781,102 @@ var TurnCompleteReason;
|
|
|
1777
1781
|
* Needs more input from the user.
|
|
1778
1782
|
*/
|
|
1779
1783
|
TurnCompleteReason["NEED_MORE_INPUT"] = "NEED_MORE_INPUT";
|
|
1784
|
+
/**
|
|
1785
|
+
* Input content is prohibited.
|
|
1786
|
+
*/
|
|
1787
|
+
TurnCompleteReason["PROHIBITED_INPUT_CONTENT"] = "PROHIBITED_INPUT_CONTENT";
|
|
1788
|
+
/**
|
|
1789
|
+
* Input image contains prohibited content.
|
|
1790
|
+
*/
|
|
1791
|
+
TurnCompleteReason["IMAGE_PROHIBITED_INPUT_CONTENT"] = "IMAGE_PROHIBITED_INPUT_CONTENT";
|
|
1792
|
+
/**
|
|
1793
|
+
* Input text contains prominent person reference.
|
|
1794
|
+
*/
|
|
1795
|
+
TurnCompleteReason["INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED"] = "INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED";
|
|
1796
|
+
/**
|
|
1797
|
+
* Input image contains celebrity.
|
|
1798
|
+
*/
|
|
1799
|
+
TurnCompleteReason["INPUT_IMAGE_CELEBRITY"] = "INPUT_IMAGE_CELEBRITY";
|
|
1800
|
+
/**
|
|
1801
|
+
* Input image contains photo realistic child.
|
|
1802
|
+
*/
|
|
1803
|
+
TurnCompleteReason["INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED"] = "INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED";
|
|
1804
|
+
/**
|
|
1805
|
+
* Input text contains NCII content.
|
|
1806
|
+
*/
|
|
1807
|
+
TurnCompleteReason["INPUT_TEXT_NCII_PROHIBITED"] = "INPUT_TEXT_NCII_PROHIBITED";
|
|
1808
|
+
/**
|
|
1809
|
+
* Other input safety issue.
|
|
1810
|
+
*/
|
|
1811
|
+
TurnCompleteReason["INPUT_OTHER"] = "INPUT_OTHER";
|
|
1812
|
+
/**
|
|
1813
|
+
* Input contains IP violation.
|
|
1814
|
+
*/
|
|
1815
|
+
TurnCompleteReason["INPUT_IP_PROHIBITED"] = "INPUT_IP_PROHIBITED";
|
|
1816
|
+
/**
|
|
1817
|
+
* Input matched blocklist.
|
|
1818
|
+
*/
|
|
1819
|
+
TurnCompleteReason["BLOCKLIST"] = "BLOCKLIST";
|
|
1820
|
+
/**
|
|
1821
|
+
* Input is unsafe for image generation.
|
|
1822
|
+
*/
|
|
1823
|
+
TurnCompleteReason["UNSAFE_PROMPT_FOR_IMAGE_GENERATION"] = "UNSAFE_PROMPT_FOR_IMAGE_GENERATION";
|
|
1824
|
+
/**
|
|
1825
|
+
* Generated image failed safety check.
|
|
1826
|
+
*/
|
|
1827
|
+
TurnCompleteReason["GENERATED_IMAGE_SAFETY"] = "GENERATED_IMAGE_SAFETY";
|
|
1828
|
+
/**
|
|
1829
|
+
* Generated content failed safety check.
|
|
1830
|
+
*/
|
|
1831
|
+
TurnCompleteReason["GENERATED_CONTENT_SAFETY"] = "GENERATED_CONTENT_SAFETY";
|
|
1832
|
+
/**
|
|
1833
|
+
* Generated audio failed safety check.
|
|
1834
|
+
*/
|
|
1835
|
+
TurnCompleteReason["GENERATED_AUDIO_SAFETY"] = "GENERATED_AUDIO_SAFETY";
|
|
1836
|
+
/**
|
|
1837
|
+
* Generated video failed safety check.
|
|
1838
|
+
*/
|
|
1839
|
+
TurnCompleteReason["GENERATED_VIDEO_SAFETY"] = "GENERATED_VIDEO_SAFETY";
|
|
1840
|
+
/**
|
|
1841
|
+
* Generated content is prohibited.
|
|
1842
|
+
*/
|
|
1843
|
+
TurnCompleteReason["GENERATED_CONTENT_PROHIBITED"] = "GENERATED_CONTENT_PROHIBITED";
|
|
1844
|
+
/**
|
|
1845
|
+
* Generated content matched blocklist.
|
|
1846
|
+
*/
|
|
1847
|
+
TurnCompleteReason["GENERATED_CONTENT_BLOCKLIST"] = "GENERATED_CONTENT_BLOCKLIST";
|
|
1848
|
+
/**
|
|
1849
|
+
* Generated image is prohibited.
|
|
1850
|
+
*/
|
|
1851
|
+
TurnCompleteReason["GENERATED_IMAGE_PROHIBITED"] = "GENERATED_IMAGE_PROHIBITED";
|
|
1852
|
+
/**
|
|
1853
|
+
* Generated image contains celebrity.
|
|
1854
|
+
*/
|
|
1855
|
+
TurnCompleteReason["GENERATED_IMAGE_CELEBRITY"] = "GENERATED_IMAGE_CELEBRITY";
|
|
1856
|
+
/**
|
|
1857
|
+
* Generated image contains prominent people detected by rewriter.
|
|
1858
|
+
*/
|
|
1859
|
+
TurnCompleteReason["GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER"] = "GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER";
|
|
1860
|
+
/**
|
|
1861
|
+
* Generated image contains identifiable people.
|
|
1862
|
+
*/
|
|
1863
|
+
TurnCompleteReason["GENERATED_IMAGE_IDENTIFIABLE_PEOPLE"] = "GENERATED_IMAGE_IDENTIFIABLE_PEOPLE";
|
|
1864
|
+
/**
|
|
1865
|
+
* Generated image contains minors.
|
|
1866
|
+
*/
|
|
1867
|
+
TurnCompleteReason["GENERATED_IMAGE_MINORS"] = "GENERATED_IMAGE_MINORS";
|
|
1868
|
+
/**
|
|
1869
|
+
* Generated image contains IP violation.
|
|
1870
|
+
*/
|
|
1871
|
+
TurnCompleteReason["OUTPUT_IMAGE_IP_PROHIBITED"] = "OUTPUT_IMAGE_IP_PROHIBITED";
|
|
1872
|
+
/**
|
|
1873
|
+
* Other generated content issue.
|
|
1874
|
+
*/
|
|
1875
|
+
TurnCompleteReason["GENERATED_OTHER"] = "GENERATED_OTHER";
|
|
1876
|
+
/**
|
|
1877
|
+
* Max regeneration attempts reached.
|
|
1878
|
+
*/
|
|
1879
|
+
TurnCompleteReason["MAX_REGENERATION_REACHED"] = "MAX_REGENERATION_REACHED";
|
|
1780
1880
|
})(TurnCompleteReason || (TurnCompleteReason = {}));
|
|
1781
1881
|
/** Server content modalities. */
|
|
1782
1882
|
var MediaModality;
|
|
@@ -4022,6 +4122,12 @@ function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
|
4022
4122
|
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
4023
4123
|
throw new Error('dest parameter is not supported in Gemini API.');
|
|
4024
4124
|
}
|
|
4125
|
+
const fromWebhookConfig = getValueByPath(fromObject, [
|
|
4126
|
+
'webhookConfig',
|
|
4127
|
+
]);
|
|
4128
|
+
if (parentObject !== undefined && fromWebhookConfig != null) {
|
|
4129
|
+
setValueByPath(parentObject, ['batch', 'webhookConfig'], fromWebhookConfig);
|
|
4130
|
+
}
|
|
4025
4131
|
return toObject;
|
|
4026
4132
|
}
|
|
4027
4133
|
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -4034,6 +4140,9 @@ function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
|
4034
4140
|
if (parentObject !== undefined && fromDest != null) {
|
|
4035
4141
|
setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
|
|
4036
4142
|
}
|
|
4143
|
+
if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
|
|
4144
|
+
throw new Error('webhookConfig parameter is not supported in Vertex AI.');
|
|
4145
|
+
}
|
|
4037
4146
|
return toObject;
|
|
4038
4147
|
}
|
|
4039
4148
|
function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
@@ -4193,6 +4302,12 @@ function embedContentConfigToMldev$1(fromObject, parentObject) {
|
|
|
4193
4302
|
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
4194
4303
|
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
4195
4304
|
}
|
|
4305
|
+
if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
|
|
4306
|
+
throw new Error('documentOcr parameter is not supported in Gemini API.');
|
|
4307
|
+
}
|
|
4308
|
+
if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
|
|
4309
|
+
throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
|
|
4310
|
+
}
|
|
4196
4311
|
return toObject;
|
|
4197
4312
|
}
|
|
4198
4313
|
function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
|
|
@@ -4359,7 +4474,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
|
4359
4474
|
let transformedList = fromSafetySettings;
|
|
4360
4475
|
if (Array.isArray(transformedList)) {
|
|
4361
4476
|
transformedList = transformedList.map((item) => {
|
|
4362
|
-
return safetySettingToMldev$
|
|
4477
|
+
return safetySettingToMldev$3(item);
|
|
4363
4478
|
});
|
|
4364
4479
|
}
|
|
4365
4480
|
setValueByPath(parentObject, ['safetySettings'], transformedList);
|
|
@@ -4766,7 +4881,7 @@ function partToMldev$4(fromObject) {
|
|
|
4766
4881
|
}
|
|
4767
4882
|
return toObject;
|
|
4768
4883
|
}
|
|
4769
|
-
function safetySettingToMldev$
|
|
4884
|
+
function safetySettingToMldev$3(fromObject) {
|
|
4770
4885
|
const toObject = {};
|
|
4771
4886
|
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
4772
4887
|
if (fromCategory != null) {
|
|
@@ -7427,10 +7542,11 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7427
7542
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7428
7543
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7429
7544
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7430
|
-
const SDK_VERSION = '1.
|
|
7545
|
+
const SDK_VERSION = '1.50.0'; // x-release-please-version
|
|
7431
7546
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7432
7547
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7433
7548
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
7549
|
+
const MULTI_REGIONAL_LOCATIONS = new Set(['us', 'eu']);
|
|
7434
7550
|
// Default retry options.
|
|
7435
7551
|
// The config is based on https://cloud.google.com/storage/docs/retry-strategy.
|
|
7436
7552
|
const DEFAULT_RETRY_ATTEMPTS = 5; // Including the initial call
|
|
@@ -7489,7 +7605,7 @@ class ApiClient {
|
|
|
7489
7605
|
}
|
|
7490
7606
|
else if (this.clientOptions.project &&
|
|
7491
7607
|
this.clientOptions.location &&
|
|
7492
|
-
this.clientOptions.location
|
|
7608
|
+
MULTI_REGIONAL_LOCATIONS.has(this.clientOptions.location)) {
|
|
7493
7609
|
initHttpOptions.baseUrl = `https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`;
|
|
7494
7610
|
}
|
|
7495
7611
|
else if (this.clientOptions.project && this.clientOptions.location) {
|
|
@@ -9812,7 +9928,8 @@ class BaseInteractions extends APIResource {
|
|
|
9812
9928
|
return this._client.delete(path `/${api_version}/interactions/${id}`, options);
|
|
9813
9929
|
}
|
|
9814
9930
|
/**
|
|
9815
|
-
* Cancels an interaction by id. This only applies to background interactions that
|
|
9931
|
+
* Cancels an interaction by id. This only applies to background interactions that
|
|
9932
|
+
* are still running.
|
|
9816
9933
|
*
|
|
9817
9934
|
* @example
|
|
9818
9935
|
* ```ts
|
|
@@ -9835,6 +9952,66 @@ BaseInteractions._key = Object.freeze(['interactions']);
|
|
|
9835
9952
|
class Interactions extends BaseInteractions {
|
|
9836
9953
|
}
|
|
9837
9954
|
|
|
9955
|
+
/**
|
|
9956
|
+
* @license
|
|
9957
|
+
* Copyright 2025 Google LLC
|
|
9958
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9959
|
+
*/
|
|
9960
|
+
class BaseWebhooks extends APIResource {
|
|
9961
|
+
/**
|
|
9962
|
+
* Creates a new Webhook.
|
|
9963
|
+
*/
|
|
9964
|
+
create(params, options) {
|
|
9965
|
+
const { api_version = this._client.apiVersion, webhook_id } = params, body = __rest(params, ["api_version", "webhook_id"]);
|
|
9966
|
+
return this._client.post(path `/${api_version}/webhooks`, Object.assign({ query: { webhook_id }, body }, options));
|
|
9967
|
+
}
|
|
9968
|
+
/**
|
|
9969
|
+
* Gets a specific Webhook.
|
|
9970
|
+
*/
|
|
9971
|
+
retrieve(id, params = {}, options) {
|
|
9972
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
9973
|
+
return this._client.get(path `/${api_version}/webhooks/${id}`, options);
|
|
9974
|
+
}
|
|
9975
|
+
/**
|
|
9976
|
+
* Updates an existing Webhook.
|
|
9977
|
+
*/
|
|
9978
|
+
update(id, params, options) {
|
|
9979
|
+
const { api_version = this._client.apiVersion, update_mask } = params, body = __rest(params, ["api_version", "update_mask"]);
|
|
9980
|
+
return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
|
|
9981
|
+
}
|
|
9982
|
+
/**
|
|
9983
|
+
* Lists all Webhooks.
|
|
9984
|
+
*/
|
|
9985
|
+
list(params = {}, options) {
|
|
9986
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
|
|
9987
|
+
return this._client.get(path `/${api_version}/webhooks`, Object.assign({ query }, options));
|
|
9988
|
+
}
|
|
9989
|
+
/**
|
|
9990
|
+
* Deletes a Webhook.
|
|
9991
|
+
*/
|
|
9992
|
+
delete(id, params = {}, options) {
|
|
9993
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
9994
|
+
return this._client.delete(path `/${api_version}/webhooks/${id}`, options);
|
|
9995
|
+
}
|
|
9996
|
+
/**
|
|
9997
|
+
* Sends a ping event to a Webhook.
|
|
9998
|
+
*/
|
|
9999
|
+
ping(id, params = undefined, options) {
|
|
10000
|
+
const { api_version = this._client.apiVersion, body } = params !== null && params !== void 0 ? params : {};
|
|
10001
|
+
return this._client.post(path `/${api_version}/webhooks/${id}:ping`, Object.assign({ body: body }, options));
|
|
10002
|
+
}
|
|
10003
|
+
/**
|
|
10004
|
+
* Generates a new signing secret for a Webhook.
|
|
10005
|
+
*/
|
|
10006
|
+
rotateSigningSecret(id, params = {}, options) {
|
|
10007
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
|
|
10008
|
+
return this._client.post(path `/${api_version}/webhooks/${id}:rotateSigningSecret`, Object.assign({ body }, options));
|
|
10009
|
+
}
|
|
10010
|
+
}
|
|
10011
|
+
BaseWebhooks._key = Object.freeze(['webhooks']);
|
|
10012
|
+
class Webhooks extends BaseWebhooks {
|
|
10013
|
+
}
|
|
10014
|
+
|
|
9838
10015
|
/**
|
|
9839
10016
|
* @license
|
|
9840
10017
|
* Copyright 2025 Google LLC
|
|
@@ -10576,12 +10753,12 @@ const buildHeaders = (newHeaders) => {
|
|
|
10576
10753
|
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
|
10577
10754
|
*/
|
|
10578
10755
|
const readEnv = (env) => {
|
|
10579
|
-
var _a, _b, _c, _d, _e
|
|
10756
|
+
var _a, _b, _c, _d, _e;
|
|
10580
10757
|
if (typeof globalThis.process !== 'undefined') {
|
|
10581
|
-
return (
|
|
10758
|
+
return ((_b = (_a = globalThis.process.env) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.trim()) || undefined;
|
|
10582
10759
|
}
|
|
10583
10760
|
if (typeof globalThis.Deno !== 'undefined') {
|
|
10584
|
-
return (
|
|
10761
|
+
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;
|
|
10585
10762
|
}
|
|
10586
10763
|
return undefined;
|
|
10587
10764
|
};
|
|
@@ -10668,7 +10845,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10668
10845
|
if (this.apiKey) {
|
|
10669
10846
|
return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
|
|
10670
10847
|
}
|
|
10671
|
-
if (this.clientAdapter.isVertexAI()) {
|
|
10848
|
+
if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
|
|
10672
10849
|
return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
|
|
10673
10850
|
}
|
|
10674
10851
|
return undefined;
|
|
@@ -11022,6 +11199,7 @@ class GeminiNextGenAPIClient extends BaseGeminiNextGenAPIClient {
|
|
|
11022
11199
|
constructor() {
|
|
11023
11200
|
super(...arguments);
|
|
11024
11201
|
this.interactions = new Interactions(this);
|
|
11202
|
+
this.webhooks = new Webhooks(this);
|
|
11025
11203
|
}
|
|
11026
11204
|
}
|
|
11027
11205
|
_a = GeminiNextGenAPIClient;
|
|
@@ -11041,6 +11219,7 @@ GeminiNextGenAPIClient.PermissionDeniedError = PermissionDeniedError;
|
|
|
11041
11219
|
GeminiNextGenAPIClient.UnprocessableEntityError = UnprocessableEntityError;
|
|
11042
11220
|
GeminiNextGenAPIClient.toFile = toFile;
|
|
11043
11221
|
GeminiNextGenAPIClient.Interactions = Interactions;
|
|
11222
|
+
GeminiNextGenAPIClient.Webhooks = Webhooks;
|
|
11044
11223
|
|
|
11045
11224
|
/**
|
|
11046
11225
|
* @license
|
|
@@ -11300,7 +11479,7 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
11300
11479
|
}
|
|
11301
11480
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
11302
11481
|
if (fromSpeechConfig != null) {
|
|
11303
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
11482
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
11304
11483
|
}
|
|
11305
11484
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
11306
11485
|
'stopSequences',
|
|
@@ -11475,6 +11654,22 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
11475
11654
|
if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
|
|
11476
11655
|
throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
|
|
11477
11656
|
}
|
|
11657
|
+
const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
|
|
11658
|
+
if (parentObject !== undefined && fromAvatarConfig != null) {
|
|
11659
|
+
setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
|
|
11660
|
+
}
|
|
11661
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
11662
|
+
'safetySettings',
|
|
11663
|
+
]);
|
|
11664
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
11665
|
+
let transformedList = fromSafetySettings;
|
|
11666
|
+
if (Array.isArray(transformedList)) {
|
|
11667
|
+
transformedList = transformedList.map((item) => {
|
|
11668
|
+
return safetySettingToMldev$2(item);
|
|
11669
|
+
});
|
|
11670
|
+
}
|
|
11671
|
+
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
11672
|
+
}
|
|
11478
11673
|
return toObject;
|
|
11479
11674
|
}
|
|
11480
11675
|
function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
@@ -11521,7 +11716,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
11521
11716
|
}
|
|
11522
11717
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
11523
11718
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
11524
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'],
|
|
11719
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
|
|
11525
11720
|
}
|
|
11526
11721
|
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
11527
11722
|
'thinkingConfig',
|
|
@@ -11591,6 +11786,22 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
11591
11786
|
if (parentObject !== undefined && fromExplicitVadSignal != null) {
|
|
11592
11787
|
setValueByPath(parentObject, ['setup', 'explicitVadSignal'], fromExplicitVadSignal);
|
|
11593
11788
|
}
|
|
11789
|
+
const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
|
|
11790
|
+
if (parentObject !== undefined && fromAvatarConfig != null) {
|
|
11791
|
+
setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
|
|
11792
|
+
}
|
|
11793
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
11794
|
+
'safetySettings',
|
|
11795
|
+
]);
|
|
11796
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
11797
|
+
let transformedList = fromSafetySettings;
|
|
11798
|
+
if (Array.isArray(transformedList)) {
|
|
11799
|
+
transformedList = transformedList.map((item) => {
|
|
11800
|
+
return item;
|
|
11801
|
+
});
|
|
11802
|
+
}
|
|
11803
|
+
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
11804
|
+
}
|
|
11594
11805
|
return toObject;
|
|
11595
11806
|
}
|
|
11596
11807
|
function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
@@ -11781,22 +11992,6 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
11781
11992
|
}
|
|
11782
11993
|
return toObject;
|
|
11783
11994
|
}
|
|
11784
|
-
function multiSpeakerVoiceConfigToVertex$1(fromObject) {
|
|
11785
|
-
const toObject = {};
|
|
11786
|
-
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
11787
|
-
'speakerVoiceConfigs',
|
|
11788
|
-
]);
|
|
11789
|
-
if (fromSpeakerVoiceConfigs != null) {
|
|
11790
|
-
let transformedList = fromSpeakerVoiceConfigs;
|
|
11791
|
-
if (Array.isArray(transformedList)) {
|
|
11792
|
-
transformedList = transformedList.map((item) => {
|
|
11793
|
-
return speakerVoiceConfigToVertex$1(item);
|
|
11794
|
-
});
|
|
11795
|
-
}
|
|
11796
|
-
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
11797
|
-
}
|
|
11798
|
-
return toObject;
|
|
11799
|
-
}
|
|
11800
11995
|
function partToMldev$2(fromObject) {
|
|
11801
11996
|
const toObject = {};
|
|
11802
11997
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -11938,17 +12133,18 @@ function partToVertex$1(fromObject) {
|
|
|
11938
12133
|
}
|
|
11939
12134
|
return toObject;
|
|
11940
12135
|
}
|
|
11941
|
-
function
|
|
12136
|
+
function safetySettingToMldev$2(fromObject) {
|
|
11942
12137
|
const toObject = {};
|
|
11943
|
-
const
|
|
11944
|
-
if (
|
|
11945
|
-
setValueByPath(toObject, ['
|
|
12138
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
12139
|
+
if (fromCategory != null) {
|
|
12140
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
11946
12141
|
}
|
|
11947
|
-
|
|
11948
|
-
'
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
12142
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
12143
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
12144
|
+
}
|
|
12145
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
12146
|
+
if (fromThreshold != null) {
|
|
12147
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
11952
12148
|
}
|
|
11953
12149
|
return toObject;
|
|
11954
12150
|
}
|
|
@@ -11963,36 +12159,6 @@ function sessionResumptionConfigToMldev$1(fromObject) {
|
|
|
11963
12159
|
}
|
|
11964
12160
|
return toObject;
|
|
11965
12161
|
}
|
|
11966
|
-
function speakerVoiceConfigToVertex$1(fromObject) {
|
|
11967
|
-
const toObject = {};
|
|
11968
|
-
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
11969
|
-
if (fromSpeaker != null) {
|
|
11970
|
-
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
11971
|
-
}
|
|
11972
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
11973
|
-
if (fromVoiceConfig != null) {
|
|
11974
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex$1(fromVoiceConfig));
|
|
11975
|
-
}
|
|
11976
|
-
return toObject;
|
|
11977
|
-
}
|
|
11978
|
-
function speechConfigToVertex$1(fromObject) {
|
|
11979
|
-
const toObject = {};
|
|
11980
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
11981
|
-
if (fromVoiceConfig != null) {
|
|
11982
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex$1(fromVoiceConfig));
|
|
11983
|
-
}
|
|
11984
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
11985
|
-
if (fromLanguageCode != null) {
|
|
11986
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
11987
|
-
}
|
|
11988
|
-
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
11989
|
-
'multiSpeakerVoiceConfig',
|
|
11990
|
-
]);
|
|
11991
|
-
if (fromMultiSpeakerVoiceConfig != null) {
|
|
11992
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToVertex$1(fromMultiSpeakerVoiceConfig));
|
|
11993
|
-
}
|
|
11994
|
-
return toObject;
|
|
11995
|
-
}
|
|
11996
12162
|
function toolToMldev$2(fromObject) {
|
|
11997
12163
|
const toObject = {};
|
|
11998
12164
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
@@ -12226,22 +12392,6 @@ function voiceActivityFromVertex(fromObject) {
|
|
|
12226
12392
|
}
|
|
12227
12393
|
return toObject;
|
|
12228
12394
|
}
|
|
12229
|
-
function voiceConfigToVertex$1(fromObject) {
|
|
12230
|
-
const toObject = {};
|
|
12231
|
-
const fromReplicatedVoiceConfig = getValueByPath(fromObject, [
|
|
12232
|
-
'replicatedVoiceConfig',
|
|
12233
|
-
]);
|
|
12234
|
-
if (fromReplicatedVoiceConfig != null) {
|
|
12235
|
-
setValueByPath(toObject, ['replicatedVoiceConfig'], replicatedVoiceConfigToVertex$1(fromReplicatedVoiceConfig));
|
|
12236
|
-
}
|
|
12237
|
-
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
12238
|
-
'prebuiltVoiceConfig',
|
|
12239
|
-
]);
|
|
12240
|
-
if (fromPrebuiltVoiceConfig != null) {
|
|
12241
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], fromPrebuiltVoiceConfig);
|
|
12242
|
-
}
|
|
12243
|
-
return toObject;
|
|
12244
|
-
}
|
|
12245
12395
|
|
|
12246
12396
|
/**
|
|
12247
12397
|
* @license
|
|
@@ -12791,6 +12941,12 @@ function embedContentConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
12791
12941
|
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
12792
12942
|
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
12793
12943
|
}
|
|
12944
|
+
if (getValueByPath(fromObject, ['documentOcr']) !== undefined) {
|
|
12945
|
+
throw new Error('documentOcr parameter is not supported in Gemini API.');
|
|
12946
|
+
}
|
|
12947
|
+
if (getValueByPath(fromObject, ['audioTrackExtraction']) !== undefined) {
|
|
12948
|
+
throw new Error('audioTrackExtraction parameter is not supported in Gemini API.');
|
|
12949
|
+
}
|
|
12794
12950
|
return toObject;
|
|
12795
12951
|
}
|
|
12796
12952
|
function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -12810,7 +12966,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
12810
12966
|
else if (discriminatorTaskType === 'EMBED_CONTENT') {
|
|
12811
12967
|
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
12812
12968
|
if (parentObject !== undefined && fromTaskType != null) {
|
|
12813
|
-
setValueByPath(parentObject, ['taskType'], fromTaskType);
|
|
12969
|
+
setValueByPath(parentObject, ['embedContentConfig', 'taskType'], fromTaskType);
|
|
12814
12970
|
}
|
|
12815
12971
|
}
|
|
12816
12972
|
let discriminatorTitle = getValueByPath(rootObject, [
|
|
@@ -12828,7 +12984,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
12828
12984
|
else if (discriminatorTitle === 'EMBED_CONTENT') {
|
|
12829
12985
|
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
12830
12986
|
if (parentObject !== undefined && fromTitle != null) {
|
|
12831
|
-
setValueByPath(parentObject, ['title'], fromTitle);
|
|
12987
|
+
setValueByPath(parentObject, ['embedContentConfig', 'title'], fromTitle);
|
|
12832
12988
|
}
|
|
12833
12989
|
}
|
|
12834
12990
|
let discriminatorOutputDimensionality = getValueByPath(rootObject, [
|
|
@@ -12850,7 +13006,7 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
12850
13006
|
'outputDimensionality',
|
|
12851
13007
|
]);
|
|
12852
13008
|
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
12853
|
-
setValueByPath(parentObject, ['outputDimensionality'], fromOutputDimensionality);
|
|
13009
|
+
setValueByPath(parentObject, ['embedContentConfig', 'outputDimensionality'], fromOutputDimensionality);
|
|
12854
13010
|
}
|
|
12855
13011
|
}
|
|
12856
13012
|
let discriminatorMimeType = getValueByPath(rootObject, [
|
|
@@ -12884,7 +13040,33 @@ function embedContentConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
12884
13040
|
'autoTruncate',
|
|
12885
13041
|
]);
|
|
12886
13042
|
if (parentObject !== undefined && fromAutoTruncate != null) {
|
|
12887
|
-
setValueByPath(parentObject, ['autoTruncate'], fromAutoTruncate);
|
|
13043
|
+
setValueByPath(parentObject, ['embedContentConfig', 'autoTruncate'], fromAutoTruncate);
|
|
13044
|
+
}
|
|
13045
|
+
}
|
|
13046
|
+
let discriminatorDocumentOcr = getValueByPath(rootObject, [
|
|
13047
|
+
'embeddingApiType',
|
|
13048
|
+
]);
|
|
13049
|
+
if (discriminatorDocumentOcr === undefined) {
|
|
13050
|
+
discriminatorDocumentOcr = 'PREDICT';
|
|
13051
|
+
}
|
|
13052
|
+
if (discriminatorDocumentOcr === 'EMBED_CONTENT') {
|
|
13053
|
+
const fromDocumentOcr = getValueByPath(fromObject, ['documentOcr']);
|
|
13054
|
+
if (parentObject !== undefined && fromDocumentOcr != null) {
|
|
13055
|
+
setValueByPath(parentObject, ['embedContentConfig', 'documentOcr'], fromDocumentOcr);
|
|
13056
|
+
}
|
|
13057
|
+
}
|
|
13058
|
+
let discriminatorAudioTrackExtraction = getValueByPath(rootObject, [
|
|
13059
|
+
'embeddingApiType',
|
|
13060
|
+
]);
|
|
13061
|
+
if (discriminatorAudioTrackExtraction === undefined) {
|
|
13062
|
+
discriminatorAudioTrackExtraction = 'PREDICT';
|
|
13063
|
+
}
|
|
13064
|
+
if (discriminatorAudioTrackExtraction === 'EMBED_CONTENT') {
|
|
13065
|
+
const fromAudioTrackExtraction = getValueByPath(fromObject, [
|
|
13066
|
+
'audioTrackExtraction',
|
|
13067
|
+
]);
|
|
13068
|
+
if (parentObject !== undefined && fromAudioTrackExtraction != null) {
|
|
13069
|
+
setValueByPath(parentObject, ['embedContentConfig', 'audioTrackExtraction'], fromAudioTrackExtraction);
|
|
12888
13070
|
}
|
|
12889
13071
|
}
|
|
12890
13072
|
return toObject;
|
|
@@ -13229,7 +13411,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject, rootO
|
|
|
13229
13411
|
let transformedList = fromSafetySettings;
|
|
13230
13412
|
if (Array.isArray(transformedList)) {
|
|
13231
13413
|
transformedList = transformedList.map((item) => {
|
|
13232
|
-
return safetySettingToMldev(item);
|
|
13414
|
+
return safetySettingToMldev$1(item);
|
|
13233
13415
|
});
|
|
13234
13416
|
}
|
|
13235
13417
|
setValueByPath(parentObject, ['safetySettings'], transformedList);
|
|
@@ -13445,7 +13627,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
13445
13627
|
}
|
|
13446
13628
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
13447
13629
|
if (fromSpeechConfig != null) {
|
|
13448
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
13630
|
+
setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
|
|
13449
13631
|
}
|
|
13450
13632
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
13451
13633
|
'audioTimestamp',
|
|
@@ -13953,6 +14135,12 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
|
|
|
13953
14135
|
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
13954
14136
|
throw new Error('labels parameter is not supported in Gemini API.');
|
|
13955
14137
|
}
|
|
14138
|
+
const fromWebhookConfig = getValueByPath(fromObject, [
|
|
14139
|
+
'webhookConfig',
|
|
14140
|
+
]);
|
|
14141
|
+
if (parentObject !== undefined && fromWebhookConfig != null) {
|
|
14142
|
+
setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
|
|
14143
|
+
}
|
|
13956
14144
|
return toObject;
|
|
13957
14145
|
}
|
|
13958
14146
|
function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -14047,6 +14235,9 @@ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
14047
14235
|
if (parentObject !== undefined && fromLabels != null) {
|
|
14048
14236
|
setValueByPath(parentObject, ['labels'], fromLabels);
|
|
14049
14237
|
}
|
|
14238
|
+
if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
|
|
14239
|
+
throw new Error('webhookConfig parameter is not supported in Vertex AI.');
|
|
14240
|
+
}
|
|
14050
14241
|
return toObject;
|
|
14051
14242
|
}
|
|
14052
14243
|
function generateVideosOperationFromMldev(fromObject, rootObject) {
|
|
@@ -14316,7 +14507,7 @@ function generatedVideoFromVertex(fromObject, rootObject) {
|
|
|
14316
14507
|
}
|
|
14317
14508
|
return toObject;
|
|
14318
14509
|
}
|
|
14319
|
-
function generationConfigToVertex(fromObject,
|
|
14510
|
+
function generationConfigToVertex(fromObject, _rootObject) {
|
|
14320
14511
|
const toObject = {};
|
|
14321
14512
|
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
14322
14513
|
'modelSelectionConfig',
|
|
@@ -14412,7 +14603,7 @@ function generationConfigToVertex(fromObject, rootObject) {
|
|
|
14412
14603
|
}
|
|
14413
14604
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14414
14605
|
if (fromSpeechConfig != null) {
|
|
14415
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
14606
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
14416
14607
|
}
|
|
14417
14608
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
14418
14609
|
'stopSequences',
|
|
@@ -14869,22 +15060,6 @@ function modelFromVertex(fromObject, rootObject) {
|
|
|
14869
15060
|
}
|
|
14870
15061
|
return toObject;
|
|
14871
15062
|
}
|
|
14872
|
-
function multiSpeakerVoiceConfigToVertex(fromObject, rootObject) {
|
|
14873
|
-
const toObject = {};
|
|
14874
|
-
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
14875
|
-
'speakerVoiceConfigs',
|
|
14876
|
-
]);
|
|
14877
|
-
if (fromSpeakerVoiceConfigs != null) {
|
|
14878
|
-
let transformedList = fromSpeakerVoiceConfigs;
|
|
14879
|
-
if (Array.isArray(transformedList)) {
|
|
14880
|
-
transformedList = transformedList.map((item) => {
|
|
14881
|
-
return speakerVoiceConfigToVertex(item);
|
|
14882
|
-
});
|
|
14883
|
-
}
|
|
14884
|
-
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
14885
|
-
}
|
|
14886
|
-
return toObject;
|
|
14887
|
-
}
|
|
14888
15063
|
function partToMldev$1(fromObject, rootObject) {
|
|
14889
15064
|
const toObject = {};
|
|
14890
15065
|
const fromMediaResolution = getValueByPath(fromObject, [
|
|
@@ -15194,20 +15369,6 @@ function referenceImageAPIInternalToVertex(fromObject, rootObject) {
|
|
|
15194
15369
|
}
|
|
15195
15370
|
return toObject;
|
|
15196
15371
|
}
|
|
15197
|
-
function replicatedVoiceConfigToVertex(fromObject, _rootObject) {
|
|
15198
|
-
const toObject = {};
|
|
15199
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
15200
|
-
if (fromMimeType != null) {
|
|
15201
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
15202
|
-
}
|
|
15203
|
-
const fromVoiceSampleAudio = getValueByPath(fromObject, [
|
|
15204
|
-
'voiceSampleAudio',
|
|
15205
|
-
]);
|
|
15206
|
-
if (fromVoiceSampleAudio != null) {
|
|
15207
|
-
setValueByPath(toObject, ['voiceSampleAudio'], fromVoiceSampleAudio);
|
|
15208
|
-
}
|
|
15209
|
-
return toObject;
|
|
15210
|
-
}
|
|
15211
15372
|
function safetyAttributesFromMldev(fromObject, _rootObject) {
|
|
15212
15373
|
const toObject = {};
|
|
15213
15374
|
const fromCategories = getValueByPath(fromObject, [
|
|
@@ -15252,7 +15413,7 @@ function safetyAttributesFromVertex(fromObject, _rootObject) {
|
|
|
15252
15413
|
}
|
|
15253
15414
|
return toObject;
|
|
15254
15415
|
}
|
|
15255
|
-
function safetySettingToMldev(fromObject, _rootObject) {
|
|
15416
|
+
function safetySettingToMldev$1(fromObject, _rootObject) {
|
|
15256
15417
|
const toObject = {};
|
|
15257
15418
|
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
15258
15419
|
if (fromCategory != null) {
|
|
@@ -15357,36 +15518,6 @@ function segmentImageSourceToVertex(fromObject, parentObject, rootObject) {
|
|
|
15357
15518
|
}
|
|
15358
15519
|
return toObject;
|
|
15359
15520
|
}
|
|
15360
|
-
function speakerVoiceConfigToVertex(fromObject, rootObject) {
|
|
15361
|
-
const toObject = {};
|
|
15362
|
-
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
15363
|
-
if (fromSpeaker != null) {
|
|
15364
|
-
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
15365
|
-
}
|
|
15366
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
15367
|
-
if (fromVoiceConfig != null) {
|
|
15368
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(fromVoiceConfig));
|
|
15369
|
-
}
|
|
15370
|
-
return toObject;
|
|
15371
|
-
}
|
|
15372
|
-
function speechConfigToVertex(fromObject, rootObject) {
|
|
15373
|
-
const toObject = {};
|
|
15374
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
15375
|
-
if (fromVoiceConfig != null) {
|
|
15376
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(fromVoiceConfig));
|
|
15377
|
-
}
|
|
15378
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
15379
|
-
if (fromLanguageCode != null) {
|
|
15380
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
15381
|
-
}
|
|
15382
|
-
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
15383
|
-
'multiSpeakerVoiceConfig',
|
|
15384
|
-
]);
|
|
15385
|
-
if (fromMultiSpeakerVoiceConfig != null) {
|
|
15386
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToVertex(fromMultiSpeakerVoiceConfig));
|
|
15387
|
-
}
|
|
15388
|
-
return toObject;
|
|
15389
|
-
}
|
|
15390
15521
|
function toolConfigToMldev(fromObject, rootObject) {
|
|
15391
15522
|
const toObject = {};
|
|
15392
15523
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
@@ -15869,22 +16000,6 @@ function videoToVertex(fromObject, _rootObject) {
|
|
|
15869
16000
|
}
|
|
15870
16001
|
return toObject;
|
|
15871
16002
|
}
|
|
15872
|
-
function voiceConfigToVertex(fromObject, rootObject) {
|
|
15873
|
-
const toObject = {};
|
|
15874
|
-
const fromReplicatedVoiceConfig = getValueByPath(fromObject, [
|
|
15875
|
-
'replicatedVoiceConfig',
|
|
15876
|
-
]);
|
|
15877
|
-
if (fromReplicatedVoiceConfig != null) {
|
|
15878
|
-
setValueByPath(toObject, ['replicatedVoiceConfig'], replicatedVoiceConfigToVertex(fromReplicatedVoiceConfig));
|
|
15879
|
-
}
|
|
15880
|
-
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
15881
|
-
'prebuiltVoiceConfig',
|
|
15882
|
-
]);
|
|
15883
|
-
if (fromPrebuiltVoiceConfig != null) {
|
|
15884
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], fromPrebuiltVoiceConfig);
|
|
15885
|
-
}
|
|
15886
|
-
return toObject;
|
|
15887
|
-
}
|
|
15888
16003
|
|
|
15889
16004
|
/**
|
|
15890
16005
|
* @license
|
|
@@ -16844,6 +16959,10 @@ class Models extends BaseModule {
|
|
|
16844
16959
|
*/
|
|
16845
16960
|
this.embedContent = async (params) => {
|
|
16846
16961
|
if (!this.apiClient.isVertexAI()) {
|
|
16962
|
+
const isGeminiEmbedding2Model = params.model.includes('gemini-embedding-2');
|
|
16963
|
+
if (isGeminiEmbedding2Model) {
|
|
16964
|
+
params.contents = tContents(params.contents);
|
|
16965
|
+
}
|
|
16847
16966
|
return await this.embedContentInternal(params);
|
|
16848
16967
|
}
|
|
16849
16968
|
const isVertexEmbedContentModel = (params.model.includes('gemini') &&
|
|
@@ -17780,29 +17899,15 @@ class Models extends BaseModule {
|
|
|
17780
17899
|
/**
|
|
17781
17900
|
* Recontextualizes an image.
|
|
17782
17901
|
*
|
|
17783
|
-
* There
|
|
17784
|
-
* 1)
|
|
17785
|
-
* and contexts.
|
|
17786
|
-
* 2) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
17902
|
+
* There is one type of recontextualization currently supported:
|
|
17903
|
+
* 1) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
17787
17904
|
*
|
|
17788
17905
|
* @param params - The parameters for recontextualizing an image.
|
|
17789
17906
|
* @return The response from the API.
|
|
17790
17907
|
*
|
|
17791
17908
|
* @example
|
|
17792
17909
|
* ```ts
|
|
17793
|
-
* const
|
|
17794
|
-
* model: 'imagen-product-recontext-preview-06-30',
|
|
17795
|
-
* source: {
|
|
17796
|
-
* prompt: 'In a modern kitchen setting.',
|
|
17797
|
-
* productImages: [productImage],
|
|
17798
|
-
* },
|
|
17799
|
-
* config: {
|
|
17800
|
-
* numberOfImages: 1,
|
|
17801
|
-
* },
|
|
17802
|
-
* });
|
|
17803
|
-
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
17804
|
-
*
|
|
17805
|
-
* const response2 = await ai.models.recontextImage({
|
|
17910
|
+
* const response = await ai.models.recontextImage({
|
|
17806
17911
|
* model: 'virtual-try-on-001',
|
|
17807
17912
|
* source: {
|
|
17808
17913
|
* personImage: personImage,
|
|
@@ -17812,7 +17917,7 @@ class Models extends BaseModule {
|
|
|
17812
17917
|
* numberOfImages: 1,
|
|
17813
17918
|
* },
|
|
17814
17919
|
* });
|
|
17815
|
-
* console.log(
|
|
17920
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
17816
17921
|
* ```
|
|
17817
17922
|
*/
|
|
17818
17923
|
async recontextImage(params) {
|
|
@@ -18837,6 +18942,22 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
18837
18942
|
if (getValueByPath(fromObject, ['explicitVadSignal']) !== undefined) {
|
|
18838
18943
|
throw new Error('explicitVadSignal parameter is not supported in Gemini API.');
|
|
18839
18944
|
}
|
|
18945
|
+
const fromAvatarConfig = getValueByPath(fromObject, ['avatarConfig']);
|
|
18946
|
+
if (parentObject !== undefined && fromAvatarConfig != null) {
|
|
18947
|
+
setValueByPath(parentObject, ['setup', 'avatarConfig'], fromAvatarConfig);
|
|
18948
|
+
}
|
|
18949
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
18950
|
+
'safetySettings',
|
|
18951
|
+
]);
|
|
18952
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
18953
|
+
let transformedList = fromSafetySettings;
|
|
18954
|
+
if (Array.isArray(transformedList)) {
|
|
18955
|
+
transformedList = transformedList.map((item) => {
|
|
18956
|
+
return safetySettingToMldev(item);
|
|
18957
|
+
});
|
|
18958
|
+
}
|
|
18959
|
+
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
18960
|
+
}
|
|
18840
18961
|
return toObject;
|
|
18841
18962
|
}
|
|
18842
18963
|
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
@@ -18923,6 +19044,21 @@ function partToMldev(fromObject) {
|
|
|
18923
19044
|
}
|
|
18924
19045
|
return toObject;
|
|
18925
19046
|
}
|
|
19047
|
+
function safetySettingToMldev(fromObject) {
|
|
19048
|
+
const toObject = {};
|
|
19049
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
19050
|
+
if (fromCategory != null) {
|
|
19051
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
19052
|
+
}
|
|
19053
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
19054
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
19055
|
+
}
|
|
19056
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
19057
|
+
if (fromThreshold != null) {
|
|
19058
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
19059
|
+
}
|
|
19060
|
+
return toObject;
|
|
19061
|
+
}
|
|
18926
19062
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
18927
19063
|
const toObject = {};
|
|
18928
19064
|
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
@@ -20607,32 +20743,41 @@ const LANGUAGE_LABEL_PREFIX = 'gl-node/';
|
|
|
20607
20743
|
*
|
|
20608
20744
|
*/
|
|
20609
20745
|
class GoogleGenAI {
|
|
20610
|
-
|
|
20746
|
+
getNextGenClient() {
|
|
20611
20747
|
var _a;
|
|
20612
|
-
if (this._interactions !== undefined) {
|
|
20613
|
-
return this._interactions;
|
|
20614
|
-
}
|
|
20615
|
-
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
20616
|
-
if (this.vertexai) {
|
|
20617
|
-
throw new Error('This version of the GenAI SDK does not support Vertex AI API for interactions.');
|
|
20618
|
-
}
|
|
20619
20748
|
const httpOpts = this.httpOptions;
|
|
20749
|
+
if (this._nextGenClient === undefined) {
|
|
20750
|
+
this._nextGenClient = new GeminiNextGenAPIClient({
|
|
20751
|
+
baseURL: this.apiClient.getBaseUrl(),
|
|
20752
|
+
apiKey: this.apiKey,
|
|
20753
|
+
apiVersion: this.apiClient.getApiVersion(),
|
|
20754
|
+
clientAdapter: this.apiClient,
|
|
20755
|
+
defaultHeaders: this.apiClient.getDefaultHeaders(),
|
|
20756
|
+
timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
|
|
20757
|
+
maxRetries: (_a = httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.retryOptions) === null || _a === void 0 ? void 0 : _a.attempts,
|
|
20758
|
+
});
|
|
20759
|
+
}
|
|
20620
20760
|
// Unsupported Options Warnings
|
|
20621
20761
|
if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {
|
|
20622
20762
|
console.warn('GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.');
|
|
20623
20763
|
}
|
|
20624
|
-
|
|
20625
|
-
|
|
20626
|
-
|
|
20627
|
-
|
|
20628
|
-
|
|
20629
|
-
|
|
20630
|
-
|
|
20631
|
-
|
|
20632
|
-
});
|
|
20633
|
-
this._interactions = nextGenClient.interactions;
|
|
20764
|
+
return this._nextGenClient;
|
|
20765
|
+
}
|
|
20766
|
+
get interactions() {
|
|
20767
|
+
if (this._interactions !== undefined) {
|
|
20768
|
+
return this._interactions;
|
|
20769
|
+
}
|
|
20770
|
+
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
20771
|
+
this._interactions = this.getNextGenClient().interactions;
|
|
20634
20772
|
return this._interactions;
|
|
20635
20773
|
}
|
|
20774
|
+
get webhooks() {
|
|
20775
|
+
if (this._webhooks !== undefined) {
|
|
20776
|
+
return this._webhooks;
|
|
20777
|
+
}
|
|
20778
|
+
this._webhooks = this.getNextGenClient().webhooks;
|
|
20779
|
+
return this._webhooks;
|
|
20780
|
+
}
|
|
20636
20781
|
constructor(options) {
|
|
20637
20782
|
var _a;
|
|
20638
20783
|
if (options.apiKey == null) {
|