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