@google/genai 0.12.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 +468 -23
- package/dist/index.js +1619 -151
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1611 -152
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +1672 -143
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +468 -23
- package/dist/web/index.mjs +1577 -118
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +468 -23
- package/package.json +4 -1
package/dist/index.mjs
CHANGED
|
@@ -489,15 +489,81 @@ function tBytes(apiClient, fromImageBytes) {
|
|
|
489
489
|
// TODO(b/389133914): Remove dummy bytes converter.
|
|
490
490
|
return fromImageBytes;
|
|
491
491
|
}
|
|
492
|
+
function _isFile(origin) {
|
|
493
|
+
return (origin !== null &&
|
|
494
|
+
origin !== undefined &&
|
|
495
|
+
typeof origin === 'object' &&
|
|
496
|
+
'name' in origin);
|
|
497
|
+
}
|
|
498
|
+
function isGeneratedVideo(origin) {
|
|
499
|
+
return (origin !== null &&
|
|
500
|
+
origin !== undefined &&
|
|
501
|
+
typeof origin === 'object' &&
|
|
502
|
+
'video' in origin);
|
|
503
|
+
}
|
|
504
|
+
function isVideo(origin) {
|
|
505
|
+
return (origin !== null &&
|
|
506
|
+
origin !== undefined &&
|
|
507
|
+
typeof origin === 'object' &&
|
|
508
|
+
'uri' in origin);
|
|
509
|
+
}
|
|
492
510
|
function tFileName(apiClient, fromName) {
|
|
493
|
-
|
|
494
|
-
|
|
511
|
+
var _a;
|
|
512
|
+
let name;
|
|
513
|
+
if (_isFile(fromName)) {
|
|
514
|
+
name = fromName.name;
|
|
515
|
+
}
|
|
516
|
+
if (isVideo(fromName)) {
|
|
517
|
+
name = fromName.uri;
|
|
518
|
+
if (name === undefined) {
|
|
519
|
+
return undefined;
|
|
520
|
+
}
|
|
495
521
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
522
|
+
if (isGeneratedVideo(fromName)) {
|
|
523
|
+
name = (_a = fromName.video) === null || _a === void 0 ? void 0 : _a.uri;
|
|
524
|
+
if (name === undefined) {
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (typeof fromName === 'string') {
|
|
529
|
+
name = fromName;
|
|
530
|
+
}
|
|
531
|
+
if (name === undefined) {
|
|
532
|
+
throw new Error('Could not extract file name from the provided input.');
|
|
533
|
+
}
|
|
534
|
+
if (name.startsWith('https://')) {
|
|
535
|
+
const suffix = name.split('files/')[1];
|
|
536
|
+
const match = suffix.match(/[a-z0-9]+/);
|
|
537
|
+
if (match === null) {
|
|
538
|
+
throw new Error(`Could not extract file name from URI ${name}`);
|
|
539
|
+
}
|
|
540
|
+
name = match[0];
|
|
541
|
+
}
|
|
542
|
+
else if (name.startsWith('files/')) {
|
|
543
|
+
name = name.split('files/')[1];
|
|
544
|
+
}
|
|
545
|
+
return name;
|
|
546
|
+
}
|
|
547
|
+
function tModelsUrl(apiClient, baseModels) {
|
|
548
|
+
let res;
|
|
549
|
+
if (apiClient.isVertexAI()) {
|
|
550
|
+
res = baseModels ? 'publishers/google/models' : 'models';
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
res = baseModels ? 'models' : 'tunedModels';
|
|
499
554
|
}
|
|
500
|
-
return
|
|
555
|
+
return res;
|
|
556
|
+
}
|
|
557
|
+
function tExtractModels(apiClient, response) {
|
|
558
|
+
for (const key of ['models', 'tunedModels', 'publisherModels']) {
|
|
559
|
+
if (hasField(response, key)) {
|
|
560
|
+
return response[key];
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return [];
|
|
564
|
+
}
|
|
565
|
+
function hasField(data, fieldName) {
|
|
566
|
+
return data !== null && typeof data === 'object' && fieldName in data;
|
|
501
567
|
}
|
|
502
568
|
|
|
503
569
|
/**
|
|
@@ -505,6 +571,21 @@ function tFileName(apiClient, fromName) {
|
|
|
505
571
|
* Copyright 2025 Google LLC
|
|
506
572
|
* SPDX-License-Identifier: Apache-2.0
|
|
507
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
|
+
}
|
|
508
589
|
function partToMldev$2(apiClient, fromObject) {
|
|
509
590
|
const toObject = {};
|
|
510
591
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -514,6 +595,10 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
514
595
|
if (fromThought != null) {
|
|
515
596
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
516
597
|
}
|
|
598
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
599
|
+
if (fromInlineData != null) {
|
|
600
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
601
|
+
}
|
|
517
602
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
518
603
|
'codeExecutionResult',
|
|
519
604
|
]);
|
|
@@ -540,10 +625,6 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
540
625
|
if (fromFunctionResponse != null) {
|
|
541
626
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
542
627
|
}
|
|
543
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
544
|
-
if (fromInlineData != null) {
|
|
545
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
546
|
-
}
|
|
547
628
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
548
629
|
if (fromText != null) {
|
|
549
630
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -611,6 +692,12 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
611
692
|
if (fromGoogleSearchRetrieval != null) {
|
|
612
693
|
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
|
|
613
694
|
}
|
|
695
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
696
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
697
|
+
}
|
|
698
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
699
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
700
|
+
}
|
|
614
701
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
615
702
|
'codeExecution',
|
|
616
703
|
]);
|
|
@@ -647,6 +734,9 @@ function toolConfigToMldev$1(apiClient, fromObject) {
|
|
|
647
734
|
if (fromFunctionCallingConfig != null) {
|
|
648
735
|
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(apiClient, fromFunctionCallingConfig));
|
|
649
736
|
}
|
|
737
|
+
if (getValueByPath(fromObject, ['retrievalConfig']) !== undefined) {
|
|
738
|
+
throw new Error('retrievalConfig parameter is not supported in Gemini API.');
|
|
739
|
+
}
|
|
650
740
|
return toObject;
|
|
651
741
|
}
|
|
652
742
|
function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
@@ -775,6 +865,22 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
|
775
865
|
}
|
|
776
866
|
return toObject;
|
|
777
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
|
+
}
|
|
778
884
|
function partToVertex$2(apiClient, fromObject) {
|
|
779
885
|
const toObject = {};
|
|
780
886
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -787,6 +893,10 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
787
893
|
if (fromThought != null) {
|
|
788
894
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
789
895
|
}
|
|
896
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
897
|
+
if (fromInlineData != null) {
|
|
898
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex$2(apiClient, fromInlineData));
|
|
899
|
+
}
|
|
790
900
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
791
901
|
'codeExecutionResult',
|
|
792
902
|
]);
|
|
@@ -813,10 +923,6 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
813
923
|
if (fromFunctionResponse != null) {
|
|
814
924
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
815
925
|
}
|
|
816
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
817
|
-
if (fromInlineData != null) {
|
|
818
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
819
|
-
}
|
|
820
926
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
821
927
|
if (fromText != null) {
|
|
822
928
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -869,6 +975,58 @@ function googleSearchRetrievalToVertex$2(apiClient, fromObject) {
|
|
|
869
975
|
}
|
|
870
976
|
return toObject;
|
|
871
977
|
}
|
|
978
|
+
function enterpriseWebSearchToVertex$2() {
|
|
979
|
+
const toObject = {};
|
|
980
|
+
return toObject;
|
|
981
|
+
}
|
|
982
|
+
function apiKeyConfigToVertex$2(apiClient, fromObject) {
|
|
983
|
+
const toObject = {};
|
|
984
|
+
const fromApiKeyString = getValueByPath(fromObject, ['apiKeyString']);
|
|
985
|
+
if (fromApiKeyString != null) {
|
|
986
|
+
setValueByPath(toObject, ['apiKeyString'], fromApiKeyString);
|
|
987
|
+
}
|
|
988
|
+
return toObject;
|
|
989
|
+
}
|
|
990
|
+
function authConfigToVertex$2(apiClient, fromObject) {
|
|
991
|
+
const toObject = {};
|
|
992
|
+
const fromApiKeyConfig = getValueByPath(fromObject, ['apiKeyConfig']);
|
|
993
|
+
if (fromApiKeyConfig != null) {
|
|
994
|
+
setValueByPath(toObject, ['apiKeyConfig'], apiKeyConfigToVertex$2(apiClient, fromApiKeyConfig));
|
|
995
|
+
}
|
|
996
|
+
const fromAuthType = getValueByPath(fromObject, ['authType']);
|
|
997
|
+
if (fromAuthType != null) {
|
|
998
|
+
setValueByPath(toObject, ['authType'], fromAuthType);
|
|
999
|
+
}
|
|
1000
|
+
const fromGoogleServiceAccountConfig = getValueByPath(fromObject, [
|
|
1001
|
+
'googleServiceAccountConfig',
|
|
1002
|
+
]);
|
|
1003
|
+
if (fromGoogleServiceAccountConfig != null) {
|
|
1004
|
+
setValueByPath(toObject, ['googleServiceAccountConfig'], fromGoogleServiceAccountConfig);
|
|
1005
|
+
}
|
|
1006
|
+
const fromHttpBasicAuthConfig = getValueByPath(fromObject, [
|
|
1007
|
+
'httpBasicAuthConfig',
|
|
1008
|
+
]);
|
|
1009
|
+
if (fromHttpBasicAuthConfig != null) {
|
|
1010
|
+
setValueByPath(toObject, ['httpBasicAuthConfig'], fromHttpBasicAuthConfig);
|
|
1011
|
+
}
|
|
1012
|
+
const fromOauthConfig = getValueByPath(fromObject, ['oauthConfig']);
|
|
1013
|
+
if (fromOauthConfig != null) {
|
|
1014
|
+
setValueByPath(toObject, ['oauthConfig'], fromOauthConfig);
|
|
1015
|
+
}
|
|
1016
|
+
const fromOidcConfig = getValueByPath(fromObject, ['oidcConfig']);
|
|
1017
|
+
if (fromOidcConfig != null) {
|
|
1018
|
+
setValueByPath(toObject, ['oidcConfig'], fromOidcConfig);
|
|
1019
|
+
}
|
|
1020
|
+
return toObject;
|
|
1021
|
+
}
|
|
1022
|
+
function googleMapsToVertex$2(apiClient, fromObject) {
|
|
1023
|
+
const toObject = {};
|
|
1024
|
+
const fromAuthConfig = getValueByPath(fromObject, ['authConfig']);
|
|
1025
|
+
if (fromAuthConfig != null) {
|
|
1026
|
+
setValueByPath(toObject, ['authConfig'], authConfigToVertex$2(apiClient, fromAuthConfig));
|
|
1027
|
+
}
|
|
1028
|
+
return toObject;
|
|
1029
|
+
}
|
|
872
1030
|
function toolToVertex$2(apiClient, fromObject) {
|
|
873
1031
|
const toObject = {};
|
|
874
1032
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
@@ -885,6 +1043,16 @@ function toolToVertex$2(apiClient, fromObject) {
|
|
|
885
1043
|
if (fromGoogleSearchRetrieval != null) {
|
|
886
1044
|
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$2(apiClient, fromGoogleSearchRetrieval));
|
|
887
1045
|
}
|
|
1046
|
+
const fromEnterpriseWebSearch = getValueByPath(fromObject, [
|
|
1047
|
+
'enterpriseWebSearch',
|
|
1048
|
+
]);
|
|
1049
|
+
if (fromEnterpriseWebSearch != null) {
|
|
1050
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
|
|
1051
|
+
}
|
|
1052
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
1053
|
+
if (fromGoogleMaps != null) {
|
|
1054
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$2(apiClient, fromGoogleMaps));
|
|
1055
|
+
}
|
|
888
1056
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
889
1057
|
'codeExecution',
|
|
890
1058
|
]);
|
|
@@ -913,6 +1081,26 @@ function functionCallingConfigToVertex$1(apiClient, fromObject) {
|
|
|
913
1081
|
}
|
|
914
1082
|
return toObject;
|
|
915
1083
|
}
|
|
1084
|
+
function latLngToVertex$1(apiClient, fromObject) {
|
|
1085
|
+
const toObject = {};
|
|
1086
|
+
const fromLatitude = getValueByPath(fromObject, ['latitude']);
|
|
1087
|
+
if (fromLatitude != null) {
|
|
1088
|
+
setValueByPath(toObject, ['latitude'], fromLatitude);
|
|
1089
|
+
}
|
|
1090
|
+
const fromLongitude = getValueByPath(fromObject, ['longitude']);
|
|
1091
|
+
if (fromLongitude != null) {
|
|
1092
|
+
setValueByPath(toObject, ['longitude'], fromLongitude);
|
|
1093
|
+
}
|
|
1094
|
+
return toObject;
|
|
1095
|
+
}
|
|
1096
|
+
function retrievalConfigToVertex$1(apiClient, fromObject) {
|
|
1097
|
+
const toObject = {};
|
|
1098
|
+
const fromLatLng = getValueByPath(fromObject, ['latLng']);
|
|
1099
|
+
if (fromLatLng != null) {
|
|
1100
|
+
setValueByPath(toObject, ['latLng'], latLngToVertex$1(apiClient, fromLatLng));
|
|
1101
|
+
}
|
|
1102
|
+
return toObject;
|
|
1103
|
+
}
|
|
916
1104
|
function toolConfigToVertex$1(apiClient, fromObject) {
|
|
917
1105
|
const toObject = {};
|
|
918
1106
|
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
@@ -921,6 +1109,12 @@ function toolConfigToVertex$1(apiClient, fromObject) {
|
|
|
921
1109
|
if (fromFunctionCallingConfig != null) {
|
|
922
1110
|
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex$1(apiClient, fromFunctionCallingConfig));
|
|
923
1111
|
}
|
|
1112
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
1113
|
+
'retrievalConfig',
|
|
1114
|
+
]);
|
|
1115
|
+
if (fromRetrievalConfig != null) {
|
|
1116
|
+
setValueByPath(toObject, ['retrievalConfig'], retrievalConfigToVertex$1(apiClient, fromRetrievalConfig));
|
|
1117
|
+
}
|
|
924
1118
|
return toObject;
|
|
925
1119
|
}
|
|
926
1120
|
function createCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
@@ -1400,6 +1594,17 @@ var Mode;
|
|
|
1400
1594
|
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1401
1595
|
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1402
1596
|
})(Mode || (Mode = {}));
|
|
1597
|
+
/** Type of auth scheme. */
|
|
1598
|
+
var AuthType;
|
|
1599
|
+
(function (AuthType) {
|
|
1600
|
+
AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
|
|
1601
|
+
AuthType["NO_AUTH"] = "NO_AUTH";
|
|
1602
|
+
AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
|
|
1603
|
+
AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
|
|
1604
|
+
AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
|
|
1605
|
+
AuthType["OAUTH"] = "OAUTH";
|
|
1606
|
+
AuthType["OIDC_AUTH"] = "OIDC_AUTH";
|
|
1607
|
+
})(AuthType || (AuthType = {}));
|
|
1403
1608
|
/** Optional. The type of the data. */
|
|
1404
1609
|
var Type;
|
|
1405
1610
|
(function (Type) {
|
|
@@ -1553,21 +1758,6 @@ var ImagePromptLanguage;
|
|
|
1553
1758
|
ImagePromptLanguage["ko"] = "ko";
|
|
1554
1759
|
ImagePromptLanguage["hi"] = "hi";
|
|
1555
1760
|
})(ImagePromptLanguage || (ImagePromptLanguage = {}));
|
|
1556
|
-
/** State for the lifecycle of a File. */
|
|
1557
|
-
var FileState;
|
|
1558
|
-
(function (FileState) {
|
|
1559
|
-
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1560
|
-
FileState["PROCESSING"] = "PROCESSING";
|
|
1561
|
-
FileState["ACTIVE"] = "ACTIVE";
|
|
1562
|
-
FileState["FAILED"] = "FAILED";
|
|
1563
|
-
})(FileState || (FileState = {}));
|
|
1564
|
-
/** Source of the File. */
|
|
1565
|
-
var FileSource;
|
|
1566
|
-
(function (FileSource) {
|
|
1567
|
-
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1568
|
-
FileSource["UPLOADED"] = "UPLOADED";
|
|
1569
|
-
FileSource["GENERATED"] = "GENERATED";
|
|
1570
|
-
})(FileSource || (FileSource = {}));
|
|
1571
1761
|
/** Enum representing the mask mode of a mask reference image. */
|
|
1572
1762
|
var MaskReferenceMode;
|
|
1573
1763
|
(function (MaskReferenceMode) {
|
|
@@ -1593,6 +1783,33 @@ var SubjectReferenceType;
|
|
|
1593
1783
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
1594
1784
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
1595
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 = {}));
|
|
1596
1813
|
/** Server content modalities. */
|
|
1597
1814
|
var MediaModality;
|
|
1598
1815
|
(function (MediaModality) {
|
|
@@ -2007,6 +2224,13 @@ class EmbedContentResponse {
|
|
|
2007
2224
|
/** The output images response. */
|
|
2008
2225
|
class GenerateImagesResponse {
|
|
2009
2226
|
}
|
|
2227
|
+
/** Response for the request to edit an image. */
|
|
2228
|
+
class EditImageResponse {
|
|
2229
|
+
}
|
|
2230
|
+
class UpscaleImageResponse {
|
|
2231
|
+
}
|
|
2232
|
+
class ListModelsResponse {
|
|
2233
|
+
}
|
|
2010
2234
|
class DeleteModelResponse {
|
|
2011
2235
|
}
|
|
2012
2236
|
/** Response for counting tokens. */
|
|
@@ -2054,6 +2278,176 @@ class DeleteFileResponse {
|
|
|
2054
2278
|
/** Represents a single response in a replay. */
|
|
2055
2279
|
class ReplayResponse {
|
|
2056
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
|
+
}
|
|
2387
|
+
/** Response message for API call. */
|
|
2388
|
+
class LiveServerMessage {
|
|
2389
|
+
/**
|
|
2390
|
+
* Returns the concatenation of all text parts from the server content if present.
|
|
2391
|
+
*
|
|
2392
|
+
* @remarks
|
|
2393
|
+
* If there are non-text parts in the response, the concatenation of all text
|
|
2394
|
+
* parts will be returned, and a warning will be logged.
|
|
2395
|
+
*/
|
|
2396
|
+
get text() {
|
|
2397
|
+
var _a, _b, _c;
|
|
2398
|
+
let text = '';
|
|
2399
|
+
let anyTextPartFound = false;
|
|
2400
|
+
const nonTextParts = [];
|
|
2401
|
+
for (const part of (_c = (_b = (_a = this.serverContent) === null || _a === void 0 ? void 0 : _a.modelTurn) === null || _b === void 0 ? void 0 : _b.parts) !== null && _c !== void 0 ? _c : []) {
|
|
2402
|
+
for (const [fieldName, fieldValue] of Object.entries(part)) {
|
|
2403
|
+
if (fieldName !== 'text' &&
|
|
2404
|
+
fieldName !== 'thought' &&
|
|
2405
|
+
fieldValue !== null) {
|
|
2406
|
+
nonTextParts.push(fieldName);
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
if (typeof part.text === 'string') {
|
|
2410
|
+
if (typeof part.thought === 'boolean' && part.thought) {
|
|
2411
|
+
continue;
|
|
2412
|
+
}
|
|
2413
|
+
anyTextPartFound = true;
|
|
2414
|
+
text += part.text;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
if (nonTextParts.length > 0) {
|
|
2418
|
+
console.warn(`there are non-text parts ${nonTextParts} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`);
|
|
2419
|
+
}
|
|
2420
|
+
// part.text === '' is different from part.text is null
|
|
2421
|
+
return anyTextPartFound ? text : undefined;
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* Returns the concatenation of all inline data parts from the server content if present.
|
|
2425
|
+
*
|
|
2426
|
+
* @remarks
|
|
2427
|
+
* If there are non-inline data parts in the
|
|
2428
|
+
* response, the concatenation of all inline data parts will be returned, and
|
|
2429
|
+
* a warning will be logged.
|
|
2430
|
+
*/
|
|
2431
|
+
get data() {
|
|
2432
|
+
var _a, _b, _c;
|
|
2433
|
+
let data = '';
|
|
2434
|
+
const nonDataParts = [];
|
|
2435
|
+
for (const part of (_c = (_b = (_a = this.serverContent) === null || _a === void 0 ? void 0 : _a.modelTurn) === null || _b === void 0 ? void 0 : _b.parts) !== null && _c !== void 0 ? _c : []) {
|
|
2436
|
+
for (const [fieldName, fieldValue] of Object.entries(part)) {
|
|
2437
|
+
if (fieldName !== 'inlineData' && fieldValue !== null) {
|
|
2438
|
+
nonDataParts.push(fieldName);
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
if (part.inlineData && typeof part.inlineData.data === 'string') {
|
|
2442
|
+
data += atob(part.inlineData.data);
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
if (nonDataParts.length > 0) {
|
|
2446
|
+
console.warn(`there are non-data parts ${nonDataParts} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`);
|
|
2447
|
+
}
|
|
2448
|
+
return data.length > 0 ? btoa(data) : undefined;
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2057
2451
|
/** Client generated response to a `ToolCall` received from the server.
|
|
2058
2452
|
|
|
2059
2453
|
Individual `FunctionResponse` objects are matched to the respective
|
|
@@ -2815,7 +3209,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
2815
3209
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
2816
3210
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
2817
3211
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
2818
|
-
const SDK_VERSION = '0.
|
|
3212
|
+
const SDK_VERSION = '0.14.0'; // x-release-please-version
|
|
2819
3213
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
2820
3214
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
2821
3215
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -2862,18 +3256,11 @@ class ApiClient {
|
|
|
2862
3256
|
if (this.clientOptions.vertexai) {
|
|
2863
3257
|
initHttpOptions.apiVersion =
|
|
2864
3258
|
(_a = this.clientOptions.apiVersion) !== null && _a !== void 0 ? _a : VERTEX_AI_API_DEFAULT_VERSION;
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
initHttpOptions.baseUrl = `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
|
|
2868
|
-
this.clientOptions.apiKey = undefined; // unset API key.
|
|
2869
|
-
}
|
|
2870
|
-
else {
|
|
2871
|
-
initHttpOptions.baseUrl = `https://aiplatform.googleapis.com/`;
|
|
2872
|
-
this.clientOptions.project = undefined; // unset project.
|
|
2873
|
-
this.clientOptions.location = undefined; // unset location.
|
|
2874
|
-
}
|
|
3259
|
+
initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
|
|
3260
|
+
this.normalizeAuthParameters();
|
|
2875
3261
|
}
|
|
2876
3262
|
else {
|
|
3263
|
+
// Gemini API
|
|
2877
3264
|
initHttpOptions.apiVersion =
|
|
2878
3265
|
(_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : GOOGLE_AI_API_DEFAULT_VERSION;
|
|
2879
3266
|
initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
|
|
@@ -2884,6 +3271,39 @@ class ApiClient {
|
|
|
2884
3271
|
this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
|
|
2885
3272
|
}
|
|
2886
3273
|
}
|
|
3274
|
+
/**
|
|
3275
|
+
* Determines the base URL for Vertex AI based on project and location.
|
|
3276
|
+
* Uses the global endpoint if location is 'global' or if project/location
|
|
3277
|
+
* are not specified (implying API key usage).
|
|
3278
|
+
* @private
|
|
3279
|
+
*/
|
|
3280
|
+
baseUrlFromProjectLocation() {
|
|
3281
|
+
if (this.clientOptions.project &&
|
|
3282
|
+
this.clientOptions.location &&
|
|
3283
|
+
this.clientOptions.location !== 'global') {
|
|
3284
|
+
// Regional endpoint
|
|
3285
|
+
return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
|
|
3286
|
+
}
|
|
3287
|
+
// Global endpoint (covers 'global' location and API key usage)
|
|
3288
|
+
return `https://aiplatform.googleapis.com/`;
|
|
3289
|
+
}
|
|
3290
|
+
/**
|
|
3291
|
+
* Normalizes authentication parameters for Vertex AI.
|
|
3292
|
+
* If project and location are provided, API key is cleared.
|
|
3293
|
+
* If project and location are not provided (implying API key usage),
|
|
3294
|
+
* project and location are cleared.
|
|
3295
|
+
* @private
|
|
3296
|
+
*/
|
|
3297
|
+
normalizeAuthParameters() {
|
|
3298
|
+
if (this.clientOptions.project && this.clientOptions.location) {
|
|
3299
|
+
// Using project/location for auth, clear potential API key
|
|
3300
|
+
this.clientOptions.apiKey = undefined;
|
|
3301
|
+
return;
|
|
3302
|
+
}
|
|
3303
|
+
// Using API key for auth (or no auth provided yet), clear project/location
|
|
3304
|
+
this.clientOptions.project = undefined;
|
|
3305
|
+
this.clientOptions.location = undefined;
|
|
3306
|
+
}
|
|
2887
3307
|
isVertexAI() {
|
|
2888
3308
|
var _a;
|
|
2889
3309
|
return (_a = this.clientOptions.vertexai) !== null && _a !== void 0 ? _a : false;
|
|
@@ -3221,6 +3641,16 @@ class ApiClient {
|
|
|
3221
3641
|
const uploadUrl = await this.fetchUploadUrl(fileToUpload, config);
|
|
3222
3642
|
return uploader.upload(file, uploadUrl, this);
|
|
3223
3643
|
}
|
|
3644
|
+
/**
|
|
3645
|
+
* Downloads a file asynchronously to the specified path.
|
|
3646
|
+
*
|
|
3647
|
+
* @params params - The parameters for the download request, see {@link
|
|
3648
|
+
* DownloadFileParameters}
|
|
3649
|
+
*/
|
|
3650
|
+
async downloadFile(params) {
|
|
3651
|
+
const downloader = this.clientOptions.downloader;
|
|
3652
|
+
await downloader.download(params, this);
|
|
3653
|
+
}
|
|
3224
3654
|
async fetchUploadUrl(file, config) {
|
|
3225
3655
|
var _a;
|
|
3226
3656
|
let httpOptions = {};
|
|
@@ -3307,7 +3737,22 @@ function crossError() {
|
|
|
3307
3737
|
`);
|
|
3308
3738
|
}
|
|
3309
3739
|
|
|
3740
|
+
/**
|
|
3741
|
+
* @license
|
|
3742
|
+
* Copyright 2025 Google LLC
|
|
3743
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
3744
|
+
*/
|
|
3745
|
+
class CrossDownloader {
|
|
3746
|
+
async download(_params, _apiClient) {
|
|
3747
|
+
throw crossError();
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3750
|
+
|
|
3310
3751
|
const MAX_CHUNK_SIZE = 1024 * 1024 * 8; // bytes
|
|
3752
|
+
const MAX_RETRY_COUNT = 3;
|
|
3753
|
+
const INITIAL_RETRY_DELAY_MS = 1000;
|
|
3754
|
+
const DELAY_MULTIPLIER = 2;
|
|
3755
|
+
const X_GOOG_UPLOAD_STATUS_HEADER_FIELD = 'x-goog-upload-status';
|
|
3311
3756
|
class CrossUploader {
|
|
3312
3757
|
async upload(file, uploadUrl, apiClient) {
|
|
3313
3758
|
if (typeof file === 'string') {
|
|
@@ -3327,7 +3772,7 @@ class CrossUploader {
|
|
|
3327
3772
|
}
|
|
3328
3773
|
}
|
|
3329
3774
|
async function uploadBlob(file, uploadUrl, apiClient) {
|
|
3330
|
-
var _a, _b;
|
|
3775
|
+
var _a, _b, _c;
|
|
3331
3776
|
let fileSize = 0;
|
|
3332
3777
|
let offset = 0;
|
|
3333
3778
|
let response = new HttpResponse(new Response());
|
|
@@ -3339,24 +3784,34 @@ async function uploadBlob(file, uploadUrl, apiClient) {
|
|
|
3339
3784
|
if (offset + chunkSize >= fileSize) {
|
|
3340
3785
|
uploadCommand += ', finalize';
|
|
3341
3786
|
}
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
'
|
|
3351
|
-
|
|
3352
|
-
|
|
3787
|
+
let retryCount = 0;
|
|
3788
|
+
let currentDelayMs = INITIAL_RETRY_DELAY_MS;
|
|
3789
|
+
while (retryCount < MAX_RETRY_COUNT) {
|
|
3790
|
+
response = await apiClient.request({
|
|
3791
|
+
path: '',
|
|
3792
|
+
body: chunk,
|
|
3793
|
+
httpMethod: 'POST',
|
|
3794
|
+
httpOptions: {
|
|
3795
|
+
apiVersion: '',
|
|
3796
|
+
baseUrl: uploadUrl,
|
|
3797
|
+
headers: {
|
|
3798
|
+
'X-Goog-Upload-Command': uploadCommand,
|
|
3799
|
+
'X-Goog-Upload-Offset': String(offset),
|
|
3800
|
+
'Content-Length': String(chunkSize),
|
|
3801
|
+
},
|
|
3353
3802
|
},
|
|
3354
|
-
}
|
|
3355
|
-
|
|
3803
|
+
});
|
|
3804
|
+
if ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) {
|
|
3805
|
+
break;
|
|
3806
|
+
}
|
|
3807
|
+
retryCount++;
|
|
3808
|
+
await sleep(currentDelayMs);
|
|
3809
|
+
currentDelayMs = currentDelayMs * DELAY_MULTIPLIER;
|
|
3810
|
+
}
|
|
3356
3811
|
offset += chunkSize;
|
|
3357
3812
|
// The `x-goog-upload-status` header field can be `active`, `final` and
|
|
3358
3813
|
//`cancelled` in resposne.
|
|
3359
|
-
if (((
|
|
3814
|
+
if (((_b = response === null || response === void 0 ? void 0 : response.headers) === null || _b === void 0 ? void 0 : _b[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'active') {
|
|
3360
3815
|
break;
|
|
3361
3816
|
}
|
|
3362
3817
|
// TODO(b/401391430) Investigate why the upload status is not finalized
|
|
@@ -3366,7 +3821,7 @@ async function uploadBlob(file, uploadUrl, apiClient) {
|
|
|
3366
3821
|
}
|
|
3367
3822
|
}
|
|
3368
3823
|
const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
|
|
3369
|
-
if (((
|
|
3824
|
+
if (((_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
|
|
3370
3825
|
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
3371
3826
|
}
|
|
3372
3827
|
return responseJson['file'];
|
|
@@ -3375,6 +3830,9 @@ async function getBlobStat(file) {
|
|
|
3375
3830
|
const fileStat = { size: file.size, type: file.type };
|
|
3376
3831
|
return fileStat;
|
|
3377
3832
|
}
|
|
3833
|
+
function sleep(ms) {
|
|
3834
|
+
return new Promise((resolvePromise) => setTimeout(resolvePromise, ms));
|
|
3835
|
+
}
|
|
3378
3836
|
|
|
3379
3837
|
/**
|
|
3380
3838
|
* @license
|
|
@@ -3723,11 +4181,30 @@ class Files extends BaseModule {
|
|
|
3723
4181
|
return file;
|
|
3724
4182
|
});
|
|
3725
4183
|
}
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
4184
|
+
/**
|
|
4185
|
+
* Downloads a remotely stored file asynchronously to a location specified in
|
|
4186
|
+
* the `params` object. This method only works on Node environment, to
|
|
4187
|
+
* download files in the browser, use a browser compliant method like an <a>
|
|
4188
|
+
* tag.
|
|
4189
|
+
*
|
|
4190
|
+
* @param params - The parameters for the download request.
|
|
4191
|
+
*
|
|
4192
|
+
* @example
|
|
4193
|
+
* The following code downloads an example file named "files/mehozpxf877d" as
|
|
4194
|
+
* "file.txt".
|
|
4195
|
+
*
|
|
4196
|
+
* ```ts
|
|
4197
|
+
* await ai.files.download({file: file.name, downloadPath: 'file.txt'});
|
|
4198
|
+
* ```
|
|
4199
|
+
*/
|
|
4200
|
+
async download(params) {
|
|
4201
|
+
await this.apiClient.downloadFile(params);
|
|
4202
|
+
}
|
|
4203
|
+
async listInternal(params) {
|
|
4204
|
+
var _a, _b;
|
|
4205
|
+
let response;
|
|
4206
|
+
let path = '';
|
|
4207
|
+
let queryParams = {};
|
|
3731
4208
|
if (this.apiClient.isVertexAI()) {
|
|
3732
4209
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
3733
4210
|
}
|
|
@@ -3896,6 +4373,37 @@ class Files extends BaseModule {
|
|
|
3896
4373
|
* Copyright 2025 Google LLC
|
|
3897
4374
|
* SPDX-License-Identifier: Apache-2.0
|
|
3898
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
|
+
}
|
|
3899
4407
|
function partToMldev$1(apiClient, fromObject) {
|
|
3900
4408
|
const toObject = {};
|
|
3901
4409
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -3905,6 +4413,10 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
3905
4413
|
if (fromThought != null) {
|
|
3906
4414
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
3907
4415
|
}
|
|
4416
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4417
|
+
if (fromInlineData != null) {
|
|
4418
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
4419
|
+
}
|
|
3908
4420
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3909
4421
|
'codeExecutionResult',
|
|
3910
4422
|
]);
|
|
@@ -3931,10 +4443,6 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
3931
4443
|
if (fromFunctionResponse != null) {
|
|
3932
4444
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3933
4445
|
}
|
|
3934
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3935
|
-
if (fromInlineData != null) {
|
|
3936
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
3937
|
-
}
|
|
3938
4446
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
3939
4447
|
if (fromText != null) {
|
|
3940
4448
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -3953,6 +4461,10 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
3953
4461
|
if (fromThought != null) {
|
|
3954
4462
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
3955
4463
|
}
|
|
4464
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4465
|
+
if (fromInlineData != null) {
|
|
4466
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex$1(apiClient, fromInlineData));
|
|
4467
|
+
}
|
|
3956
4468
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3957
4469
|
'codeExecutionResult',
|
|
3958
4470
|
]);
|
|
@@ -3979,10 +4491,6 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
3979
4491
|
if (fromFunctionResponse != null) {
|
|
3980
4492
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3981
4493
|
}
|
|
3982
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3983
|
-
if (fromInlineData != null) {
|
|
3984
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
3985
|
-
}
|
|
3986
4494
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
3987
4495
|
if (fromText != null) {
|
|
3988
4496
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -4081,6 +4589,58 @@ function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
|
|
|
4081
4589
|
}
|
|
4082
4590
|
return toObject;
|
|
4083
4591
|
}
|
|
4592
|
+
function enterpriseWebSearchToVertex$1() {
|
|
4593
|
+
const toObject = {};
|
|
4594
|
+
return toObject;
|
|
4595
|
+
}
|
|
4596
|
+
function apiKeyConfigToVertex$1(apiClient, fromObject) {
|
|
4597
|
+
const toObject = {};
|
|
4598
|
+
const fromApiKeyString = getValueByPath(fromObject, ['apiKeyString']);
|
|
4599
|
+
if (fromApiKeyString != null) {
|
|
4600
|
+
setValueByPath(toObject, ['apiKeyString'], fromApiKeyString);
|
|
4601
|
+
}
|
|
4602
|
+
return toObject;
|
|
4603
|
+
}
|
|
4604
|
+
function authConfigToVertex$1(apiClient, fromObject) {
|
|
4605
|
+
const toObject = {};
|
|
4606
|
+
const fromApiKeyConfig = getValueByPath(fromObject, ['apiKeyConfig']);
|
|
4607
|
+
if (fromApiKeyConfig != null) {
|
|
4608
|
+
setValueByPath(toObject, ['apiKeyConfig'], apiKeyConfigToVertex$1(apiClient, fromApiKeyConfig));
|
|
4609
|
+
}
|
|
4610
|
+
const fromAuthType = getValueByPath(fromObject, ['authType']);
|
|
4611
|
+
if (fromAuthType != null) {
|
|
4612
|
+
setValueByPath(toObject, ['authType'], fromAuthType);
|
|
4613
|
+
}
|
|
4614
|
+
const fromGoogleServiceAccountConfig = getValueByPath(fromObject, [
|
|
4615
|
+
'googleServiceAccountConfig',
|
|
4616
|
+
]);
|
|
4617
|
+
if (fromGoogleServiceAccountConfig != null) {
|
|
4618
|
+
setValueByPath(toObject, ['googleServiceAccountConfig'], fromGoogleServiceAccountConfig);
|
|
4619
|
+
}
|
|
4620
|
+
const fromHttpBasicAuthConfig = getValueByPath(fromObject, [
|
|
4621
|
+
'httpBasicAuthConfig',
|
|
4622
|
+
]);
|
|
4623
|
+
if (fromHttpBasicAuthConfig != null) {
|
|
4624
|
+
setValueByPath(toObject, ['httpBasicAuthConfig'], fromHttpBasicAuthConfig);
|
|
4625
|
+
}
|
|
4626
|
+
const fromOauthConfig = getValueByPath(fromObject, ['oauthConfig']);
|
|
4627
|
+
if (fromOauthConfig != null) {
|
|
4628
|
+
setValueByPath(toObject, ['oauthConfig'], fromOauthConfig);
|
|
4629
|
+
}
|
|
4630
|
+
const fromOidcConfig = getValueByPath(fromObject, ['oidcConfig']);
|
|
4631
|
+
if (fromOidcConfig != null) {
|
|
4632
|
+
setValueByPath(toObject, ['oidcConfig'], fromOidcConfig);
|
|
4633
|
+
}
|
|
4634
|
+
return toObject;
|
|
4635
|
+
}
|
|
4636
|
+
function googleMapsToVertex$1(apiClient, fromObject) {
|
|
4637
|
+
const toObject = {};
|
|
4638
|
+
const fromAuthConfig = getValueByPath(fromObject, ['authConfig']);
|
|
4639
|
+
if (fromAuthConfig != null) {
|
|
4640
|
+
setValueByPath(toObject, ['authConfig'], authConfigToVertex$1(apiClient, fromAuthConfig));
|
|
4641
|
+
}
|
|
4642
|
+
return toObject;
|
|
4643
|
+
}
|
|
4084
4644
|
function toolToMldev$1(apiClient, fromObject) {
|
|
4085
4645
|
const toObject = {};
|
|
4086
4646
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
@@ -4096,6 +4656,12 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
4096
4656
|
if (fromGoogleSearchRetrieval != null) {
|
|
4097
4657
|
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
|
|
4098
4658
|
}
|
|
4659
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
4660
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
4661
|
+
}
|
|
4662
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
4663
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
4664
|
+
}
|
|
4099
4665
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
4100
4666
|
'codeExecution',
|
|
4101
4667
|
]);
|
|
@@ -4126,6 +4692,16 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
4126
4692
|
if (fromGoogleSearchRetrieval != null) {
|
|
4127
4693
|
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
|
|
4128
4694
|
}
|
|
4695
|
+
const fromEnterpriseWebSearch = getValueByPath(fromObject, [
|
|
4696
|
+
'enterpriseWebSearch',
|
|
4697
|
+
]);
|
|
4698
|
+
if (fromEnterpriseWebSearch != null) {
|
|
4699
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
|
|
4700
|
+
}
|
|
4701
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
4702
|
+
if (fromGoogleMaps != null) {
|
|
4703
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$1(apiClient, fromGoogleMaps));
|
|
4704
|
+
}
|
|
4129
4705
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
4130
4706
|
'codeExecution',
|
|
4131
4707
|
]);
|
|
@@ -4391,8 +4967,11 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
4391
4967
|
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
4392
4968
|
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
4393
4969
|
}
|
|
4394
|
-
|
|
4395
|
-
|
|
4970
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
4971
|
+
'inputAudioTranscription',
|
|
4972
|
+
]);
|
|
4973
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
4974
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
4396
4975
|
}
|
|
4397
4976
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
4398
4977
|
'outputAudioTranscription',
|
|
@@ -4625,12 +5204,44 @@ function liveServerSetupCompleteFromVertex() {
|
|
|
4625
5204
|
const toObject = {};
|
|
4626
5205
|
return toObject;
|
|
4627
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
|
+
}
|
|
4628
5235
|
function partFromMldev$1(apiClient, fromObject) {
|
|
4629
5236
|
const toObject = {};
|
|
4630
5237
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4631
5238
|
if (fromThought != null) {
|
|
4632
5239
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
4633
5240
|
}
|
|
5241
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5242
|
+
if (fromInlineData != null) {
|
|
5243
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev$1(apiClient, fromInlineData));
|
|
5244
|
+
}
|
|
4634
5245
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4635
5246
|
'codeExecutionResult',
|
|
4636
5247
|
]);
|
|
@@ -4657,10 +5268,6 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
4657
5268
|
if (fromFunctionResponse != null) {
|
|
4658
5269
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4659
5270
|
}
|
|
4660
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4661
|
-
if (fromInlineData != null) {
|
|
4662
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4663
|
-
}
|
|
4664
5271
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4665
5272
|
if (fromText != null) {
|
|
4666
5273
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -4679,6 +5286,10 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
4679
5286
|
if (fromThought != null) {
|
|
4680
5287
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
4681
5288
|
}
|
|
5289
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5290
|
+
if (fromInlineData != null) {
|
|
5291
|
+
setValueByPath(toObject, ['inlineData'], blobFromVertex$1(apiClient, fromInlineData));
|
|
5292
|
+
}
|
|
4682
5293
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4683
5294
|
'codeExecutionResult',
|
|
4684
5295
|
]);
|
|
@@ -4705,10 +5316,6 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
4705
5316
|
if (fromFunctionResponse != null) {
|
|
4706
5317
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4707
5318
|
}
|
|
4708
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4709
|
-
if (fromInlineData != null) {
|
|
4710
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4711
|
-
}
|
|
4712
5319
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4713
5320
|
if (fromText != null) {
|
|
4714
5321
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5277,6 +5884,21 @@ function liveServerMessageFromVertex(apiClient, fromObject) {
|
|
|
5277
5884
|
* Copyright 2025 Google LLC
|
|
5278
5885
|
* SPDX-License-Identifier: Apache-2.0
|
|
5279
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
|
+
}
|
|
5280
5902
|
function partToMldev(apiClient, fromObject) {
|
|
5281
5903
|
const toObject = {};
|
|
5282
5904
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
@@ -5286,6 +5908,10 @@ function partToMldev(apiClient, fromObject) {
|
|
|
5286
5908
|
if (fromThought != null) {
|
|
5287
5909
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5288
5910
|
}
|
|
5911
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5912
|
+
if (fromInlineData != null) {
|
|
5913
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
5914
|
+
}
|
|
5289
5915
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5290
5916
|
'codeExecutionResult',
|
|
5291
5917
|
]);
|
|
@@ -5312,10 +5938,6 @@ function partToMldev(apiClient, fromObject) {
|
|
|
5312
5938
|
if (fromFunctionResponse != null) {
|
|
5313
5939
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5314
5940
|
}
|
|
5315
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5316
|
-
if (fromInlineData != null) {
|
|
5317
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5318
|
-
}
|
|
5319
5941
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5320
5942
|
if (fromText != null) {
|
|
5321
5943
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -5398,6 +6020,12 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
5398
6020
|
if (fromGoogleSearchRetrieval != null) {
|
|
5399
6021
|
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
5400
6022
|
}
|
|
6023
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
6024
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
6025
|
+
}
|
|
6026
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
6027
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
6028
|
+
}
|
|
5401
6029
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5402
6030
|
'codeExecution',
|
|
5403
6031
|
]);
|
|
@@ -5434,6 +6062,9 @@ function toolConfigToMldev(apiClient, fromObject) {
|
|
|
5434
6062
|
if (fromFunctionCallingConfig != null) {
|
|
5435
6063
|
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(apiClient, fromFunctionCallingConfig));
|
|
5436
6064
|
}
|
|
6065
|
+
if (getValueByPath(fromObject, ['retrievalConfig']) !== undefined) {
|
|
6066
|
+
throw new Error('retrievalConfig parameter is not supported in Gemini API.');
|
|
6067
|
+
}
|
|
5437
6068
|
return toObject;
|
|
5438
6069
|
}
|
|
5439
6070
|
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
@@ -5795,6 +6426,34 @@ function getModelParametersToMldev(apiClient, fromObject) {
|
|
|
5795
6426
|
}
|
|
5796
6427
|
return toObject;
|
|
5797
6428
|
}
|
|
6429
|
+
function listModelsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
6430
|
+
const toObject = {};
|
|
6431
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
6432
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
6433
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
6434
|
+
}
|
|
6435
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
6436
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
6437
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
6438
|
+
}
|
|
6439
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
6440
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
6441
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
6442
|
+
}
|
|
6443
|
+
const fromQueryBase = getValueByPath(fromObject, ['queryBase']);
|
|
6444
|
+
if (parentObject !== undefined && fromQueryBase != null) {
|
|
6445
|
+
setValueByPath(parentObject, ['_url', 'models_url'], tModelsUrl(apiClient, fromQueryBase));
|
|
6446
|
+
}
|
|
6447
|
+
return toObject;
|
|
6448
|
+
}
|
|
6449
|
+
function listModelsParametersToMldev(apiClient, fromObject) {
|
|
6450
|
+
const toObject = {};
|
|
6451
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6452
|
+
if (fromConfig != null) {
|
|
6453
|
+
setValueByPath(toObject, ['config'], listModelsConfigToMldev(apiClient, fromConfig, toObject));
|
|
6454
|
+
}
|
|
6455
|
+
return toObject;
|
|
6456
|
+
}
|
|
5798
6457
|
function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
|
|
5799
6458
|
const toObject = {};
|
|
5800
6459
|
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
@@ -5805,6 +6464,12 @@ function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5805
6464
|
if (parentObject !== undefined && fromDescription != null) {
|
|
5806
6465
|
setValueByPath(parentObject, ['description'], fromDescription);
|
|
5807
6466
|
}
|
|
6467
|
+
const fromDefaultCheckpointId = getValueByPath(fromObject, [
|
|
6468
|
+
'defaultCheckpointId',
|
|
6469
|
+
]);
|
|
6470
|
+
if (parentObject !== undefined && fromDefaultCheckpointId != null) {
|
|
6471
|
+
setValueByPath(parentObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
|
|
6472
|
+
}
|
|
5808
6473
|
return toObject;
|
|
5809
6474
|
}
|
|
5810
6475
|
function updateModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -5951,6 +6616,22 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
|
5951
6616
|
}
|
|
5952
6617
|
return toObject;
|
|
5953
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
|
+
}
|
|
5954
6635
|
function partToVertex(apiClient, fromObject) {
|
|
5955
6636
|
const toObject = {};
|
|
5956
6637
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -5963,6 +6644,10 @@ function partToVertex(apiClient, fromObject) {
|
|
|
5963
6644
|
if (fromThought != null) {
|
|
5964
6645
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
5965
6646
|
}
|
|
6647
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6648
|
+
if (fromInlineData != null) {
|
|
6649
|
+
setValueByPath(toObject, ['inlineData'], blobToVertex(apiClient, fromInlineData));
|
|
6650
|
+
}
|
|
5966
6651
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5967
6652
|
'codeExecutionResult',
|
|
5968
6653
|
]);
|
|
@@ -5989,10 +6674,6 @@ function partToVertex(apiClient, fromObject) {
|
|
|
5989
6674
|
if (fromFunctionResponse != null) {
|
|
5990
6675
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5991
6676
|
}
|
|
5992
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5993
|
-
if (fromInlineData != null) {
|
|
5994
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
5995
|
-
}
|
|
5996
6677
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5997
6678
|
if (fromText != null) {
|
|
5998
6679
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -6071,6 +6752,58 @@ function googleSearchRetrievalToVertex(apiClient, fromObject) {
|
|
|
6071
6752
|
}
|
|
6072
6753
|
return toObject;
|
|
6073
6754
|
}
|
|
6755
|
+
function enterpriseWebSearchToVertex() {
|
|
6756
|
+
const toObject = {};
|
|
6757
|
+
return toObject;
|
|
6758
|
+
}
|
|
6759
|
+
function apiKeyConfigToVertex(apiClient, fromObject) {
|
|
6760
|
+
const toObject = {};
|
|
6761
|
+
const fromApiKeyString = getValueByPath(fromObject, ['apiKeyString']);
|
|
6762
|
+
if (fromApiKeyString != null) {
|
|
6763
|
+
setValueByPath(toObject, ['apiKeyString'], fromApiKeyString);
|
|
6764
|
+
}
|
|
6765
|
+
return toObject;
|
|
6766
|
+
}
|
|
6767
|
+
function authConfigToVertex(apiClient, fromObject) {
|
|
6768
|
+
const toObject = {};
|
|
6769
|
+
const fromApiKeyConfig = getValueByPath(fromObject, ['apiKeyConfig']);
|
|
6770
|
+
if (fromApiKeyConfig != null) {
|
|
6771
|
+
setValueByPath(toObject, ['apiKeyConfig'], apiKeyConfigToVertex(apiClient, fromApiKeyConfig));
|
|
6772
|
+
}
|
|
6773
|
+
const fromAuthType = getValueByPath(fromObject, ['authType']);
|
|
6774
|
+
if (fromAuthType != null) {
|
|
6775
|
+
setValueByPath(toObject, ['authType'], fromAuthType);
|
|
6776
|
+
}
|
|
6777
|
+
const fromGoogleServiceAccountConfig = getValueByPath(fromObject, [
|
|
6778
|
+
'googleServiceAccountConfig',
|
|
6779
|
+
]);
|
|
6780
|
+
if (fromGoogleServiceAccountConfig != null) {
|
|
6781
|
+
setValueByPath(toObject, ['googleServiceAccountConfig'], fromGoogleServiceAccountConfig);
|
|
6782
|
+
}
|
|
6783
|
+
const fromHttpBasicAuthConfig = getValueByPath(fromObject, [
|
|
6784
|
+
'httpBasicAuthConfig',
|
|
6785
|
+
]);
|
|
6786
|
+
if (fromHttpBasicAuthConfig != null) {
|
|
6787
|
+
setValueByPath(toObject, ['httpBasicAuthConfig'], fromHttpBasicAuthConfig);
|
|
6788
|
+
}
|
|
6789
|
+
const fromOauthConfig = getValueByPath(fromObject, ['oauthConfig']);
|
|
6790
|
+
if (fromOauthConfig != null) {
|
|
6791
|
+
setValueByPath(toObject, ['oauthConfig'], fromOauthConfig);
|
|
6792
|
+
}
|
|
6793
|
+
const fromOidcConfig = getValueByPath(fromObject, ['oidcConfig']);
|
|
6794
|
+
if (fromOidcConfig != null) {
|
|
6795
|
+
setValueByPath(toObject, ['oidcConfig'], fromOidcConfig);
|
|
6796
|
+
}
|
|
6797
|
+
return toObject;
|
|
6798
|
+
}
|
|
6799
|
+
function googleMapsToVertex(apiClient, fromObject) {
|
|
6800
|
+
const toObject = {};
|
|
6801
|
+
const fromAuthConfig = getValueByPath(fromObject, ['authConfig']);
|
|
6802
|
+
if (fromAuthConfig != null) {
|
|
6803
|
+
setValueByPath(toObject, ['authConfig'], authConfigToVertex(apiClient, fromAuthConfig));
|
|
6804
|
+
}
|
|
6805
|
+
return toObject;
|
|
6806
|
+
}
|
|
6074
6807
|
function toolToVertex(apiClient, fromObject) {
|
|
6075
6808
|
const toObject = {};
|
|
6076
6809
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
@@ -6087,6 +6820,16 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
6087
6820
|
if (fromGoogleSearchRetrieval != null) {
|
|
6088
6821
|
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex(apiClient, fromGoogleSearchRetrieval));
|
|
6089
6822
|
}
|
|
6823
|
+
const fromEnterpriseWebSearch = getValueByPath(fromObject, [
|
|
6824
|
+
'enterpriseWebSearch',
|
|
6825
|
+
]);
|
|
6826
|
+
if (fromEnterpriseWebSearch != null) {
|
|
6827
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
|
|
6828
|
+
}
|
|
6829
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
6830
|
+
if (fromGoogleMaps != null) {
|
|
6831
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex(apiClient, fromGoogleMaps));
|
|
6832
|
+
}
|
|
6090
6833
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
6091
6834
|
'codeExecution',
|
|
6092
6835
|
]);
|
|
@@ -6115,6 +6858,26 @@ function functionCallingConfigToVertex(apiClient, fromObject) {
|
|
|
6115
6858
|
}
|
|
6116
6859
|
return toObject;
|
|
6117
6860
|
}
|
|
6861
|
+
function latLngToVertex(apiClient, fromObject) {
|
|
6862
|
+
const toObject = {};
|
|
6863
|
+
const fromLatitude = getValueByPath(fromObject, ['latitude']);
|
|
6864
|
+
if (fromLatitude != null) {
|
|
6865
|
+
setValueByPath(toObject, ['latitude'], fromLatitude);
|
|
6866
|
+
}
|
|
6867
|
+
const fromLongitude = getValueByPath(fromObject, ['longitude']);
|
|
6868
|
+
if (fromLongitude != null) {
|
|
6869
|
+
setValueByPath(toObject, ['longitude'], fromLongitude);
|
|
6870
|
+
}
|
|
6871
|
+
return toObject;
|
|
6872
|
+
}
|
|
6873
|
+
function retrievalConfigToVertex(apiClient, fromObject) {
|
|
6874
|
+
const toObject = {};
|
|
6875
|
+
const fromLatLng = getValueByPath(fromObject, ['latLng']);
|
|
6876
|
+
if (fromLatLng != null) {
|
|
6877
|
+
setValueByPath(toObject, ['latLng'], latLngToVertex(apiClient, fromLatLng));
|
|
6878
|
+
}
|
|
6879
|
+
return toObject;
|
|
6880
|
+
}
|
|
6118
6881
|
function toolConfigToVertex(apiClient, fromObject) {
|
|
6119
6882
|
const toObject = {};
|
|
6120
6883
|
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
@@ -6123,6 +6886,12 @@ function toolConfigToVertex(apiClient, fromObject) {
|
|
|
6123
6886
|
if (fromFunctionCallingConfig != null) {
|
|
6124
6887
|
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex(apiClient, fromFunctionCallingConfig));
|
|
6125
6888
|
}
|
|
6889
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
6890
|
+
'retrievalConfig',
|
|
6891
|
+
]);
|
|
6892
|
+
if (fromRetrievalConfig != null) {
|
|
6893
|
+
setValueByPath(toObject, ['retrievalConfig'], retrievalConfigToVertex(apiClient, fromRetrievalConfig));
|
|
6894
|
+
}
|
|
6126
6895
|
return toObject;
|
|
6127
6896
|
}
|
|
6128
6897
|
function prebuiltVoiceConfigToVertex(apiClient, fromObject) {
|
|
@@ -6489,61 +7258,375 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
6489
7258
|
}
|
|
6490
7259
|
return toObject;
|
|
6491
7260
|
}
|
|
6492
|
-
function
|
|
7261
|
+
function imageToVertex(apiClient, fromObject) {
|
|
6493
7262
|
const toObject = {};
|
|
6494
|
-
const
|
|
6495
|
-
if (
|
|
6496
|
-
setValueByPath(toObject, ['
|
|
7263
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
7264
|
+
if (fromGcsUri != null) {
|
|
7265
|
+
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
6497
7266
|
}
|
|
6498
|
-
const
|
|
6499
|
-
if (
|
|
6500
|
-
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);
|
|
6501
7274
|
}
|
|
6502
7275
|
return toObject;
|
|
6503
7276
|
}
|
|
6504
|
-
function
|
|
7277
|
+
function maskReferenceConfigToVertex(apiClient, fromObject) {
|
|
6505
7278
|
const toObject = {};
|
|
6506
|
-
const
|
|
6507
|
-
if (
|
|
6508
|
-
setValueByPath(
|
|
7279
|
+
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
7280
|
+
if (fromMaskMode != null) {
|
|
7281
|
+
setValueByPath(toObject, ['maskMode'], fromMaskMode);
|
|
6509
7282
|
}
|
|
6510
|
-
const
|
|
6511
|
-
|
|
6512
|
-
|
|
7283
|
+
const fromSegmentationClasses = getValueByPath(fromObject, [
|
|
7284
|
+
'segmentationClasses',
|
|
7285
|
+
]);
|
|
7286
|
+
if (fromSegmentationClasses != null) {
|
|
7287
|
+
setValueByPath(toObject, ['maskClasses'], fromSegmentationClasses);
|
|
7288
|
+
}
|
|
7289
|
+
const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
|
|
7290
|
+
if (fromMaskDilation != null) {
|
|
7291
|
+
setValueByPath(toObject, ['dilation'], fromMaskDilation);
|
|
6513
7292
|
}
|
|
6514
7293
|
return toObject;
|
|
6515
7294
|
}
|
|
6516
|
-
function
|
|
7295
|
+
function controlReferenceConfigToVertex(apiClient, fromObject) {
|
|
6517
7296
|
const toObject = {};
|
|
6518
|
-
const
|
|
6519
|
-
if (
|
|
6520
|
-
setValueByPath(toObject, ['
|
|
7297
|
+
const fromControlType = getValueByPath(fromObject, ['controlType']);
|
|
7298
|
+
if (fromControlType != null) {
|
|
7299
|
+
setValueByPath(toObject, ['controlType'], fromControlType);
|
|
6521
7300
|
}
|
|
6522
|
-
const
|
|
6523
|
-
|
|
6524
|
-
|
|
7301
|
+
const fromEnableControlImageComputation = getValueByPath(fromObject, [
|
|
7302
|
+
'enableControlImageComputation',
|
|
7303
|
+
]);
|
|
7304
|
+
if (fromEnableControlImageComputation != null) {
|
|
7305
|
+
setValueByPath(toObject, ['computeControl'], fromEnableControlImageComputation);
|
|
6525
7306
|
}
|
|
6526
7307
|
return toObject;
|
|
6527
7308
|
}
|
|
6528
|
-
function
|
|
7309
|
+
function styleReferenceConfigToVertex(apiClient, fromObject) {
|
|
6529
7310
|
const toObject = {};
|
|
6530
|
-
const
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
if (fromConfig != null) {
|
|
6536
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
7311
|
+
const fromStyleDescription = getValueByPath(fromObject, [
|
|
7312
|
+
'styleDescription',
|
|
7313
|
+
]);
|
|
7314
|
+
if (fromStyleDescription != null) {
|
|
7315
|
+
setValueByPath(toObject, ['styleDescription'], fromStyleDescription);
|
|
6537
7316
|
}
|
|
6538
7317
|
return toObject;
|
|
6539
7318
|
}
|
|
6540
|
-
function
|
|
7319
|
+
function subjectReferenceConfigToVertex(apiClient, fromObject) {
|
|
6541
7320
|
const toObject = {};
|
|
6542
|
-
const
|
|
6543
|
-
|
|
7321
|
+
const fromSubjectType = getValueByPath(fromObject, ['subjectType']);
|
|
7322
|
+
if (fromSubjectType != null) {
|
|
7323
|
+
setValueByPath(toObject, ['subjectType'], fromSubjectType);
|
|
7324
|
+
}
|
|
7325
|
+
const fromSubjectDescription = getValueByPath(fromObject, [
|
|
7326
|
+
'subjectDescription',
|
|
6544
7327
|
]);
|
|
6545
|
-
if (
|
|
6546
|
-
setValueByPath(
|
|
7328
|
+
if (fromSubjectDescription != null) {
|
|
7329
|
+
setValueByPath(toObject, ['subjectDescription'], fromSubjectDescription);
|
|
7330
|
+
}
|
|
7331
|
+
return toObject;
|
|
7332
|
+
}
|
|
7333
|
+
function referenceImageAPIInternalToVertex(apiClient, fromObject) {
|
|
7334
|
+
const toObject = {};
|
|
7335
|
+
const fromReferenceImage = getValueByPath(fromObject, [
|
|
7336
|
+
'referenceImage',
|
|
7337
|
+
]);
|
|
7338
|
+
if (fromReferenceImage != null) {
|
|
7339
|
+
setValueByPath(toObject, ['referenceImage'], imageToVertex(apiClient, fromReferenceImage));
|
|
7340
|
+
}
|
|
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']);
|
|
7618
|
+
if (fromConfig != null) {
|
|
7619
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
7620
|
+
}
|
|
7621
|
+
return toObject;
|
|
7622
|
+
}
|
|
7623
|
+
function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
7624
|
+
const toObject = {};
|
|
7625
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
7626
|
+
'systemInstruction',
|
|
7627
|
+
]);
|
|
7628
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
7629
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
6547
7630
|
}
|
|
6548
7631
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
6549
7632
|
if (parentObject !== undefined && fromTools != null) {
|
|
@@ -6607,22 +7690,6 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
6607
7690
|
}
|
|
6608
7691
|
return toObject;
|
|
6609
7692
|
}
|
|
6610
|
-
function imageToVertex(apiClient, fromObject) {
|
|
6611
|
-
const toObject = {};
|
|
6612
|
-
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
6613
|
-
if (fromGcsUri != null) {
|
|
6614
|
-
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
6615
|
-
}
|
|
6616
|
-
const fromImageBytes = getValueByPath(fromObject, ['imageBytes']);
|
|
6617
|
-
if (fromImageBytes != null) {
|
|
6618
|
-
setValueByPath(toObject, ['bytesBase64Encoded'], tBytes(apiClient, fromImageBytes));
|
|
6619
|
-
}
|
|
6620
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6621
|
-
if (fromMimeType != null) {
|
|
6622
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
6623
|
-
}
|
|
6624
|
-
return toObject;
|
|
6625
|
-
}
|
|
6626
7693
|
function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6627
7694
|
const toObject = {};
|
|
6628
7695
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -6701,12 +7768,28 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
|
6701
7768
|
}
|
|
6702
7769
|
return toObject;
|
|
6703
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
|
+
}
|
|
6704
7783
|
function partFromMldev(apiClient, fromObject) {
|
|
6705
7784
|
const toObject = {};
|
|
6706
7785
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
6707
7786
|
if (fromThought != null) {
|
|
6708
7787
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
6709
7788
|
}
|
|
7789
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7790
|
+
if (fromInlineData != null) {
|
|
7791
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev(apiClient, fromInlineData));
|
|
7792
|
+
}
|
|
6710
7793
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6711
7794
|
'codeExecutionResult',
|
|
6712
7795
|
]);
|
|
@@ -6733,10 +7816,6 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
6733
7816
|
if (fromFunctionResponse != null) {
|
|
6734
7817
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
6735
7818
|
}
|
|
6736
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
6737
|
-
if (fromInlineData != null) {
|
|
6738
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
6739
|
-
}
|
|
6740
7819
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
6741
7820
|
if (fromText != null) {
|
|
6742
7821
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7011,6 +8090,26 @@ function modelFromMldev(apiClient, fromObject) {
|
|
|
7011
8090
|
}
|
|
7012
8091
|
return toObject;
|
|
7013
8092
|
}
|
|
8093
|
+
function listModelsResponseFromMldev(apiClient, fromObject) {
|
|
8094
|
+
const toObject = {};
|
|
8095
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
8096
|
+
'nextPageToken',
|
|
8097
|
+
]);
|
|
8098
|
+
if (fromNextPageToken != null) {
|
|
8099
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
8100
|
+
}
|
|
8101
|
+
const fromModels = getValueByPath(fromObject, ['_self']);
|
|
8102
|
+
if (fromModels != null) {
|
|
8103
|
+
let transformedList = tExtractModels(apiClient, fromModels);
|
|
8104
|
+
if (Array.isArray(transformedList)) {
|
|
8105
|
+
transformedList = transformedList.map((item) => {
|
|
8106
|
+
return modelFromMldev(apiClient, item);
|
|
8107
|
+
});
|
|
8108
|
+
}
|
|
8109
|
+
setValueByPath(toObject, ['models'], transformedList);
|
|
8110
|
+
}
|
|
8111
|
+
return toObject;
|
|
8112
|
+
}
|
|
7014
8113
|
function deleteModelResponseFromMldev() {
|
|
7015
8114
|
const toObject = {};
|
|
7016
8115
|
return toObject;
|
|
@@ -7111,6 +8210,22 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
|
|
|
7111
8210
|
}
|
|
7112
8211
|
return toObject;
|
|
7113
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
|
+
}
|
|
7114
8229
|
function partFromVertex(apiClient, fromObject) {
|
|
7115
8230
|
const toObject = {};
|
|
7116
8231
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7123,6 +8238,10 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
7123
8238
|
if (fromThought != null) {
|
|
7124
8239
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
7125
8240
|
}
|
|
8241
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
8242
|
+
if (fromInlineData != null) {
|
|
8243
|
+
setValueByPath(toObject, ['inlineData'], blobFromVertex(apiClient, fromInlineData));
|
|
8244
|
+
}
|
|
7126
8245
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7127
8246
|
'codeExecutionResult',
|
|
7128
8247
|
]);
|
|
@@ -7149,10 +8268,6 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
7149
8268
|
if (fromFunctionResponse != null) {
|
|
7150
8269
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
7151
8270
|
}
|
|
7152
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7153
|
-
if (fromInlineData != null) {
|
|
7154
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
7155
|
-
}
|
|
7156
8271
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
7157
8272
|
if (fromText != null) {
|
|
7158
8273
|
setValueByPath(toObject, ['text'], fromText);
|
|
@@ -7412,6 +8527,38 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
7412
8527
|
}
|
|
7413
8528
|
return toObject;
|
|
7414
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
|
+
}
|
|
7415
8562
|
function endpointFromVertex(apiClient, fromObject) {
|
|
7416
8563
|
const toObject = {};
|
|
7417
8564
|
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
@@ -7445,6 +8592,22 @@ function tunedModelInfoFromVertex(apiClient, fromObject) {
|
|
|
7445
8592
|
}
|
|
7446
8593
|
return toObject;
|
|
7447
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
|
+
}
|
|
7448
8611
|
function modelFromVertex(apiClient, fromObject) {
|
|
7449
8612
|
const toObject = {};
|
|
7450
8613
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -7481,6 +8644,42 @@ function modelFromVertex(apiClient, fromObject) {
|
|
|
7481
8644
|
if (fromTunedModelInfo != null) {
|
|
7482
8645
|
setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
|
|
7483
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
|
+
}
|
|
8663
|
+
return toObject;
|
|
8664
|
+
}
|
|
8665
|
+
function listModelsResponseFromVertex(apiClient, fromObject) {
|
|
8666
|
+
const toObject = {};
|
|
8667
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
8668
|
+
'nextPageToken',
|
|
8669
|
+
]);
|
|
8670
|
+
if (fromNextPageToken != null) {
|
|
8671
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
8672
|
+
}
|
|
8673
|
+
const fromModels = getValueByPath(fromObject, ['_self']);
|
|
8674
|
+
if (fromModels != null) {
|
|
8675
|
+
let transformedList = tExtractModels(apiClient, fromModels);
|
|
8676
|
+
if (Array.isArray(transformedList)) {
|
|
8677
|
+
transformedList = transformedList.map((item) => {
|
|
8678
|
+
return modelFromVertex(apiClient, item);
|
|
8679
|
+
});
|
|
8680
|
+
}
|
|
8681
|
+
setValueByPath(toObject, ['models'], transformedList);
|
|
8682
|
+
}
|
|
7484
8683
|
return toObject;
|
|
7485
8684
|
}
|
|
7486
8685
|
function deleteModelResponseFromVertex() {
|
|
@@ -7600,7 +8799,7 @@ const FUNCTION_RESPONSE_REQUIRES_ID = 'FunctionResponse request must have an `id
|
|
|
7600
8799
|
* @param event The MessageEvent from the WebSocket.
|
|
7601
8800
|
*/
|
|
7602
8801
|
async function handleWebSocketMessage(apiClient, onmessage, event) {
|
|
7603
|
-
|
|
8802
|
+
const serverMessage = new LiveServerMessage();
|
|
7604
8803
|
let data;
|
|
7605
8804
|
if (event.data instanceof Blob) {
|
|
7606
8805
|
data = JSON.parse(await event.data.text());
|
|
@@ -7609,10 +8808,12 @@ async function handleWebSocketMessage(apiClient, onmessage, event) {
|
|
|
7609
8808
|
data = JSON.parse(event.data);
|
|
7610
8809
|
}
|
|
7611
8810
|
if (apiClient.isVertexAI()) {
|
|
7612
|
-
|
|
8811
|
+
const resp = liveServerMessageFromVertex(apiClient, data);
|
|
8812
|
+
Object.assign(serverMessage, resp);
|
|
7613
8813
|
}
|
|
7614
8814
|
else {
|
|
7615
|
-
|
|
8815
|
+
const resp = liveServerMessageFromMldev(apiClient, data);
|
|
8816
|
+
Object.assign(serverMessage, resp);
|
|
7616
8817
|
}
|
|
7617
8818
|
onmessage(serverMessage);
|
|
7618
8819
|
}
|
|
@@ -8069,9 +9270,7 @@ class Models extends BaseModule {
|
|
|
8069
9270
|
/**
|
|
8070
9271
|
* Generates an image based on a text description and configuration.
|
|
8071
9272
|
*
|
|
8072
|
-
* @param
|
|
8073
|
-
* @param prompt - A text description of the image to generate.
|
|
8074
|
-
* @param [config] - The config for image generation.
|
|
9273
|
+
* @param params - The parameters for generating images.
|
|
8075
9274
|
* @return The response from the API.
|
|
8076
9275
|
*
|
|
8077
9276
|
* @example
|
|
@@ -8119,6 +9318,97 @@ class Models extends BaseModule {
|
|
|
8119
9318
|
return response;
|
|
8120
9319
|
});
|
|
8121
9320
|
};
|
|
9321
|
+
this.list = async (params) => {
|
|
9322
|
+
var _a;
|
|
9323
|
+
const defaultConfig = {
|
|
9324
|
+
queryBase: true,
|
|
9325
|
+
};
|
|
9326
|
+
const actualConfig = Object.assign(Object.assign({}, defaultConfig), params === null || params === void 0 ? void 0 : params.config);
|
|
9327
|
+
const actualParams = {
|
|
9328
|
+
config: actualConfig,
|
|
9329
|
+
};
|
|
9330
|
+
if (this.apiClient.isVertexAI()) {
|
|
9331
|
+
if (!actualParams.config.queryBase) {
|
|
9332
|
+
if ((_a = actualParams.config) === null || _a === void 0 ? void 0 : _a.filter) {
|
|
9333
|
+
throw new Error('Filtering tuned models list for Vertex AI is not currently supported');
|
|
9334
|
+
}
|
|
9335
|
+
else {
|
|
9336
|
+
actualParams.config.filter = 'labels.tune-type:*';
|
|
9337
|
+
}
|
|
9338
|
+
}
|
|
9339
|
+
}
|
|
9340
|
+
return new Pager(PagedItem.PAGED_ITEM_MODELS, (x) => this.listInternal(x), await this.listInternal(actualParams), actualParams);
|
|
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
|
+
};
|
|
8122
9412
|
}
|
|
8123
9413
|
async generateContentInternal(params) {
|
|
8124
9414
|
var _a, _b, _c, _d;
|
|
@@ -8420,6 +9710,76 @@ class Models extends BaseModule {
|
|
|
8420
9710
|
});
|
|
8421
9711
|
}
|
|
8422
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
|
+
}
|
|
8423
9783
|
/**
|
|
8424
9784
|
* Fetches information about a model by name.
|
|
8425
9785
|
*
|
|
@@ -8482,6 +9842,64 @@ class Models extends BaseModule {
|
|
|
8482
9842
|
});
|
|
8483
9843
|
}
|
|
8484
9844
|
}
|
|
9845
|
+
async listInternal(params) {
|
|
9846
|
+
var _a, _b, _c, _d;
|
|
9847
|
+
let response;
|
|
9848
|
+
let path = '';
|
|
9849
|
+
let queryParams = {};
|
|
9850
|
+
if (this.apiClient.isVertexAI()) {
|
|
9851
|
+
const body = listModelsParametersToVertex(this.apiClient, params);
|
|
9852
|
+
path = formatMap('{models_url}', body['_url']);
|
|
9853
|
+
queryParams = body['_query'];
|
|
9854
|
+
delete body['config'];
|
|
9855
|
+
delete body['_url'];
|
|
9856
|
+
delete body['_query'];
|
|
9857
|
+
response = this.apiClient
|
|
9858
|
+
.request({
|
|
9859
|
+
path: path,
|
|
9860
|
+
queryParams: queryParams,
|
|
9861
|
+
body: JSON.stringify(body),
|
|
9862
|
+
httpMethod: 'GET',
|
|
9863
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9864
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9865
|
+
})
|
|
9866
|
+
.then((httpResponse) => {
|
|
9867
|
+
return httpResponse.json();
|
|
9868
|
+
});
|
|
9869
|
+
return response.then((apiResponse) => {
|
|
9870
|
+
const resp = listModelsResponseFromVertex(this.apiClient, apiResponse);
|
|
9871
|
+
const typedResp = new ListModelsResponse();
|
|
9872
|
+
Object.assign(typedResp, resp);
|
|
9873
|
+
return typedResp;
|
|
9874
|
+
});
|
|
9875
|
+
}
|
|
9876
|
+
else {
|
|
9877
|
+
const body = listModelsParametersToMldev(this.apiClient, params);
|
|
9878
|
+
path = formatMap('{models_url}', body['_url']);
|
|
9879
|
+
queryParams = body['_query'];
|
|
9880
|
+
delete body['config'];
|
|
9881
|
+
delete body['_url'];
|
|
9882
|
+
delete body['_query'];
|
|
9883
|
+
response = this.apiClient
|
|
9884
|
+
.request({
|
|
9885
|
+
path: path,
|
|
9886
|
+
queryParams: queryParams,
|
|
9887
|
+
body: JSON.stringify(body),
|
|
9888
|
+
httpMethod: 'GET',
|
|
9889
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
9890
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
9891
|
+
})
|
|
9892
|
+
.then((httpResponse) => {
|
|
9893
|
+
return httpResponse.json();
|
|
9894
|
+
});
|
|
9895
|
+
return response.then((apiResponse) => {
|
|
9896
|
+
const resp = listModelsResponseFromMldev(this.apiClient, apiResponse);
|
|
9897
|
+
const typedResp = new ListModelsResponse();
|
|
9898
|
+
Object.assign(typedResp, resp);
|
|
9899
|
+
return typedResp;
|
|
9900
|
+
});
|
|
9901
|
+
}
|
|
9902
|
+
}
|
|
8485
9903
|
/**
|
|
8486
9904
|
* Updates a tuned model by its name.
|
|
8487
9905
|
*
|
|
@@ -9262,6 +10680,10 @@ function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
9262
10680
|
if (fromLearningRateMultiplier != null) {
|
|
9263
10681
|
setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
9264
10682
|
}
|
|
10683
|
+
if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
|
|
10684
|
+
undefined) {
|
|
10685
|
+
throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
|
|
10686
|
+
}
|
|
9265
10687
|
if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
|
|
9266
10688
|
throw new Error('adapterSize parameter is not supported in Gemini API.');
|
|
9267
10689
|
}
|
|
@@ -9376,6 +10798,12 @@ function createTuningJobConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
9376
10798
|
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
9377
10799
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
9378
10800
|
}
|
|
10801
|
+
const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
|
|
10802
|
+
'exportLastCheckpointOnly',
|
|
10803
|
+
]);
|
|
10804
|
+
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
10805
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
10806
|
+
}
|
|
9379
10807
|
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
9380
10808
|
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
9381
10809
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
@@ -9528,6 +10956,26 @@ function operationFromMldev(apiClient, fromObject) {
|
|
|
9528
10956
|
}
|
|
9529
10957
|
return toObject;
|
|
9530
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
|
+
}
|
|
9531
10979
|
function tunedModelFromVertex(apiClient, fromObject) {
|
|
9532
10980
|
const toObject = {};
|
|
9533
10981
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -9538,6 +10986,16 @@ function tunedModelFromVertex(apiClient, fromObject) {
|
|
|
9538
10986
|
if (fromEndpoint != null) {
|
|
9539
10987
|
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
9540
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
|
+
}
|
|
9541
10999
|
return toObject;
|
|
9542
11000
|
}
|
|
9543
11001
|
function tuningJobFromVertex(apiClient, fromObject) {
|
|
@@ -9972,6 +11430,7 @@ class GoogleGenAI {
|
|
|
9972
11430
|
httpOptions: options.httpOptions,
|
|
9973
11431
|
userAgentExtra: LANGUAGE_LABEL_PREFIX + 'cross',
|
|
9974
11432
|
uploader: new CrossUploader(),
|
|
11433
|
+
downloader: new CrossDownloader(),
|
|
9975
11434
|
});
|
|
9976
11435
|
this.models = new Models(this.apiClient);
|
|
9977
11436
|
this.live = new Live(this.apiClient, auth, new CrossWebSocketFactory());
|
|
@@ -9983,5 +11442,5 @@ class GoogleGenAI {
|
|
|
9983
11442
|
}
|
|
9984
11443
|
}
|
|
9985
11444
|
|
|
9986
|
-
export { ActivityHandling, AdapterSize, 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, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, 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 };
|
|
9987
11446
|
//# sourceMappingURL=index.mjs.map
|