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