@google/genai 0.13.0 → 0.14.1
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/README.md +27 -1
- package/dist/genai.d.ts +237 -21
- package/dist/index.js +917 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +911 -121
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +917 -120
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +237 -21
- package/dist/web/index.mjs +911 -121
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +237 -21
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -573,6 +573,21 @@ function hasField(data, fieldName) {
|
|
|
573
573
|
* Copyright 2025 Google LLC
|
|
574
574
|
* SPDX-License-Identifier: Apache-2.0
|
|
575
575
|
*/
|
|
576
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
577
|
+
const toObject = {};
|
|
578
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
579
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
580
|
+
}
|
|
581
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
582
|
+
if (fromData != null) {
|
|
583
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
584
|
+
}
|
|
585
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
586
|
+
if (fromMimeType != null) {
|
|
587
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
588
|
+
}
|
|
589
|
+
return toObject;
|
|
590
|
+
}
|
|
576
591
|
function partToMldev$2(apiClient, fromObject) {
|
|
577
592
|
const toObject = {};
|
|
578
593
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -582,6 +597,10 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
582
597
|
if (fromThought != null) {
|
|
583
598
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
584
599
|
}
|
|
600
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
601
|
+
if (fromInlineData != null) {
|
|
602
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
603
|
+
}
|
|
585
604
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
586
605
|
'codeExecutionResult',
|
|
587
606
|
]);
|
|
@@ -608,10 +627,6 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
608
627
|
if (fromFunctionResponse != null) {
|
|
609
628
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
610
629
|
}
|
|
611
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
612
|
-
if (fromInlineData != null) {
|
|
613
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
614
|
-
}
|
|
615
630
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
616
631
|
if (fromText != null) {
|
|
617
632
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -852,6 +867,22 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
|
852
867
|
}
|
|
853
868
|
return toObject;
|
|
854
869
|
}
|
|
870
|
+
function blobToVertex$2(apiClient, fromObject) {
|
|
871
|
+
const toObject = {};
|
|
872
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
873
|
+
if (fromDisplayName != null) {
|
|
874
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
875
|
+
}
|
|
876
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
877
|
+
if (fromData != null) {
|
|
878
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
879
|
+
}
|
|
880
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
881
|
+
if (fromMimeType != null) {
|
|
882
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
883
|
+
}
|
|
884
|
+
return toObject;
|
|
885
|
+
}
|
|
855
886
|
function partToVertex$2(apiClient, fromObject) {
|
|
856
887
|
const toObject = {};
|
|
857
888
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -864,6 +895,10 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
864
895
|
if (fromThought != null) {
|
|
865
896
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
866
897
|
}
|
|
898
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
899
|
+
if (fromInlineData != null) {
|
|
900
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex$2(apiClient, fromInlineData));
|
|
901
|
+
}
|
|
867
902
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
868
903
|
'codeExecutionResult',
|
|
869
904
|
]);
|
|
@@ -890,10 +925,6 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
890
925
|
if (fromFunctionResponse != null) {
|
|
891
926
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
892
927
|
}
|
|
893
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
894
|
-
if (fromInlineData != null) {
|
|
895
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
896
|
-
}
|
|
897
928
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
898
929
|
if (fromText != null) {
|
|
899
930
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -1729,21 +1760,6 @@ exports.ImagePromptLanguage = void 0;
|
|
|
1729
1760
|
ImagePromptLanguage["ko"] = "ko";
|
|
1730
1761
|
ImagePromptLanguage["hi"] = "hi";
|
|
1731
1762
|
})(exports.ImagePromptLanguage || (exports.ImagePromptLanguage = {}));
|
|
1732
|
-
/** State for the lifecycle of a File. */
|
|
1733
|
-
exports.FileState = void 0;
|
|
1734
|
-
(function (FileState) {
|
|
1735
|
-
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1736
|
-
FileState["PROCESSING"] = "PROCESSING";
|
|
1737
|
-
FileState["ACTIVE"] = "ACTIVE";
|
|
1738
|
-
FileState["FAILED"] = "FAILED";
|
|
1739
|
-
})(exports.FileState || (exports.FileState = {}));
|
|
1740
|
-
/** Source of the File. */
|
|
1741
|
-
exports.FileSource = void 0;
|
|
1742
|
-
(function (FileSource) {
|
|
1743
|
-
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1744
|
-
FileSource["UPLOADED"] = "UPLOADED";
|
|
1745
|
-
FileSource["GENERATED"] = "GENERATED";
|
|
1746
|
-
})(exports.FileSource || (exports.FileSource = {}));
|
|
1747
1763
|
/** Enum representing the mask mode of a mask reference image. */
|
|
1748
1764
|
exports.MaskReferenceMode = void 0;
|
|
1749
1765
|
(function (MaskReferenceMode) {
|
|
@@ -1769,6 +1785,33 @@ exports.SubjectReferenceType = void 0;
|
|
|
1769
1785
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
1770
1786
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
1771
1787
|
})(exports.SubjectReferenceType || (exports.SubjectReferenceType = {}));
|
|
1788
|
+
/** Enum representing the Imagen 3 Edit mode. */
|
|
1789
|
+
exports.EditMode = void 0;
|
|
1790
|
+
(function (EditMode) {
|
|
1791
|
+
EditMode["EDIT_MODE_DEFAULT"] = "EDIT_MODE_DEFAULT";
|
|
1792
|
+
EditMode["EDIT_MODE_INPAINT_REMOVAL"] = "EDIT_MODE_INPAINT_REMOVAL";
|
|
1793
|
+
EditMode["EDIT_MODE_INPAINT_INSERTION"] = "EDIT_MODE_INPAINT_INSERTION";
|
|
1794
|
+
EditMode["EDIT_MODE_OUTPAINT"] = "EDIT_MODE_OUTPAINT";
|
|
1795
|
+
EditMode["EDIT_MODE_CONTROLLED_EDITING"] = "EDIT_MODE_CONTROLLED_EDITING";
|
|
1796
|
+
EditMode["EDIT_MODE_STYLE"] = "EDIT_MODE_STYLE";
|
|
1797
|
+
EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
|
|
1798
|
+
EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
|
|
1799
|
+
})(exports.EditMode || (exports.EditMode = {}));
|
|
1800
|
+
/** State for the lifecycle of a File. */
|
|
1801
|
+
exports.FileState = void 0;
|
|
1802
|
+
(function (FileState) {
|
|
1803
|
+
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1804
|
+
FileState["PROCESSING"] = "PROCESSING";
|
|
1805
|
+
FileState["ACTIVE"] = "ACTIVE";
|
|
1806
|
+
FileState["FAILED"] = "FAILED";
|
|
1807
|
+
})(exports.FileState || (exports.FileState = {}));
|
|
1808
|
+
/** Source of the File. */
|
|
1809
|
+
exports.FileSource = void 0;
|
|
1810
|
+
(function (FileSource) {
|
|
1811
|
+
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1812
|
+
FileSource["UPLOADED"] = "UPLOADED";
|
|
1813
|
+
FileSource["GENERATED"] = "GENERATED";
|
|
1814
|
+
})(exports.FileSource || (exports.FileSource = {}));
|
|
1772
1815
|
/** Server content modalities. */
|
|
1773
1816
|
exports.MediaModality = void 0;
|
|
1774
1817
|
(function (MediaModality) {
|
|
@@ -2183,6 +2226,11 @@ class EmbedContentResponse {
|
|
|
2183
2226
|
/** The output images response. */
|
|
2184
2227
|
class GenerateImagesResponse {
|
|
2185
2228
|
}
|
|
2229
|
+
/** Response for the request to edit an image. */
|
|
2230
|
+
class EditImageResponse {
|
|
2231
|
+
}
|
|
2232
|
+
class UpscaleImageResponse {
|
|
2233
|
+
}
|
|
2186
2234
|
class ListModelsResponse {
|
|
2187
2235
|
}
|
|
2188
2236
|
class DeleteModelResponse {
|
|
@@ -2232,6 +2280,112 @@ class DeleteFileResponse {
|
|
|
2232
2280
|
/** Represents a single response in a replay. */
|
|
2233
2281
|
class ReplayResponse {
|
|
2234
2282
|
}
|
|
2283
|
+
/** A raw reference image.
|
|
2284
|
+
|
|
2285
|
+
A raw reference image represents the base image to edit, provided by the user.
|
|
2286
|
+
It can optionally be provided in addition to a mask reference image or
|
|
2287
|
+
a style reference image.
|
|
2288
|
+
*/
|
|
2289
|
+
class RawReferenceImage {
|
|
2290
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2291
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2292
|
+
toReferenceImageAPI() {
|
|
2293
|
+
const referenceImageAPI = {
|
|
2294
|
+
referenceType: 'REFERENCE_TYPE_RAW',
|
|
2295
|
+
referenceImage: this.referenceImage,
|
|
2296
|
+
referenceId: this.referenceId,
|
|
2297
|
+
};
|
|
2298
|
+
return referenceImageAPI;
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
/** A mask reference image.
|
|
2302
|
+
|
|
2303
|
+
This encapsulates either a mask image provided by the user and configs for
|
|
2304
|
+
the user provided mask, or only config parameters for the model to generate
|
|
2305
|
+
a mask.
|
|
2306
|
+
|
|
2307
|
+
A mask image is an image whose non-zero values indicate where to edit the base
|
|
2308
|
+
image. If the user provides a mask image, the mask must be in the same
|
|
2309
|
+
dimensions as the raw image.
|
|
2310
|
+
*/
|
|
2311
|
+
class MaskReferenceImage {
|
|
2312
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2313
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2314
|
+
toReferenceImageAPI() {
|
|
2315
|
+
const referenceImageAPI = {
|
|
2316
|
+
referenceType: 'REFERENCE_TYPE_MASK',
|
|
2317
|
+
referenceImage: this.referenceImage,
|
|
2318
|
+
referenceId: this.referenceId,
|
|
2319
|
+
maskImageConfig: this.config,
|
|
2320
|
+
};
|
|
2321
|
+
return referenceImageAPI;
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
/** A control reference image.
|
|
2325
|
+
|
|
2326
|
+
The image of the control reference image is either a control image provided
|
|
2327
|
+
by the user, or a regular image which the backend will use to generate a
|
|
2328
|
+
control image of. In the case of the latter, the
|
|
2329
|
+
enable_control_image_computation field in the config should be set to True.
|
|
2330
|
+
|
|
2331
|
+
A control image is an image that represents a sketch image of areas for the
|
|
2332
|
+
model to fill in based on the prompt.
|
|
2333
|
+
*/
|
|
2334
|
+
class ControlReferenceImage {
|
|
2335
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2337
|
+
toReferenceImageAPI() {
|
|
2338
|
+
const referenceImageAPI = {
|
|
2339
|
+
referenceType: 'REFERENCE_TYPE_CONTROL',
|
|
2340
|
+
referenceImage: this.referenceImage,
|
|
2341
|
+
referenceId: this.referenceId,
|
|
2342
|
+
controlImageConfig: this.config,
|
|
2343
|
+
};
|
|
2344
|
+
return referenceImageAPI;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
/** A style reference image.
|
|
2348
|
+
|
|
2349
|
+
This encapsulates a style reference image provided by the user, and
|
|
2350
|
+
additionally optional config parameters for the style reference image.
|
|
2351
|
+
|
|
2352
|
+
A raw reference image can also be provided as a destination for the style to
|
|
2353
|
+
be applied to.
|
|
2354
|
+
*/
|
|
2355
|
+
class StyleReferenceImage {
|
|
2356
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2357
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2358
|
+
toReferenceImageAPI() {
|
|
2359
|
+
const referenceImageAPI = {
|
|
2360
|
+
referenceType: 'REFERENCE_TYPE_STYLE',
|
|
2361
|
+
referenceImage: this.referenceImage,
|
|
2362
|
+
referenceId: this.referenceId,
|
|
2363
|
+
styleImageConfig: this.config,
|
|
2364
|
+
};
|
|
2365
|
+
return referenceImageAPI;
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
/** A subject reference image.
|
|
2369
|
+
|
|
2370
|
+
This encapsulates a subject reference image provided by the user, and
|
|
2371
|
+
additionally optional config parameters for the subject reference image.
|
|
2372
|
+
|
|
2373
|
+
A raw reference image can also be provided as a destination for the subject to
|
|
2374
|
+
be applied to.
|
|
2375
|
+
*/
|
|
2376
|
+
class SubjectReferenceImage {
|
|
2377
|
+
/* Internal method to convert to ReferenceImageAPIInternal. */
|
|
2378
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2379
|
+
toReferenceImageAPI() {
|
|
2380
|
+
const referenceImageAPI = {
|
|
2381
|
+
referenceType: 'REFERENCE_TYPE_SUBJECT',
|
|
2382
|
+
referenceImage: this.referenceImage,
|
|
2383
|
+
referenceId: this.referenceId,
|
|
2384
|
+
subjectImageConfig: this.config,
|
|
2385
|
+
};
|
|
2386
|
+
return referenceImageAPI;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2235
2389
|
/** Response message for API call. */
|
|
2236
2390
|
class LiveServerMessage {
|
|
2237
2391
|
/**
|
|
@@ -3057,7 +3211,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
3057
3211
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
3058
3212
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
3059
3213
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
3060
|
-
const SDK_VERSION = '0.
|
|
3214
|
+
const SDK_VERSION = '0.14.1'; // x-release-please-version
|
|
3061
3215
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
3062
3216
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
3063
3217
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -4221,6 +4375,37 @@ class Files extends BaseModule {
|
|
|
4221
4375
|
* Copyright 2025 Google LLC
|
|
4222
4376
|
* SPDX-License-Identifier: Apache-2.0
|
|
4223
4377
|
*/
|
|
4378
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
4379
|
+
const toObject = {};
|
|
4380
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
4381
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
4382
|
+
}
|
|
4383
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
4384
|
+
if (fromData != null) {
|
|
4385
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
4386
|
+
}
|
|
4387
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4388
|
+
if (fromMimeType != null) {
|
|
4389
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4390
|
+
}
|
|
4391
|
+
return toObject;
|
|
4392
|
+
}
|
|
4393
|
+
function blobToVertex$1(apiClient, fromObject) {
|
|
4394
|
+
const toObject = {};
|
|
4395
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
4396
|
+
if (fromDisplayName != null) {
|
|
4397
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
4398
|
+
}
|
|
4399
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
4400
|
+
if (fromData != null) {
|
|
4401
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
4402
|
+
}
|
|
4403
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4404
|
+
if (fromMimeType != null) {
|
|
4405
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4406
|
+
}
|
|
4407
|
+
return toObject;
|
|
4408
|
+
}
|
|
4224
4409
|
function partToMldev$1(apiClient, fromObject) {
|
|
4225
4410
|
const toObject = {};
|
|
4226
4411
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -4230,6 +4415,10 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
4230
4415
|
if (fromThought != null) {
|
|
4231
4416
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
4232
4417
|
}
|
|
4418
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4419
|
+
if (fromInlineData != null) {
|
|
4420
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
4421
|
+
}
|
|
4233
4422
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4234
4423
|
'codeExecutionResult',
|
|
4235
4424
|
]);
|
|
@@ -4256,10 +4445,6 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
4256
4445
|
if (fromFunctionResponse != null) {
|
|
4257
4446
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4258
4447
|
}
|
|
4259
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4260
|
-
if (fromInlineData != null) {
|
|
4261
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4262
|
-
}
|
|
4263
4448
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4264
4449
|
if (fromText != null) {
|
|
4265
4450
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -4278,6 +4463,10 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
4278
4463
|
if (fromThought != null) {
|
|
4279
4464
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
4280
4465
|
}
|
|
4466
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4467
|
+
if (fromInlineData != null) {
|
|
4468
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex$1(apiClient, fromInlineData));
|
|
4469
|
+
}
|
|
4281
4470
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4282
4471
|
'codeExecutionResult',
|
|
4283
4472
|
]);
|
|
@@ -4304,10 +4493,6 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
4304
4493
|
if (fromFunctionResponse != null) {
|
|
4305
4494
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4306
4495
|
}
|
|
4307
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4308
|
-
if (fromInlineData != null) {
|
|
4309
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4310
|
-
}
|
|
4311
4496
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4312
4497
|
if (fromText != null) {
|
|
4313
4498
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5021,12 +5206,44 @@ function liveServerSetupCompleteFromVertex() {
|
|
|
5021
5206
|
const toObject = {};
|
|
5022
5207
|
return toObject;
|
|
5023
5208
|
}
|
|
5209
|
+
function blobFromMldev$1(apiClient, fromObject) {
|
|
5210
|
+
const toObject = {};
|
|
5211
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
5212
|
+
if (fromData != null) {
|
|
5213
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
5214
|
+
}
|
|
5215
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
5216
|
+
if (fromMimeType != null) {
|
|
5217
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
5218
|
+
}
|
|
5219
|
+
return toObject;
|
|
5220
|
+
}
|
|
5221
|
+
function blobFromVertex$1(apiClient, fromObject) {
|
|
5222
|
+
const toObject = {};
|
|
5223
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
5224
|
+
if (fromDisplayName != null) {
|
|
5225
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
5226
|
+
}
|
|
5227
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
5228
|
+
if (fromData != null) {
|
|
5229
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
5230
|
+
}
|
|
5231
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
5232
|
+
if (fromMimeType != null) {
|
|
5233
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
5234
|
+
}
|
|
5235
|
+
return toObject;
|
|
5236
|
+
}
|
|
5024
5237
|
function partFromMldev$1(apiClient, fromObject) {
|
|
5025
5238
|
const toObject = {};
|
|
5026
5239
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5027
5240
|
if (fromThought != null) {
|
|
5028
5241
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5029
5242
|
}
|
|
5243
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5244
|
+
if (fromInlineData != null) {
|
|
5245
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev$1(apiClient, fromInlineData));
|
|
5246
|
+
}
|
|
5030
5247
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5031
5248
|
'codeExecutionResult',
|
|
5032
5249
|
]);
|
|
@@ -5053,10 +5270,6 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
5053
5270
|
if (fromFunctionResponse != null) {
|
|
5054
5271
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5055
5272
|
}
|
|
5056
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5057
|
-
if (fromInlineData != null) {
|
|
5058
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5059
|
-
}
|
|
5060
5273
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5061
5274
|
if (fromText != null) {
|
|
5062
5275
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5075,6 +5288,10 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
5075
5288
|
if (fromThought != null) {
|
|
5076
5289
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5077
5290
|
}
|
|
5291
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5292
|
+
if (fromInlineData != null) {
|
|
5293
|
+
setValueByPath(toObject, ['inlineData'], blobFromVertex$1(apiClient, fromInlineData));
|
|
5294
|
+
}
|
|
5078
5295
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5079
5296
|
'codeExecutionResult',
|
|
5080
5297
|
]);
|
|
@@ -5101,10 +5318,6 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
5101
5318
|
if (fromFunctionResponse != null) {
|
|
5102
5319
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5103
5320
|
}
|
|
5104
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5105
|
-
if (fromInlineData != null) {
|
|
5106
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5107
|
-
}
|
|
5108
5321
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5109
5322
|
if (fromText != null) {
|
|
5110
5323
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5673,6 +5886,21 @@ function liveServerMessageFromVertex(apiClient, fromObject) {
|
|
|
5673
5886
|
* Copyright 2025 Google LLC
|
|
5674
5887
|
* SPDX-License-Identifier: Apache-2.0
|
|
5675
5888
|
*/
|
|
5889
|
+
function blobToMldev(apiClient, fromObject) {
|
|
5890
|
+
const toObject = {};
|
|
5891
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5892
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
5893
|
+
}
|
|
5894
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
5895
|
+
if (fromData != null) {
|
|
5896
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
5897
|
+
}
|
|
5898
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
5899
|
+
if (fromMimeType != null) {
|
|
5900
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
5901
|
+
}
|
|
5902
|
+
return toObject;
|
|
5903
|
+
}
|
|
5676
5904
|
function partToMldev(apiClient, fromObject) {
|
|
5677
5905
|
const toObject = {};
|
|
5678
5906
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -5682,6 +5910,10 @@ function partToMldev(apiClient, fromObject) {
|
|
|
5682
5910
|
if (fromThought != null) {
|
|
5683
5911
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5684
5912
|
}
|
|
5913
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5914
|
+
if (fromInlineData != null) {
|
|
5915
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
5916
|
+
}
|
|
5685
5917
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5686
5918
|
'codeExecutionResult',
|
|
5687
5919
|
]);
|
|
@@ -5708,10 +5940,6 @@ function partToMldev(apiClient, fromObject) {
|
|
|
5708
5940
|
if (fromFunctionResponse != null) {
|
|
5709
5941
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5710
5942
|
}
|
|
5711
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5712
|
-
if (fromInlineData != null) {
|
|
5713
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5714
|
-
}
|
|
5715
5943
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5716
5944
|
if (fromText != null) {
|
|
5717
5945
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -6238,6 +6466,12 @@ function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
6238
6466
|
if (parentObject !== undefined && fromDescription != null) {
|
|
6239
6467
|
setValueByPath(parentObject, ['description'], fromDescription);
|
|
6240
6468
|
}
|
|
6469
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
6470
|
+
'defaultCheckpointId',
|
|
6471
|
+
]);
|
|
6472
|
+
if (parentObject !== undefined && fromDefaultCheckpointId != null) {
|
|
6473
|
+
setValueByPath(parentObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
6474
|
+
}
|
|
6241
6475
|
return toObject;
|
|
6242
6476
|
}
|
|
6243
6477
|
function updateModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -6384,6 +6618,22 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
|
6384
6618
|
}
|
|
6385
6619
|
return toObject;
|
|
6386
6620
|
}
|
|
6621
|
+
function blobToVertex(apiClient, fromObject) {
|
|
6622
|
+
const toObject = {};
|
|
6623
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6624
|
+
if (fromDisplayName != null) {
|
|
6625
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
6626
|
+
}
|
|
6627
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
6628
|
+
if (fromData != null) {
|
|
6629
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
6630
|
+
}
|
|
6631
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6632
|
+
if (fromMimeType != null) {
|
|
6633
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
6634
|
+
}
|
|
6635
|
+
return toObject;
|
|
6636
|
+
}
|
|
6387
6637
|
function partToVertex(apiClient, fromObject) {
|
|
6388
6638
|
const toObject = {};
|
|
6389
6639
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -6396,6 +6646,10 @@ function partToVertex(apiClient, fromObject) {
|
|
|
6396
6646
|
if (fromThought != null) {
|
|
6397
6647
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
6398
6648
|
}
|
|
6649
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6650
|
+
if (fromInlineData != null) {
|
|
6651
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex(apiClient, fromInlineData));
|
|
6652
|
+
}
|
|
6399
6653
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6400
6654
|
'codeExecutionResult',
|
|
6401
6655
|
]);
|
|
@@ -6422,10 +6676,6 @@ function partToVertex(apiClient, fromObject) {
|
|
|
6422
6676
|
if (fromFunctionResponse != null) {
|
|
6423
6677
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
6424
6678
|
}
|
|
6425
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6426
|
-
if (fromInlineData != null) {
|
|
6427
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
6428
|
-
}
|
|
6429
6679
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
6430
6680
|
if (fromText != null) {
|
|
6431
6681
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7010,77 +7260,363 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
7010
7260
|
}
|
|
7011
7261
|
return toObject;
|
|
7012
7262
|
}
|
|
7013
|
-
function
|
|
7263
|
+
function imageToVertex(apiClient, fromObject) {
|
|
7014
7264
|
const toObject = {};
|
|
7015
|
-
const
|
|
7016
|
-
if (
|
|
7017
|
-
setValueByPath(toObject, ['
|
|
7265
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
7266
|
+
if (fromGcsUri != null) {
|
|
7267
|
+
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
7018
7268
|
}
|
|
7019
|
-
const
|
|
7020
|
-
if (
|
|
7021
|
-
setValueByPath(toObject, ['
|
|
7269
|
+
const fromImageBytes = getValueByPath(fromObject, ['imageBytes']);
|
|
7270
|
+
if (fromImageBytes != null) {
|
|
7271
|
+
setValueByPath(toObject, ['bytesBase64Encoded'], tBytes(apiClient, fromImageBytes));
|
|
7272
|
+
}
|
|
7273
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7274
|
+
if (fromMimeType != null) {
|
|
7275
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
7022
7276
|
}
|
|
7023
7277
|
return toObject;
|
|
7024
7278
|
}
|
|
7025
|
-
function
|
|
7279
|
+
function maskReferenceConfigToVertex(apiClient, fromObject) {
|
|
7026
7280
|
const toObject = {};
|
|
7027
|
-
const
|
|
7028
|
-
if (
|
|
7029
|
-
setValueByPath(
|
|
7281
|
+
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
7282
|
+
if (fromMaskMode != null) {
|
|
7283
|
+
setValueByPath(toObject, ['maskMode'], fromMaskMode);
|
|
7030
7284
|
}
|
|
7031
|
-
const
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
if (parentObject !== undefined && fromFilter != null) {
|
|
7037
|
-
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
7285
|
+
const fromSegmentationClasses = getValueByPath(fromObject, [
|
|
7286
|
+
'segmentationClasses',
|
|
7287
|
+
]);
|
|
7288
|
+
if (fromSegmentationClasses != null) {
|
|
7289
|
+
setValueByPath(toObject, ['maskClasses'], fromSegmentationClasses);
|
|
7038
7290
|
}
|
|
7039
|
-
const
|
|
7040
|
-
if (
|
|
7041
|
-
setValueByPath(
|
|
7291
|
+
const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
|
|
7292
|
+
if (fromMaskDilation != null) {
|
|
7293
|
+
setValueByPath(toObject, ['dilation'], fromMaskDilation);
|
|
7042
7294
|
}
|
|
7043
7295
|
return toObject;
|
|
7044
7296
|
}
|
|
7045
|
-
function
|
|
7297
|
+
function controlReferenceConfigToVertex(apiClient, fromObject) {
|
|
7046
7298
|
const toObject = {};
|
|
7047
|
-
const
|
|
7048
|
-
if (
|
|
7049
|
-
setValueByPath(toObject, ['
|
|
7299
|
+
const fromControlType = getValueByPath(fromObject, ['controlType']);
|
|
7300
|
+
if (fromControlType != null) {
|
|
7301
|
+
setValueByPath(toObject, ['controlType'], fromControlType);
|
|
7302
|
+
}
|
|
7303
|
+
const fromEnableControlImageComputation = getValueByPath(fromObject, [
|
|
7304
|
+
'enableControlImageComputation',
|
|
7305
|
+
]);
|
|
7306
|
+
if (fromEnableControlImageComputation != null) {
|
|
7307
|
+
setValueByPath(toObject, ['computeControl'], fromEnableControlImageComputation);
|
|
7050
7308
|
}
|
|
7051
7309
|
return toObject;
|
|
7052
7310
|
}
|
|
7053
|
-
function
|
|
7311
|
+
function styleReferenceConfigToVertex(apiClient, fromObject) {
|
|
7054
7312
|
const toObject = {};
|
|
7055
|
-
const
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
if (parentObject !== undefined && fromDescription != null) {
|
|
7061
|
-
setValueByPath(parentObject, ['description'], fromDescription);
|
|
7313
|
+
const fromStyleDescription = getValueByPath(fromObject, [
|
|
7314
|
+
'styleDescription',
|
|
7315
|
+
]);
|
|
7316
|
+
if (fromStyleDescription != null) {
|
|
7317
|
+
setValueByPath(toObject, ['styleDescription'], fromStyleDescription);
|
|
7062
7318
|
}
|
|
7063
7319
|
return toObject;
|
|
7064
7320
|
}
|
|
7065
|
-
function
|
|
7321
|
+
function subjectReferenceConfigToVertex(apiClient, fromObject) {
|
|
7066
7322
|
const toObject = {};
|
|
7067
|
-
const
|
|
7068
|
-
if (
|
|
7069
|
-
setValueByPath(toObject, ['
|
|
7323
|
+
const fromSubjectType = getValueByPath(fromObject, ['subjectType']);
|
|
7324
|
+
if (fromSubjectType != null) {
|
|
7325
|
+
setValueByPath(toObject, ['subjectType'], fromSubjectType);
|
|
7070
7326
|
}
|
|
7071
|
-
const
|
|
7072
|
-
|
|
7073
|
-
|
|
7327
|
+
const fromSubjectDescription = getValueByPath(fromObject, [
|
|
7328
|
+
'subjectDescription',
|
|
7329
|
+
]);
|
|
7330
|
+
if (fromSubjectDescription != null) {
|
|
7331
|
+
setValueByPath(toObject, ['subjectDescription'], fromSubjectDescription);
|
|
7074
7332
|
}
|
|
7075
7333
|
return toObject;
|
|
7076
7334
|
}
|
|
7077
|
-
function
|
|
7335
|
+
function referenceImageAPIInternalToVertex(apiClient, fromObject) {
|
|
7078
7336
|
const toObject = {};
|
|
7079
|
-
const
|
|
7080
|
-
|
|
7081
|
-
|
|
7337
|
+
const fromReferenceImage = getValueByPath(fromObject, [
|
|
7338
|
+
'referenceImage',
|
|
7339
|
+
]);
|
|
7340
|
+
if (fromReferenceImage != null) {
|
|
7341
|
+
setValueByPath(toObject, ['referenceImage'], imageToVertex(apiClient, fromReferenceImage));
|
|
7082
7342
|
}
|
|
7083
|
-
const
|
|
7343
|
+
const fromReferenceId = getValueByPath(fromObject, ['referenceId']);
|
|
7344
|
+
if (fromReferenceId != null) {
|
|
7345
|
+
setValueByPath(toObject, ['referenceId'], fromReferenceId);
|
|
7346
|
+
}
|
|
7347
|
+
const fromReferenceType = getValueByPath(fromObject, [
|
|
7348
|
+
'referenceType',
|
|
7349
|
+
]);
|
|
7350
|
+
if (fromReferenceType != null) {
|
|
7351
|
+
setValueByPath(toObject, ['referenceType'], fromReferenceType);
|
|
7352
|
+
}
|
|
7353
|
+
const fromMaskImageConfig = getValueByPath(fromObject, [
|
|
7354
|
+
'maskImageConfig',
|
|
7355
|
+
]);
|
|
7356
|
+
if (fromMaskImageConfig != null) {
|
|
7357
|
+
setValueByPath(toObject, ['maskImageConfig'], maskReferenceConfigToVertex(apiClient, fromMaskImageConfig));
|
|
7358
|
+
}
|
|
7359
|
+
const fromControlImageConfig = getValueByPath(fromObject, [
|
|
7360
|
+
'controlImageConfig',
|
|
7361
|
+
]);
|
|
7362
|
+
if (fromControlImageConfig != null) {
|
|
7363
|
+
setValueByPath(toObject, ['controlImageConfig'], controlReferenceConfigToVertex(apiClient, fromControlImageConfig));
|
|
7364
|
+
}
|
|
7365
|
+
const fromStyleImageConfig = getValueByPath(fromObject, [
|
|
7366
|
+
'styleImageConfig',
|
|
7367
|
+
]);
|
|
7368
|
+
if (fromStyleImageConfig != null) {
|
|
7369
|
+
setValueByPath(toObject, ['styleImageConfig'], styleReferenceConfigToVertex(apiClient, fromStyleImageConfig));
|
|
7370
|
+
}
|
|
7371
|
+
const fromSubjectImageConfig = getValueByPath(fromObject, [
|
|
7372
|
+
'subjectImageConfig',
|
|
7373
|
+
]);
|
|
7374
|
+
if (fromSubjectImageConfig != null) {
|
|
7375
|
+
setValueByPath(toObject, ['subjectImageConfig'], subjectReferenceConfigToVertex(apiClient, fromSubjectImageConfig));
|
|
7376
|
+
}
|
|
7377
|
+
return toObject;
|
|
7378
|
+
}
|
|
7379
|
+
function editImageConfigToVertex(apiClient, fromObject, parentObject) {
|
|
7380
|
+
const toObject = {};
|
|
7381
|
+
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
7382
|
+
if (parentObject !== undefined && fromOutputGcsUri != null) {
|
|
7383
|
+
setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
|
|
7384
|
+
}
|
|
7385
|
+
const fromNegativePrompt = getValueByPath(fromObject, [
|
|
7386
|
+
'negativePrompt',
|
|
7387
|
+
]);
|
|
7388
|
+
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
7389
|
+
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
7390
|
+
}
|
|
7391
|
+
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
7392
|
+
'numberOfImages',
|
|
7393
|
+
]);
|
|
7394
|
+
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
7395
|
+
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
7396
|
+
}
|
|
7397
|
+
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
7398
|
+
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
7399
|
+
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
7400
|
+
}
|
|
7401
|
+
const fromGuidanceScale = getValueByPath(fromObject, [
|
|
7402
|
+
'guidanceScale',
|
|
7403
|
+
]);
|
|
7404
|
+
if (parentObject !== undefined && fromGuidanceScale != null) {
|
|
7405
|
+
setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
|
|
7406
|
+
}
|
|
7407
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
7408
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
7409
|
+
setValueByPath(parentObject, ['parameters', 'seed'], fromSeed);
|
|
7410
|
+
}
|
|
7411
|
+
const fromSafetyFilterLevel = getValueByPath(fromObject, [
|
|
7412
|
+
'safetyFilterLevel',
|
|
7413
|
+
]);
|
|
7414
|
+
if (parentObject !== undefined && fromSafetyFilterLevel != null) {
|
|
7415
|
+
setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
|
|
7416
|
+
}
|
|
7417
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
7418
|
+
'personGeneration',
|
|
7419
|
+
]);
|
|
7420
|
+
if (parentObject !== undefined && fromPersonGeneration != null) {
|
|
7421
|
+
setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
|
|
7422
|
+
}
|
|
7423
|
+
const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
|
|
7424
|
+
'includeSafetyAttributes',
|
|
7425
|
+
]);
|
|
7426
|
+
if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
|
|
7427
|
+
setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
|
|
7428
|
+
}
|
|
7429
|
+
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
7430
|
+
'includeRaiReason',
|
|
7431
|
+
]);
|
|
7432
|
+
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
7433
|
+
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
7434
|
+
}
|
|
7435
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
7436
|
+
if (parentObject !== undefined && fromLanguage != null) {
|
|
7437
|
+
setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
|
|
7438
|
+
}
|
|
7439
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
7440
|
+
'outputMimeType',
|
|
7441
|
+
]);
|
|
7442
|
+
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
7443
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
7444
|
+
}
|
|
7445
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
7446
|
+
'outputCompressionQuality',
|
|
7447
|
+
]);
|
|
7448
|
+
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
7449
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
7450
|
+
}
|
|
7451
|
+
const fromEditMode = getValueByPath(fromObject, ['editMode']);
|
|
7452
|
+
if (parentObject !== undefined && fromEditMode != null) {
|
|
7453
|
+
setValueByPath(parentObject, ['parameters', 'editMode'], fromEditMode);
|
|
7454
|
+
}
|
|
7455
|
+
const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
|
|
7456
|
+
if (parentObject !== undefined && fromBaseSteps != null) {
|
|
7457
|
+
setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
|
|
7458
|
+
}
|
|
7459
|
+
return toObject;
|
|
7460
|
+
}
|
|
7461
|
+
function editImageParametersInternalToVertex(apiClient, fromObject) {
|
|
7462
|
+
const toObject = {};
|
|
7463
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
7464
|
+
if (fromModel != null) {
|
|
7465
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
7466
|
+
}
|
|
7467
|
+
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
7468
|
+
if (fromPrompt != null) {
|
|
7469
|
+
setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
7470
|
+
}
|
|
7471
|
+
const fromReferenceImages = getValueByPath(fromObject, [
|
|
7472
|
+
'referenceImages',
|
|
7473
|
+
]);
|
|
7474
|
+
if (fromReferenceImages != null) {
|
|
7475
|
+
let transformedList = fromReferenceImages;
|
|
7476
|
+
if (Array.isArray(transformedList)) {
|
|
7477
|
+
transformedList = transformedList.map((item) => {
|
|
7478
|
+
return referenceImageAPIInternalToVertex(apiClient, item);
|
|
7479
|
+
});
|
|
7480
|
+
}
|
|
7481
|
+
setValueByPath(toObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
7482
|
+
}
|
|
7483
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7484
|
+
if (fromConfig != null) {
|
|
7485
|
+
setValueByPath(toObject, ['config'], editImageConfigToVertex(apiClient, fromConfig, toObject));
|
|
7486
|
+
}
|
|
7487
|
+
return toObject;
|
|
7488
|
+
}
|
|
7489
|
+
function upscaleImageAPIConfigInternalToVertex(apiClient, fromObject, parentObject) {
|
|
7490
|
+
const toObject = {};
|
|
7491
|
+
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
7492
|
+
'includeRaiReason',
|
|
7493
|
+
]);
|
|
7494
|
+
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
7495
|
+
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
7496
|
+
}
|
|
7497
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
7498
|
+
'outputMimeType',
|
|
7499
|
+
]);
|
|
7500
|
+
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
7501
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
7502
|
+
}
|
|
7503
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
7504
|
+
'outputCompressionQuality',
|
|
7505
|
+
]);
|
|
7506
|
+
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
7507
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
7508
|
+
}
|
|
7509
|
+
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
7510
|
+
'numberOfImages',
|
|
7511
|
+
]);
|
|
7512
|
+
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
7513
|
+
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
7514
|
+
}
|
|
7515
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
7516
|
+
if (parentObject !== undefined && fromMode != null) {
|
|
7517
|
+
setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
|
|
7518
|
+
}
|
|
7519
|
+
return toObject;
|
|
7520
|
+
}
|
|
7521
|
+
function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
|
|
7522
|
+
const toObject = {};
|
|
7523
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
7524
|
+
if (fromModel != null) {
|
|
7525
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
7526
|
+
}
|
|
7527
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
7528
|
+
if (fromImage != null) {
|
|
7529
|
+
setValueByPath(toObject, ['instances[0]', 'image'], imageToVertex(apiClient, fromImage));
|
|
7530
|
+
}
|
|
7531
|
+
const fromUpscaleFactor = getValueByPath(fromObject, [
|
|
7532
|
+
'upscaleFactor',
|
|
7533
|
+
]);
|
|
7534
|
+
if (fromUpscaleFactor != null) {
|
|
7535
|
+
setValueByPath(toObject, ['parameters', 'upscaleConfig', 'upscaleFactor'], fromUpscaleFactor);
|
|
7536
|
+
}
|
|
7537
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7538
|
+
if (fromConfig != null) {
|
|
7539
|
+
setValueByPath(toObject, ['config'], upscaleImageAPIConfigInternalToVertex(apiClient, fromConfig, toObject));
|
|
7540
|
+
}
|
|
7541
|
+
return toObject;
|
|
7542
|
+
}
|
|
7543
|
+
function getModelParametersToVertex(apiClient, fromObject) {
|
|
7544
|
+
const toObject = {};
|
|
7545
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
7546
|
+
if (fromModel != null) {
|
|
7547
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
7548
|
+
}
|
|
7549
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7550
|
+
if (fromConfig != null) {
|
|
7551
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
7552
|
+
}
|
|
7553
|
+
return toObject;
|
|
7554
|
+
}
|
|
7555
|
+
function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
7556
|
+
const toObject = {};
|
|
7557
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
7558
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
7559
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
7560
|
+
}
|
|
7561
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
7562
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
7563
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
7564
|
+
}
|
|
7565
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
7566
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
7567
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
7568
|
+
}
|
|
7569
|
+
const fromQueryBase = getValueByPath(fromObject, ['queryBase']);
|
|
7570
|
+
if (parentObject !== undefined && fromQueryBase != null) {
|
|
7571
|
+
setValueByPath(parentObject, ['_url', 'models_url'], tModelsUrl(apiClient, fromQueryBase));
|
|
7572
|
+
}
|
|
7573
|
+
return toObject;
|
|
7574
|
+
}
|
|
7575
|
+
function listModelsParametersToVertex(apiClient, fromObject) {
|
|
7576
|
+
const toObject = {};
|
|
7577
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7578
|
+
if (fromConfig != null) {
|
|
7579
|
+
setValueByPath(toObject, ['config'], listModelsConfigToVertex(apiClient, fromConfig, toObject));
|
|
7580
|
+
}
|
|
7581
|
+
return toObject;
|
|
7582
|
+
}
|
|
7583
|
+
function updateModelConfigToVertex(apiClient, fromObject, parentObject) {
|
|
7584
|
+
const toObject = {};
|
|
7585
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7586
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
7587
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
7588
|
+
}
|
|
7589
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
7590
|
+
if (parentObject !== undefined && fromDescription != null) {
|
|
7591
|
+
setValueByPath(parentObject, ['description'], fromDescription);
|
|
7592
|
+
}
|
|
7593
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
7594
|
+
'defaultCheckpointId',
|
|
7595
|
+
]);
|
|
7596
|
+
if (parentObject !== undefined && fromDefaultCheckpointId != null) {
|
|
7597
|
+
setValueByPath(parentObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
7598
|
+
}
|
|
7599
|
+
return toObject;
|
|
7600
|
+
}
|
|
7601
|
+
function updateModelParametersToVertex(apiClient, fromObject) {
|
|
7602
|
+
const toObject = {};
|
|
7603
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
7604
|
+
if (fromModel != null) {
|
|
7605
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
7606
|
+
}
|
|
7607
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7608
|
+
if (fromConfig != null) {
|
|
7609
|
+
setValueByPath(toObject, ['config'], updateModelConfigToVertex(apiClient, fromConfig, toObject));
|
|
7610
|
+
}
|
|
7611
|
+
return toObject;
|
|
7612
|
+
}
|
|
7613
|
+
function deleteModelParametersToVertex(apiClient, fromObject) {
|
|
7614
|
+
const toObject = {};
|
|
7615
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
7616
|
+
if (fromModel != null) {
|
|
7617
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
7618
|
+
}
|
|
7619
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7084
7620
|
if (fromConfig != null) {
|
|
7085
7621
|
setValueByPath(toObject, ['config'], fromConfig);
|
|
7086
7622
|
}
|
|
@@ -7156,22 +7692,6 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
7156
7692
|
}
|
|
7157
7693
|
return toObject;
|
|
7158
7694
|
}
|
|
7159
|
-
function imageToVertex(apiClient, fromObject) {
|
|
7160
|
-
const toObject = {};
|
|
7161
|
-
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
7162
|
-
if (fromGcsUri != null) {
|
|
7163
|
-
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
7164
|
-
}
|
|
7165
|
-
const fromImageBytes = getValueByPath(fromObject, ['imageBytes']);
|
|
7166
|
-
if (fromImageBytes != null) {
|
|
7167
|
-
setValueByPath(toObject, ['bytesBase64Encoded'], tBytes(apiClient, fromImageBytes));
|
|
7168
|
-
}
|
|
7169
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7170
|
-
if (fromMimeType != null) {
|
|
7171
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
7172
|
-
}
|
|
7173
|
-
return toObject;
|
|
7174
|
-
}
|
|
7175
7695
|
function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
|
|
7176
7696
|
const toObject = {};
|
|
7177
7697
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -7250,12 +7770,28 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
|
7250
7770
|
}
|
|
7251
7771
|
return toObject;
|
|
7252
7772
|
}
|
|
7773
|
+
function blobFromMldev(apiClient, fromObject) {
|
|
7774
|
+
const toObject = {};
|
|
7775
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
7776
|
+
if (fromData != null) {
|
|
7777
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
7778
|
+
}
|
|
7779
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7780
|
+
if (fromMimeType != null) {
|
|
7781
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
7782
|
+
}
|
|
7783
|
+
return toObject;
|
|
7784
|
+
}
|
|
7253
7785
|
function partFromMldev(apiClient, fromObject) {
|
|
7254
7786
|
const toObject = {};
|
|
7255
7787
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
7256
7788
|
if (fromThought != null) {
|
|
7257
7789
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
7258
7790
|
}
|
|
7791
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7792
|
+
if (fromInlineData != null) {
|
|
7793
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev(apiClient, fromInlineData));
|
|
7794
|
+
}
|
|
7259
7795
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7260
7796
|
'codeExecutionResult',
|
|
7261
7797
|
]);
|
|
@@ -7282,10 +7818,6 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
7282
7818
|
if (fromFunctionResponse != null) {
|
|
7283
7819
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
7284
7820
|
}
|
|
7285
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7286
|
-
if (fromInlineData != null) {
|
|
7287
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
7288
|
-
}
|
|
7289
7821
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
7290
7822
|
if (fromText != null) {
|
|
7291
7823
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7680,6 +8212,22 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
|
|
|
7680
8212
|
}
|
|
7681
8213
|
return toObject;
|
|
7682
8214
|
}
|
|
8215
|
+
function blobFromVertex(apiClient, fromObject) {
|
|
8216
|
+
const toObject = {};
|
|
8217
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
8218
|
+
if (fromDisplayName != null) {
|
|
8219
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
8220
|
+
}
|
|
8221
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
8222
|
+
if (fromData != null) {
|
|
8223
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
8224
|
+
}
|
|
8225
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
8226
|
+
if (fromMimeType != null) {
|
|
8227
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
8228
|
+
}
|
|
8229
|
+
return toObject;
|
|
8230
|
+
}
|
|
7683
8231
|
function partFromVertex(apiClient, fromObject) {
|
|
7684
8232
|
const toObject = {};
|
|
7685
8233
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7692,6 +8240,10 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
7692
8240
|
if (fromThought != null) {
|
|
7693
8241
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
7694
8242
|
}
|
|
8243
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
8244
|
+
if (fromInlineData != null) {
|
|
8245
|
+
setValueByPath(toObject, ['inlineData'], blobFromVertex(apiClient, fromInlineData));
|
|
8246
|
+
}
|
|
7695
8247
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7696
8248
|
'codeExecutionResult',
|
|
7697
8249
|
]);
|
|
@@ -7718,10 +8270,6 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
7718
8270
|
if (fromFunctionResponse != null) {
|
|
7719
8271
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
7720
8272
|
}
|
|
7721
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7722
|
-
if (fromInlineData != null) {
|
|
7723
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
7724
|
-
}
|
|
7725
8273
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
7726
8274
|
if (fromText != null) {
|
|
7727
8275
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7981,6 +8529,38 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
7981
8529
|
}
|
|
7982
8530
|
return toObject;
|
|
7983
8531
|
}
|
|
8532
|
+
function editImageResponseFromVertex(apiClient, fromObject) {
|
|
8533
|
+
const toObject = {};
|
|
8534
|
+
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
8535
|
+
'predictions',
|
|
8536
|
+
]);
|
|
8537
|
+
if (fromGeneratedImages != null) {
|
|
8538
|
+
let transformedList = fromGeneratedImages;
|
|
8539
|
+
if (Array.isArray(transformedList)) {
|
|
8540
|
+
transformedList = transformedList.map((item) => {
|
|
8541
|
+
return generatedImageFromVertex(apiClient, item);
|
|
8542
|
+
});
|
|
8543
|
+
}
|
|
8544
|
+
setValueByPath(toObject, ['generatedImages'], transformedList);
|
|
8545
|
+
}
|
|
8546
|
+
return toObject;
|
|
8547
|
+
}
|
|
8548
|
+
function upscaleImageResponseFromVertex(apiClient, fromObject) {
|
|
8549
|
+
const toObject = {};
|
|
8550
|
+
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
8551
|
+
'predictions',
|
|
8552
|
+
]);
|
|
8553
|
+
if (fromGeneratedImages != null) {
|
|
8554
|
+
let transformedList = fromGeneratedImages;
|
|
8555
|
+
if (Array.isArray(transformedList)) {
|
|
8556
|
+
transformedList = transformedList.map((item) => {
|
|
8557
|
+
return generatedImageFromVertex(apiClient, item);
|
|
8558
|
+
});
|
|
8559
|
+
}
|
|
8560
|
+
setValueByPath(toObject, ['generatedImages'], transformedList);
|
|
8561
|
+
}
|
|
8562
|
+
return toObject;
|
|
8563
|
+
}
|
|
7984
8564
|
function endpointFromVertex(apiClient, fromObject) {
|
|
7985
8565
|
const toObject = {};
|
|
7986
8566
|
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
@@ -8014,6 +8594,22 @@ function tunedModelInfoFromVertex(apiClient, fromObject) {
|
|
|
8014
8594
|
}
|
|
8015
8595
|
return toObject;
|
|
8016
8596
|
}
|
|
8597
|
+
function checkpointFromVertex(apiClient, fromObject) {
|
|
8598
|
+
const toObject = {};
|
|
8599
|
+
const fromCheckpointId = getValueByPath(fromObject, ['checkpointId']);
|
|
8600
|
+
if (fromCheckpointId != null) {
|
|
8601
|
+
setValueByPath(toObject, ['checkpointId'], fromCheckpointId);
|
|
8602
|
+
}
|
|
8603
|
+
const fromEpoch = getValueByPath(fromObject, ['epoch']);
|
|
8604
|
+
if (fromEpoch != null) {
|
|
8605
|
+
setValueByPath(toObject, ['epoch'], fromEpoch);
|
|
8606
|
+
}
|
|
8607
|
+
const fromStep = getValueByPath(fromObject, ['step']);
|
|
8608
|
+
if (fromStep != null) {
|
|
8609
|
+
setValueByPath(toObject, ['step'], fromStep);
|
|
8610
|
+
}
|
|
8611
|
+
return toObject;
|
|
8612
|
+
}
|
|
8017
8613
|
function modelFromVertex(apiClient, fromObject) {
|
|
8018
8614
|
const toObject = {};
|
|
8019
8615
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -8050,6 +8646,22 @@ function modelFromVertex(apiClient, fromObject) {
|
|
|
8050
8646
|
if (fromTunedModelInfo != null) {
|
|
8051
8647
|
setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
|
|
8052
8648
|
}
|
|
8649
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
8650
|
+
'defaultCheckpointId',
|
|
8651
|
+
]);
|
|
8652
|
+
if (fromDefaultCheckpointId != null) {
|
|
8653
|
+
setValueByPath(toObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
8654
|
+
}
|
|
8655
|
+
const fromCheckpoints = getValueByPath(fromObject, ['checkpoints']);
|
|
8656
|
+
if (fromCheckpoints != null) {
|
|
8657
|
+
let transformedList = fromCheckpoints;
|
|
8658
|
+
if (Array.isArray(transformedList)) {
|
|
8659
|
+
transformedList = transformedList.map((item) => {
|
|
8660
|
+
return checkpointFromVertex(apiClient, item);
|
|
8661
|
+
});
|
|
8662
|
+
}
|
|
8663
|
+
setValueByPath(toObject, ['checkpoints'], transformedList);
|
|
8664
|
+
}
|
|
8053
8665
|
return toObject;
|
|
8054
8666
|
}
|
|
8055
8667
|
function listModelsResponseFromVertex(apiClient, fromObject) {
|
|
@@ -8660,9 +9272,7 @@ class Models extends BaseModule {
|
|
|
8660
9272
|
/**
|
|
8661
9273
|
* Generates an image based on a text description and configuration.
|
|
8662
9274
|
*
|
|
8663
|
-
* @param
|
|
8664
|
-
* @param prompt - A text description of the image to generate.
|
|
8665
|
-
* @param [config] - The config for image generation.
|
|
9275
|
+
* @param params - The parameters for generating images.
|
|
8666
9276
|
* @return The response from the API.
|
|
8667
9277
|
*
|
|
8668
9278
|
* @example
|
|
@@ -8731,6 +9341,76 @@ class Models extends BaseModule {
|
|
|
8731
9341
|
}
|
|
8732
9342
|
return new Pager(exports.PagedItem.PAGED_ITEM_MODELS, (x) => this.listInternal(x), await this.listInternal(actualParams), actualParams);
|
|
8733
9343
|
};
|
|
9344
|
+
/**
|
|
9345
|
+
* Edits an image based on a prompt, list of reference images, and configuration.
|
|
9346
|
+
*
|
|
9347
|
+
* @param params - The parameters for editing an image.
|
|
9348
|
+
* @return The response from the API.
|
|
9349
|
+
*
|
|
9350
|
+
* @example
|
|
9351
|
+
* ```ts
|
|
9352
|
+
* const response = await client.models.editImage({
|
|
9353
|
+
* model: 'imagen-3.0-capability-001',
|
|
9354
|
+
* prompt: 'Generate an image containing a mug with the product logo [1] visible on the side of the mug.',
|
|
9355
|
+
* referenceImages: [subjectReferenceImage]
|
|
9356
|
+
* config: {
|
|
9357
|
+
* numberOfImages: 1,
|
|
9358
|
+
* includeRaiReason: true,
|
|
9359
|
+
* },
|
|
9360
|
+
* });
|
|
9361
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
9362
|
+
* ```
|
|
9363
|
+
*/
|
|
9364
|
+
this.editImage = async (params) => {
|
|
9365
|
+
const paramsInternal = {
|
|
9366
|
+
model: params.model,
|
|
9367
|
+
prompt: params.prompt,
|
|
9368
|
+
referenceImages: [],
|
|
9369
|
+
config: params.config,
|
|
9370
|
+
};
|
|
9371
|
+
if (params.referenceImages) {
|
|
9372
|
+
if (params.referenceImages) {
|
|
9373
|
+
paramsInternal.referenceImages = params.referenceImages.map((img) => img.toReferenceImageAPI());
|
|
9374
|
+
}
|
|
9375
|
+
}
|
|
9376
|
+
return await this.editImageInternal(paramsInternal);
|
|
9377
|
+
};
|
|
9378
|
+
/**
|
|
9379
|
+
* Upscales an image based on an image, upscale factor, and configuration.
|
|
9380
|
+
* Only supported in Vertex AI currently.
|
|
9381
|
+
*
|
|
9382
|
+
* @param params - The parameters for upscaling an image.
|
|
9383
|
+
* @return The response from the API.
|
|
9384
|
+
*
|
|
9385
|
+
* @example
|
|
9386
|
+
* ```ts
|
|
9387
|
+
* const response = await client.models.upscaleImage({
|
|
9388
|
+
* model: 'imagen-3.0-generate-002',
|
|
9389
|
+
* image: image,
|
|
9390
|
+
* upscaleFactor: 'x2',
|
|
9391
|
+
* config: {
|
|
9392
|
+
* includeRaiReason: true,
|
|
9393
|
+
* },
|
|
9394
|
+
* });
|
|
9395
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
9396
|
+
* ```
|
|
9397
|
+
*/
|
|
9398
|
+
this.upscaleImage = async (params) => {
|
|
9399
|
+
let apiConfig = {
|
|
9400
|
+
numberOfImages: 1,
|
|
9401
|
+
mode: 'upscale',
|
|
9402
|
+
};
|
|
9403
|
+
if (params.config) {
|
|
9404
|
+
apiConfig = Object.assign(Object.assign({}, apiConfig), params.config);
|
|
9405
|
+
}
|
|
9406
|
+
const apiParams = {
|
|
9407
|
+
model: params.model,
|
|
9408
|
+
image: params.image,
|
|
9409
|
+
upscaleFactor: params.upscaleFactor,
|
|
9410
|
+
config: apiConfig,
|
|
9411
|
+
};
|
|
9412
|
+
return await this.upscaleImageInternal(apiParams);
|
|
9413
|
+
};
|
|
8734
9414
|
}
|
|
8735
9415
|
async generateContentInternal(params) {
|
|
8736
9416
|
var _a, _b, _c, _d;
|
|
@@ -9032,6 +9712,76 @@ class Models extends BaseModule {
|
|
|
9032
9712
|
});
|
|
9033
9713
|
}
|
|
9034
9714
|
}
|
|
9715
|
+
async editImageInternal(params) {
|
|
9716
|
+
var _a, _b;
|
|
9717
|
+
let response;
|
|
9718
|
+
let path = '';
|
|
9719
|
+
let queryParams = {};
|
|
9720
|
+
if (this.apiClient.isVertexAI()) {
|
|
9721
|
+
const body = editImageParametersInternalToVertex(this.apiClient, params);
|
|
9722
|
+
path = formatMap('{model}:predict', body['_url']);
|
|
9723
|
+
queryParams = body['_query'];
|
|
9724
|
+
delete body['config'];
|
|
9725
|
+
delete body['_url'];
|
|
9726
|
+
delete body['_query'];
|
|
9727
|
+
response = this.apiClient
|
|
9728
|
+
.request({
|
|
9729
|
+
path: path,
|
|
9730
|
+
queryParams: queryParams,
|
|
9731
|
+
body: JSON.stringify(body),
|
|
9732
|
+
httpMethod: 'POST',
|
|
9733
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9734
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9735
|
+
})
|
|
9736
|
+
.then((httpResponse) => {
|
|
9737
|
+
return httpResponse.json();
|
|
9738
|
+
});
|
|
9739
|
+
return response.then((apiResponse) => {
|
|
9740
|
+
const resp = editImageResponseFromVertex(this.apiClient, apiResponse);
|
|
9741
|
+
const typedResp = new EditImageResponse();
|
|
9742
|
+
Object.assign(typedResp, resp);
|
|
9743
|
+
return typedResp;
|
|
9744
|
+
});
|
|
9745
|
+
}
|
|
9746
|
+
else {
|
|
9747
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
9748
|
+
}
|
|
9749
|
+
}
|
|
9750
|
+
async upscaleImageInternal(params) {
|
|
9751
|
+
var _a, _b;
|
|
9752
|
+
let response;
|
|
9753
|
+
let path = '';
|
|
9754
|
+
let queryParams = {};
|
|
9755
|
+
if (this.apiClient.isVertexAI()) {
|
|
9756
|
+
const body = upscaleImageAPIParametersInternalToVertex(this.apiClient, params);
|
|
9757
|
+
path = formatMap('{model}:predict', body['_url']);
|
|
9758
|
+
queryParams = body['_query'];
|
|
9759
|
+
delete body['config'];
|
|
9760
|
+
delete body['_url'];
|
|
9761
|
+
delete body['_query'];
|
|
9762
|
+
response = this.apiClient
|
|
9763
|
+
.request({
|
|
9764
|
+
path: path,
|
|
9765
|
+
queryParams: queryParams,
|
|
9766
|
+
body: JSON.stringify(body),
|
|
9767
|
+
httpMethod: 'POST',
|
|
9768
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9769
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9770
|
+
})
|
|
9771
|
+
.then((httpResponse) => {
|
|
9772
|
+
return httpResponse.json();
|
|
9773
|
+
});
|
|
9774
|
+
return response.then((apiResponse) => {
|
|
9775
|
+
const resp = upscaleImageResponseFromVertex(this.apiClient, apiResponse);
|
|
9776
|
+
const typedResp = new UpscaleImageResponse();
|
|
9777
|
+
Object.assign(typedResp, resp);
|
|
9778
|
+
return typedResp;
|
|
9779
|
+
});
|
|
9780
|
+
}
|
|
9781
|
+
else {
|
|
9782
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
9783
|
+
}
|
|
9784
|
+
}
|
|
9035
9785
|
/**
|
|
9036
9786
|
* Fetches information about a model by name.
|
|
9037
9787
|
*
|
|
@@ -9932,6 +10682,10 @@ function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
9932
10682
|
if (fromLearningRateMultiplier != null) {
|
|
9933
10683
|
setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
9934
10684
|
}
|
|
10685
|
+
if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
|
|
10686
|
+
undefined) {
|
|
10687
|
+
throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
|
|
10688
|
+
}
|
|
9935
10689
|
if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
|
|
9936
10690
|
throw new Error('adapterSize parameter is not supported in Gemini API.');
|
|
9937
10691
|
}
|
|
@@ -10046,6 +10800,12 @@ function createTuningJobConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
10046
10800
|
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
10047
10801
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
10048
10802
|
}
|
|
10803
|
+
const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
|
|
10804
|
+
'exportLastCheckpointOnly',
|
|
10805
|
+
]);
|
|
10806
|
+
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
10807
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
10808
|
+
}
|
|
10049
10809
|
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
10050
10810
|
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
10051
10811
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
@@ -10198,6 +10958,26 @@ function operationFromMldev(apiClient, fromObject) {
|
|
|
10198
10958
|
}
|
|
10199
10959
|
return toObject;
|
|
10200
10960
|
}
|
|
10961
|
+
function tunedModelCheckpointFromVertex(apiClient, fromObject) {
|
|
10962
|
+
const toObject = {};
|
|
10963
|
+
const fromCheckpointId = getValueByPath(fromObject, ['checkpointId']);
|
|
10964
|
+
if (fromCheckpointId != null) {
|
|
10965
|
+
setValueByPath(toObject, ['checkpointId'], fromCheckpointId);
|
|
10966
|
+
}
|
|
10967
|
+
const fromEpoch = getValueByPath(fromObject, ['epoch']);
|
|
10968
|
+
if (fromEpoch != null) {
|
|
10969
|
+
setValueByPath(toObject, ['epoch'], fromEpoch);
|
|
10970
|
+
}
|
|
10971
|
+
const fromStep = getValueByPath(fromObject, ['step']);
|
|
10972
|
+
if (fromStep != null) {
|
|
10973
|
+
setValueByPath(toObject, ['step'], fromStep);
|
|
10974
|
+
}
|
|
10975
|
+
const fromEndpoint = getValueByPath(fromObject, ['endpoint']);
|
|
10976
|
+
if (fromEndpoint != null) {
|
|
10977
|
+
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
10978
|
+
}
|
|
10979
|
+
return toObject;
|
|
10980
|
+
}
|
|
10201
10981
|
function tunedModelFromVertex(apiClient, fromObject) {
|
|
10202
10982
|
const toObject = {};
|
|
10203
10983
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -10208,6 +10988,16 @@ function tunedModelFromVertex(apiClient, fromObject) {
|
|
|
10208
10988
|
if (fromEndpoint != null) {
|
|
10209
10989
|
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
10210
10990
|
}
|
|
10991
|
+
const fromCheckpoints = getValueByPath(fromObject, ['checkpoints']);
|
|
10992
|
+
if (fromCheckpoints != null) {
|
|
10993
|
+
let transformedList = fromCheckpoints;
|
|
10994
|
+
if (Array.isArray(transformedList)) {
|
|
10995
|
+
transformedList = transformedList.map((item) => {
|
|
10996
|
+
return tunedModelCheckpointFromVertex(apiClient, item);
|
|
10997
|
+
});
|
|
10998
|
+
}
|
|
10999
|
+
setValueByPath(toObject, ['checkpoints'], transformedList);
|
|
11000
|
+
}
|
|
10211
11001
|
return toObject;
|
|
10212
11002
|
}
|
|
10213
11003
|
function tuningJobFromVertex(apiClient, fromObject) {
|
|
@@ -10658,11 +11448,13 @@ exports.Caches = Caches;
|
|
|
10658
11448
|
exports.Chat = Chat;
|
|
10659
11449
|
exports.Chats = Chats;
|
|
10660
11450
|
exports.ComputeTokensResponse = ComputeTokensResponse;
|
|
11451
|
+
exports.ControlReferenceImage = ControlReferenceImage;
|
|
10661
11452
|
exports.CountTokensResponse = CountTokensResponse;
|
|
10662
11453
|
exports.CreateFileResponse = CreateFileResponse;
|
|
10663
11454
|
exports.DeleteCachedContentResponse = DeleteCachedContentResponse;
|
|
10664
11455
|
exports.DeleteFileResponse = DeleteFileResponse;
|
|
10665
11456
|
exports.DeleteModelResponse = DeleteModelResponse;
|
|
11457
|
+
exports.EditImageResponse = EditImageResponse;
|
|
10666
11458
|
exports.EmbedContentResponse = EmbedContentResponse;
|
|
10667
11459
|
exports.Files = Files;
|
|
10668
11460
|
exports.FunctionResponse = FunctionResponse;
|
|
@@ -10681,11 +11473,16 @@ exports.Live = Live;
|
|
|
10681
11473
|
exports.LiveClientToolResponse = LiveClientToolResponse;
|
|
10682
11474
|
exports.LiveSendToolResponseParameters = LiveSendToolResponseParameters;
|
|
10683
11475
|
exports.LiveServerMessage = LiveServerMessage;
|
|
11476
|
+
exports.MaskReferenceImage = MaskReferenceImage;
|
|
10684
11477
|
exports.Models = Models;
|
|
10685
11478
|
exports.Operations = Operations;
|
|
10686
11479
|
exports.Pager = Pager;
|
|
11480
|
+
exports.RawReferenceImage = RawReferenceImage;
|
|
10687
11481
|
exports.ReplayResponse = ReplayResponse;
|
|
10688
11482
|
exports.Session = Session;
|
|
11483
|
+
exports.StyleReferenceImage = StyleReferenceImage;
|
|
11484
|
+
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
11485
|
+
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
10689
11486
|
exports.createModelContent = createModelContent;
|
|
10690
11487
|
exports.createPartFromBase64 = createPartFromBase64;
|
|
10691
11488
|
exports.createPartFromCodeExecutionResult = createPartFromCodeExecutionResult;
|