@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/node/index.js
CHANGED
|
@@ -629,6 +629,21 @@ function hasField(data, fieldName) {
|
|
|
629
629
|
* Copyright 2025 Google LLC
|
|
630
630
|
* SPDX-License-Identifier: Apache-2.0
|
|
631
631
|
*/
|
|
632
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
633
|
+
const toObject = {};
|
|
634
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
635
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
636
|
+
}
|
|
637
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
638
|
+
if (fromData != null) {
|
|
639
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
640
|
+
}
|
|
641
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
642
|
+
if (fromMimeType != null) {
|
|
643
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
644
|
+
}
|
|
645
|
+
return toObject;
|
|
646
|
+
}
|
|
632
647
|
function partToMldev$2(apiClient, fromObject) {
|
|
633
648
|
const toObject = {};
|
|
634
649
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -638,6 +653,10 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
638
653
|
if (fromThought != null) {
|
|
639
654
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
640
655
|
}
|
|
656
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
657
|
+
if (fromInlineData != null) {
|
|
658
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
659
|
+
}
|
|
641
660
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
642
661
|
'codeExecutionResult',
|
|
643
662
|
]);
|
|
@@ -664,10 +683,6 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
664
683
|
if (fromFunctionResponse != null) {
|
|
665
684
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
666
685
|
}
|
|
667
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
668
|
-
if (fromInlineData != null) {
|
|
669
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
670
|
-
}
|
|
671
686
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
672
687
|
if (fromText != null) {
|
|
673
688
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -908,6 +923,22 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
|
908
923
|
}
|
|
909
924
|
return toObject;
|
|
910
925
|
}
|
|
926
|
+
function blobToVertex$2(apiClient, fromObject) {
|
|
927
|
+
const toObject = {};
|
|
928
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
929
|
+
if (fromDisplayName != null) {
|
|
930
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
931
|
+
}
|
|
932
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
933
|
+
if (fromData != null) {
|
|
934
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
935
|
+
}
|
|
936
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
937
|
+
if (fromMimeType != null) {
|
|
938
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
939
|
+
}
|
|
940
|
+
return toObject;
|
|
941
|
+
}
|
|
911
942
|
function partToVertex$2(apiClient, fromObject) {
|
|
912
943
|
const toObject = {};
|
|
913
944
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -920,6 +951,10 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
920
951
|
if (fromThought != null) {
|
|
921
952
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
922
953
|
}
|
|
954
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
955
|
+
if (fromInlineData != null) {
|
|
956
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex$2(apiClient, fromInlineData));
|
|
957
|
+
}
|
|
923
958
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
924
959
|
'codeExecutionResult',
|
|
925
960
|
]);
|
|
@@ -946,10 +981,6 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
946
981
|
if (fromFunctionResponse != null) {
|
|
947
982
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
948
983
|
}
|
|
949
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
950
|
-
if (fromInlineData != null) {
|
|
951
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
952
|
-
}
|
|
953
984
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
954
985
|
if (fromText != null) {
|
|
955
986
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -1785,21 +1816,6 @@ exports.ImagePromptLanguage = void 0;
|
|
|
1785
1816
|
ImagePromptLanguage["ko"] = "ko";
|
|
1786
1817
|
ImagePromptLanguage["hi"] = "hi";
|
|
1787
1818
|
})(exports.ImagePromptLanguage || (exports.ImagePromptLanguage = {}));
|
|
1788
|
-
/** State for the lifecycle of a File. */
|
|
1789
|
-
exports.FileState = void 0;
|
|
1790
|
-
(function (FileState) {
|
|
1791
|
-
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1792
|
-
FileState["PROCESSING"] = "PROCESSING";
|
|
1793
|
-
FileState["ACTIVE"] = "ACTIVE";
|
|
1794
|
-
FileState["FAILED"] = "FAILED";
|
|
1795
|
-
})(exports.FileState || (exports.FileState = {}));
|
|
1796
|
-
/** Source of the File. */
|
|
1797
|
-
exports.FileSource = void 0;
|
|
1798
|
-
(function (FileSource) {
|
|
1799
|
-
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1800
|
-
FileSource["UPLOADED"] = "UPLOADED";
|
|
1801
|
-
FileSource["GENERATED"] = "GENERATED";
|
|
1802
|
-
})(exports.FileSource || (exports.FileSource = {}));
|
|
1803
1819
|
/** Enum representing the mask mode of a mask reference image. */
|
|
1804
1820
|
exports.MaskReferenceMode = void 0;
|
|
1805
1821
|
(function (MaskReferenceMode) {
|
|
@@ -1825,6 +1841,33 @@ exports.SubjectReferenceType = void 0;
|
|
|
1825
1841
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
1826
1842
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
1827
1843
|
})(exports.SubjectReferenceType || (exports.SubjectReferenceType = {}));
|
|
1844
|
+
/** Enum representing the Imagen 3 Edit mode. */
|
|
1845
|
+
exports.EditMode = void 0;
|
|
1846
|
+
(function (EditMode) {
|
|
1847
|
+
EditMode["EDIT_MODE_DEFAULT"] = "EDIT_MODE_DEFAULT";
|
|
1848
|
+
EditMode["EDIT_MODE_INPAINT_REMOVAL"] = "EDIT_MODE_INPAINT_REMOVAL";
|
|
1849
|
+
EditMode["EDIT_MODE_INPAINT_INSERTION"] = "EDIT_MODE_INPAINT_INSERTION";
|
|
1850
|
+
EditMode["EDIT_MODE_OUTPAINT"] = "EDIT_MODE_OUTPAINT";
|
|
1851
|
+
EditMode["EDIT_MODE_CONTROLLED_EDITING"] = "EDIT_MODE_CONTROLLED_EDITING";
|
|
1852
|
+
EditMode["EDIT_MODE_STYLE"] = "EDIT_MODE_STYLE";
|
|
1853
|
+
EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
|
|
1854
|
+
EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
|
|
1855
|
+
})(exports.EditMode || (exports.EditMode = {}));
|
|
1856
|
+
/** State for the lifecycle of a File. */
|
|
1857
|
+
exports.FileState = void 0;
|
|
1858
|
+
(function (FileState) {
|
|
1859
|
+
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1860
|
+
FileState["PROCESSING"] = "PROCESSING";
|
|
1861
|
+
FileState["ACTIVE"] = "ACTIVE";
|
|
1862
|
+
FileState["FAILED"] = "FAILED";
|
|
1863
|
+
})(exports.FileState || (exports.FileState = {}));
|
|
1864
|
+
/** Source of the File. */
|
|
1865
|
+
exports.FileSource = void 0;
|
|
1866
|
+
(function (FileSource) {
|
|
1867
|
+
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1868
|
+
FileSource["UPLOADED"] = "UPLOADED";
|
|
1869
|
+
FileSource["GENERATED"] = "GENERATED";
|
|
1870
|
+
})(exports.FileSource || (exports.FileSource = {}));
|
|
1828
1871
|
/** Server content modalities. */
|
|
1829
1872
|
exports.MediaModality = void 0;
|
|
1830
1873
|
(function (MediaModality) {
|
|
@@ -2239,6 +2282,11 @@ class EmbedContentResponse {
|
|
|
2239
2282
|
/** The output images response. */
|
|
2240
2283
|
class GenerateImagesResponse {
|
|
2241
2284
|
}
|
|
2285
|
+
/** Response for the request to edit an image. */
|
|
2286
|
+
class EditImageResponse {
|
|
2287
|
+
}
|
|
2288
|
+
class UpscaleImageResponse {
|
|
2289
|
+
}
|
|
2242
2290
|
class ListModelsResponse {
|
|
2243
2291
|
}
|
|
2244
2292
|
class DeleteModelResponse {
|
|
@@ -2288,6 +2336,112 @@ class DeleteFileResponse {
|
|
|
2288
2336
|
/** Represents a single response in a replay. */
|
|
2289
2337
|
class ReplayResponse {
|
|
2290
2338
|
}
|
|
2339
|
+
/** A raw reference image.
|
|
2340
|
+
|
|
2341
|
+
A raw reference image represents the base image to edit, provided by the user.
|
|
2342
|
+
It can optionally be provided in addition to a mask reference image or
|
|
2343
|
+
a style reference image.
|
|
2344
|
+
*/
|
|
2345
|
+
class RawReferenceImage {
|
|
2346
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2347
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2348
|
+
toReferenceImageAPI() {
|
|
2349
|
+
const referenceImageAPI = {
|
|
2350
|
+
referenceType: 'REFERENCE_TYPE_RAW',
|
|
2351
|
+
referenceImage: this.referenceImage,
|
|
2352
|
+
referenceId: this.referenceId,
|
|
2353
|
+
};
|
|
2354
|
+
return referenceImageAPI;
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
/** A mask reference image.
|
|
2358
|
+
|
|
2359
|
+
This encapsulates either a mask image provided by the user and configs for
|
|
2360
|
+
the user provided mask, or only config parameters for the model to generate
|
|
2361
|
+
a mask.
|
|
2362
|
+
|
|
2363
|
+
A mask image is an image whose non-zero values indicate where to edit the base
|
|
2364
|
+
image. If the user provides a mask image, the mask must be in the same
|
|
2365
|
+
dimensions as the raw image.
|
|
2366
|
+
*/
|
|
2367
|
+
class MaskReferenceImage {
|
|
2368
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2369
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2370
|
+
toReferenceImageAPI() {
|
|
2371
|
+
const referenceImageAPI = {
|
|
2372
|
+
referenceType: 'REFERENCE_TYPE_MASK',
|
|
2373
|
+
referenceImage: this.referenceImage,
|
|
2374
|
+
referenceId: this.referenceId,
|
|
2375
|
+
maskImageConfig: this.config,
|
|
2376
|
+
};
|
|
2377
|
+
return referenceImageAPI;
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
/** A control reference image.
|
|
2381
|
+
|
|
2382
|
+
The image of the control reference image is either a control image provided
|
|
2383
|
+
by the user, or a regular image which the backend will use to generate a
|
|
2384
|
+
control image of. In the case of the latter, the
|
|
2385
|
+
enable_control_image_computation field in the config should be set to True.
|
|
2386
|
+
|
|
2387
|
+
A control image is an image that represents a sketch image of areas for the
|
|
2388
|
+
model to fill in based on the prompt.
|
|
2389
|
+
*/
|
|
2390
|
+
class ControlReferenceImage {
|
|
2391
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2392
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2393
|
+
toReferenceImageAPI() {
|
|
2394
|
+
const referenceImageAPI = {
|
|
2395
|
+
referenceType: 'REFERENCE_TYPE_CONTROL',
|
|
2396
|
+
referenceImage: this.referenceImage,
|
|
2397
|
+
referenceId: this.referenceId,
|
|
2398
|
+
controlImageConfig: this.config,
|
|
2399
|
+
};
|
|
2400
|
+
return referenceImageAPI;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
/** A style reference image.
|
|
2404
|
+
|
|
2405
|
+
This encapsulates a style reference image provided by the user, and
|
|
2406
|
+
additionally optional config parameters for the style reference image.
|
|
2407
|
+
|
|
2408
|
+
A raw reference image can also be provided as a destination for the style to
|
|
2409
|
+
be applied to.
|
|
2410
|
+
*/
|
|
2411
|
+
class StyleReferenceImage {
|
|
2412
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2413
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2414
|
+
toReferenceImageAPI() {
|
|
2415
|
+
const referenceImageAPI = {
|
|
2416
|
+
referenceType: 'REFERENCE_TYPE_STYLE',
|
|
2417
|
+
referenceImage: this.referenceImage,
|
|
2418
|
+
referenceId: this.referenceId,
|
|
2419
|
+
styleImageConfig: this.config,
|
|
2420
|
+
};
|
|
2421
|
+
return referenceImageAPI;
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
/** A subject reference image.
|
|
2425
|
+
|
|
2426
|
+
This encapsulates a subject reference image provided by the user, and
|
|
2427
|
+
additionally optional config parameters for the subject reference image.
|
|
2428
|
+
|
|
2429
|
+
A raw reference image can also be provided as a destination for the subject to
|
|
2430
|
+
be applied to.
|
|
2431
|
+
*/
|
|
2432
|
+
class SubjectReferenceImage {
|
|
2433
|
+
/* Internal method to convert to ReferenceImageAPIInternal. */
|
|
2434
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2435
|
+
toReferenceImageAPI() {
|
|
2436
|
+
const referenceImageAPI = {
|
|
2437
|
+
referenceType: 'REFERENCE_TYPE_SUBJECT',
|
|
2438
|
+
referenceImage: this.referenceImage,
|
|
2439
|
+
referenceId: this.referenceId,
|
|
2440
|
+
subjectImageConfig: this.config,
|
|
2441
|
+
};
|
|
2442
|
+
return referenceImageAPI;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2291
2445
|
/** Response message for API call. */
|
|
2292
2446
|
class LiveServerMessage {
|
|
2293
2447
|
/**
|
|
@@ -3630,6 +3784,37 @@ class Files extends BaseModule {
|
|
|
3630
3784
|
* Copyright 2025 Google LLC
|
|
3631
3785
|
* SPDX-License-Identifier: Apache-2.0
|
|
3632
3786
|
*/
|
|
3787
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
3788
|
+
const toObject = {};
|
|
3789
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
3790
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
3791
|
+
}
|
|
3792
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
3793
|
+
if (fromData != null) {
|
|
3794
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
3795
|
+
}
|
|
3796
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3797
|
+
if (fromMimeType != null) {
|
|
3798
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
3799
|
+
}
|
|
3800
|
+
return toObject;
|
|
3801
|
+
}
|
|
3802
|
+
function blobToVertex$1(apiClient, fromObject) {
|
|
3803
|
+
const toObject = {};
|
|
3804
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3805
|
+
if (fromDisplayName != null) {
|
|
3806
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
3807
|
+
}
|
|
3808
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
3809
|
+
if (fromData != null) {
|
|
3810
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
3811
|
+
}
|
|
3812
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3813
|
+
if (fromMimeType != null) {
|
|
3814
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
3815
|
+
}
|
|
3816
|
+
return toObject;
|
|
3817
|
+
}
|
|
3633
3818
|
function partToMldev$1(apiClient, fromObject) {
|
|
3634
3819
|
const toObject = {};
|
|
3635
3820
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -3639,6 +3824,10 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
3639
3824
|
if (fromThought != null) {
|
|
3640
3825
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
3641
3826
|
}
|
|
3827
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3828
|
+
if (fromInlineData != null) {
|
|
3829
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
3830
|
+
}
|
|
3642
3831
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3643
3832
|
'codeExecutionResult',
|
|
3644
3833
|
]);
|
|
@@ -3665,10 +3854,6 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
3665
3854
|
if (fromFunctionResponse != null) {
|
|
3666
3855
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3667
3856
|
}
|
|
3668
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3669
|
-
if (fromInlineData != null) {
|
|
3670
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
3671
|
-
}
|
|
3672
3857
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
3673
3858
|
if (fromText != null) {
|
|
3674
3859
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -3687,6 +3872,10 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
3687
3872
|
if (fromThought != null) {
|
|
3688
3873
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
3689
3874
|
}
|
|
3875
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3876
|
+
if (fromInlineData != null) {
|
|
3877
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex$1(apiClient, fromInlineData));
|
|
3878
|
+
}
|
|
3690
3879
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3691
3880
|
'codeExecutionResult',
|
|
3692
3881
|
]);
|
|
@@ -3713,10 +3902,6 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
3713
3902
|
if (fromFunctionResponse != null) {
|
|
3714
3903
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3715
3904
|
}
|
|
3716
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3717
|
-
if (fromInlineData != null) {
|
|
3718
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
3719
|
-
}
|
|
3720
3905
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
3721
3906
|
if (fromText != null) {
|
|
3722
3907
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -4430,12 +4615,44 @@ function liveServerSetupCompleteFromVertex() {
|
|
|
4430
4615
|
const toObject = {};
|
|
4431
4616
|
return toObject;
|
|
4432
4617
|
}
|
|
4618
|
+
function blobFromMldev$1(apiClient, fromObject) {
|
|
4619
|
+
const toObject = {};
|
|
4620
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
4621
|
+
if (fromData != null) {
|
|
4622
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
4623
|
+
}
|
|
4624
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4625
|
+
if (fromMimeType != null) {
|
|
4626
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4627
|
+
}
|
|
4628
|
+
return toObject;
|
|
4629
|
+
}
|
|
4630
|
+
function blobFromVertex$1(apiClient, fromObject) {
|
|
4631
|
+
const toObject = {};
|
|
4632
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
4633
|
+
if (fromDisplayName != null) {
|
|
4634
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
4635
|
+
}
|
|
4636
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
4637
|
+
if (fromData != null) {
|
|
4638
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
4639
|
+
}
|
|
4640
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4641
|
+
if (fromMimeType != null) {
|
|
4642
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4643
|
+
}
|
|
4644
|
+
return toObject;
|
|
4645
|
+
}
|
|
4433
4646
|
function partFromMldev$1(apiClient, fromObject) {
|
|
4434
4647
|
const toObject = {};
|
|
4435
4648
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4436
4649
|
if (fromThought != null) {
|
|
4437
4650
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
4438
4651
|
}
|
|
4652
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4653
|
+
if (fromInlineData != null) {
|
|
4654
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev$1(apiClient, fromInlineData));
|
|
4655
|
+
}
|
|
4439
4656
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4440
4657
|
'codeExecutionResult',
|
|
4441
4658
|
]);
|
|
@@ -4462,10 +4679,6 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
4462
4679
|
if (fromFunctionResponse != null) {
|
|
4463
4680
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4464
4681
|
}
|
|
4465
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4466
|
-
if (fromInlineData != null) {
|
|
4467
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4468
|
-
}
|
|
4469
4682
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4470
4683
|
if (fromText != null) {
|
|
4471
4684
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -4484,6 +4697,10 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
4484
4697
|
if (fromThought != null) {
|
|
4485
4698
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
4486
4699
|
}
|
|
4700
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4701
|
+
if (fromInlineData != null) {
|
|
4702
|
+
setValueByPath(toObject, ['inlineData'], blobFromVertex$1(apiClient, fromInlineData));
|
|
4703
|
+
}
|
|
4487
4704
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4488
4705
|
'codeExecutionResult',
|
|
4489
4706
|
]);
|
|
@@ -4510,10 +4727,6 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
4510
4727
|
if (fromFunctionResponse != null) {
|
|
4511
4728
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4512
4729
|
}
|
|
4513
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4514
|
-
if (fromInlineData != null) {
|
|
4515
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4516
|
-
}
|
|
4517
4730
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4518
4731
|
if (fromText != null) {
|
|
4519
4732
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5082,6 +5295,21 @@ function liveServerMessageFromVertex(apiClient, fromObject) {
|
|
|
5082
5295
|
* Copyright 2025 Google LLC
|
|
5083
5296
|
* SPDX-License-Identifier: Apache-2.0
|
|
5084
5297
|
*/
|
|
5298
|
+
function blobToMldev(apiClient, fromObject) {
|
|
5299
|
+
const toObject = {};
|
|
5300
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5301
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
5302
|
+
}
|
|
5303
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
5304
|
+
if (fromData != null) {
|
|
5305
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
5306
|
+
}
|
|
5307
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
5308
|
+
if (fromMimeType != null) {
|
|
5309
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
5310
|
+
}
|
|
5311
|
+
return toObject;
|
|
5312
|
+
}
|
|
5085
5313
|
function partToMldev(apiClient, fromObject) {
|
|
5086
5314
|
const toObject = {};
|
|
5087
5315
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -5091,6 +5319,10 @@ function partToMldev(apiClient, fromObject) {
|
|
|
5091
5319
|
if (fromThought != null) {
|
|
5092
5320
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5093
5321
|
}
|
|
5322
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5323
|
+
if (fromInlineData != null) {
|
|
5324
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
5325
|
+
}
|
|
5094
5326
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5095
5327
|
'codeExecutionResult',
|
|
5096
5328
|
]);
|
|
@@ -5117,10 +5349,6 @@ function partToMldev(apiClient, fromObject) {
|
|
|
5117
5349
|
if (fromFunctionResponse != null) {
|
|
5118
5350
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5119
5351
|
}
|
|
5120
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5121
|
-
if (fromInlineData != null) {
|
|
5122
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5123
|
-
}
|
|
5124
5352
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5125
5353
|
if (fromText != null) {
|
|
5126
5354
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5647,6 +5875,12 @@ function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5647
5875
|
if (parentObject !== undefined && fromDescription != null) {
|
|
5648
5876
|
setValueByPath(parentObject, ['description'], fromDescription);
|
|
5649
5877
|
}
|
|
5878
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
5879
|
+
'defaultCheckpointId',
|
|
5880
|
+
]);
|
|
5881
|
+
if (parentObject !== undefined && fromDefaultCheckpointId != null) {
|
|
5882
|
+
setValueByPath(parentObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
5883
|
+
}
|
|
5650
5884
|
return toObject;
|
|
5651
5885
|
}
|
|
5652
5886
|
function updateModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -5793,6 +6027,22 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
|
5793
6027
|
}
|
|
5794
6028
|
return toObject;
|
|
5795
6029
|
}
|
|
6030
|
+
function blobToVertex(apiClient, fromObject) {
|
|
6031
|
+
const toObject = {};
|
|
6032
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6033
|
+
if (fromDisplayName != null) {
|
|
6034
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
6035
|
+
}
|
|
6036
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
6037
|
+
if (fromData != null) {
|
|
6038
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
6039
|
+
}
|
|
6040
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6041
|
+
if (fromMimeType != null) {
|
|
6042
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
6043
|
+
}
|
|
6044
|
+
return toObject;
|
|
6045
|
+
}
|
|
5796
6046
|
function partToVertex(apiClient, fromObject) {
|
|
5797
6047
|
const toObject = {};
|
|
5798
6048
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -5805,6 +6055,10 @@ function partToVertex(apiClient, fromObject) {
|
|
|
5805
6055
|
if (fromThought != null) {
|
|
5806
6056
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5807
6057
|
}
|
|
6058
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6059
|
+
if (fromInlineData != null) {
|
|
6060
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex(apiClient, fromInlineData));
|
|
6061
|
+
}
|
|
5808
6062
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5809
6063
|
'codeExecutionResult',
|
|
5810
6064
|
]);
|
|
@@ -5831,10 +6085,6 @@ function partToVertex(apiClient, fromObject) {
|
|
|
5831
6085
|
if (fromFunctionResponse != null) {
|
|
5832
6086
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5833
6087
|
}
|
|
5834
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5835
|
-
if (fromInlineData != null) {
|
|
5836
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5837
|
-
}
|
|
5838
6088
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5839
6089
|
if (fromText != null) {
|
|
5840
6090
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -6419,77 +6669,363 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
6419
6669
|
}
|
|
6420
6670
|
return toObject;
|
|
6421
6671
|
}
|
|
6422
|
-
function
|
|
6672
|
+
function imageToVertex(apiClient, fromObject) {
|
|
6423
6673
|
const toObject = {};
|
|
6424
|
-
const
|
|
6425
|
-
if (
|
|
6426
|
-
setValueByPath(toObject, ['
|
|
6674
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
6675
|
+
if (fromGcsUri != null) {
|
|
6676
|
+
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
6427
6677
|
}
|
|
6428
|
-
const
|
|
6429
|
-
if (
|
|
6430
|
-
setValueByPath(toObject, ['
|
|
6678
|
+
const fromImageBytes = getValueByPath(fromObject, ['imageBytes']);
|
|
6679
|
+
if (fromImageBytes != null) {
|
|
6680
|
+
setValueByPath(toObject, ['bytesBase64Encoded'], tBytes(apiClient, fromImageBytes));
|
|
6681
|
+
}
|
|
6682
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6683
|
+
if (fromMimeType != null) {
|
|
6684
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
6431
6685
|
}
|
|
6432
6686
|
return toObject;
|
|
6433
6687
|
}
|
|
6434
|
-
function
|
|
6688
|
+
function maskReferenceConfigToVertex(apiClient, fromObject) {
|
|
6435
6689
|
const toObject = {};
|
|
6436
|
-
const
|
|
6437
|
-
if (
|
|
6438
|
-
setValueByPath(
|
|
6690
|
+
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
6691
|
+
if (fromMaskMode != null) {
|
|
6692
|
+
setValueByPath(toObject, ['maskMode'], fromMaskMode);
|
|
6439
6693
|
}
|
|
6440
|
-
const
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
if (parentObject !== undefined && fromFilter != null) {
|
|
6446
|
-
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
6694
|
+
const fromSegmentationClasses = getValueByPath(fromObject, [
|
|
6695
|
+
'segmentationClasses',
|
|
6696
|
+
]);
|
|
6697
|
+
if (fromSegmentationClasses != null) {
|
|
6698
|
+
setValueByPath(toObject, ['maskClasses'], fromSegmentationClasses);
|
|
6447
6699
|
}
|
|
6448
|
-
const
|
|
6449
|
-
if (
|
|
6450
|
-
setValueByPath(
|
|
6700
|
+
const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
|
|
6701
|
+
if (fromMaskDilation != null) {
|
|
6702
|
+
setValueByPath(toObject, ['dilation'], fromMaskDilation);
|
|
6451
6703
|
}
|
|
6452
6704
|
return toObject;
|
|
6453
6705
|
}
|
|
6454
|
-
function
|
|
6706
|
+
function controlReferenceConfigToVertex(apiClient, fromObject) {
|
|
6455
6707
|
const toObject = {};
|
|
6456
|
-
const
|
|
6457
|
-
if (
|
|
6458
|
-
setValueByPath(toObject, ['
|
|
6708
|
+
const fromControlType = getValueByPath(fromObject, ['controlType']);
|
|
6709
|
+
if (fromControlType != null) {
|
|
6710
|
+
setValueByPath(toObject, ['controlType'], fromControlType);
|
|
6711
|
+
}
|
|
6712
|
+
const fromEnableControlImageComputation = getValueByPath(fromObject, [
|
|
6713
|
+
'enableControlImageComputation',
|
|
6714
|
+
]);
|
|
6715
|
+
if (fromEnableControlImageComputation != null) {
|
|
6716
|
+
setValueByPath(toObject, ['computeControl'], fromEnableControlImageComputation);
|
|
6459
6717
|
}
|
|
6460
6718
|
return toObject;
|
|
6461
6719
|
}
|
|
6462
|
-
function
|
|
6720
|
+
function styleReferenceConfigToVertex(apiClient, fromObject) {
|
|
6463
6721
|
const toObject = {};
|
|
6464
|
-
const
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
if (parentObject !== undefined && fromDescription != null) {
|
|
6470
|
-
setValueByPath(parentObject, ['description'], fromDescription);
|
|
6722
|
+
const fromStyleDescription = getValueByPath(fromObject, [
|
|
6723
|
+
'styleDescription',
|
|
6724
|
+
]);
|
|
6725
|
+
if (fromStyleDescription != null) {
|
|
6726
|
+
setValueByPath(toObject, ['styleDescription'], fromStyleDescription);
|
|
6471
6727
|
}
|
|
6472
6728
|
return toObject;
|
|
6473
6729
|
}
|
|
6474
|
-
function
|
|
6730
|
+
function subjectReferenceConfigToVertex(apiClient, fromObject) {
|
|
6475
6731
|
const toObject = {};
|
|
6476
|
-
const
|
|
6477
|
-
if (
|
|
6478
|
-
setValueByPath(toObject, ['
|
|
6732
|
+
const fromSubjectType = getValueByPath(fromObject, ['subjectType']);
|
|
6733
|
+
if (fromSubjectType != null) {
|
|
6734
|
+
setValueByPath(toObject, ['subjectType'], fromSubjectType);
|
|
6479
6735
|
}
|
|
6480
|
-
const
|
|
6481
|
-
|
|
6482
|
-
|
|
6736
|
+
const fromSubjectDescription = getValueByPath(fromObject, [
|
|
6737
|
+
'subjectDescription',
|
|
6738
|
+
]);
|
|
6739
|
+
if (fromSubjectDescription != null) {
|
|
6740
|
+
setValueByPath(toObject, ['subjectDescription'], fromSubjectDescription);
|
|
6483
6741
|
}
|
|
6484
6742
|
return toObject;
|
|
6485
6743
|
}
|
|
6486
|
-
function
|
|
6744
|
+
function referenceImageAPIInternalToVertex(apiClient, fromObject) {
|
|
6487
6745
|
const toObject = {};
|
|
6488
|
-
const
|
|
6489
|
-
|
|
6490
|
-
|
|
6746
|
+
const fromReferenceImage = getValueByPath(fromObject, [
|
|
6747
|
+
'referenceImage',
|
|
6748
|
+
]);
|
|
6749
|
+
if (fromReferenceImage != null) {
|
|
6750
|
+
setValueByPath(toObject, ['referenceImage'], imageToVertex(apiClient, fromReferenceImage));
|
|
6491
6751
|
}
|
|
6492
|
-
const
|
|
6752
|
+
const fromReferenceId = getValueByPath(fromObject, ['referenceId']);
|
|
6753
|
+
if (fromReferenceId != null) {
|
|
6754
|
+
setValueByPath(toObject, ['referenceId'], fromReferenceId);
|
|
6755
|
+
}
|
|
6756
|
+
const fromReferenceType = getValueByPath(fromObject, [
|
|
6757
|
+
'referenceType',
|
|
6758
|
+
]);
|
|
6759
|
+
if (fromReferenceType != null) {
|
|
6760
|
+
setValueByPath(toObject, ['referenceType'], fromReferenceType);
|
|
6761
|
+
}
|
|
6762
|
+
const fromMaskImageConfig = getValueByPath(fromObject, [
|
|
6763
|
+
'maskImageConfig',
|
|
6764
|
+
]);
|
|
6765
|
+
if (fromMaskImageConfig != null) {
|
|
6766
|
+
setValueByPath(toObject, ['maskImageConfig'], maskReferenceConfigToVertex(apiClient, fromMaskImageConfig));
|
|
6767
|
+
}
|
|
6768
|
+
const fromControlImageConfig = getValueByPath(fromObject, [
|
|
6769
|
+
'controlImageConfig',
|
|
6770
|
+
]);
|
|
6771
|
+
if (fromControlImageConfig != null) {
|
|
6772
|
+
setValueByPath(toObject, ['controlImageConfig'], controlReferenceConfigToVertex(apiClient, fromControlImageConfig));
|
|
6773
|
+
}
|
|
6774
|
+
const fromStyleImageConfig = getValueByPath(fromObject, [
|
|
6775
|
+
'styleImageConfig',
|
|
6776
|
+
]);
|
|
6777
|
+
if (fromStyleImageConfig != null) {
|
|
6778
|
+
setValueByPath(toObject, ['styleImageConfig'], styleReferenceConfigToVertex(apiClient, fromStyleImageConfig));
|
|
6779
|
+
}
|
|
6780
|
+
const fromSubjectImageConfig = getValueByPath(fromObject, [
|
|
6781
|
+
'subjectImageConfig',
|
|
6782
|
+
]);
|
|
6783
|
+
if (fromSubjectImageConfig != null) {
|
|
6784
|
+
setValueByPath(toObject, ['subjectImageConfig'], subjectReferenceConfigToVertex(apiClient, fromSubjectImageConfig));
|
|
6785
|
+
}
|
|
6786
|
+
return toObject;
|
|
6787
|
+
}
|
|
6788
|
+
function editImageConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6789
|
+
const toObject = {};
|
|
6790
|
+
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
6791
|
+
if (parentObject !== undefined && fromOutputGcsUri != null) {
|
|
6792
|
+
setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
|
|
6793
|
+
}
|
|
6794
|
+
const fromNegativePrompt = getValueByPath(fromObject, [
|
|
6795
|
+
'negativePrompt',
|
|
6796
|
+
]);
|
|
6797
|
+
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
6798
|
+
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
6799
|
+
}
|
|
6800
|
+
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
6801
|
+
'numberOfImages',
|
|
6802
|
+
]);
|
|
6803
|
+
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
6804
|
+
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
6805
|
+
}
|
|
6806
|
+
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
6807
|
+
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
6808
|
+
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
6809
|
+
}
|
|
6810
|
+
const fromGuidanceScale = getValueByPath(fromObject, [
|
|
6811
|
+
'guidanceScale',
|
|
6812
|
+
]);
|
|
6813
|
+
if (parentObject !== undefined && fromGuidanceScale != null) {
|
|
6814
|
+
setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
|
|
6815
|
+
}
|
|
6816
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
6817
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
6818
|
+
setValueByPath(parentObject, ['parameters', 'seed'], fromSeed);
|
|
6819
|
+
}
|
|
6820
|
+
const fromSafetyFilterLevel = getValueByPath(fromObject, [
|
|
6821
|
+
'safetyFilterLevel',
|
|
6822
|
+
]);
|
|
6823
|
+
if (parentObject !== undefined && fromSafetyFilterLevel != null) {
|
|
6824
|
+
setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
|
|
6825
|
+
}
|
|
6826
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
6827
|
+
'personGeneration',
|
|
6828
|
+
]);
|
|
6829
|
+
if (parentObject !== undefined && fromPersonGeneration != null) {
|
|
6830
|
+
setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
|
|
6831
|
+
}
|
|
6832
|
+
const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
|
|
6833
|
+
'includeSafetyAttributes',
|
|
6834
|
+
]);
|
|
6835
|
+
if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
|
|
6836
|
+
setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
|
|
6837
|
+
}
|
|
6838
|
+
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
6839
|
+
'includeRaiReason',
|
|
6840
|
+
]);
|
|
6841
|
+
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
6842
|
+
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
6843
|
+
}
|
|
6844
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
6845
|
+
if (parentObject !== undefined && fromLanguage != null) {
|
|
6846
|
+
setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
|
|
6847
|
+
}
|
|
6848
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
6849
|
+
'outputMimeType',
|
|
6850
|
+
]);
|
|
6851
|
+
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
6852
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
6853
|
+
}
|
|
6854
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
6855
|
+
'outputCompressionQuality',
|
|
6856
|
+
]);
|
|
6857
|
+
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
6858
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
6859
|
+
}
|
|
6860
|
+
const fromEditMode = getValueByPath(fromObject, ['editMode']);
|
|
6861
|
+
if (parentObject !== undefined && fromEditMode != null) {
|
|
6862
|
+
setValueByPath(parentObject, ['parameters', 'editMode'], fromEditMode);
|
|
6863
|
+
}
|
|
6864
|
+
const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
|
|
6865
|
+
if (parentObject !== undefined && fromBaseSteps != null) {
|
|
6866
|
+
setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
|
|
6867
|
+
}
|
|
6868
|
+
return toObject;
|
|
6869
|
+
}
|
|
6870
|
+
function editImageParametersInternalToVertex(apiClient, fromObject) {
|
|
6871
|
+
const toObject = {};
|
|
6872
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6873
|
+
if (fromModel != null) {
|
|
6874
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
6875
|
+
}
|
|
6876
|
+
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
6877
|
+
if (fromPrompt != null) {
|
|
6878
|
+
setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
6879
|
+
}
|
|
6880
|
+
const fromReferenceImages = getValueByPath(fromObject, [
|
|
6881
|
+
'referenceImages',
|
|
6882
|
+
]);
|
|
6883
|
+
if (fromReferenceImages != null) {
|
|
6884
|
+
let transformedList = fromReferenceImages;
|
|
6885
|
+
if (Array.isArray(transformedList)) {
|
|
6886
|
+
transformedList = transformedList.map((item) => {
|
|
6887
|
+
return referenceImageAPIInternalToVertex(apiClient, item);
|
|
6888
|
+
});
|
|
6889
|
+
}
|
|
6890
|
+
setValueByPath(toObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
6891
|
+
}
|
|
6892
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6893
|
+
if (fromConfig != null) {
|
|
6894
|
+
setValueByPath(toObject, ['config'], editImageConfigToVertex(apiClient, fromConfig, toObject));
|
|
6895
|
+
}
|
|
6896
|
+
return toObject;
|
|
6897
|
+
}
|
|
6898
|
+
function upscaleImageAPIConfigInternalToVertex(apiClient, fromObject, parentObject) {
|
|
6899
|
+
const toObject = {};
|
|
6900
|
+
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
6901
|
+
'includeRaiReason',
|
|
6902
|
+
]);
|
|
6903
|
+
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
6904
|
+
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
6905
|
+
}
|
|
6906
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
6907
|
+
'outputMimeType',
|
|
6908
|
+
]);
|
|
6909
|
+
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
6910
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
6911
|
+
}
|
|
6912
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
6913
|
+
'outputCompressionQuality',
|
|
6914
|
+
]);
|
|
6915
|
+
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
6916
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
6917
|
+
}
|
|
6918
|
+
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
6919
|
+
'numberOfImages',
|
|
6920
|
+
]);
|
|
6921
|
+
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
6922
|
+
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
6923
|
+
}
|
|
6924
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
6925
|
+
if (parentObject !== undefined && fromMode != null) {
|
|
6926
|
+
setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
|
|
6927
|
+
}
|
|
6928
|
+
return toObject;
|
|
6929
|
+
}
|
|
6930
|
+
function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
|
|
6931
|
+
const toObject = {};
|
|
6932
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6933
|
+
if (fromModel != null) {
|
|
6934
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
6935
|
+
}
|
|
6936
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
6937
|
+
if (fromImage != null) {
|
|
6938
|
+
setValueByPath(toObject, ['instances[0]', 'image'], imageToVertex(apiClient, fromImage));
|
|
6939
|
+
}
|
|
6940
|
+
const fromUpscaleFactor = getValueByPath(fromObject, [
|
|
6941
|
+
'upscaleFactor',
|
|
6942
|
+
]);
|
|
6943
|
+
if (fromUpscaleFactor != null) {
|
|
6944
|
+
setValueByPath(toObject, ['parameters', 'upscaleConfig', 'upscaleFactor'], fromUpscaleFactor);
|
|
6945
|
+
}
|
|
6946
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6947
|
+
if (fromConfig != null) {
|
|
6948
|
+
setValueByPath(toObject, ['config'], upscaleImageAPIConfigInternalToVertex(apiClient, fromConfig, toObject));
|
|
6949
|
+
}
|
|
6950
|
+
return toObject;
|
|
6951
|
+
}
|
|
6952
|
+
function getModelParametersToVertex(apiClient, fromObject) {
|
|
6953
|
+
const toObject = {};
|
|
6954
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6955
|
+
if (fromModel != null) {
|
|
6956
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
6957
|
+
}
|
|
6958
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6959
|
+
if (fromConfig != null) {
|
|
6960
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
6961
|
+
}
|
|
6962
|
+
return toObject;
|
|
6963
|
+
}
|
|
6964
|
+
function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6965
|
+
const toObject = {};
|
|
6966
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
6967
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
6968
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
6969
|
+
}
|
|
6970
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
6971
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
6972
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
6973
|
+
}
|
|
6974
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
6975
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
6976
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
6977
|
+
}
|
|
6978
|
+
const fromQueryBase = getValueByPath(fromObject, ['queryBase']);
|
|
6979
|
+
if (parentObject !== undefined && fromQueryBase != null) {
|
|
6980
|
+
setValueByPath(parentObject, ['_url', 'models_url'], tModelsUrl(apiClient, fromQueryBase));
|
|
6981
|
+
}
|
|
6982
|
+
return toObject;
|
|
6983
|
+
}
|
|
6984
|
+
function listModelsParametersToVertex(apiClient, fromObject) {
|
|
6985
|
+
const toObject = {};
|
|
6986
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6987
|
+
if (fromConfig != null) {
|
|
6988
|
+
setValueByPath(toObject, ['config'], listModelsConfigToVertex(apiClient, fromConfig, toObject));
|
|
6989
|
+
}
|
|
6990
|
+
return toObject;
|
|
6991
|
+
}
|
|
6992
|
+
function updateModelConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6993
|
+
const toObject = {};
|
|
6994
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6995
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
6996
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
6997
|
+
}
|
|
6998
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
6999
|
+
if (parentObject !== undefined && fromDescription != null) {
|
|
7000
|
+
setValueByPath(parentObject, ['description'], fromDescription);
|
|
7001
|
+
}
|
|
7002
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
7003
|
+
'defaultCheckpointId',
|
|
7004
|
+
]);
|
|
7005
|
+
if (parentObject !== undefined && fromDefaultCheckpointId != null) {
|
|
7006
|
+
setValueByPath(parentObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
7007
|
+
}
|
|
7008
|
+
return toObject;
|
|
7009
|
+
}
|
|
7010
|
+
function updateModelParametersToVertex(apiClient, fromObject) {
|
|
7011
|
+
const toObject = {};
|
|
7012
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
7013
|
+
if (fromModel != null) {
|
|
7014
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
7015
|
+
}
|
|
7016
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7017
|
+
if (fromConfig != null) {
|
|
7018
|
+
setValueByPath(toObject, ['config'], updateModelConfigToVertex(apiClient, fromConfig, toObject));
|
|
7019
|
+
}
|
|
7020
|
+
return toObject;
|
|
7021
|
+
}
|
|
7022
|
+
function deleteModelParametersToVertex(apiClient, fromObject) {
|
|
7023
|
+
const toObject = {};
|
|
7024
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
7025
|
+
if (fromModel != null) {
|
|
7026
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
7027
|
+
}
|
|
7028
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6493
7029
|
if (fromConfig != null) {
|
|
6494
7030
|
setValueByPath(toObject, ['config'], fromConfig);
|
|
6495
7031
|
}
|
|
@@ -6565,22 +7101,6 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
6565
7101
|
}
|
|
6566
7102
|
return toObject;
|
|
6567
7103
|
}
|
|
6568
|
-
function imageToVertex(apiClient, fromObject) {
|
|
6569
|
-
const toObject = {};
|
|
6570
|
-
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
6571
|
-
if (fromGcsUri != null) {
|
|
6572
|
-
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
6573
|
-
}
|
|
6574
|
-
const fromImageBytes = getValueByPath(fromObject, ['imageBytes']);
|
|
6575
|
-
if (fromImageBytes != null) {
|
|
6576
|
-
setValueByPath(toObject, ['bytesBase64Encoded'], tBytes(apiClient, fromImageBytes));
|
|
6577
|
-
}
|
|
6578
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6579
|
-
if (fromMimeType != null) {
|
|
6580
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
6581
|
-
}
|
|
6582
|
-
return toObject;
|
|
6583
|
-
}
|
|
6584
7104
|
function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6585
7105
|
const toObject = {};
|
|
6586
7106
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -6659,12 +7179,28 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
|
6659
7179
|
}
|
|
6660
7180
|
return toObject;
|
|
6661
7181
|
}
|
|
7182
|
+
function blobFromMldev(apiClient, fromObject) {
|
|
7183
|
+
const toObject = {};
|
|
7184
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
7185
|
+
if (fromData != null) {
|
|
7186
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
7187
|
+
}
|
|
7188
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7189
|
+
if (fromMimeType != null) {
|
|
7190
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
7191
|
+
}
|
|
7192
|
+
return toObject;
|
|
7193
|
+
}
|
|
6662
7194
|
function partFromMldev(apiClient, fromObject) {
|
|
6663
7195
|
const toObject = {};
|
|
6664
7196
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
6665
7197
|
if (fromThought != null) {
|
|
6666
7198
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
6667
7199
|
}
|
|
7200
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7201
|
+
if (fromInlineData != null) {
|
|
7202
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev(apiClient, fromInlineData));
|
|
7203
|
+
}
|
|
6668
7204
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6669
7205
|
'codeExecutionResult',
|
|
6670
7206
|
]);
|
|
@@ -6691,10 +7227,6 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
6691
7227
|
if (fromFunctionResponse != null) {
|
|
6692
7228
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
6693
7229
|
}
|
|
6694
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6695
|
-
if (fromInlineData != null) {
|
|
6696
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
6697
|
-
}
|
|
6698
7230
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
6699
7231
|
if (fromText != null) {
|
|
6700
7232
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7089,6 +7621,22 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
|
|
|
7089
7621
|
}
|
|
7090
7622
|
return toObject;
|
|
7091
7623
|
}
|
|
7624
|
+
function blobFromVertex(apiClient, fromObject) {
|
|
7625
|
+
const toObject = {};
|
|
7626
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7627
|
+
if (fromDisplayName != null) {
|
|
7628
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
7629
|
+
}
|
|
7630
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
7631
|
+
if (fromData != null) {
|
|
7632
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
7633
|
+
}
|
|
7634
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7635
|
+
if (fromMimeType != null) {
|
|
7636
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
7637
|
+
}
|
|
7638
|
+
return toObject;
|
|
7639
|
+
}
|
|
7092
7640
|
function partFromVertex(apiClient, fromObject) {
|
|
7093
7641
|
const toObject = {};
|
|
7094
7642
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7101,6 +7649,10 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
7101
7649
|
if (fromThought != null) {
|
|
7102
7650
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
7103
7651
|
}
|
|
7652
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7653
|
+
if (fromInlineData != null) {
|
|
7654
|
+
setValueByPath(toObject, ['inlineData'], blobFromVertex(apiClient, fromInlineData));
|
|
7655
|
+
}
|
|
7104
7656
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7105
7657
|
'codeExecutionResult',
|
|
7106
7658
|
]);
|
|
@@ -7127,10 +7679,6 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
7127
7679
|
if (fromFunctionResponse != null) {
|
|
7128
7680
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
7129
7681
|
}
|
|
7130
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7131
|
-
if (fromInlineData != null) {
|
|
7132
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
7133
|
-
}
|
|
7134
7682
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
7135
7683
|
if (fromText != null) {
|
|
7136
7684
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7390,6 +7938,38 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
7390
7938
|
}
|
|
7391
7939
|
return toObject;
|
|
7392
7940
|
}
|
|
7941
|
+
function editImageResponseFromVertex(apiClient, fromObject) {
|
|
7942
|
+
const toObject = {};
|
|
7943
|
+
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
7944
|
+
'predictions',
|
|
7945
|
+
]);
|
|
7946
|
+
if (fromGeneratedImages != null) {
|
|
7947
|
+
let transformedList = fromGeneratedImages;
|
|
7948
|
+
if (Array.isArray(transformedList)) {
|
|
7949
|
+
transformedList = transformedList.map((item) => {
|
|
7950
|
+
return generatedImageFromVertex(apiClient, item);
|
|
7951
|
+
});
|
|
7952
|
+
}
|
|
7953
|
+
setValueByPath(toObject, ['generatedImages'], transformedList);
|
|
7954
|
+
}
|
|
7955
|
+
return toObject;
|
|
7956
|
+
}
|
|
7957
|
+
function upscaleImageResponseFromVertex(apiClient, fromObject) {
|
|
7958
|
+
const toObject = {};
|
|
7959
|
+
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
7960
|
+
'predictions',
|
|
7961
|
+
]);
|
|
7962
|
+
if (fromGeneratedImages != null) {
|
|
7963
|
+
let transformedList = fromGeneratedImages;
|
|
7964
|
+
if (Array.isArray(transformedList)) {
|
|
7965
|
+
transformedList = transformedList.map((item) => {
|
|
7966
|
+
return generatedImageFromVertex(apiClient, item);
|
|
7967
|
+
});
|
|
7968
|
+
}
|
|
7969
|
+
setValueByPath(toObject, ['generatedImages'], transformedList);
|
|
7970
|
+
}
|
|
7971
|
+
return toObject;
|
|
7972
|
+
}
|
|
7393
7973
|
function endpointFromVertex(apiClient, fromObject) {
|
|
7394
7974
|
const toObject = {};
|
|
7395
7975
|
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
@@ -7423,6 +8003,22 @@ function tunedModelInfoFromVertex(apiClient, fromObject) {
|
|
|
7423
8003
|
}
|
|
7424
8004
|
return toObject;
|
|
7425
8005
|
}
|
|
8006
|
+
function checkpointFromVertex(apiClient, fromObject) {
|
|
8007
|
+
const toObject = {};
|
|
8008
|
+
const fromCheckpointId = getValueByPath(fromObject, ['checkpointId']);
|
|
8009
|
+
if (fromCheckpointId != null) {
|
|
8010
|
+
setValueByPath(toObject, ['checkpointId'], fromCheckpointId);
|
|
8011
|
+
}
|
|
8012
|
+
const fromEpoch = getValueByPath(fromObject, ['epoch']);
|
|
8013
|
+
if (fromEpoch != null) {
|
|
8014
|
+
setValueByPath(toObject, ['epoch'], fromEpoch);
|
|
8015
|
+
}
|
|
8016
|
+
const fromStep = getValueByPath(fromObject, ['step']);
|
|
8017
|
+
if (fromStep != null) {
|
|
8018
|
+
setValueByPath(toObject, ['step'], fromStep);
|
|
8019
|
+
}
|
|
8020
|
+
return toObject;
|
|
8021
|
+
}
|
|
7426
8022
|
function modelFromVertex(apiClient, fromObject) {
|
|
7427
8023
|
const toObject = {};
|
|
7428
8024
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -7459,6 +8055,22 @@ function modelFromVertex(apiClient, fromObject) {
|
|
|
7459
8055
|
if (fromTunedModelInfo != null) {
|
|
7460
8056
|
setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
|
|
7461
8057
|
}
|
|
8058
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
8059
|
+
'defaultCheckpointId',
|
|
8060
|
+
]);
|
|
8061
|
+
if (fromDefaultCheckpointId != null) {
|
|
8062
|
+
setValueByPath(toObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
8063
|
+
}
|
|
8064
|
+
const fromCheckpoints = getValueByPath(fromObject, ['checkpoints']);
|
|
8065
|
+
if (fromCheckpoints != null) {
|
|
8066
|
+
let transformedList = fromCheckpoints;
|
|
8067
|
+
if (Array.isArray(transformedList)) {
|
|
8068
|
+
transformedList = transformedList.map((item) => {
|
|
8069
|
+
return checkpointFromVertex(apiClient, item);
|
|
8070
|
+
});
|
|
8071
|
+
}
|
|
8072
|
+
setValueByPath(toObject, ['checkpoints'], transformedList);
|
|
8073
|
+
}
|
|
7462
8074
|
return toObject;
|
|
7463
8075
|
}
|
|
7464
8076
|
function listModelsResponseFromVertex(apiClient, fromObject) {
|
|
@@ -8069,9 +8681,7 @@ class Models extends BaseModule {
|
|
|
8069
8681
|
/**
|
|
8070
8682
|
* Generates an image based on a text description and configuration.
|
|
8071
8683
|
*
|
|
8072
|
-
* @param
|
|
8073
|
-
* @param prompt - A text description of the image to generate.
|
|
8074
|
-
* @param [config] - The config for image generation.
|
|
8684
|
+
* @param params - The parameters for generating images.
|
|
8075
8685
|
* @return The response from the API.
|
|
8076
8686
|
*
|
|
8077
8687
|
* @example
|
|
@@ -8140,6 +8750,76 @@ class Models extends BaseModule {
|
|
|
8140
8750
|
}
|
|
8141
8751
|
return new Pager(exports.PagedItem.PAGED_ITEM_MODELS, (x) => this.listInternal(x), await this.listInternal(actualParams), actualParams);
|
|
8142
8752
|
};
|
|
8753
|
+
/**
|
|
8754
|
+
* Edits an image based on a prompt, list of reference images, and configuration.
|
|
8755
|
+
*
|
|
8756
|
+
* @param params - The parameters for editing an image.
|
|
8757
|
+
* @return The response from the API.
|
|
8758
|
+
*
|
|
8759
|
+
* @example
|
|
8760
|
+
* ```ts
|
|
8761
|
+
* const response = await client.models.editImage({
|
|
8762
|
+
* model: 'imagen-3.0-capability-001',
|
|
8763
|
+
* prompt: 'Generate an image containing a mug with the product logo [1] visible on the side of the mug.',
|
|
8764
|
+
* referenceImages: [subjectReferenceImage]
|
|
8765
|
+
* config: {
|
|
8766
|
+
* numberOfImages: 1,
|
|
8767
|
+
* includeRaiReason: true,
|
|
8768
|
+
* },
|
|
8769
|
+
* });
|
|
8770
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
8771
|
+
* ```
|
|
8772
|
+
*/
|
|
8773
|
+
this.editImage = async (params) => {
|
|
8774
|
+
const paramsInternal = {
|
|
8775
|
+
model: params.model,
|
|
8776
|
+
prompt: params.prompt,
|
|
8777
|
+
referenceImages: [],
|
|
8778
|
+
config: params.config,
|
|
8779
|
+
};
|
|
8780
|
+
if (params.referenceImages) {
|
|
8781
|
+
if (params.referenceImages) {
|
|
8782
|
+
paramsInternal.referenceImages = params.referenceImages.map((img) => img.toReferenceImageAPI());
|
|
8783
|
+
}
|
|
8784
|
+
}
|
|
8785
|
+
return await this.editImageInternal(paramsInternal);
|
|
8786
|
+
};
|
|
8787
|
+
/**
|
|
8788
|
+
* Upscales an image based on an image, upscale factor, and configuration.
|
|
8789
|
+
* Only supported in Vertex AI currently.
|
|
8790
|
+
*
|
|
8791
|
+
* @param params - The parameters for upscaling an image.
|
|
8792
|
+
* @return The response from the API.
|
|
8793
|
+
*
|
|
8794
|
+
* @example
|
|
8795
|
+
* ```ts
|
|
8796
|
+
* const response = await client.models.upscaleImage({
|
|
8797
|
+
* model: 'imagen-3.0-generate-002',
|
|
8798
|
+
* image: image,
|
|
8799
|
+
* upscaleFactor: 'x2',
|
|
8800
|
+
* config: {
|
|
8801
|
+
* includeRaiReason: true,
|
|
8802
|
+
* },
|
|
8803
|
+
* });
|
|
8804
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
8805
|
+
* ```
|
|
8806
|
+
*/
|
|
8807
|
+
this.upscaleImage = async (params) => {
|
|
8808
|
+
let apiConfig = {
|
|
8809
|
+
numberOfImages: 1,
|
|
8810
|
+
mode: 'upscale',
|
|
8811
|
+
};
|
|
8812
|
+
if (params.config) {
|
|
8813
|
+
apiConfig = Object.assign(Object.assign({}, apiConfig), params.config);
|
|
8814
|
+
}
|
|
8815
|
+
const apiParams = {
|
|
8816
|
+
model: params.model,
|
|
8817
|
+
image: params.image,
|
|
8818
|
+
upscaleFactor: params.upscaleFactor,
|
|
8819
|
+
config: apiConfig,
|
|
8820
|
+
};
|
|
8821
|
+
return await this.upscaleImageInternal(apiParams);
|
|
8822
|
+
};
|
|
8143
8823
|
}
|
|
8144
8824
|
async generateContentInternal(params) {
|
|
8145
8825
|
var _a, _b, _c, _d;
|
|
@@ -8441,6 +9121,76 @@ class Models extends BaseModule {
|
|
|
8441
9121
|
});
|
|
8442
9122
|
}
|
|
8443
9123
|
}
|
|
9124
|
+
async editImageInternal(params) {
|
|
9125
|
+
var _a, _b;
|
|
9126
|
+
let response;
|
|
9127
|
+
let path = '';
|
|
9128
|
+
let queryParams = {};
|
|
9129
|
+
if (this.apiClient.isVertexAI()) {
|
|
9130
|
+
const body = editImageParametersInternalToVertex(this.apiClient, params);
|
|
9131
|
+
path = formatMap('{model}:predict', body['_url']);
|
|
9132
|
+
queryParams = body['_query'];
|
|
9133
|
+
delete body['config'];
|
|
9134
|
+
delete body['_url'];
|
|
9135
|
+
delete body['_query'];
|
|
9136
|
+
response = this.apiClient
|
|
9137
|
+
.request({
|
|
9138
|
+
path: path,
|
|
9139
|
+
queryParams: queryParams,
|
|
9140
|
+
body: JSON.stringify(body),
|
|
9141
|
+
httpMethod: 'POST',
|
|
9142
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9143
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9144
|
+
})
|
|
9145
|
+
.then((httpResponse) => {
|
|
9146
|
+
return httpResponse.json();
|
|
9147
|
+
});
|
|
9148
|
+
return response.then((apiResponse) => {
|
|
9149
|
+
const resp = editImageResponseFromVertex(this.apiClient, apiResponse);
|
|
9150
|
+
const typedResp = new EditImageResponse();
|
|
9151
|
+
Object.assign(typedResp, resp);
|
|
9152
|
+
return typedResp;
|
|
9153
|
+
});
|
|
9154
|
+
}
|
|
9155
|
+
else {
|
|
9156
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
9157
|
+
}
|
|
9158
|
+
}
|
|
9159
|
+
async upscaleImageInternal(params) {
|
|
9160
|
+
var _a, _b;
|
|
9161
|
+
let response;
|
|
9162
|
+
let path = '';
|
|
9163
|
+
let queryParams = {};
|
|
9164
|
+
if (this.apiClient.isVertexAI()) {
|
|
9165
|
+
const body = upscaleImageAPIParametersInternalToVertex(this.apiClient, params);
|
|
9166
|
+
path = formatMap('{model}:predict', body['_url']);
|
|
9167
|
+
queryParams = body['_query'];
|
|
9168
|
+
delete body['config'];
|
|
9169
|
+
delete body['_url'];
|
|
9170
|
+
delete body['_query'];
|
|
9171
|
+
response = this.apiClient
|
|
9172
|
+
.request({
|
|
9173
|
+
path: path,
|
|
9174
|
+
queryParams: queryParams,
|
|
9175
|
+
body: JSON.stringify(body),
|
|
9176
|
+
httpMethod: 'POST',
|
|
9177
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9178
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9179
|
+
})
|
|
9180
|
+
.then((httpResponse) => {
|
|
9181
|
+
return httpResponse.json();
|
|
9182
|
+
});
|
|
9183
|
+
return response.then((apiResponse) => {
|
|
9184
|
+
const resp = upscaleImageResponseFromVertex(this.apiClient, apiResponse);
|
|
9185
|
+
const typedResp = new UpscaleImageResponse();
|
|
9186
|
+
Object.assign(typedResp, resp);
|
|
9187
|
+
return typedResp;
|
|
9188
|
+
});
|
|
9189
|
+
}
|
|
9190
|
+
else {
|
|
9191
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
8444
9194
|
/**
|
|
8445
9195
|
* Fetches information about a model by name.
|
|
8446
9196
|
*
|
|
@@ -9256,7 +10006,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
9256
10006
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
9257
10007
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
9258
10008
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
9259
|
-
const SDK_VERSION = '0.
|
|
10009
|
+
const SDK_VERSION = '0.14.1'; // x-release-please-version
|
|
9260
10010
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
9261
10011
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
9262
10012
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -10034,6 +10784,10 @@ function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
10034
10784
|
if (fromLearningRateMultiplier != null) {
|
|
10035
10785
|
setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
10036
10786
|
}
|
|
10787
|
+
if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
|
|
10788
|
+
undefined) {
|
|
10789
|
+
throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
|
|
10790
|
+
}
|
|
10037
10791
|
if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
|
|
10038
10792
|
throw new Error('adapterSize parameter is not supported in Gemini API.');
|
|
10039
10793
|
}
|
|
@@ -10148,6 +10902,12 @@ function createTuningJobConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
10148
10902
|
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
10149
10903
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
10150
10904
|
}
|
|
10905
|
+
const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
|
|
10906
|
+
'exportLastCheckpointOnly',
|
|
10907
|
+
]);
|
|
10908
|
+
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
10909
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
10910
|
+
}
|
|
10151
10911
|
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
10152
10912
|
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
10153
10913
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
@@ -10300,6 +11060,26 @@ function operationFromMldev(apiClient, fromObject) {
|
|
|
10300
11060
|
}
|
|
10301
11061
|
return toObject;
|
|
10302
11062
|
}
|
|
11063
|
+
function tunedModelCheckpointFromVertex(apiClient, fromObject) {
|
|
11064
|
+
const toObject = {};
|
|
11065
|
+
const fromCheckpointId = getValueByPath(fromObject, ['checkpointId']);
|
|
11066
|
+
if (fromCheckpointId != null) {
|
|
11067
|
+
setValueByPath(toObject, ['checkpointId'], fromCheckpointId);
|
|
11068
|
+
}
|
|
11069
|
+
const fromEpoch = getValueByPath(fromObject, ['epoch']);
|
|
11070
|
+
if (fromEpoch != null) {
|
|
11071
|
+
setValueByPath(toObject, ['epoch'], fromEpoch);
|
|
11072
|
+
}
|
|
11073
|
+
const fromStep = getValueByPath(fromObject, ['step']);
|
|
11074
|
+
if (fromStep != null) {
|
|
11075
|
+
setValueByPath(toObject, ['step'], fromStep);
|
|
11076
|
+
}
|
|
11077
|
+
const fromEndpoint = getValueByPath(fromObject, ['endpoint']);
|
|
11078
|
+
if (fromEndpoint != null) {
|
|
11079
|
+
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
11080
|
+
}
|
|
11081
|
+
return toObject;
|
|
11082
|
+
}
|
|
10303
11083
|
function tunedModelFromVertex(apiClient, fromObject) {
|
|
10304
11084
|
const toObject = {};
|
|
10305
11085
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -10310,6 +11090,16 @@ function tunedModelFromVertex(apiClient, fromObject) {
|
|
|
10310
11090
|
if (fromEndpoint != null) {
|
|
10311
11091
|
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
10312
11092
|
}
|
|
11093
|
+
const fromCheckpoints = getValueByPath(fromObject, ['checkpoints']);
|
|
11094
|
+
if (fromCheckpoints != null) {
|
|
11095
|
+
let transformedList = fromCheckpoints;
|
|
11096
|
+
if (Array.isArray(transformedList)) {
|
|
11097
|
+
transformedList = transformedList.map((item) => {
|
|
11098
|
+
return tunedModelCheckpointFromVertex(apiClient, item);
|
|
11099
|
+
});
|
|
11100
|
+
}
|
|
11101
|
+
setValueByPath(toObject, ['checkpoints'], transformedList);
|
|
11102
|
+
}
|
|
10313
11103
|
return toObject;
|
|
10314
11104
|
}
|
|
10315
11105
|
function tuningJobFromVertex(apiClient, fromObject) {
|
|
@@ -11064,11 +11854,13 @@ exports.Caches = Caches;
|
|
|
11064
11854
|
exports.Chat = Chat;
|
|
11065
11855
|
exports.Chats = Chats;
|
|
11066
11856
|
exports.ComputeTokensResponse = ComputeTokensResponse;
|
|
11857
|
+
exports.ControlReferenceImage = ControlReferenceImage;
|
|
11067
11858
|
exports.CountTokensResponse = CountTokensResponse;
|
|
11068
11859
|
exports.CreateFileResponse = CreateFileResponse;
|
|
11069
11860
|
exports.DeleteCachedContentResponse = DeleteCachedContentResponse;
|
|
11070
11861
|
exports.DeleteFileResponse = DeleteFileResponse;
|
|
11071
11862
|
exports.DeleteModelResponse = DeleteModelResponse;
|
|
11863
|
+
exports.EditImageResponse = EditImageResponse;
|
|
11072
11864
|
exports.EmbedContentResponse = EmbedContentResponse;
|
|
11073
11865
|
exports.Files = Files;
|
|
11074
11866
|
exports.FunctionResponse = FunctionResponse;
|
|
@@ -11087,11 +11879,16 @@ exports.Live = Live;
|
|
|
11087
11879
|
exports.LiveClientToolResponse = LiveClientToolResponse;
|
|
11088
11880
|
exports.LiveSendToolResponseParameters = LiveSendToolResponseParameters;
|
|
11089
11881
|
exports.LiveServerMessage = LiveServerMessage;
|
|
11882
|
+
exports.MaskReferenceImage = MaskReferenceImage;
|
|
11090
11883
|
exports.Models = Models;
|
|
11091
11884
|
exports.Operations = Operations;
|
|
11092
11885
|
exports.Pager = Pager;
|
|
11886
|
+
exports.RawReferenceImage = RawReferenceImage;
|
|
11093
11887
|
exports.ReplayResponse = ReplayResponse;
|
|
11094
11888
|
exports.Session = Session;
|
|
11889
|
+
exports.StyleReferenceImage = StyleReferenceImage;
|
|
11890
|
+
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
11891
|
+
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
11095
11892
|
exports.createModelContent = createModelContent;
|
|
11096
11893
|
exports.createPartFromBase64 = createPartFromBase64;
|
|
11097
11894
|
exports.createPartFromCodeExecutionResult = createPartFromCodeExecutionResult;
|