@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/web/index.mjs
CHANGED
|
@@ -601,6 +601,21 @@ function hasField(data, fieldName) {
|
|
|
601
601
|
* Copyright 2025 Google LLC
|
|
602
602
|
* SPDX-License-Identifier: Apache-2.0
|
|
603
603
|
*/
|
|
604
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
605
|
+
const toObject = {};
|
|
606
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
607
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
608
|
+
}
|
|
609
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
610
|
+
if (fromData != null) {
|
|
611
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
612
|
+
}
|
|
613
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
614
|
+
if (fromMimeType != null) {
|
|
615
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
616
|
+
}
|
|
617
|
+
return toObject;
|
|
618
|
+
}
|
|
604
619
|
function partToMldev$2(apiClient, fromObject) {
|
|
605
620
|
const toObject = {};
|
|
606
621
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -610,6 +625,10 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
610
625
|
if (fromThought != null) {
|
|
611
626
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
612
627
|
}
|
|
628
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
629
|
+
if (fromInlineData != null) {
|
|
630
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
631
|
+
}
|
|
613
632
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
614
633
|
'codeExecutionResult',
|
|
615
634
|
]);
|
|
@@ -636,10 +655,6 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
636
655
|
if (fromFunctionResponse != null) {
|
|
637
656
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
638
657
|
}
|
|
639
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
640
|
-
if (fromInlineData != null) {
|
|
641
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
642
|
-
}
|
|
643
658
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
644
659
|
if (fromText != null) {
|
|
645
660
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -880,6 +895,22 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
|
880
895
|
}
|
|
881
896
|
return toObject;
|
|
882
897
|
}
|
|
898
|
+
function blobToVertex$2(apiClient, fromObject) {
|
|
899
|
+
const toObject = {};
|
|
900
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
901
|
+
if (fromDisplayName != null) {
|
|
902
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
903
|
+
}
|
|
904
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
905
|
+
if (fromData != null) {
|
|
906
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
907
|
+
}
|
|
908
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
909
|
+
if (fromMimeType != null) {
|
|
910
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
911
|
+
}
|
|
912
|
+
return toObject;
|
|
913
|
+
}
|
|
883
914
|
function partToVertex$2(apiClient, fromObject) {
|
|
884
915
|
const toObject = {};
|
|
885
916
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -892,6 +923,10 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
892
923
|
if (fromThought != null) {
|
|
893
924
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
894
925
|
}
|
|
926
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
927
|
+
if (fromInlineData != null) {
|
|
928
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex$2(apiClient, fromInlineData));
|
|
929
|
+
}
|
|
895
930
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
896
931
|
'codeExecutionResult',
|
|
897
932
|
]);
|
|
@@ -918,10 +953,6 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
918
953
|
if (fromFunctionResponse != null) {
|
|
919
954
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
920
955
|
}
|
|
921
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
922
|
-
if (fromInlineData != null) {
|
|
923
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
924
|
-
}
|
|
925
956
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
926
957
|
if (fromText != null) {
|
|
927
958
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -1757,21 +1788,6 @@ var ImagePromptLanguage;
|
|
|
1757
1788
|
ImagePromptLanguage["ko"] = "ko";
|
|
1758
1789
|
ImagePromptLanguage["hi"] = "hi";
|
|
1759
1790
|
})(ImagePromptLanguage || (ImagePromptLanguage = {}));
|
|
1760
|
-
/** State for the lifecycle of a File. */
|
|
1761
|
-
var FileState;
|
|
1762
|
-
(function (FileState) {
|
|
1763
|
-
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1764
|
-
FileState["PROCESSING"] = "PROCESSING";
|
|
1765
|
-
FileState["ACTIVE"] = "ACTIVE";
|
|
1766
|
-
FileState["FAILED"] = "FAILED";
|
|
1767
|
-
})(FileState || (FileState = {}));
|
|
1768
|
-
/** Source of the File. */
|
|
1769
|
-
var FileSource;
|
|
1770
|
-
(function (FileSource) {
|
|
1771
|
-
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1772
|
-
FileSource["UPLOADED"] = "UPLOADED";
|
|
1773
|
-
FileSource["GENERATED"] = "GENERATED";
|
|
1774
|
-
})(FileSource || (FileSource = {}));
|
|
1775
1791
|
/** Enum representing the mask mode of a mask reference image. */
|
|
1776
1792
|
var MaskReferenceMode;
|
|
1777
1793
|
(function (MaskReferenceMode) {
|
|
@@ -1797,6 +1813,33 @@ var SubjectReferenceType;
|
|
|
1797
1813
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
1798
1814
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
1799
1815
|
})(SubjectReferenceType || (SubjectReferenceType = {}));
|
|
1816
|
+
/** Enum representing the Imagen 3 Edit mode. */
|
|
1817
|
+
var EditMode;
|
|
1818
|
+
(function (EditMode) {
|
|
1819
|
+
EditMode["EDIT_MODE_DEFAULT"] = "EDIT_MODE_DEFAULT";
|
|
1820
|
+
EditMode["EDIT_MODE_INPAINT_REMOVAL"] = "EDIT_MODE_INPAINT_REMOVAL";
|
|
1821
|
+
EditMode["EDIT_MODE_INPAINT_INSERTION"] = "EDIT_MODE_INPAINT_INSERTION";
|
|
1822
|
+
EditMode["EDIT_MODE_OUTPAINT"] = "EDIT_MODE_OUTPAINT";
|
|
1823
|
+
EditMode["EDIT_MODE_CONTROLLED_EDITING"] = "EDIT_MODE_CONTROLLED_EDITING";
|
|
1824
|
+
EditMode["EDIT_MODE_STYLE"] = "EDIT_MODE_STYLE";
|
|
1825
|
+
EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
|
|
1826
|
+
EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
|
|
1827
|
+
})(EditMode || (EditMode = {}));
|
|
1828
|
+
/** State for the lifecycle of a File. */
|
|
1829
|
+
var FileState;
|
|
1830
|
+
(function (FileState) {
|
|
1831
|
+
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1832
|
+
FileState["PROCESSING"] = "PROCESSING";
|
|
1833
|
+
FileState["ACTIVE"] = "ACTIVE";
|
|
1834
|
+
FileState["FAILED"] = "FAILED";
|
|
1835
|
+
})(FileState || (FileState = {}));
|
|
1836
|
+
/** Source of the File. */
|
|
1837
|
+
var FileSource;
|
|
1838
|
+
(function (FileSource) {
|
|
1839
|
+
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1840
|
+
FileSource["UPLOADED"] = "UPLOADED";
|
|
1841
|
+
FileSource["GENERATED"] = "GENERATED";
|
|
1842
|
+
})(FileSource || (FileSource = {}));
|
|
1800
1843
|
/** Server content modalities. */
|
|
1801
1844
|
var MediaModality;
|
|
1802
1845
|
(function (MediaModality) {
|
|
@@ -2211,6 +2254,11 @@ class EmbedContentResponse {
|
|
|
2211
2254
|
/** The output images response. */
|
|
2212
2255
|
class GenerateImagesResponse {
|
|
2213
2256
|
}
|
|
2257
|
+
/** Response for the request to edit an image. */
|
|
2258
|
+
class EditImageResponse {
|
|
2259
|
+
}
|
|
2260
|
+
class UpscaleImageResponse {
|
|
2261
|
+
}
|
|
2214
2262
|
class ListModelsResponse {
|
|
2215
2263
|
}
|
|
2216
2264
|
class DeleteModelResponse {
|
|
@@ -2260,6 +2308,112 @@ class DeleteFileResponse {
|
|
|
2260
2308
|
/** Represents a single response in a replay. */
|
|
2261
2309
|
class ReplayResponse {
|
|
2262
2310
|
}
|
|
2311
|
+
/** A raw reference image.
|
|
2312
|
+
|
|
2313
|
+
A raw reference image represents the base image to edit, provided by the user.
|
|
2314
|
+
It can optionally be provided in addition to a mask reference image or
|
|
2315
|
+
a style reference image.
|
|
2316
|
+
*/
|
|
2317
|
+
class RawReferenceImage {
|
|
2318
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2319
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2320
|
+
toReferenceImageAPI() {
|
|
2321
|
+
const referenceImageAPI = {
|
|
2322
|
+
referenceType: 'REFERENCE_TYPE_RAW',
|
|
2323
|
+
referenceImage: this.referenceImage,
|
|
2324
|
+
referenceId: this.referenceId,
|
|
2325
|
+
};
|
|
2326
|
+
return referenceImageAPI;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
/** A mask reference image.
|
|
2330
|
+
|
|
2331
|
+
This encapsulates either a mask image provided by the user and configs for
|
|
2332
|
+
the user provided mask, or only config parameters for the model to generate
|
|
2333
|
+
a mask.
|
|
2334
|
+
|
|
2335
|
+
A mask image is an image whose non-zero values indicate where to edit the base
|
|
2336
|
+
image. If the user provides a mask image, the mask must be in the same
|
|
2337
|
+
dimensions as the raw image.
|
|
2338
|
+
*/
|
|
2339
|
+
class MaskReferenceImage {
|
|
2340
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2341
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2342
|
+
toReferenceImageAPI() {
|
|
2343
|
+
const referenceImageAPI = {
|
|
2344
|
+
referenceType: 'REFERENCE_TYPE_MASK',
|
|
2345
|
+
referenceImage: this.referenceImage,
|
|
2346
|
+
referenceId: this.referenceId,
|
|
2347
|
+
maskImageConfig: this.config,
|
|
2348
|
+
};
|
|
2349
|
+
return referenceImageAPI;
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
/** A control reference image.
|
|
2353
|
+
|
|
2354
|
+
The image of the control reference image is either a control image provided
|
|
2355
|
+
by the user, or a regular image which the backend will use to generate a
|
|
2356
|
+
control image of. In the case of the latter, the
|
|
2357
|
+
enable_control_image_computation field in the config should be set to True.
|
|
2358
|
+
|
|
2359
|
+
A control image is an image that represents a sketch image of areas for the
|
|
2360
|
+
model to fill in based on the prompt.
|
|
2361
|
+
*/
|
|
2362
|
+
class ControlReferenceImage {
|
|
2363
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2364
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2365
|
+
toReferenceImageAPI() {
|
|
2366
|
+
const referenceImageAPI = {
|
|
2367
|
+
referenceType: 'REFERENCE_TYPE_CONTROL',
|
|
2368
|
+
referenceImage: this.referenceImage,
|
|
2369
|
+
referenceId: this.referenceId,
|
|
2370
|
+
controlImageConfig: this.config,
|
|
2371
|
+
};
|
|
2372
|
+
return referenceImageAPI;
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
/** A style reference image.
|
|
2376
|
+
|
|
2377
|
+
This encapsulates a style reference image provided by the user, and
|
|
2378
|
+
additionally optional config parameters for the style reference image.
|
|
2379
|
+
|
|
2380
|
+
A raw reference image can also be provided as a destination for the style to
|
|
2381
|
+
be applied to.
|
|
2382
|
+
*/
|
|
2383
|
+
class StyleReferenceImage {
|
|
2384
|
+
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
2385
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2386
|
+
toReferenceImageAPI() {
|
|
2387
|
+
const referenceImageAPI = {
|
|
2388
|
+
referenceType: 'REFERENCE_TYPE_STYLE',
|
|
2389
|
+
referenceImage: this.referenceImage,
|
|
2390
|
+
referenceId: this.referenceId,
|
|
2391
|
+
styleImageConfig: this.config,
|
|
2392
|
+
};
|
|
2393
|
+
return referenceImageAPI;
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
/** A subject reference image.
|
|
2397
|
+
|
|
2398
|
+
This encapsulates a subject reference image provided by the user, and
|
|
2399
|
+
additionally optional config parameters for the subject reference image.
|
|
2400
|
+
|
|
2401
|
+
A raw reference image can also be provided as a destination for the subject to
|
|
2402
|
+
be applied to.
|
|
2403
|
+
*/
|
|
2404
|
+
class SubjectReferenceImage {
|
|
2405
|
+
/* Internal method to convert to ReferenceImageAPIInternal. */
|
|
2406
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2407
|
+
toReferenceImageAPI() {
|
|
2408
|
+
const referenceImageAPI = {
|
|
2409
|
+
referenceType: 'REFERENCE_TYPE_SUBJECT',
|
|
2410
|
+
referenceImage: this.referenceImage,
|
|
2411
|
+
referenceId: this.referenceId,
|
|
2412
|
+
subjectImageConfig: this.config,
|
|
2413
|
+
};
|
|
2414
|
+
return referenceImageAPI;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2263
2417
|
/** Response message for API call. */
|
|
2264
2418
|
class LiveServerMessage {
|
|
2265
2419
|
/**
|
|
@@ -3602,6 +3756,37 @@ class Files extends BaseModule {
|
|
|
3602
3756
|
* Copyright 2025 Google LLC
|
|
3603
3757
|
* SPDX-License-Identifier: Apache-2.0
|
|
3604
3758
|
*/
|
|
3759
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
3760
|
+
const toObject = {};
|
|
3761
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
3762
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
3763
|
+
}
|
|
3764
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
3765
|
+
if (fromData != null) {
|
|
3766
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
3767
|
+
}
|
|
3768
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3769
|
+
if (fromMimeType != null) {
|
|
3770
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
3771
|
+
}
|
|
3772
|
+
return toObject;
|
|
3773
|
+
}
|
|
3774
|
+
function blobToVertex$1(apiClient, fromObject) {
|
|
3775
|
+
const toObject = {};
|
|
3776
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3777
|
+
if (fromDisplayName != null) {
|
|
3778
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
3779
|
+
}
|
|
3780
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
3781
|
+
if (fromData != null) {
|
|
3782
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
3783
|
+
}
|
|
3784
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3785
|
+
if (fromMimeType != null) {
|
|
3786
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
3787
|
+
}
|
|
3788
|
+
return toObject;
|
|
3789
|
+
}
|
|
3605
3790
|
function partToMldev$1(apiClient, fromObject) {
|
|
3606
3791
|
const toObject = {};
|
|
3607
3792
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -3611,6 +3796,10 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
3611
3796
|
if (fromThought != null) {
|
|
3612
3797
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
3613
3798
|
}
|
|
3799
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3800
|
+
if (fromInlineData != null) {
|
|
3801
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
3802
|
+
}
|
|
3614
3803
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3615
3804
|
'codeExecutionResult',
|
|
3616
3805
|
]);
|
|
@@ -3637,10 +3826,6 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
3637
3826
|
if (fromFunctionResponse != null) {
|
|
3638
3827
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3639
3828
|
}
|
|
3640
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3641
|
-
if (fromInlineData != null) {
|
|
3642
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
3643
|
-
}
|
|
3644
3829
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
3645
3830
|
if (fromText != null) {
|
|
3646
3831
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -3659,6 +3844,10 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
3659
3844
|
if (fromThought != null) {
|
|
3660
3845
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
3661
3846
|
}
|
|
3847
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3848
|
+
if (fromInlineData != null) {
|
|
3849
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex$1(apiClient, fromInlineData));
|
|
3850
|
+
}
|
|
3662
3851
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3663
3852
|
'codeExecutionResult',
|
|
3664
3853
|
]);
|
|
@@ -3685,10 +3874,6 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
3685
3874
|
if (fromFunctionResponse != null) {
|
|
3686
3875
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3687
3876
|
}
|
|
3688
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3689
|
-
if (fromInlineData != null) {
|
|
3690
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
3691
|
-
}
|
|
3692
3877
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
3693
3878
|
if (fromText != null) {
|
|
3694
3879
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -4402,12 +4587,44 @@ function liveServerSetupCompleteFromVertex() {
|
|
|
4402
4587
|
const toObject = {};
|
|
4403
4588
|
return toObject;
|
|
4404
4589
|
}
|
|
4590
|
+
function blobFromMldev$1(apiClient, fromObject) {
|
|
4591
|
+
const toObject = {};
|
|
4592
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
4593
|
+
if (fromData != null) {
|
|
4594
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
4595
|
+
}
|
|
4596
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4597
|
+
if (fromMimeType != null) {
|
|
4598
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4599
|
+
}
|
|
4600
|
+
return toObject;
|
|
4601
|
+
}
|
|
4602
|
+
function blobFromVertex$1(apiClient, fromObject) {
|
|
4603
|
+
const toObject = {};
|
|
4604
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
4605
|
+
if (fromDisplayName != null) {
|
|
4606
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
4607
|
+
}
|
|
4608
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
4609
|
+
if (fromData != null) {
|
|
4610
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
4611
|
+
}
|
|
4612
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4613
|
+
if (fromMimeType != null) {
|
|
4614
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4615
|
+
}
|
|
4616
|
+
return toObject;
|
|
4617
|
+
}
|
|
4405
4618
|
function partFromMldev$1(apiClient, fromObject) {
|
|
4406
4619
|
const toObject = {};
|
|
4407
4620
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4408
4621
|
if (fromThought != null) {
|
|
4409
4622
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
4410
4623
|
}
|
|
4624
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4625
|
+
if (fromInlineData != null) {
|
|
4626
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev$1(apiClient, fromInlineData));
|
|
4627
|
+
}
|
|
4411
4628
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4412
4629
|
'codeExecutionResult',
|
|
4413
4630
|
]);
|
|
@@ -4434,10 +4651,6 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
4434
4651
|
if (fromFunctionResponse != null) {
|
|
4435
4652
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4436
4653
|
}
|
|
4437
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4438
|
-
if (fromInlineData != null) {
|
|
4439
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4440
|
-
}
|
|
4441
4654
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4442
4655
|
if (fromText != null) {
|
|
4443
4656
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -4456,6 +4669,10 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
4456
4669
|
if (fromThought != null) {
|
|
4457
4670
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
4458
4671
|
}
|
|
4672
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4673
|
+
if (fromInlineData != null) {
|
|
4674
|
+
setValueByPath(toObject, ['inlineData'], blobFromVertex$1(apiClient, fromInlineData));
|
|
4675
|
+
}
|
|
4459
4676
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4460
4677
|
'codeExecutionResult',
|
|
4461
4678
|
]);
|
|
@@ -4482,10 +4699,6 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
4482
4699
|
if (fromFunctionResponse != null) {
|
|
4483
4700
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4484
4701
|
}
|
|
4485
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4486
|
-
if (fromInlineData != null) {
|
|
4487
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4488
|
-
}
|
|
4489
4702
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4490
4703
|
if (fromText != null) {
|
|
4491
4704
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5054,6 +5267,21 @@ function liveServerMessageFromVertex(apiClient, fromObject) {
|
|
|
5054
5267
|
* Copyright 2025 Google LLC
|
|
5055
5268
|
* SPDX-License-Identifier: Apache-2.0
|
|
5056
5269
|
*/
|
|
5270
|
+
function blobToMldev(apiClient, fromObject) {
|
|
5271
|
+
const toObject = {};
|
|
5272
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5273
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
5274
|
+
}
|
|
5275
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
5276
|
+
if (fromData != null) {
|
|
5277
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
5278
|
+
}
|
|
5279
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
5280
|
+
if (fromMimeType != null) {
|
|
5281
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
5282
|
+
}
|
|
5283
|
+
return toObject;
|
|
5284
|
+
}
|
|
5057
5285
|
function partToMldev(apiClient, fromObject) {
|
|
5058
5286
|
const toObject = {};
|
|
5059
5287
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -5063,6 +5291,10 @@ function partToMldev(apiClient, fromObject) {
|
|
|
5063
5291
|
if (fromThought != null) {
|
|
5064
5292
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5065
5293
|
}
|
|
5294
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5295
|
+
if (fromInlineData != null) {
|
|
5296
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
5297
|
+
}
|
|
5066
5298
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5067
5299
|
'codeExecutionResult',
|
|
5068
5300
|
]);
|
|
@@ -5089,10 +5321,6 @@ function partToMldev(apiClient, fromObject) {
|
|
|
5089
5321
|
if (fromFunctionResponse != null) {
|
|
5090
5322
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5091
5323
|
}
|
|
5092
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5093
|
-
if (fromInlineData != null) {
|
|
5094
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5095
|
-
}
|
|
5096
5324
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5097
5325
|
if (fromText != null) {
|
|
5098
5326
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5619,6 +5847,12 @@ function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5619
5847
|
if (parentObject !== undefined && fromDescription != null) {
|
|
5620
5848
|
setValueByPath(parentObject, ['description'], fromDescription);
|
|
5621
5849
|
}
|
|
5850
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
5851
|
+
'defaultCheckpointId',
|
|
5852
|
+
]);
|
|
5853
|
+
if (parentObject !== undefined && fromDefaultCheckpointId != null) {
|
|
5854
|
+
setValueByPath(parentObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
5855
|
+
}
|
|
5622
5856
|
return toObject;
|
|
5623
5857
|
}
|
|
5624
5858
|
function updateModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -5765,6 +5999,22 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
|
5765
5999
|
}
|
|
5766
6000
|
return toObject;
|
|
5767
6001
|
}
|
|
6002
|
+
function blobToVertex(apiClient, fromObject) {
|
|
6003
|
+
const toObject = {};
|
|
6004
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6005
|
+
if (fromDisplayName != null) {
|
|
6006
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
6007
|
+
}
|
|
6008
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
6009
|
+
if (fromData != null) {
|
|
6010
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
6011
|
+
}
|
|
6012
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6013
|
+
if (fromMimeType != null) {
|
|
6014
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
6015
|
+
}
|
|
6016
|
+
return toObject;
|
|
6017
|
+
}
|
|
5768
6018
|
function partToVertex(apiClient, fromObject) {
|
|
5769
6019
|
const toObject = {};
|
|
5770
6020
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -5777,6 +6027,10 @@ function partToVertex(apiClient, fromObject) {
|
|
|
5777
6027
|
if (fromThought != null) {
|
|
5778
6028
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5779
6029
|
}
|
|
6030
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6031
|
+
if (fromInlineData != null) {
|
|
6032
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex(apiClient, fromInlineData));
|
|
6033
|
+
}
|
|
5780
6034
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5781
6035
|
'codeExecutionResult',
|
|
5782
6036
|
]);
|
|
@@ -5803,10 +6057,6 @@ function partToVertex(apiClient, fromObject) {
|
|
|
5803
6057
|
if (fromFunctionResponse != null) {
|
|
5804
6058
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5805
6059
|
}
|
|
5806
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5807
|
-
if (fromInlineData != null) {
|
|
5808
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5809
|
-
}
|
|
5810
6060
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5811
6061
|
if (fromText != null) {
|
|
5812
6062
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -6391,77 +6641,363 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
6391
6641
|
}
|
|
6392
6642
|
return toObject;
|
|
6393
6643
|
}
|
|
6394
|
-
function
|
|
6644
|
+
function imageToVertex(apiClient, fromObject) {
|
|
6395
6645
|
const toObject = {};
|
|
6396
|
-
const
|
|
6397
|
-
if (
|
|
6398
|
-
setValueByPath(toObject, ['
|
|
6646
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
6647
|
+
if (fromGcsUri != null) {
|
|
6648
|
+
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
6399
6649
|
}
|
|
6400
|
-
const
|
|
6401
|
-
if (
|
|
6402
|
-
setValueByPath(toObject, ['
|
|
6650
|
+
const fromImageBytes = getValueByPath(fromObject, ['imageBytes']);
|
|
6651
|
+
if (fromImageBytes != null) {
|
|
6652
|
+
setValueByPath(toObject, ['bytesBase64Encoded'], tBytes(apiClient, fromImageBytes));
|
|
6653
|
+
}
|
|
6654
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6655
|
+
if (fromMimeType != null) {
|
|
6656
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
6403
6657
|
}
|
|
6404
6658
|
return toObject;
|
|
6405
6659
|
}
|
|
6406
|
-
function
|
|
6660
|
+
function maskReferenceConfigToVertex(apiClient, fromObject) {
|
|
6407
6661
|
const toObject = {};
|
|
6408
|
-
const
|
|
6409
|
-
if (
|
|
6410
|
-
setValueByPath(
|
|
6662
|
+
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
6663
|
+
if (fromMaskMode != null) {
|
|
6664
|
+
setValueByPath(toObject, ['maskMode'], fromMaskMode);
|
|
6411
6665
|
}
|
|
6412
|
-
const
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
if (parentObject !== undefined && fromFilter != null) {
|
|
6418
|
-
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
6666
|
+
const fromSegmentationClasses = getValueByPath(fromObject, [
|
|
6667
|
+
'segmentationClasses',
|
|
6668
|
+
]);
|
|
6669
|
+
if (fromSegmentationClasses != null) {
|
|
6670
|
+
setValueByPath(toObject, ['maskClasses'], fromSegmentationClasses);
|
|
6419
6671
|
}
|
|
6420
|
-
const
|
|
6421
|
-
if (
|
|
6422
|
-
setValueByPath(
|
|
6672
|
+
const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
|
|
6673
|
+
if (fromMaskDilation != null) {
|
|
6674
|
+
setValueByPath(toObject, ['dilation'], fromMaskDilation);
|
|
6423
6675
|
}
|
|
6424
6676
|
return toObject;
|
|
6425
6677
|
}
|
|
6426
|
-
function
|
|
6678
|
+
function controlReferenceConfigToVertex(apiClient, fromObject) {
|
|
6427
6679
|
const toObject = {};
|
|
6428
|
-
const
|
|
6429
|
-
if (
|
|
6430
|
-
setValueByPath(toObject, ['
|
|
6680
|
+
const fromControlType = getValueByPath(fromObject, ['controlType']);
|
|
6681
|
+
if (fromControlType != null) {
|
|
6682
|
+
setValueByPath(toObject, ['controlType'], fromControlType);
|
|
6683
|
+
}
|
|
6684
|
+
const fromEnableControlImageComputation = getValueByPath(fromObject, [
|
|
6685
|
+
'enableControlImageComputation',
|
|
6686
|
+
]);
|
|
6687
|
+
if (fromEnableControlImageComputation != null) {
|
|
6688
|
+
setValueByPath(toObject, ['computeControl'], fromEnableControlImageComputation);
|
|
6431
6689
|
}
|
|
6432
6690
|
return toObject;
|
|
6433
6691
|
}
|
|
6434
|
-
function
|
|
6692
|
+
function styleReferenceConfigToVertex(apiClient, fromObject) {
|
|
6435
6693
|
const toObject = {};
|
|
6436
|
-
const
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
if (parentObject !== undefined && fromDescription != null) {
|
|
6442
|
-
setValueByPath(parentObject, ['description'], fromDescription);
|
|
6694
|
+
const fromStyleDescription = getValueByPath(fromObject, [
|
|
6695
|
+
'styleDescription',
|
|
6696
|
+
]);
|
|
6697
|
+
if (fromStyleDescription != null) {
|
|
6698
|
+
setValueByPath(toObject, ['styleDescription'], fromStyleDescription);
|
|
6443
6699
|
}
|
|
6444
6700
|
return toObject;
|
|
6445
6701
|
}
|
|
6446
|
-
function
|
|
6702
|
+
function subjectReferenceConfigToVertex(apiClient, fromObject) {
|
|
6447
6703
|
const toObject = {};
|
|
6448
|
-
const
|
|
6449
|
-
if (
|
|
6450
|
-
setValueByPath(toObject, ['
|
|
6704
|
+
const fromSubjectType = getValueByPath(fromObject, ['subjectType']);
|
|
6705
|
+
if (fromSubjectType != null) {
|
|
6706
|
+
setValueByPath(toObject, ['subjectType'], fromSubjectType);
|
|
6451
6707
|
}
|
|
6452
|
-
const
|
|
6453
|
-
|
|
6454
|
-
|
|
6708
|
+
const fromSubjectDescription = getValueByPath(fromObject, [
|
|
6709
|
+
'subjectDescription',
|
|
6710
|
+
]);
|
|
6711
|
+
if (fromSubjectDescription != null) {
|
|
6712
|
+
setValueByPath(toObject, ['subjectDescription'], fromSubjectDescription);
|
|
6455
6713
|
}
|
|
6456
6714
|
return toObject;
|
|
6457
6715
|
}
|
|
6458
|
-
function
|
|
6716
|
+
function referenceImageAPIInternalToVertex(apiClient, fromObject) {
|
|
6459
6717
|
const toObject = {};
|
|
6460
|
-
const
|
|
6461
|
-
|
|
6462
|
-
|
|
6718
|
+
const fromReferenceImage = getValueByPath(fromObject, [
|
|
6719
|
+
'referenceImage',
|
|
6720
|
+
]);
|
|
6721
|
+
if (fromReferenceImage != null) {
|
|
6722
|
+
setValueByPath(toObject, ['referenceImage'], imageToVertex(apiClient, fromReferenceImage));
|
|
6463
6723
|
}
|
|
6464
|
-
const
|
|
6724
|
+
const fromReferenceId = getValueByPath(fromObject, ['referenceId']);
|
|
6725
|
+
if (fromReferenceId != null) {
|
|
6726
|
+
setValueByPath(toObject, ['referenceId'], fromReferenceId);
|
|
6727
|
+
}
|
|
6728
|
+
const fromReferenceType = getValueByPath(fromObject, [
|
|
6729
|
+
'referenceType',
|
|
6730
|
+
]);
|
|
6731
|
+
if (fromReferenceType != null) {
|
|
6732
|
+
setValueByPath(toObject, ['referenceType'], fromReferenceType);
|
|
6733
|
+
}
|
|
6734
|
+
const fromMaskImageConfig = getValueByPath(fromObject, [
|
|
6735
|
+
'maskImageConfig',
|
|
6736
|
+
]);
|
|
6737
|
+
if (fromMaskImageConfig != null) {
|
|
6738
|
+
setValueByPath(toObject, ['maskImageConfig'], maskReferenceConfigToVertex(apiClient, fromMaskImageConfig));
|
|
6739
|
+
}
|
|
6740
|
+
const fromControlImageConfig = getValueByPath(fromObject, [
|
|
6741
|
+
'controlImageConfig',
|
|
6742
|
+
]);
|
|
6743
|
+
if (fromControlImageConfig != null) {
|
|
6744
|
+
setValueByPath(toObject, ['controlImageConfig'], controlReferenceConfigToVertex(apiClient, fromControlImageConfig));
|
|
6745
|
+
}
|
|
6746
|
+
const fromStyleImageConfig = getValueByPath(fromObject, [
|
|
6747
|
+
'styleImageConfig',
|
|
6748
|
+
]);
|
|
6749
|
+
if (fromStyleImageConfig != null) {
|
|
6750
|
+
setValueByPath(toObject, ['styleImageConfig'], styleReferenceConfigToVertex(apiClient, fromStyleImageConfig));
|
|
6751
|
+
}
|
|
6752
|
+
const fromSubjectImageConfig = getValueByPath(fromObject, [
|
|
6753
|
+
'subjectImageConfig',
|
|
6754
|
+
]);
|
|
6755
|
+
if (fromSubjectImageConfig != null) {
|
|
6756
|
+
setValueByPath(toObject, ['subjectImageConfig'], subjectReferenceConfigToVertex(apiClient, fromSubjectImageConfig));
|
|
6757
|
+
}
|
|
6758
|
+
return toObject;
|
|
6759
|
+
}
|
|
6760
|
+
function editImageConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6761
|
+
const toObject = {};
|
|
6762
|
+
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
6763
|
+
if (parentObject !== undefined && fromOutputGcsUri != null) {
|
|
6764
|
+
setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
|
|
6765
|
+
}
|
|
6766
|
+
const fromNegativePrompt = getValueByPath(fromObject, [
|
|
6767
|
+
'negativePrompt',
|
|
6768
|
+
]);
|
|
6769
|
+
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
6770
|
+
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
6771
|
+
}
|
|
6772
|
+
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
6773
|
+
'numberOfImages',
|
|
6774
|
+
]);
|
|
6775
|
+
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
6776
|
+
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
6777
|
+
}
|
|
6778
|
+
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
6779
|
+
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
6780
|
+
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
6781
|
+
}
|
|
6782
|
+
const fromGuidanceScale = getValueByPath(fromObject, [
|
|
6783
|
+
'guidanceScale',
|
|
6784
|
+
]);
|
|
6785
|
+
if (parentObject !== undefined && fromGuidanceScale != null) {
|
|
6786
|
+
setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
|
|
6787
|
+
}
|
|
6788
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
6789
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
6790
|
+
setValueByPath(parentObject, ['parameters', 'seed'], fromSeed);
|
|
6791
|
+
}
|
|
6792
|
+
const fromSafetyFilterLevel = getValueByPath(fromObject, [
|
|
6793
|
+
'safetyFilterLevel',
|
|
6794
|
+
]);
|
|
6795
|
+
if (parentObject !== undefined && fromSafetyFilterLevel != null) {
|
|
6796
|
+
setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
|
|
6797
|
+
}
|
|
6798
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
6799
|
+
'personGeneration',
|
|
6800
|
+
]);
|
|
6801
|
+
if (parentObject !== undefined && fromPersonGeneration != null) {
|
|
6802
|
+
setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
|
|
6803
|
+
}
|
|
6804
|
+
const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
|
|
6805
|
+
'includeSafetyAttributes',
|
|
6806
|
+
]);
|
|
6807
|
+
if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
|
|
6808
|
+
setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
|
|
6809
|
+
}
|
|
6810
|
+
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
6811
|
+
'includeRaiReason',
|
|
6812
|
+
]);
|
|
6813
|
+
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
6814
|
+
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
6815
|
+
}
|
|
6816
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
6817
|
+
if (parentObject !== undefined && fromLanguage != null) {
|
|
6818
|
+
setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
|
|
6819
|
+
}
|
|
6820
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
6821
|
+
'outputMimeType',
|
|
6822
|
+
]);
|
|
6823
|
+
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
6824
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
6825
|
+
}
|
|
6826
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
6827
|
+
'outputCompressionQuality',
|
|
6828
|
+
]);
|
|
6829
|
+
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
6830
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
6831
|
+
}
|
|
6832
|
+
const fromEditMode = getValueByPath(fromObject, ['editMode']);
|
|
6833
|
+
if (parentObject !== undefined && fromEditMode != null) {
|
|
6834
|
+
setValueByPath(parentObject, ['parameters', 'editMode'], fromEditMode);
|
|
6835
|
+
}
|
|
6836
|
+
const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
|
|
6837
|
+
if (parentObject !== undefined && fromBaseSteps != null) {
|
|
6838
|
+
setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
|
|
6839
|
+
}
|
|
6840
|
+
return toObject;
|
|
6841
|
+
}
|
|
6842
|
+
function editImageParametersInternalToVertex(apiClient, fromObject) {
|
|
6843
|
+
const toObject = {};
|
|
6844
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6845
|
+
if (fromModel != null) {
|
|
6846
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
6847
|
+
}
|
|
6848
|
+
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
6849
|
+
if (fromPrompt != null) {
|
|
6850
|
+
setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
6851
|
+
}
|
|
6852
|
+
const fromReferenceImages = getValueByPath(fromObject, [
|
|
6853
|
+
'referenceImages',
|
|
6854
|
+
]);
|
|
6855
|
+
if (fromReferenceImages != null) {
|
|
6856
|
+
let transformedList = fromReferenceImages;
|
|
6857
|
+
if (Array.isArray(transformedList)) {
|
|
6858
|
+
transformedList = transformedList.map((item) => {
|
|
6859
|
+
return referenceImageAPIInternalToVertex(apiClient, item);
|
|
6860
|
+
});
|
|
6861
|
+
}
|
|
6862
|
+
setValueByPath(toObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
6863
|
+
}
|
|
6864
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6865
|
+
if (fromConfig != null) {
|
|
6866
|
+
setValueByPath(toObject, ['config'], editImageConfigToVertex(apiClient, fromConfig, toObject));
|
|
6867
|
+
}
|
|
6868
|
+
return toObject;
|
|
6869
|
+
}
|
|
6870
|
+
function upscaleImageAPIConfigInternalToVertex(apiClient, fromObject, parentObject) {
|
|
6871
|
+
const toObject = {};
|
|
6872
|
+
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
6873
|
+
'includeRaiReason',
|
|
6874
|
+
]);
|
|
6875
|
+
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
6876
|
+
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
6877
|
+
}
|
|
6878
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
6879
|
+
'outputMimeType',
|
|
6880
|
+
]);
|
|
6881
|
+
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
6882
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
6883
|
+
}
|
|
6884
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
6885
|
+
'outputCompressionQuality',
|
|
6886
|
+
]);
|
|
6887
|
+
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
6888
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
6889
|
+
}
|
|
6890
|
+
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
6891
|
+
'numberOfImages',
|
|
6892
|
+
]);
|
|
6893
|
+
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
6894
|
+
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
6895
|
+
}
|
|
6896
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
6897
|
+
if (parentObject !== undefined && fromMode != null) {
|
|
6898
|
+
setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
|
|
6899
|
+
}
|
|
6900
|
+
return toObject;
|
|
6901
|
+
}
|
|
6902
|
+
function upscaleImageAPIParametersInternalToVertex(apiClient, fromObject) {
|
|
6903
|
+
const toObject = {};
|
|
6904
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6905
|
+
if (fromModel != null) {
|
|
6906
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
6907
|
+
}
|
|
6908
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
6909
|
+
if (fromImage != null) {
|
|
6910
|
+
setValueByPath(toObject, ['instances[0]', 'image'], imageToVertex(apiClient, fromImage));
|
|
6911
|
+
}
|
|
6912
|
+
const fromUpscaleFactor = getValueByPath(fromObject, [
|
|
6913
|
+
'upscaleFactor',
|
|
6914
|
+
]);
|
|
6915
|
+
if (fromUpscaleFactor != null) {
|
|
6916
|
+
setValueByPath(toObject, ['parameters', 'upscaleConfig', 'upscaleFactor'], fromUpscaleFactor);
|
|
6917
|
+
}
|
|
6918
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6919
|
+
if (fromConfig != null) {
|
|
6920
|
+
setValueByPath(toObject, ['config'], upscaleImageAPIConfigInternalToVertex(apiClient, fromConfig, toObject));
|
|
6921
|
+
}
|
|
6922
|
+
return toObject;
|
|
6923
|
+
}
|
|
6924
|
+
function getModelParametersToVertex(apiClient, fromObject) {
|
|
6925
|
+
const toObject = {};
|
|
6926
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6927
|
+
if (fromModel != null) {
|
|
6928
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
6929
|
+
}
|
|
6930
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6931
|
+
if (fromConfig != null) {
|
|
6932
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
6933
|
+
}
|
|
6934
|
+
return toObject;
|
|
6935
|
+
}
|
|
6936
|
+
function listModelsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6937
|
+
const toObject = {};
|
|
6938
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
6939
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
6940
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
6941
|
+
}
|
|
6942
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
6943
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
6944
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
6945
|
+
}
|
|
6946
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
6947
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
6948
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
6949
|
+
}
|
|
6950
|
+
const fromQueryBase = getValueByPath(fromObject, ['queryBase']);
|
|
6951
|
+
if (parentObject !== undefined && fromQueryBase != null) {
|
|
6952
|
+
setValueByPath(parentObject, ['_url', 'models_url'], tModelsUrl(apiClient, fromQueryBase));
|
|
6953
|
+
}
|
|
6954
|
+
return toObject;
|
|
6955
|
+
}
|
|
6956
|
+
function listModelsParametersToVertex(apiClient, fromObject) {
|
|
6957
|
+
const toObject = {};
|
|
6958
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6959
|
+
if (fromConfig != null) {
|
|
6960
|
+
setValueByPath(toObject, ['config'], listModelsConfigToVertex(apiClient, fromConfig, toObject));
|
|
6961
|
+
}
|
|
6962
|
+
return toObject;
|
|
6963
|
+
}
|
|
6964
|
+
function updateModelConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6965
|
+
const toObject = {};
|
|
6966
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6967
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
6968
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
6969
|
+
}
|
|
6970
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
6971
|
+
if (parentObject !== undefined && fromDescription != null) {
|
|
6972
|
+
setValueByPath(parentObject, ['description'], fromDescription);
|
|
6973
|
+
}
|
|
6974
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
6975
|
+
'defaultCheckpointId',
|
|
6976
|
+
]);
|
|
6977
|
+
if (parentObject !== undefined && fromDefaultCheckpointId != null) {
|
|
6978
|
+
setValueByPath(parentObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
6979
|
+
}
|
|
6980
|
+
return toObject;
|
|
6981
|
+
}
|
|
6982
|
+
function updateModelParametersToVertex(apiClient, fromObject) {
|
|
6983
|
+
const toObject = {};
|
|
6984
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6985
|
+
if (fromModel != null) {
|
|
6986
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
6987
|
+
}
|
|
6988
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6989
|
+
if (fromConfig != null) {
|
|
6990
|
+
setValueByPath(toObject, ['config'], updateModelConfigToVertex(apiClient, fromConfig, toObject));
|
|
6991
|
+
}
|
|
6992
|
+
return toObject;
|
|
6993
|
+
}
|
|
6994
|
+
function deleteModelParametersToVertex(apiClient, fromObject) {
|
|
6995
|
+
const toObject = {};
|
|
6996
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6997
|
+
if (fromModel != null) {
|
|
6998
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
6999
|
+
}
|
|
7000
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6465
7001
|
if (fromConfig != null) {
|
|
6466
7002
|
setValueByPath(toObject, ['config'], fromConfig);
|
|
6467
7003
|
}
|
|
@@ -6537,22 +7073,6 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
6537
7073
|
}
|
|
6538
7074
|
return toObject;
|
|
6539
7075
|
}
|
|
6540
|
-
function imageToVertex(apiClient, fromObject) {
|
|
6541
|
-
const toObject = {};
|
|
6542
|
-
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
6543
|
-
if (fromGcsUri != null) {
|
|
6544
|
-
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
6545
|
-
}
|
|
6546
|
-
const fromImageBytes = getValueByPath(fromObject, ['imageBytes']);
|
|
6547
|
-
if (fromImageBytes != null) {
|
|
6548
|
-
setValueByPath(toObject, ['bytesBase64Encoded'], tBytes(apiClient, fromImageBytes));
|
|
6549
|
-
}
|
|
6550
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6551
|
-
if (fromMimeType != null) {
|
|
6552
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
6553
|
-
}
|
|
6554
|
-
return toObject;
|
|
6555
|
-
}
|
|
6556
7076
|
function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6557
7077
|
const toObject = {};
|
|
6558
7078
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -6631,12 +7151,28 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
|
6631
7151
|
}
|
|
6632
7152
|
return toObject;
|
|
6633
7153
|
}
|
|
7154
|
+
function blobFromMldev(apiClient, fromObject) {
|
|
7155
|
+
const toObject = {};
|
|
7156
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
7157
|
+
if (fromData != null) {
|
|
7158
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
7159
|
+
}
|
|
7160
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7161
|
+
if (fromMimeType != null) {
|
|
7162
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
7163
|
+
}
|
|
7164
|
+
return toObject;
|
|
7165
|
+
}
|
|
6634
7166
|
function partFromMldev(apiClient, fromObject) {
|
|
6635
7167
|
const toObject = {};
|
|
6636
7168
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
6637
7169
|
if (fromThought != null) {
|
|
6638
7170
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
6639
7171
|
}
|
|
7172
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7173
|
+
if (fromInlineData != null) {
|
|
7174
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev(apiClient, fromInlineData));
|
|
7175
|
+
}
|
|
6640
7176
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6641
7177
|
'codeExecutionResult',
|
|
6642
7178
|
]);
|
|
@@ -6663,10 +7199,6 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
6663
7199
|
if (fromFunctionResponse != null) {
|
|
6664
7200
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
6665
7201
|
}
|
|
6666
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6667
|
-
if (fromInlineData != null) {
|
|
6668
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
6669
|
-
}
|
|
6670
7202
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
6671
7203
|
if (fromText != null) {
|
|
6672
7204
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7061,6 +7593,22 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
|
|
|
7061
7593
|
}
|
|
7062
7594
|
return toObject;
|
|
7063
7595
|
}
|
|
7596
|
+
function blobFromVertex(apiClient, fromObject) {
|
|
7597
|
+
const toObject = {};
|
|
7598
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7599
|
+
if (fromDisplayName != null) {
|
|
7600
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
7601
|
+
}
|
|
7602
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
7603
|
+
if (fromData != null) {
|
|
7604
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
7605
|
+
}
|
|
7606
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7607
|
+
if (fromMimeType != null) {
|
|
7608
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
7609
|
+
}
|
|
7610
|
+
return toObject;
|
|
7611
|
+
}
|
|
7064
7612
|
function partFromVertex(apiClient, fromObject) {
|
|
7065
7613
|
const toObject = {};
|
|
7066
7614
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7073,6 +7621,10 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
7073
7621
|
if (fromThought != null) {
|
|
7074
7622
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
7075
7623
|
}
|
|
7624
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7625
|
+
if (fromInlineData != null) {
|
|
7626
|
+
setValueByPath(toObject, ['inlineData'], blobFromVertex(apiClient, fromInlineData));
|
|
7627
|
+
}
|
|
7076
7628
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7077
7629
|
'codeExecutionResult',
|
|
7078
7630
|
]);
|
|
@@ -7099,10 +7651,6 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
7099
7651
|
if (fromFunctionResponse != null) {
|
|
7100
7652
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
7101
7653
|
}
|
|
7102
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7103
|
-
if (fromInlineData != null) {
|
|
7104
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
7105
|
-
}
|
|
7106
7654
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
7107
7655
|
if (fromText != null) {
|
|
7108
7656
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7362,6 +7910,38 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
7362
7910
|
}
|
|
7363
7911
|
return toObject;
|
|
7364
7912
|
}
|
|
7913
|
+
function editImageResponseFromVertex(apiClient, fromObject) {
|
|
7914
|
+
const toObject = {};
|
|
7915
|
+
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
7916
|
+
'predictions',
|
|
7917
|
+
]);
|
|
7918
|
+
if (fromGeneratedImages != null) {
|
|
7919
|
+
let transformedList = fromGeneratedImages;
|
|
7920
|
+
if (Array.isArray(transformedList)) {
|
|
7921
|
+
transformedList = transformedList.map((item) => {
|
|
7922
|
+
return generatedImageFromVertex(apiClient, item);
|
|
7923
|
+
});
|
|
7924
|
+
}
|
|
7925
|
+
setValueByPath(toObject, ['generatedImages'], transformedList);
|
|
7926
|
+
}
|
|
7927
|
+
return toObject;
|
|
7928
|
+
}
|
|
7929
|
+
function upscaleImageResponseFromVertex(apiClient, fromObject) {
|
|
7930
|
+
const toObject = {};
|
|
7931
|
+
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
7932
|
+
'predictions',
|
|
7933
|
+
]);
|
|
7934
|
+
if (fromGeneratedImages != null) {
|
|
7935
|
+
let transformedList = fromGeneratedImages;
|
|
7936
|
+
if (Array.isArray(transformedList)) {
|
|
7937
|
+
transformedList = transformedList.map((item) => {
|
|
7938
|
+
return generatedImageFromVertex(apiClient, item);
|
|
7939
|
+
});
|
|
7940
|
+
}
|
|
7941
|
+
setValueByPath(toObject, ['generatedImages'], transformedList);
|
|
7942
|
+
}
|
|
7943
|
+
return toObject;
|
|
7944
|
+
}
|
|
7365
7945
|
function endpointFromVertex(apiClient, fromObject) {
|
|
7366
7946
|
const toObject = {};
|
|
7367
7947
|
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
@@ -7395,6 +7975,22 @@ function tunedModelInfoFromVertex(apiClient, fromObject) {
|
|
|
7395
7975
|
}
|
|
7396
7976
|
return toObject;
|
|
7397
7977
|
}
|
|
7978
|
+
function checkpointFromVertex(apiClient, fromObject) {
|
|
7979
|
+
const toObject = {};
|
|
7980
|
+
const fromCheckpointId = getValueByPath(fromObject, ['checkpointId']);
|
|
7981
|
+
if (fromCheckpointId != null) {
|
|
7982
|
+
setValueByPath(toObject, ['checkpointId'], fromCheckpointId);
|
|
7983
|
+
}
|
|
7984
|
+
const fromEpoch = getValueByPath(fromObject, ['epoch']);
|
|
7985
|
+
if (fromEpoch != null) {
|
|
7986
|
+
setValueByPath(toObject, ['epoch'], fromEpoch);
|
|
7987
|
+
}
|
|
7988
|
+
const fromStep = getValueByPath(fromObject, ['step']);
|
|
7989
|
+
if (fromStep != null) {
|
|
7990
|
+
setValueByPath(toObject, ['step'], fromStep);
|
|
7991
|
+
}
|
|
7992
|
+
return toObject;
|
|
7993
|
+
}
|
|
7398
7994
|
function modelFromVertex(apiClient, fromObject) {
|
|
7399
7995
|
const toObject = {};
|
|
7400
7996
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -7431,6 +8027,22 @@ function modelFromVertex(apiClient, fromObject) {
|
|
|
7431
8027
|
if (fromTunedModelInfo != null) {
|
|
7432
8028
|
setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
|
|
7433
8029
|
}
|
|
8030
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
8031
|
+
'defaultCheckpointId',
|
|
8032
|
+
]);
|
|
8033
|
+
if (fromDefaultCheckpointId != null) {
|
|
8034
|
+
setValueByPath(toObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
8035
|
+
}
|
|
8036
|
+
const fromCheckpoints = getValueByPath(fromObject, ['checkpoints']);
|
|
8037
|
+
if (fromCheckpoints != null) {
|
|
8038
|
+
let transformedList = fromCheckpoints;
|
|
8039
|
+
if (Array.isArray(transformedList)) {
|
|
8040
|
+
transformedList = transformedList.map((item) => {
|
|
8041
|
+
return checkpointFromVertex(apiClient, item);
|
|
8042
|
+
});
|
|
8043
|
+
}
|
|
8044
|
+
setValueByPath(toObject, ['checkpoints'], transformedList);
|
|
8045
|
+
}
|
|
7434
8046
|
return toObject;
|
|
7435
8047
|
}
|
|
7436
8048
|
function listModelsResponseFromVertex(apiClient, fromObject) {
|
|
@@ -8041,9 +8653,7 @@ class Models extends BaseModule {
|
|
|
8041
8653
|
/**
|
|
8042
8654
|
* Generates an image based on a text description and configuration.
|
|
8043
8655
|
*
|
|
8044
|
-
* @param
|
|
8045
|
-
* @param prompt - A text description of the image to generate.
|
|
8046
|
-
* @param [config] - The config for image generation.
|
|
8656
|
+
* @param params - The parameters for generating images.
|
|
8047
8657
|
* @return The response from the API.
|
|
8048
8658
|
*
|
|
8049
8659
|
* @example
|
|
@@ -8112,6 +8722,76 @@ class Models extends BaseModule {
|
|
|
8112
8722
|
}
|
|
8113
8723
|
return new Pager(PagedItem.PAGED_ITEM_MODELS, (x) => this.listInternal(x), await this.listInternal(actualParams), actualParams);
|
|
8114
8724
|
};
|
|
8725
|
+
/**
|
|
8726
|
+
* Edits an image based on a prompt, list of reference images, and configuration.
|
|
8727
|
+
*
|
|
8728
|
+
* @param params - The parameters for editing an image.
|
|
8729
|
+
* @return The response from the API.
|
|
8730
|
+
*
|
|
8731
|
+
* @example
|
|
8732
|
+
* ```ts
|
|
8733
|
+
* const response = await client.models.editImage({
|
|
8734
|
+
* model: 'imagen-3.0-capability-001',
|
|
8735
|
+
* prompt: 'Generate an image containing a mug with the product logo [1] visible on the side of the mug.',
|
|
8736
|
+
* referenceImages: [subjectReferenceImage]
|
|
8737
|
+
* config: {
|
|
8738
|
+
* numberOfImages: 1,
|
|
8739
|
+
* includeRaiReason: true,
|
|
8740
|
+
* },
|
|
8741
|
+
* });
|
|
8742
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
8743
|
+
* ```
|
|
8744
|
+
*/
|
|
8745
|
+
this.editImage = async (params) => {
|
|
8746
|
+
const paramsInternal = {
|
|
8747
|
+
model: params.model,
|
|
8748
|
+
prompt: params.prompt,
|
|
8749
|
+
referenceImages: [],
|
|
8750
|
+
config: params.config,
|
|
8751
|
+
};
|
|
8752
|
+
if (params.referenceImages) {
|
|
8753
|
+
if (params.referenceImages) {
|
|
8754
|
+
paramsInternal.referenceImages = params.referenceImages.map((img) => img.toReferenceImageAPI());
|
|
8755
|
+
}
|
|
8756
|
+
}
|
|
8757
|
+
return await this.editImageInternal(paramsInternal);
|
|
8758
|
+
};
|
|
8759
|
+
/**
|
|
8760
|
+
* Upscales an image based on an image, upscale factor, and configuration.
|
|
8761
|
+
* Only supported in Vertex AI currently.
|
|
8762
|
+
*
|
|
8763
|
+
* @param params - The parameters for upscaling an image.
|
|
8764
|
+
* @return The response from the API.
|
|
8765
|
+
*
|
|
8766
|
+
* @example
|
|
8767
|
+
* ```ts
|
|
8768
|
+
* const response = await client.models.upscaleImage({
|
|
8769
|
+
* model: 'imagen-3.0-generate-002',
|
|
8770
|
+
* image: image,
|
|
8771
|
+
* upscaleFactor: 'x2',
|
|
8772
|
+
* config: {
|
|
8773
|
+
* includeRaiReason: true,
|
|
8774
|
+
* },
|
|
8775
|
+
* });
|
|
8776
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
8777
|
+
* ```
|
|
8778
|
+
*/
|
|
8779
|
+
this.upscaleImage = async (params) => {
|
|
8780
|
+
let apiConfig = {
|
|
8781
|
+
numberOfImages: 1,
|
|
8782
|
+
mode: 'upscale',
|
|
8783
|
+
};
|
|
8784
|
+
if (params.config) {
|
|
8785
|
+
apiConfig = Object.assign(Object.assign({}, apiConfig), params.config);
|
|
8786
|
+
}
|
|
8787
|
+
const apiParams = {
|
|
8788
|
+
model: params.model,
|
|
8789
|
+
image: params.image,
|
|
8790
|
+
upscaleFactor: params.upscaleFactor,
|
|
8791
|
+
config: apiConfig,
|
|
8792
|
+
};
|
|
8793
|
+
return await this.upscaleImageInternal(apiParams);
|
|
8794
|
+
};
|
|
8115
8795
|
}
|
|
8116
8796
|
async generateContentInternal(params) {
|
|
8117
8797
|
var _a, _b, _c, _d;
|
|
@@ -8413,6 +9093,76 @@ class Models extends BaseModule {
|
|
|
8413
9093
|
});
|
|
8414
9094
|
}
|
|
8415
9095
|
}
|
|
9096
|
+
async editImageInternal(params) {
|
|
9097
|
+
var _a, _b;
|
|
9098
|
+
let response;
|
|
9099
|
+
let path = '';
|
|
9100
|
+
let queryParams = {};
|
|
9101
|
+
if (this.apiClient.isVertexAI()) {
|
|
9102
|
+
const body = editImageParametersInternalToVertex(this.apiClient, params);
|
|
9103
|
+
path = formatMap('{model}:predict', body['_url']);
|
|
9104
|
+
queryParams = body['_query'];
|
|
9105
|
+
delete body['config'];
|
|
9106
|
+
delete body['_url'];
|
|
9107
|
+
delete body['_query'];
|
|
9108
|
+
response = this.apiClient
|
|
9109
|
+
.request({
|
|
9110
|
+
path: path,
|
|
9111
|
+
queryParams: queryParams,
|
|
9112
|
+
body: JSON.stringify(body),
|
|
9113
|
+
httpMethod: 'POST',
|
|
9114
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9115
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9116
|
+
})
|
|
9117
|
+
.then((httpResponse) => {
|
|
9118
|
+
return httpResponse.json();
|
|
9119
|
+
});
|
|
9120
|
+
return response.then((apiResponse) => {
|
|
9121
|
+
const resp = editImageResponseFromVertex(this.apiClient, apiResponse);
|
|
9122
|
+
const typedResp = new EditImageResponse();
|
|
9123
|
+
Object.assign(typedResp, resp);
|
|
9124
|
+
return typedResp;
|
|
9125
|
+
});
|
|
9126
|
+
}
|
|
9127
|
+
else {
|
|
9128
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
9129
|
+
}
|
|
9130
|
+
}
|
|
9131
|
+
async upscaleImageInternal(params) {
|
|
9132
|
+
var _a, _b;
|
|
9133
|
+
let response;
|
|
9134
|
+
let path = '';
|
|
9135
|
+
let queryParams = {};
|
|
9136
|
+
if (this.apiClient.isVertexAI()) {
|
|
9137
|
+
const body = upscaleImageAPIParametersInternalToVertex(this.apiClient, params);
|
|
9138
|
+
path = formatMap('{model}:predict', body['_url']);
|
|
9139
|
+
queryParams = body['_query'];
|
|
9140
|
+
delete body['config'];
|
|
9141
|
+
delete body['_url'];
|
|
9142
|
+
delete body['_query'];
|
|
9143
|
+
response = this.apiClient
|
|
9144
|
+
.request({
|
|
9145
|
+
path: path,
|
|
9146
|
+
queryParams: queryParams,
|
|
9147
|
+
body: JSON.stringify(body),
|
|
9148
|
+
httpMethod: 'POST',
|
|
9149
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9150
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9151
|
+
})
|
|
9152
|
+
.then((httpResponse) => {
|
|
9153
|
+
return httpResponse.json();
|
|
9154
|
+
});
|
|
9155
|
+
return response.then((apiResponse) => {
|
|
9156
|
+
const resp = upscaleImageResponseFromVertex(this.apiClient, apiResponse);
|
|
9157
|
+
const typedResp = new UpscaleImageResponse();
|
|
9158
|
+
Object.assign(typedResp, resp);
|
|
9159
|
+
return typedResp;
|
|
9160
|
+
});
|
|
9161
|
+
}
|
|
9162
|
+
else {
|
|
9163
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
9164
|
+
}
|
|
9165
|
+
}
|
|
8416
9166
|
/**
|
|
8417
9167
|
* Fetches information about a model by name.
|
|
8418
9168
|
*
|
|
@@ -9228,7 +9978,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
9228
9978
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
9229
9979
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
9230
9980
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
9231
|
-
const SDK_VERSION = '0.
|
|
9981
|
+
const SDK_VERSION = '0.14.1'; // x-release-please-version
|
|
9232
9982
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
9233
9983
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
9234
9984
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -9835,6 +10585,10 @@ function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
9835
10585
|
if (fromLearningRateMultiplier != null) {
|
|
9836
10586
|
setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
9837
10587
|
}
|
|
10588
|
+
if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
|
|
10589
|
+
undefined) {
|
|
10590
|
+
throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
|
|
10591
|
+
}
|
|
9838
10592
|
if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
|
|
9839
10593
|
throw new Error('adapterSize parameter is not supported in Gemini API.');
|
|
9840
10594
|
}
|
|
@@ -9949,6 +10703,12 @@ function createTuningJobConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
9949
10703
|
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
9950
10704
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
9951
10705
|
}
|
|
10706
|
+
const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
|
|
10707
|
+
'exportLastCheckpointOnly',
|
|
10708
|
+
]);
|
|
10709
|
+
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
10710
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
10711
|
+
}
|
|
9952
10712
|
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
9953
10713
|
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
9954
10714
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
@@ -10101,6 +10861,26 @@ function operationFromMldev(apiClient, fromObject) {
|
|
|
10101
10861
|
}
|
|
10102
10862
|
return toObject;
|
|
10103
10863
|
}
|
|
10864
|
+
function tunedModelCheckpointFromVertex(apiClient, fromObject) {
|
|
10865
|
+
const toObject = {};
|
|
10866
|
+
const fromCheckpointId = getValueByPath(fromObject, ['checkpointId']);
|
|
10867
|
+
if (fromCheckpointId != null) {
|
|
10868
|
+
setValueByPath(toObject, ['checkpointId'], fromCheckpointId);
|
|
10869
|
+
}
|
|
10870
|
+
const fromEpoch = getValueByPath(fromObject, ['epoch']);
|
|
10871
|
+
if (fromEpoch != null) {
|
|
10872
|
+
setValueByPath(toObject, ['epoch'], fromEpoch);
|
|
10873
|
+
}
|
|
10874
|
+
const fromStep = getValueByPath(fromObject, ['step']);
|
|
10875
|
+
if (fromStep != null) {
|
|
10876
|
+
setValueByPath(toObject, ['step'], fromStep);
|
|
10877
|
+
}
|
|
10878
|
+
const fromEndpoint = getValueByPath(fromObject, ['endpoint']);
|
|
10879
|
+
if (fromEndpoint != null) {
|
|
10880
|
+
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
10881
|
+
}
|
|
10882
|
+
return toObject;
|
|
10883
|
+
}
|
|
10104
10884
|
function tunedModelFromVertex(apiClient, fromObject) {
|
|
10105
10885
|
const toObject = {};
|
|
10106
10886
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -10111,6 +10891,16 @@ function tunedModelFromVertex(apiClient, fromObject) {
|
|
|
10111
10891
|
if (fromEndpoint != null) {
|
|
10112
10892
|
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
10113
10893
|
}
|
|
10894
|
+
const fromCheckpoints = getValueByPath(fromObject, ['checkpoints']);
|
|
10895
|
+
if (fromCheckpoints != null) {
|
|
10896
|
+
let transformedList = fromCheckpoints;
|
|
10897
|
+
if (Array.isArray(transformedList)) {
|
|
10898
|
+
transformedList = transformedList.map((item) => {
|
|
10899
|
+
return tunedModelCheckpointFromVertex(apiClient, item);
|
|
10900
|
+
});
|
|
10901
|
+
}
|
|
10902
|
+
setValueByPath(toObject, ['checkpoints'], transformedList);
|
|
10903
|
+
}
|
|
10114
10904
|
return toObject;
|
|
10115
10905
|
}
|
|
10116
10906
|
function tuningJobFromVertex(apiClient, fromObject) {
|
|
@@ -10713,5 +11503,5 @@ class GoogleGenAI {
|
|
|
10713
11503
|
}
|
|
10714
11504
|
}
|
|
10715
11505
|
|
|
10716
|
-
export { ActivityHandling, AdapterSize, AuthType, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, StartSensitivity, SubjectReferenceType, TrafficType, TurnCoverage, Type, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, setDefaultBaseUrls };
|
|
11506
|
+
export { ActivityHandling, AdapterSize, AuthType, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, TrafficType, TurnCoverage, Type, UpscaleImageResponse, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, setDefaultBaseUrls };
|
|
10717
11507
|
//# sourceMappingURL=index.mjs.map
|