@google/genai 0.10.0 → 0.12.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/dist/genai.d.ts +576 -39
- package/dist/index.js +1320 -894
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1319 -895
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +1320 -894
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +576 -39
- package/dist/web/index.mjs +1319 -895
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +576 -39
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -468,6 +468,20 @@ function tCachedContentName(apiClient, name) {
|
|
|
468
468
|
}
|
|
469
469
|
return resourceName(apiClient, name, 'cachedContents');
|
|
470
470
|
}
|
|
471
|
+
function tTuningJobStatus(apiClient, status) {
|
|
472
|
+
switch (status) {
|
|
473
|
+
case 'STATE_UNSPECIFIED':
|
|
474
|
+
return 'JOB_STATE_UNSPECIFIED';
|
|
475
|
+
case 'CREATING':
|
|
476
|
+
return 'JOB_STATE_RUNNING';
|
|
477
|
+
case 'ACTIVE':
|
|
478
|
+
return 'JOB_STATE_SUCCEEDED';
|
|
479
|
+
case 'FAILED':
|
|
480
|
+
return 'JOB_STATE_FAILED';
|
|
481
|
+
default:
|
|
482
|
+
return status;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
471
485
|
function tBytes(apiClient, fromImageBytes) {
|
|
472
486
|
if (typeof fromImageBytes !== 'string') {
|
|
473
487
|
throw new Error('fromImageBytes must be a string');
|
|
@@ -540,14 +554,13 @@ function contentToMldev$2(apiClient, fromObject) {
|
|
|
540
554
|
const toObject = {};
|
|
541
555
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
542
556
|
if (fromParts != null) {
|
|
543
|
-
|
|
544
|
-
|
|
557
|
+
let transformedList = fromParts;
|
|
558
|
+
if (Array.isArray(transformedList)) {
|
|
559
|
+
transformedList = transformedList.map((item) => {
|
|
545
560
|
return partToMldev$2(apiClient, item);
|
|
546
|
-
})
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
561
|
+
});
|
|
550
562
|
}
|
|
563
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
551
564
|
}
|
|
552
565
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
553
566
|
if (fromRole != null) {
|
|
@@ -555,25 +568,6 @@ function contentToMldev$2(apiClient, fromObject) {
|
|
|
555
568
|
}
|
|
556
569
|
return toObject;
|
|
557
570
|
}
|
|
558
|
-
function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
559
|
-
const toObject = {};
|
|
560
|
-
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
561
|
-
throw new Error('response parameter is not supported in Gemini API.');
|
|
562
|
-
}
|
|
563
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
564
|
-
if (fromDescription != null) {
|
|
565
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
566
|
-
}
|
|
567
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
568
|
-
if (fromName != null) {
|
|
569
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
570
|
-
}
|
|
571
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
572
|
-
if (fromParameters != null) {
|
|
573
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
574
|
-
}
|
|
575
|
-
return toObject;
|
|
576
|
-
}
|
|
577
571
|
function googleSearchToMldev$2() {
|
|
578
572
|
const toObject = {};
|
|
579
573
|
return toObject;
|
|
@@ -604,19 +598,6 @@ function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
|
|
|
604
598
|
}
|
|
605
599
|
function toolToMldev$2(apiClient, fromObject) {
|
|
606
600
|
const toObject = {};
|
|
607
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
608
|
-
'functionDeclarations',
|
|
609
|
-
]);
|
|
610
|
-
if (fromFunctionDeclarations != null) {
|
|
611
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
612
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
613
|
-
return functionDeclarationToMldev$2(apiClient, item);
|
|
614
|
-
}));
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
601
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
621
602
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
622
603
|
}
|
|
@@ -636,6 +617,12 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
636
617
|
if (fromCodeExecution != null) {
|
|
637
618
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
638
619
|
}
|
|
620
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
621
|
+
'functionDeclarations',
|
|
622
|
+
]);
|
|
623
|
+
if (fromFunctionDeclarations != null) {
|
|
624
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
625
|
+
}
|
|
639
626
|
return toObject;
|
|
640
627
|
}
|
|
641
628
|
function functionCallingConfigToMldev$1(apiClient, fromObject) {
|
|
@@ -678,14 +665,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
678
665
|
}
|
|
679
666
|
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
680
667
|
if (parentObject !== undefined && fromContents != null) {
|
|
681
|
-
|
|
682
|
-
|
|
668
|
+
let transformedList = tContents(apiClient, fromContents);
|
|
669
|
+
if (Array.isArray(transformedList)) {
|
|
670
|
+
transformedList = transformedList.map((item) => {
|
|
683
671
|
return contentToMldev$2(apiClient, item);
|
|
684
|
-
})
|
|
685
|
-
}
|
|
686
|
-
else {
|
|
687
|
-
setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
|
|
672
|
+
});
|
|
688
673
|
}
|
|
674
|
+
setValueByPath(parentObject, ['contents'], transformedList);
|
|
689
675
|
}
|
|
690
676
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
691
677
|
'systemInstruction',
|
|
@@ -695,14 +681,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
695
681
|
}
|
|
696
682
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
697
683
|
if (parentObject !== undefined && fromTools != null) {
|
|
698
|
-
|
|
699
|
-
|
|
684
|
+
let transformedList = fromTools;
|
|
685
|
+
if (Array.isArray(transformedList)) {
|
|
686
|
+
transformedList = transformedList.map((item) => {
|
|
700
687
|
return toolToMldev$2(apiClient, item);
|
|
701
|
-
})
|
|
702
|
-
}
|
|
703
|
-
else {
|
|
704
|
-
setValueByPath(parentObject, ['tools'], fromTools);
|
|
688
|
+
});
|
|
705
689
|
}
|
|
690
|
+
setValueByPath(parentObject, ['tools'], transformedList);
|
|
706
691
|
}
|
|
707
692
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
708
693
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
@@ -842,14 +827,13 @@ function contentToVertex$2(apiClient, fromObject) {
|
|
|
842
827
|
const toObject = {};
|
|
843
828
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
844
829
|
if (fromParts != null) {
|
|
845
|
-
|
|
846
|
-
|
|
830
|
+
let transformedList = fromParts;
|
|
831
|
+
if (Array.isArray(transformedList)) {
|
|
832
|
+
transformedList = transformedList.map((item) => {
|
|
847
833
|
return partToVertex$2(apiClient, item);
|
|
848
|
-
})
|
|
849
|
-
}
|
|
850
|
-
else {
|
|
851
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
834
|
+
});
|
|
852
835
|
}
|
|
836
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
853
837
|
}
|
|
854
838
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
855
839
|
if (fromRole != null) {
|
|
@@ -857,124 +841,6 @@ function contentToVertex$2(apiClient, fromObject) {
|
|
|
857
841
|
}
|
|
858
842
|
return toObject;
|
|
859
843
|
}
|
|
860
|
-
function schemaToVertex$2(apiClient, fromObject) {
|
|
861
|
-
const toObject = {};
|
|
862
|
-
const fromExample = getValueByPath(fromObject, ['example']);
|
|
863
|
-
if (fromExample != null) {
|
|
864
|
-
setValueByPath(toObject, ['example'], fromExample);
|
|
865
|
-
}
|
|
866
|
-
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
867
|
-
if (fromPattern != null) {
|
|
868
|
-
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
869
|
-
}
|
|
870
|
-
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
871
|
-
if (fromDefault != null) {
|
|
872
|
-
setValueByPath(toObject, ['default'], fromDefault);
|
|
873
|
-
}
|
|
874
|
-
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
875
|
-
if (fromMaxLength != null) {
|
|
876
|
-
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
877
|
-
}
|
|
878
|
-
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
879
|
-
if (fromMinLength != null) {
|
|
880
|
-
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
881
|
-
}
|
|
882
|
-
const fromMinProperties = getValueByPath(fromObject, [
|
|
883
|
-
'minProperties',
|
|
884
|
-
]);
|
|
885
|
-
if (fromMinProperties != null) {
|
|
886
|
-
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
887
|
-
}
|
|
888
|
-
const fromMaxProperties = getValueByPath(fromObject, [
|
|
889
|
-
'maxProperties',
|
|
890
|
-
]);
|
|
891
|
-
if (fromMaxProperties != null) {
|
|
892
|
-
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
893
|
-
}
|
|
894
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
895
|
-
if (fromAnyOf != null) {
|
|
896
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
897
|
-
}
|
|
898
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
899
|
-
if (fromDescription != null) {
|
|
900
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
901
|
-
}
|
|
902
|
-
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
903
|
-
if (fromEnum != null) {
|
|
904
|
-
setValueByPath(toObject, ['enum'], fromEnum);
|
|
905
|
-
}
|
|
906
|
-
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
907
|
-
if (fromFormat != null) {
|
|
908
|
-
setValueByPath(toObject, ['format'], fromFormat);
|
|
909
|
-
}
|
|
910
|
-
const fromItems = getValueByPath(fromObject, ['items']);
|
|
911
|
-
if (fromItems != null) {
|
|
912
|
-
setValueByPath(toObject, ['items'], fromItems);
|
|
913
|
-
}
|
|
914
|
-
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
915
|
-
if (fromMaxItems != null) {
|
|
916
|
-
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
917
|
-
}
|
|
918
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
919
|
-
if (fromMaximum != null) {
|
|
920
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
921
|
-
}
|
|
922
|
-
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
923
|
-
if (fromMinItems != null) {
|
|
924
|
-
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
925
|
-
}
|
|
926
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
927
|
-
if (fromMinimum != null) {
|
|
928
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
929
|
-
}
|
|
930
|
-
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
931
|
-
if (fromNullable != null) {
|
|
932
|
-
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
933
|
-
}
|
|
934
|
-
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
935
|
-
if (fromProperties != null) {
|
|
936
|
-
setValueByPath(toObject, ['properties'], fromProperties);
|
|
937
|
-
}
|
|
938
|
-
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
939
|
-
'propertyOrdering',
|
|
940
|
-
]);
|
|
941
|
-
if (fromPropertyOrdering != null) {
|
|
942
|
-
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
943
|
-
}
|
|
944
|
-
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
945
|
-
if (fromRequired != null) {
|
|
946
|
-
setValueByPath(toObject, ['required'], fromRequired);
|
|
947
|
-
}
|
|
948
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
949
|
-
if (fromTitle != null) {
|
|
950
|
-
setValueByPath(toObject, ['title'], fromTitle);
|
|
951
|
-
}
|
|
952
|
-
const fromType = getValueByPath(fromObject, ['type']);
|
|
953
|
-
if (fromType != null) {
|
|
954
|
-
setValueByPath(toObject, ['type'], fromType);
|
|
955
|
-
}
|
|
956
|
-
return toObject;
|
|
957
|
-
}
|
|
958
|
-
function functionDeclarationToVertex$2(apiClient, fromObject) {
|
|
959
|
-
const toObject = {};
|
|
960
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
961
|
-
if (fromResponse != null) {
|
|
962
|
-
setValueByPath(toObject, ['response'], schemaToVertex$2(apiClient, fromResponse));
|
|
963
|
-
}
|
|
964
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
965
|
-
if (fromDescription != null) {
|
|
966
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
967
|
-
}
|
|
968
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
969
|
-
if (fromName != null) {
|
|
970
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
971
|
-
}
|
|
972
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
973
|
-
if (fromParameters != null) {
|
|
974
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
975
|
-
}
|
|
976
|
-
return toObject;
|
|
977
|
-
}
|
|
978
844
|
function googleSearchToVertex$2() {
|
|
979
845
|
const toObject = {};
|
|
980
846
|
return toObject;
|
|
@@ -1005,19 +871,6 @@ function googleSearchRetrievalToVertex$2(apiClient, fromObject) {
|
|
|
1005
871
|
}
|
|
1006
872
|
function toolToVertex$2(apiClient, fromObject) {
|
|
1007
873
|
const toObject = {};
|
|
1008
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
1009
|
-
'functionDeclarations',
|
|
1010
|
-
]);
|
|
1011
|
-
if (fromFunctionDeclarations != null) {
|
|
1012
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
1013
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
1014
|
-
return functionDeclarationToVertex$2(apiClient, item);
|
|
1015
|
-
}));
|
|
1016
|
-
}
|
|
1017
|
-
else {
|
|
1018
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
874
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
1022
875
|
if (fromRetrieval != null) {
|
|
1023
876
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
@@ -1038,6 +891,12 @@ function toolToVertex$2(apiClient, fromObject) {
|
|
|
1038
891
|
if (fromCodeExecution != null) {
|
|
1039
892
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
1040
893
|
}
|
|
894
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
895
|
+
'functionDeclarations',
|
|
896
|
+
]);
|
|
897
|
+
if (fromFunctionDeclarations != null) {
|
|
898
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
899
|
+
}
|
|
1041
900
|
return toObject;
|
|
1042
901
|
}
|
|
1043
902
|
function functionCallingConfigToVertex$1(apiClient, fromObject) {
|
|
@@ -1080,14 +939,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
|
|
|
1080
939
|
}
|
|
1081
940
|
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
1082
941
|
if (parentObject !== undefined && fromContents != null) {
|
|
1083
|
-
|
|
1084
|
-
|
|
942
|
+
let transformedList = tContents(apiClient, fromContents);
|
|
943
|
+
if (Array.isArray(transformedList)) {
|
|
944
|
+
transformedList = transformedList.map((item) => {
|
|
1085
945
|
return contentToVertex$2(apiClient, item);
|
|
1086
|
-
})
|
|
1087
|
-
}
|
|
1088
|
-
else {
|
|
1089
|
-
setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
|
|
946
|
+
});
|
|
1090
947
|
}
|
|
948
|
+
setValueByPath(parentObject, ['contents'], transformedList);
|
|
1091
949
|
}
|
|
1092
950
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
1093
951
|
'systemInstruction',
|
|
@@ -1097,14 +955,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
|
|
|
1097
955
|
}
|
|
1098
956
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
1099
957
|
if (parentObject !== undefined && fromTools != null) {
|
|
1100
|
-
|
|
1101
|
-
|
|
958
|
+
let transformedList = fromTools;
|
|
959
|
+
if (Array.isArray(transformedList)) {
|
|
960
|
+
transformedList = transformedList.map((item) => {
|
|
1102
961
|
return toolToVertex$2(apiClient, item);
|
|
1103
|
-
})
|
|
1104
|
-
}
|
|
1105
|
-
else {
|
|
1106
|
-
setValueByPath(parentObject, ['tools'], fromTools);
|
|
962
|
+
});
|
|
1107
963
|
}
|
|
964
|
+
setValueByPath(parentObject, ['tools'], transformedList);
|
|
1108
965
|
}
|
|
1109
966
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
1110
967
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
@@ -1242,14 +1099,13 @@ function listCachedContentsResponseFromMldev(apiClient, fromObject) {
|
|
|
1242
1099
|
'cachedContents',
|
|
1243
1100
|
]);
|
|
1244
1101
|
if (fromCachedContents != null) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1102
|
+
let transformedList = fromCachedContents;
|
|
1103
|
+
if (Array.isArray(transformedList)) {
|
|
1104
|
+
transformedList = transformedList.map((item) => {
|
|
1247
1105
|
return cachedContentFromMldev(apiClient, item);
|
|
1248
|
-
})
|
|
1249
|
-
}
|
|
1250
|
-
else {
|
|
1251
|
-
setValueByPath(toObject, ['cachedContents'], fromCachedContents);
|
|
1106
|
+
});
|
|
1252
1107
|
}
|
|
1108
|
+
setValueByPath(toObject, ['cachedContents'], transformedList);
|
|
1253
1109
|
}
|
|
1254
1110
|
return toObject;
|
|
1255
1111
|
}
|
|
@@ -1303,14 +1159,13 @@ function listCachedContentsResponseFromVertex(apiClient, fromObject) {
|
|
|
1303
1159
|
'cachedContents',
|
|
1304
1160
|
]);
|
|
1305
1161
|
if (fromCachedContents != null) {
|
|
1306
|
-
|
|
1307
|
-
|
|
1162
|
+
let transformedList = fromCachedContents;
|
|
1163
|
+
if (Array.isArray(transformedList)) {
|
|
1164
|
+
transformedList = transformedList.map((item) => {
|
|
1308
1165
|
return cachedContentFromVertex(apiClient, item);
|
|
1309
|
-
})
|
|
1310
|
-
}
|
|
1311
|
-
else {
|
|
1312
|
-
setValueByPath(toObject, ['cachedContents'], fromCachedContents);
|
|
1166
|
+
});
|
|
1313
1167
|
}
|
|
1168
|
+
setValueByPath(toObject, ['cachedContents'], transformedList);
|
|
1314
1169
|
}
|
|
1315
1170
|
return toObject;
|
|
1316
1171
|
}
|
|
@@ -1512,17 +1367,6 @@ var Language;
|
|
|
1512
1367
|
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
1513
1368
|
Language["PYTHON"] = "PYTHON";
|
|
1514
1369
|
})(Language || (Language = {}));
|
|
1515
|
-
/** Optional. The type of the data. */
|
|
1516
|
-
var Type;
|
|
1517
|
-
(function (Type) {
|
|
1518
|
-
Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
|
|
1519
|
-
Type["STRING"] = "STRING";
|
|
1520
|
-
Type["NUMBER"] = "NUMBER";
|
|
1521
|
-
Type["INTEGER"] = "INTEGER";
|
|
1522
|
-
Type["BOOLEAN"] = "BOOLEAN";
|
|
1523
|
-
Type["ARRAY"] = "ARRAY";
|
|
1524
|
-
Type["OBJECT"] = "OBJECT";
|
|
1525
|
-
})(Type || (Type = {}));
|
|
1526
1370
|
/** Required. Harm category. */
|
|
1527
1371
|
var HarmCategory;
|
|
1528
1372
|
(function (HarmCategory) {
|
|
@@ -1556,6 +1400,17 @@ var Mode;
|
|
|
1556
1400
|
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1557
1401
|
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1558
1402
|
})(Mode || (Mode = {}));
|
|
1403
|
+
/** Optional. The type of the data. */
|
|
1404
|
+
var Type;
|
|
1405
|
+
(function (Type) {
|
|
1406
|
+
Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
|
|
1407
|
+
Type["STRING"] = "STRING";
|
|
1408
|
+
Type["NUMBER"] = "NUMBER";
|
|
1409
|
+
Type["INTEGER"] = "INTEGER";
|
|
1410
|
+
Type["BOOLEAN"] = "BOOLEAN";
|
|
1411
|
+
Type["ARRAY"] = "ARRAY";
|
|
1412
|
+
Type["OBJECT"] = "OBJECT";
|
|
1413
|
+
})(Type || (Type = {}));
|
|
1559
1414
|
/** Output only. The reason why the model stopped generating tokens.
|
|
1560
1415
|
|
|
1561
1416
|
If empty, the model has not stopped generating the tokens.
|
|
@@ -1625,6 +1480,33 @@ var MediaResolution;
|
|
|
1625
1480
|
MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
|
|
1626
1481
|
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1627
1482
|
})(MediaResolution || (MediaResolution = {}));
|
|
1483
|
+
/** Output only. The detailed state of the job. */
|
|
1484
|
+
var JobState;
|
|
1485
|
+
(function (JobState) {
|
|
1486
|
+
JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
|
|
1487
|
+
JobState["JOB_STATE_QUEUED"] = "JOB_STATE_QUEUED";
|
|
1488
|
+
JobState["JOB_STATE_PENDING"] = "JOB_STATE_PENDING";
|
|
1489
|
+
JobState["JOB_STATE_RUNNING"] = "JOB_STATE_RUNNING";
|
|
1490
|
+
JobState["JOB_STATE_SUCCEEDED"] = "JOB_STATE_SUCCEEDED";
|
|
1491
|
+
JobState["JOB_STATE_FAILED"] = "JOB_STATE_FAILED";
|
|
1492
|
+
JobState["JOB_STATE_CANCELLING"] = "JOB_STATE_CANCELLING";
|
|
1493
|
+
JobState["JOB_STATE_CANCELLED"] = "JOB_STATE_CANCELLED";
|
|
1494
|
+
JobState["JOB_STATE_PAUSED"] = "JOB_STATE_PAUSED";
|
|
1495
|
+
JobState["JOB_STATE_EXPIRED"] = "JOB_STATE_EXPIRED";
|
|
1496
|
+
JobState["JOB_STATE_UPDATING"] = "JOB_STATE_UPDATING";
|
|
1497
|
+
JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
|
|
1498
|
+
})(JobState || (JobState = {}));
|
|
1499
|
+
/** Optional. Adapter size for tuning. */
|
|
1500
|
+
var AdapterSize;
|
|
1501
|
+
(function (AdapterSize) {
|
|
1502
|
+
AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
|
|
1503
|
+
AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
|
|
1504
|
+
AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
|
|
1505
|
+
AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
|
|
1506
|
+
AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
|
|
1507
|
+
AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
|
|
1508
|
+
AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
|
|
1509
|
+
})(AdapterSize || (AdapterSize = {}));
|
|
1628
1510
|
/** Options for feature selection preference. */
|
|
1629
1511
|
var FeatureSelectionPreference;
|
|
1630
1512
|
(function (FeatureSelectionPreference) {
|
|
@@ -2125,6 +2007,8 @@ class EmbedContentResponse {
|
|
|
2125
2007
|
/** The output images response. */
|
|
2126
2008
|
class GenerateImagesResponse {
|
|
2127
2009
|
}
|
|
2010
|
+
class DeleteModelResponse {
|
|
2011
|
+
}
|
|
2128
2012
|
/** Response for counting tokens. */
|
|
2129
2013
|
class CountTokensResponse {
|
|
2130
2014
|
}
|
|
@@ -2134,6 +2018,9 @@ class ComputeTokensResponse {
|
|
|
2134
2018
|
/** Response with generated videos. */
|
|
2135
2019
|
class GenerateVideosResponse {
|
|
2136
2020
|
}
|
|
2021
|
+
/** Response for the list tuning jobs method. */
|
|
2022
|
+
class ListTuningJobsResponse {
|
|
2023
|
+
}
|
|
2137
2024
|
/** Empty response for caches.delete method. */
|
|
2138
2025
|
class DeleteCachedContentResponse {
|
|
2139
2026
|
}
|
|
@@ -2230,7 +2117,7 @@ class Caches extends BaseModule {
|
|
|
2230
2117
|
* ```ts
|
|
2231
2118
|
* const contents = ...; // Initialize the content to cache.
|
|
2232
2119
|
* const response = await ai.caches.create({
|
|
2233
|
-
* model: 'gemini-
|
|
2120
|
+
* model: 'gemini-2.0-flash-001',
|
|
2234
2121
|
* config: {
|
|
2235
2122
|
* 'contents': contents,
|
|
2236
2123
|
* 'displayName': 'test cache',
|
|
@@ -2302,7 +2189,7 @@ class Caches extends BaseModule {
|
|
|
2302
2189
|
*
|
|
2303
2190
|
* @example
|
|
2304
2191
|
* ```ts
|
|
2305
|
-
* await ai.caches.get({name: '
|
|
2192
|
+
* await ai.caches.get({name: '...'}); // The server-generated resource name.
|
|
2306
2193
|
* ```
|
|
2307
2194
|
*/
|
|
2308
2195
|
async get(params) {
|
|
@@ -2367,7 +2254,7 @@ class Caches extends BaseModule {
|
|
|
2367
2254
|
*
|
|
2368
2255
|
* @example
|
|
2369
2256
|
* ```ts
|
|
2370
|
-
* await ai.caches.delete({name: '
|
|
2257
|
+
* await ai.caches.delete({name: '...'}); // The server-generated resource name.
|
|
2371
2258
|
* ```
|
|
2372
2259
|
*/
|
|
2373
2260
|
async delete(params) {
|
|
@@ -2437,7 +2324,7 @@ class Caches extends BaseModule {
|
|
|
2437
2324
|
* @example
|
|
2438
2325
|
* ```ts
|
|
2439
2326
|
* const response = await ai.caches.update({
|
|
2440
|
-
* name: '
|
|
2327
|
+
* name: '...', // The server-generated resource name.
|
|
2441
2328
|
* config: {'ttl': '7600s'}
|
|
2442
2329
|
* });
|
|
2443
2330
|
* ```
|
|
@@ -2835,7 +2722,12 @@ class Chat {
|
|
|
2835
2722
|
contents: this.getHistory(true).concat(inputContent),
|
|
2836
2723
|
config: (_a = params.config) !== null && _a !== void 0 ? _a : this.config,
|
|
2837
2724
|
});
|
|
2838
|
-
|
|
2725
|
+
// Resolve the internal tracking of send completion promise - `sendPromise`
|
|
2726
|
+
// for both success and failure response. The actual failure is still
|
|
2727
|
+
// propagated by the `await streamResponse`.
|
|
2728
|
+
this.sendPromise = streamResponse
|
|
2729
|
+
.then(() => undefined)
|
|
2730
|
+
.catch(() => undefined);
|
|
2839
2731
|
const response = await streamResponse;
|
|
2840
2732
|
const result = this.processStreamResponse(response, inputContent);
|
|
2841
2733
|
return result;
|
|
@@ -2923,7 +2815,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
2923
2815
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
2924
2816
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
2925
2817
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
2926
|
-
const SDK_VERSION = '0.
|
|
2818
|
+
const SDK_VERSION = '0.12.0'; // x-release-please-version
|
|
2927
2819
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
2928
2820
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
2929
2821
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -3728,14 +3620,13 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
|
|
|
3728
3620
|
}
|
|
3729
3621
|
const fromFiles = getValueByPath(fromObject, ['files']);
|
|
3730
3622
|
if (fromFiles != null) {
|
|
3731
|
-
|
|
3732
|
-
|
|
3623
|
+
let transformedList = fromFiles;
|
|
3624
|
+
if (Array.isArray(transformedList)) {
|
|
3625
|
+
transformedList = transformedList.map((item) => {
|
|
3733
3626
|
return fileFromMldev(apiClient, item);
|
|
3734
|
-
})
|
|
3735
|
-
}
|
|
3736
|
-
else {
|
|
3737
|
-
setValueByPath(toObject, ['files'], fromFiles);
|
|
3627
|
+
});
|
|
3738
3628
|
}
|
|
3629
|
+
setValueByPath(toObject, ['files'], transformedList);
|
|
3739
3630
|
}
|
|
3740
3631
|
return toObject;
|
|
3741
3632
|
}
|
|
@@ -4102,14 +3993,13 @@ function contentToMldev$1(apiClient, fromObject) {
|
|
|
4102
3993
|
const toObject = {};
|
|
4103
3994
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4104
3995
|
if (fromParts != null) {
|
|
4105
|
-
|
|
4106
|
-
|
|
3996
|
+
let transformedList = fromParts;
|
|
3997
|
+
if (Array.isArray(transformedList)) {
|
|
3998
|
+
transformedList = transformedList.map((item) => {
|
|
4107
3999
|
return partToMldev$1(apiClient, item);
|
|
4108
|
-
})
|
|
4109
|
-
}
|
|
4110
|
-
else {
|
|
4111
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
4000
|
+
});
|
|
4112
4001
|
}
|
|
4002
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
4113
4003
|
}
|
|
4114
4004
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4115
4005
|
if (fromRole != null) {
|
|
@@ -4121,14 +4011,13 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
4121
4011
|
const toObject = {};
|
|
4122
4012
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4123
4013
|
if (fromParts != null) {
|
|
4124
|
-
|
|
4125
|
-
|
|
4014
|
+
let transformedList = fromParts;
|
|
4015
|
+
if (Array.isArray(transformedList)) {
|
|
4016
|
+
transformedList = transformedList.map((item) => {
|
|
4126
4017
|
return partToVertex$1(apiClient, item);
|
|
4127
|
-
})
|
|
4128
|
-
}
|
|
4129
|
-
else {
|
|
4130
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
4018
|
+
});
|
|
4131
4019
|
}
|
|
4020
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
4132
4021
|
}
|
|
4133
4022
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4134
4023
|
if (fromRole != null) {
|
|
@@ -4136,143 +4025,6 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
4136
4025
|
}
|
|
4137
4026
|
return toObject;
|
|
4138
4027
|
}
|
|
4139
|
-
function schemaToVertex$1(apiClient, fromObject) {
|
|
4140
|
-
const toObject = {};
|
|
4141
|
-
const fromExample = getValueByPath(fromObject, ['example']);
|
|
4142
|
-
if (fromExample != null) {
|
|
4143
|
-
setValueByPath(toObject, ['example'], fromExample);
|
|
4144
|
-
}
|
|
4145
|
-
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
4146
|
-
if (fromPattern != null) {
|
|
4147
|
-
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
4148
|
-
}
|
|
4149
|
-
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
4150
|
-
if (fromDefault != null) {
|
|
4151
|
-
setValueByPath(toObject, ['default'], fromDefault);
|
|
4152
|
-
}
|
|
4153
|
-
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
4154
|
-
if (fromMaxLength != null) {
|
|
4155
|
-
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
4156
|
-
}
|
|
4157
|
-
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
4158
|
-
if (fromMinLength != null) {
|
|
4159
|
-
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
4160
|
-
}
|
|
4161
|
-
const fromMinProperties = getValueByPath(fromObject, [
|
|
4162
|
-
'minProperties',
|
|
4163
|
-
]);
|
|
4164
|
-
if (fromMinProperties != null) {
|
|
4165
|
-
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
4166
|
-
}
|
|
4167
|
-
const fromMaxProperties = getValueByPath(fromObject, [
|
|
4168
|
-
'maxProperties',
|
|
4169
|
-
]);
|
|
4170
|
-
if (fromMaxProperties != null) {
|
|
4171
|
-
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
4172
|
-
}
|
|
4173
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
4174
|
-
if (fromAnyOf != null) {
|
|
4175
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
4176
|
-
}
|
|
4177
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4178
|
-
if (fromDescription != null) {
|
|
4179
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
4180
|
-
}
|
|
4181
|
-
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
4182
|
-
if (fromEnum != null) {
|
|
4183
|
-
setValueByPath(toObject, ['enum'], fromEnum);
|
|
4184
|
-
}
|
|
4185
|
-
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
4186
|
-
if (fromFormat != null) {
|
|
4187
|
-
setValueByPath(toObject, ['format'], fromFormat);
|
|
4188
|
-
}
|
|
4189
|
-
const fromItems = getValueByPath(fromObject, ['items']);
|
|
4190
|
-
if (fromItems != null) {
|
|
4191
|
-
setValueByPath(toObject, ['items'], fromItems);
|
|
4192
|
-
}
|
|
4193
|
-
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
4194
|
-
if (fromMaxItems != null) {
|
|
4195
|
-
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
4196
|
-
}
|
|
4197
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
4198
|
-
if (fromMaximum != null) {
|
|
4199
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
4200
|
-
}
|
|
4201
|
-
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
4202
|
-
if (fromMinItems != null) {
|
|
4203
|
-
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
4204
|
-
}
|
|
4205
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
4206
|
-
if (fromMinimum != null) {
|
|
4207
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
4208
|
-
}
|
|
4209
|
-
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
4210
|
-
if (fromNullable != null) {
|
|
4211
|
-
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
4212
|
-
}
|
|
4213
|
-
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
4214
|
-
if (fromProperties != null) {
|
|
4215
|
-
setValueByPath(toObject, ['properties'], fromProperties);
|
|
4216
|
-
}
|
|
4217
|
-
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
4218
|
-
'propertyOrdering',
|
|
4219
|
-
]);
|
|
4220
|
-
if (fromPropertyOrdering != null) {
|
|
4221
|
-
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
4222
|
-
}
|
|
4223
|
-
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
4224
|
-
if (fromRequired != null) {
|
|
4225
|
-
setValueByPath(toObject, ['required'], fromRequired);
|
|
4226
|
-
}
|
|
4227
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
4228
|
-
if (fromTitle != null) {
|
|
4229
|
-
setValueByPath(toObject, ['title'], fromTitle);
|
|
4230
|
-
}
|
|
4231
|
-
const fromType = getValueByPath(fromObject, ['type']);
|
|
4232
|
-
if (fromType != null) {
|
|
4233
|
-
setValueByPath(toObject, ['type'], fromType);
|
|
4234
|
-
}
|
|
4235
|
-
return toObject;
|
|
4236
|
-
}
|
|
4237
|
-
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
4238
|
-
const toObject = {};
|
|
4239
|
-
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
4240
|
-
throw new Error('response parameter is not supported in Gemini API.');
|
|
4241
|
-
}
|
|
4242
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4243
|
-
if (fromDescription != null) {
|
|
4244
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
4245
|
-
}
|
|
4246
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
4247
|
-
if (fromName != null) {
|
|
4248
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
4249
|
-
}
|
|
4250
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
4251
|
-
if (fromParameters != null) {
|
|
4252
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
4253
|
-
}
|
|
4254
|
-
return toObject;
|
|
4255
|
-
}
|
|
4256
|
-
function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
4257
|
-
const toObject = {};
|
|
4258
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
4259
|
-
if (fromResponse != null) {
|
|
4260
|
-
setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
|
|
4261
|
-
}
|
|
4262
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4263
|
-
if (fromDescription != null) {
|
|
4264
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
4265
|
-
}
|
|
4266
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
4267
|
-
if (fromName != null) {
|
|
4268
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
4269
|
-
}
|
|
4270
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
4271
|
-
if (fromParameters != null) {
|
|
4272
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
4273
|
-
}
|
|
4274
|
-
return toObject;
|
|
4275
|
-
}
|
|
4276
4028
|
function googleSearchToMldev$1() {
|
|
4277
4029
|
const toObject = {};
|
|
4278
4030
|
return toObject;
|
|
@@ -4331,19 +4083,6 @@ function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
|
|
|
4331
4083
|
}
|
|
4332
4084
|
function toolToMldev$1(apiClient, fromObject) {
|
|
4333
4085
|
const toObject = {};
|
|
4334
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4335
|
-
'functionDeclarations',
|
|
4336
|
-
]);
|
|
4337
|
-
if (fromFunctionDeclarations != null) {
|
|
4338
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
4339
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
4340
|
-
return functionDeclarationToMldev$1(apiClient, item);
|
|
4341
|
-
}));
|
|
4342
|
-
}
|
|
4343
|
-
else {
|
|
4344
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
4345
|
-
}
|
|
4346
|
-
}
|
|
4347
4086
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
4348
4087
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
4349
4088
|
}
|
|
@@ -4363,23 +4102,16 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
4363
4102
|
if (fromCodeExecution != null) {
|
|
4364
4103
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
4365
4104
|
}
|
|
4366
|
-
return toObject;
|
|
4367
|
-
}
|
|
4368
|
-
function toolToVertex$1(apiClient, fromObject) {
|
|
4369
|
-
const toObject = {};
|
|
4370
4105
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4371
4106
|
'functionDeclarations',
|
|
4372
4107
|
]);
|
|
4373
4108
|
if (fromFunctionDeclarations != null) {
|
|
4374
|
-
|
|
4375
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
4376
|
-
return functionDeclarationToVertex$1(apiClient, item);
|
|
4377
|
-
}));
|
|
4378
|
-
}
|
|
4379
|
-
else {
|
|
4380
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
4381
|
-
}
|
|
4109
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
4382
4110
|
}
|
|
4111
|
+
return toObject;
|
|
4112
|
+
}
|
|
4113
|
+
function toolToVertex$1(apiClient, fromObject) {
|
|
4114
|
+
const toObject = {};
|
|
4383
4115
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
4384
4116
|
if (fromRetrieval != null) {
|
|
4385
4117
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
@@ -4400,6 +4132,12 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
4400
4132
|
if (fromCodeExecution != null) {
|
|
4401
4133
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
4402
4134
|
}
|
|
4135
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4136
|
+
'functionDeclarations',
|
|
4137
|
+
]);
|
|
4138
|
+
if (fromFunctionDeclarations != null) {
|
|
4139
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
4140
|
+
}
|
|
4403
4141
|
return toObject;
|
|
4404
4142
|
}
|
|
4405
4143
|
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
@@ -4639,14 +4377,13 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
4639
4377
|
}
|
|
4640
4378
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
4641
4379
|
if (parentObject !== undefined && fromTools != null) {
|
|
4642
|
-
|
|
4643
|
-
|
|
4380
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
4381
|
+
if (Array.isArray(transformedList)) {
|
|
4382
|
+
transformedList = transformedList.map((item) => {
|
|
4644
4383
|
return toolToMldev$1(apiClient, tTool(apiClient, item));
|
|
4645
|
-
})
|
|
4646
|
-
}
|
|
4647
|
-
else {
|
|
4648
|
-
setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
|
|
4384
|
+
});
|
|
4649
4385
|
}
|
|
4386
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
4650
4387
|
}
|
|
4651
4388
|
const fromSessionResumption = getValueByPath(fromObject, [
|
|
4652
4389
|
'sessionResumption',
|
|
@@ -4731,14 +4468,13 @@ function liveConnectConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
4731
4468
|
}
|
|
4732
4469
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
4733
4470
|
if (parentObject !== undefined && fromTools != null) {
|
|
4734
|
-
|
|
4735
|
-
|
|
4471
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
4472
|
+
if (Array.isArray(transformedList)) {
|
|
4473
|
+
transformedList = transformedList.map((item) => {
|
|
4736
4474
|
return toolToVertex$1(apiClient, tTool(apiClient, item));
|
|
4737
|
-
})
|
|
4738
|
-
}
|
|
4739
|
-
else {
|
|
4740
|
-
setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
|
|
4475
|
+
});
|
|
4741
4476
|
}
|
|
4477
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
4742
4478
|
}
|
|
4743
4479
|
const fromSessionResumption = getValueByPath(fromObject, [
|
|
4744
4480
|
'sessionResumption',
|
|
@@ -4983,14 +4719,13 @@ function contentFromMldev$1(apiClient, fromObject) {
|
|
|
4983
4719
|
const toObject = {};
|
|
4984
4720
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4985
4721
|
if (fromParts != null) {
|
|
4986
|
-
|
|
4987
|
-
|
|
4722
|
+
let transformedList = fromParts;
|
|
4723
|
+
if (Array.isArray(transformedList)) {
|
|
4724
|
+
transformedList = transformedList.map((item) => {
|
|
4988
4725
|
return partFromMldev$1(apiClient, item);
|
|
4989
|
-
})
|
|
4990
|
-
}
|
|
4991
|
-
else {
|
|
4992
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
4726
|
+
});
|
|
4993
4727
|
}
|
|
4728
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
4994
4729
|
}
|
|
4995
4730
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4996
4731
|
if (fromRole != null) {
|
|
@@ -5002,14 +4737,13 @@ function contentFromVertex$1(apiClient, fromObject) {
|
|
|
5002
4737
|
const toObject = {};
|
|
5003
4738
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5004
4739
|
if (fromParts != null) {
|
|
5005
|
-
|
|
5006
|
-
|
|
4740
|
+
let transformedList = fromParts;
|
|
4741
|
+
if (Array.isArray(transformedList)) {
|
|
4742
|
+
transformedList = transformedList.map((item) => {
|
|
5007
4743
|
return partFromVertex$1(apiClient, item);
|
|
5008
|
-
})
|
|
5009
|
-
}
|
|
5010
|
-
else {
|
|
5011
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
4744
|
+
});
|
|
5012
4745
|
}
|
|
4746
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
5013
4747
|
}
|
|
5014
4748
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
5015
4749
|
if (fromRole != null) {
|
|
@@ -5055,6 +4789,12 @@ function liveServerContentFromMldev(apiClient, fromObject) {
|
|
|
5055
4789
|
if (fromInterrupted != null) {
|
|
5056
4790
|
setValueByPath(toObject, ['interrupted'], fromInterrupted);
|
|
5057
4791
|
}
|
|
4792
|
+
const fromGroundingMetadata = getValueByPath(fromObject, [
|
|
4793
|
+
'groundingMetadata',
|
|
4794
|
+
]);
|
|
4795
|
+
if (fromGroundingMetadata != null) {
|
|
4796
|
+
setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
|
|
4797
|
+
}
|
|
5058
4798
|
const fromGenerationComplete = getValueByPath(fromObject, [
|
|
5059
4799
|
'generationComplete',
|
|
5060
4800
|
]);
|
|
@@ -5089,6 +4829,12 @@ function liveServerContentFromVertex(apiClient, fromObject) {
|
|
|
5089
4829
|
if (fromInterrupted != null) {
|
|
5090
4830
|
setValueByPath(toObject, ['interrupted'], fromInterrupted);
|
|
5091
4831
|
}
|
|
4832
|
+
const fromGroundingMetadata = getValueByPath(fromObject, [
|
|
4833
|
+
'groundingMetadata',
|
|
4834
|
+
]);
|
|
4835
|
+
if (fromGroundingMetadata != null) {
|
|
4836
|
+
setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
|
|
4837
|
+
}
|
|
5092
4838
|
const fromGenerationComplete = getValueByPath(fromObject, [
|
|
5093
4839
|
'generationComplete',
|
|
5094
4840
|
]);
|
|
@@ -5143,14 +4889,13 @@ function liveServerToolCallFromMldev(apiClient, fromObject) {
|
|
|
5143
4889
|
'functionCalls',
|
|
5144
4890
|
]);
|
|
5145
4891
|
if (fromFunctionCalls != null) {
|
|
5146
|
-
|
|
5147
|
-
|
|
4892
|
+
let transformedList = fromFunctionCalls;
|
|
4893
|
+
if (Array.isArray(transformedList)) {
|
|
4894
|
+
transformedList = transformedList.map((item) => {
|
|
5148
4895
|
return functionCallFromMldev(apiClient, item);
|
|
5149
|
-
})
|
|
5150
|
-
}
|
|
5151
|
-
else {
|
|
5152
|
-
setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
|
|
4896
|
+
});
|
|
5153
4897
|
}
|
|
4898
|
+
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
5154
4899
|
}
|
|
5155
4900
|
return toObject;
|
|
5156
4901
|
}
|
|
@@ -5160,14 +4905,13 @@ function liveServerToolCallFromVertex(apiClient, fromObject) {
|
|
|
5160
4905
|
'functionCalls',
|
|
5161
4906
|
]);
|
|
5162
4907
|
if (fromFunctionCalls != null) {
|
|
5163
|
-
|
|
5164
|
-
|
|
4908
|
+
let transformedList = fromFunctionCalls;
|
|
4909
|
+
if (Array.isArray(transformedList)) {
|
|
4910
|
+
transformedList = transformedList.map((item) => {
|
|
5165
4911
|
return functionCallFromVertex(apiClient, item);
|
|
5166
|
-
})
|
|
5167
|
-
}
|
|
5168
|
-
else {
|
|
5169
|
-
setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
|
|
4912
|
+
});
|
|
5170
4913
|
}
|
|
4914
|
+
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
5171
4915
|
}
|
|
5172
4916
|
return toObject;
|
|
5173
4917
|
}
|
|
@@ -5253,53 +4997,49 @@ function usageMetadataFromMldev(apiClient, fromObject) {
|
|
|
5253
4997
|
'promptTokensDetails',
|
|
5254
4998
|
]);
|
|
5255
4999
|
if (fromPromptTokensDetails != null) {
|
|
5256
|
-
|
|
5257
|
-
|
|
5000
|
+
let transformedList = fromPromptTokensDetails;
|
|
5001
|
+
if (Array.isArray(transformedList)) {
|
|
5002
|
+
transformedList = transformedList.map((item) => {
|
|
5258
5003
|
return modalityTokenCountFromMldev(apiClient, item);
|
|
5259
|
-
})
|
|
5260
|
-
}
|
|
5261
|
-
else {
|
|
5262
|
-
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
|
|
5004
|
+
});
|
|
5263
5005
|
}
|
|
5006
|
+
setValueByPath(toObject, ['promptTokensDetails'], transformedList);
|
|
5264
5007
|
}
|
|
5265
5008
|
const fromCacheTokensDetails = getValueByPath(fromObject, [
|
|
5266
5009
|
'cacheTokensDetails',
|
|
5267
5010
|
]);
|
|
5268
5011
|
if (fromCacheTokensDetails != null) {
|
|
5269
|
-
|
|
5270
|
-
|
|
5012
|
+
let transformedList = fromCacheTokensDetails;
|
|
5013
|
+
if (Array.isArray(transformedList)) {
|
|
5014
|
+
transformedList = transformedList.map((item) => {
|
|
5271
5015
|
return modalityTokenCountFromMldev(apiClient, item);
|
|
5272
|
-
})
|
|
5273
|
-
}
|
|
5274
|
-
else {
|
|
5275
|
-
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
|
|
5016
|
+
});
|
|
5276
5017
|
}
|
|
5018
|
+
setValueByPath(toObject, ['cacheTokensDetails'], transformedList);
|
|
5277
5019
|
}
|
|
5278
5020
|
const fromResponseTokensDetails = getValueByPath(fromObject, [
|
|
5279
5021
|
'responseTokensDetails',
|
|
5280
5022
|
]);
|
|
5281
5023
|
if (fromResponseTokensDetails != null) {
|
|
5282
|
-
|
|
5283
|
-
|
|
5024
|
+
let transformedList = fromResponseTokensDetails;
|
|
5025
|
+
if (Array.isArray(transformedList)) {
|
|
5026
|
+
transformedList = transformedList.map((item) => {
|
|
5284
5027
|
return modalityTokenCountFromMldev(apiClient, item);
|
|
5285
|
-
})
|
|
5286
|
-
}
|
|
5287
|
-
else {
|
|
5288
|
-
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
|
|
5028
|
+
});
|
|
5289
5029
|
}
|
|
5030
|
+
setValueByPath(toObject, ['responseTokensDetails'], transformedList);
|
|
5290
5031
|
}
|
|
5291
5032
|
const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
|
|
5292
5033
|
'toolUsePromptTokensDetails',
|
|
5293
5034
|
]);
|
|
5294
5035
|
if (fromToolUsePromptTokensDetails != null) {
|
|
5295
|
-
|
|
5296
|
-
|
|
5036
|
+
let transformedList = fromToolUsePromptTokensDetails;
|
|
5037
|
+
if (Array.isArray(transformedList)) {
|
|
5038
|
+
transformedList = transformedList.map((item) => {
|
|
5297
5039
|
return modalityTokenCountFromMldev(apiClient, item);
|
|
5298
|
-
})
|
|
5299
|
-
}
|
|
5300
|
-
else {
|
|
5301
|
-
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
|
|
5040
|
+
});
|
|
5302
5041
|
}
|
|
5042
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], transformedList);
|
|
5303
5043
|
}
|
|
5304
5044
|
return toObject;
|
|
5305
5045
|
}
|
|
@@ -5345,53 +5085,49 @@ function usageMetadataFromVertex(apiClient, fromObject) {
|
|
|
5345
5085
|
'promptTokensDetails',
|
|
5346
5086
|
]);
|
|
5347
5087
|
if (fromPromptTokensDetails != null) {
|
|
5348
|
-
|
|
5349
|
-
|
|
5088
|
+
let transformedList = fromPromptTokensDetails;
|
|
5089
|
+
if (Array.isArray(transformedList)) {
|
|
5090
|
+
transformedList = transformedList.map((item) => {
|
|
5350
5091
|
return modalityTokenCountFromVertex(apiClient, item);
|
|
5351
|
-
})
|
|
5352
|
-
}
|
|
5353
|
-
else {
|
|
5354
|
-
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
|
|
5092
|
+
});
|
|
5355
5093
|
}
|
|
5094
|
+
setValueByPath(toObject, ['promptTokensDetails'], transformedList);
|
|
5356
5095
|
}
|
|
5357
5096
|
const fromCacheTokensDetails = getValueByPath(fromObject, [
|
|
5358
5097
|
'cacheTokensDetails',
|
|
5359
5098
|
]);
|
|
5360
5099
|
if (fromCacheTokensDetails != null) {
|
|
5361
|
-
|
|
5362
|
-
|
|
5100
|
+
let transformedList = fromCacheTokensDetails;
|
|
5101
|
+
if (Array.isArray(transformedList)) {
|
|
5102
|
+
transformedList = transformedList.map((item) => {
|
|
5363
5103
|
return modalityTokenCountFromVertex(apiClient, item);
|
|
5364
|
-
})
|
|
5365
|
-
}
|
|
5366
|
-
else {
|
|
5367
|
-
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
|
|
5104
|
+
});
|
|
5368
5105
|
}
|
|
5106
|
+
setValueByPath(toObject, ['cacheTokensDetails'], transformedList);
|
|
5369
5107
|
}
|
|
5370
5108
|
const fromResponseTokensDetails = getValueByPath(fromObject, [
|
|
5371
5109
|
'candidatesTokensDetails',
|
|
5372
5110
|
]);
|
|
5373
5111
|
if (fromResponseTokensDetails != null) {
|
|
5374
|
-
|
|
5375
|
-
|
|
5112
|
+
let transformedList = fromResponseTokensDetails;
|
|
5113
|
+
if (Array.isArray(transformedList)) {
|
|
5114
|
+
transformedList = transformedList.map((item) => {
|
|
5376
5115
|
return modalityTokenCountFromVertex(apiClient, item);
|
|
5377
|
-
})
|
|
5378
|
-
}
|
|
5379
|
-
else {
|
|
5380
|
-
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
|
|
5116
|
+
});
|
|
5381
5117
|
}
|
|
5118
|
+
setValueByPath(toObject, ['responseTokensDetails'], transformedList);
|
|
5382
5119
|
}
|
|
5383
5120
|
const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
|
|
5384
5121
|
'toolUsePromptTokensDetails',
|
|
5385
5122
|
]);
|
|
5386
5123
|
if (fromToolUsePromptTokensDetails != null) {
|
|
5387
|
-
|
|
5388
|
-
|
|
5124
|
+
let transformedList = fromToolUsePromptTokensDetails;
|
|
5125
|
+
if (Array.isArray(transformedList)) {
|
|
5126
|
+
transformedList = transformedList.map((item) => {
|
|
5389
5127
|
return modalityTokenCountFromVertex(apiClient, item);
|
|
5390
|
-
})
|
|
5391
|
-
}
|
|
5392
|
-
else {
|
|
5393
|
-
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
|
|
5128
|
+
});
|
|
5394
5129
|
}
|
|
5130
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], transformedList);
|
|
5395
5131
|
}
|
|
5396
5132
|
const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
|
|
5397
5133
|
if (fromTrafficType != null) {
|
|
@@ -5590,14 +5326,13 @@ function contentToMldev(apiClient, fromObject) {
|
|
|
5590
5326
|
const toObject = {};
|
|
5591
5327
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5592
5328
|
if (fromParts != null) {
|
|
5593
|
-
|
|
5594
|
-
|
|
5329
|
+
let transformedList = fromParts;
|
|
5330
|
+
if (Array.isArray(transformedList)) {
|
|
5331
|
+
transformedList = transformedList.map((item) => {
|
|
5595
5332
|
return partToMldev(apiClient, item);
|
|
5596
|
-
})
|
|
5597
|
-
}
|
|
5598
|
-
else {
|
|
5599
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
5333
|
+
});
|
|
5600
5334
|
}
|
|
5335
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
5601
5336
|
}
|
|
5602
5337
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
5603
5338
|
if (fromRole != null) {
|
|
@@ -5605,93 +5340,6 @@ function contentToMldev(apiClient, fromObject) {
|
|
|
5605
5340
|
}
|
|
5606
5341
|
return toObject;
|
|
5607
5342
|
}
|
|
5608
|
-
function schemaToMldev(apiClient, fromObject) {
|
|
5609
|
-
const toObject = {};
|
|
5610
|
-
if (getValueByPath(fromObject, ['example']) !== undefined) {
|
|
5611
|
-
throw new Error('example parameter is not supported in Gemini API.');
|
|
5612
|
-
}
|
|
5613
|
-
if (getValueByPath(fromObject, ['pattern']) !== undefined) {
|
|
5614
|
-
throw new Error('pattern parameter is not supported in Gemini API.');
|
|
5615
|
-
}
|
|
5616
|
-
if (getValueByPath(fromObject, ['default']) !== undefined) {
|
|
5617
|
-
throw new Error('default parameter is not supported in Gemini API.');
|
|
5618
|
-
}
|
|
5619
|
-
if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
|
|
5620
|
-
throw new Error('maxLength parameter is not supported in Gemini API.');
|
|
5621
|
-
}
|
|
5622
|
-
if (getValueByPath(fromObject, ['minLength']) !== undefined) {
|
|
5623
|
-
throw new Error('minLength parameter is not supported in Gemini API.');
|
|
5624
|
-
}
|
|
5625
|
-
if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
|
|
5626
|
-
throw new Error('minProperties parameter is not supported in Gemini API.');
|
|
5627
|
-
}
|
|
5628
|
-
if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
|
|
5629
|
-
throw new Error('maxProperties parameter is not supported in Gemini API.');
|
|
5630
|
-
}
|
|
5631
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
5632
|
-
if (fromAnyOf != null) {
|
|
5633
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
5634
|
-
}
|
|
5635
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5636
|
-
if (fromDescription != null) {
|
|
5637
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
5638
|
-
}
|
|
5639
|
-
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
5640
|
-
if (fromEnum != null) {
|
|
5641
|
-
setValueByPath(toObject, ['enum'], fromEnum);
|
|
5642
|
-
}
|
|
5643
|
-
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
5644
|
-
if (fromFormat != null) {
|
|
5645
|
-
setValueByPath(toObject, ['format'], fromFormat);
|
|
5646
|
-
}
|
|
5647
|
-
const fromItems = getValueByPath(fromObject, ['items']);
|
|
5648
|
-
if (fromItems != null) {
|
|
5649
|
-
setValueByPath(toObject, ['items'], fromItems);
|
|
5650
|
-
}
|
|
5651
|
-
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
5652
|
-
if (fromMaxItems != null) {
|
|
5653
|
-
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
5654
|
-
}
|
|
5655
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
5656
|
-
if (fromMaximum != null) {
|
|
5657
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
5658
|
-
}
|
|
5659
|
-
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
5660
|
-
if (fromMinItems != null) {
|
|
5661
|
-
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
5662
|
-
}
|
|
5663
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
5664
|
-
if (fromMinimum != null) {
|
|
5665
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
5666
|
-
}
|
|
5667
|
-
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
5668
|
-
if (fromNullable != null) {
|
|
5669
|
-
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
5670
|
-
}
|
|
5671
|
-
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
5672
|
-
if (fromProperties != null) {
|
|
5673
|
-
setValueByPath(toObject, ['properties'], fromProperties);
|
|
5674
|
-
}
|
|
5675
|
-
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
5676
|
-
'propertyOrdering',
|
|
5677
|
-
]);
|
|
5678
|
-
if (fromPropertyOrdering != null) {
|
|
5679
|
-
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
5680
|
-
}
|
|
5681
|
-
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
5682
|
-
if (fromRequired != null) {
|
|
5683
|
-
setValueByPath(toObject, ['required'], fromRequired);
|
|
5684
|
-
}
|
|
5685
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
5686
|
-
if (fromTitle != null) {
|
|
5687
|
-
setValueByPath(toObject, ['title'], fromTitle);
|
|
5688
|
-
}
|
|
5689
|
-
const fromType = getValueByPath(fromObject, ['type']);
|
|
5690
|
-
if (fromType != null) {
|
|
5691
|
-
setValueByPath(toObject, ['type'], fromType);
|
|
5692
|
-
}
|
|
5693
|
-
return toObject;
|
|
5694
|
-
}
|
|
5695
5343
|
function safetySettingToMldev(apiClient, fromObject) {
|
|
5696
5344
|
const toObject = {};
|
|
5697
5345
|
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
@@ -5707,25 +5355,6 @@ function safetySettingToMldev(apiClient, fromObject) {
|
|
|
5707
5355
|
}
|
|
5708
5356
|
return toObject;
|
|
5709
5357
|
}
|
|
5710
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
5711
|
-
const toObject = {};
|
|
5712
|
-
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
5713
|
-
throw new Error('response parameter is not supported in Gemini API.');
|
|
5714
|
-
}
|
|
5715
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5716
|
-
if (fromDescription != null) {
|
|
5717
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
5718
|
-
}
|
|
5719
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
5720
|
-
if (fromName != null) {
|
|
5721
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
5722
|
-
}
|
|
5723
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
5724
|
-
if (fromParameters != null) {
|
|
5725
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
5726
|
-
}
|
|
5727
|
-
return toObject;
|
|
5728
|
-
}
|
|
5729
5358
|
function googleSearchToMldev() {
|
|
5730
5359
|
const toObject = {};
|
|
5731
5360
|
return toObject;
|
|
@@ -5756,19 +5385,6 @@ function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
|
5756
5385
|
}
|
|
5757
5386
|
function toolToMldev(apiClient, fromObject) {
|
|
5758
5387
|
const toObject = {};
|
|
5759
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5760
|
-
'functionDeclarations',
|
|
5761
|
-
]);
|
|
5762
|
-
if (fromFunctionDeclarations != null) {
|
|
5763
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
5764
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
5765
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
5766
|
-
}));
|
|
5767
|
-
}
|
|
5768
|
-
else {
|
|
5769
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
5770
|
-
}
|
|
5771
|
-
}
|
|
5772
5388
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
5773
5389
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
5774
5390
|
}
|
|
@@ -5788,6 +5404,12 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
5788
5404
|
if (fromCodeExecution != null) {
|
|
5789
5405
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5790
5406
|
}
|
|
5407
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5408
|
+
'functionDeclarations',
|
|
5409
|
+
]);
|
|
5410
|
+
if (fromFunctionDeclarations != null) {
|
|
5411
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
5412
|
+
}
|
|
5791
5413
|
return toObject;
|
|
5792
5414
|
}
|
|
5793
5415
|
function functionCallingConfigToMldev(apiClient, fromObject) {
|
|
@@ -5934,7 +5556,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5934
5556
|
'responseSchema',
|
|
5935
5557
|
]);
|
|
5936
5558
|
if (fromResponseSchema != null) {
|
|
5937
|
-
setValueByPath(toObject, ['responseSchema'],
|
|
5559
|
+
setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
|
|
5938
5560
|
}
|
|
5939
5561
|
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
5940
5562
|
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
@@ -5946,25 +5568,23 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5946
5568
|
'safetySettings',
|
|
5947
5569
|
]);
|
|
5948
5570
|
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
5949
|
-
|
|
5950
|
-
|
|
5571
|
+
let transformedList = fromSafetySettings;
|
|
5572
|
+
if (Array.isArray(transformedList)) {
|
|
5573
|
+
transformedList = transformedList.map((item) => {
|
|
5951
5574
|
return safetySettingToMldev(apiClient, item);
|
|
5952
|
-
})
|
|
5953
|
-
}
|
|
5954
|
-
else {
|
|
5955
|
-
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
|
|
5575
|
+
});
|
|
5956
5576
|
}
|
|
5577
|
+
setValueByPath(parentObject, ['safetySettings'], transformedList);
|
|
5957
5578
|
}
|
|
5958
5579
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5959
5580
|
if (parentObject !== undefined && fromTools != null) {
|
|
5960
|
-
|
|
5961
|
-
|
|
5581
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
5582
|
+
if (Array.isArray(transformedList)) {
|
|
5583
|
+
transformedList = transformedList.map((item) => {
|
|
5962
5584
|
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
5963
|
-
})
|
|
5964
|
-
}
|
|
5965
|
-
else {
|
|
5966
|
-
setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
|
|
5585
|
+
});
|
|
5967
5586
|
}
|
|
5587
|
+
setValueByPath(parentObject, ['tools'], transformedList);
|
|
5968
5588
|
}
|
|
5969
5589
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
5970
5590
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
@@ -6014,14 +5634,13 @@ function generateContentParametersToMldev(apiClient, fromObject) {
|
|
|
6014
5634
|
}
|
|
6015
5635
|
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
6016
5636
|
if (fromContents != null) {
|
|
6017
|
-
|
|
6018
|
-
|
|
5637
|
+
let transformedList = tContents(apiClient, fromContents);
|
|
5638
|
+
if (Array.isArray(transformedList)) {
|
|
5639
|
+
transformedList = transformedList.map((item) => {
|
|
6019
5640
|
return contentToMldev(apiClient, item);
|
|
6020
|
-
})
|
|
6021
|
-
}
|
|
6022
|
-
else {
|
|
6023
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
5641
|
+
});
|
|
6024
5642
|
}
|
|
5643
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
6025
5644
|
}
|
|
6026
5645
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6027
5646
|
if (fromConfig != null) {
|
|
@@ -6176,6 +5795,42 @@ function getModelParametersToMldev(apiClient, fromObject) {
|
|
|
6176
5795
|
}
|
|
6177
5796
|
return toObject;
|
|
6178
5797
|
}
|
|
5798
|
+
function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
|
|
5799
|
+
const toObject = {};
|
|
5800
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
5801
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
5802
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
5803
|
+
}
|
|
5804
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5805
|
+
if (parentObject !== undefined && fromDescription != null) {
|
|
5806
|
+
setValueByPath(parentObject, ['description'], fromDescription);
|
|
5807
|
+
}
|
|
5808
|
+
return toObject;
|
|
5809
|
+
}
|
|
5810
|
+
function updateModelParametersToMldev(apiClient, fromObject) {
|
|
5811
|
+
const toObject = {};
|
|
5812
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
5813
|
+
if (fromModel != null) {
|
|
5814
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
5815
|
+
}
|
|
5816
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5817
|
+
if (fromConfig != null) {
|
|
5818
|
+
setValueByPath(toObject, ['config'], updateModelConfigToMldev(apiClient, fromConfig, toObject));
|
|
5819
|
+
}
|
|
5820
|
+
return toObject;
|
|
5821
|
+
}
|
|
5822
|
+
function deleteModelParametersToMldev(apiClient, fromObject) {
|
|
5823
|
+
const toObject = {};
|
|
5824
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
5825
|
+
if (fromModel != null) {
|
|
5826
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
5827
|
+
}
|
|
5828
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5829
|
+
if (fromConfig != null) {
|
|
5830
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
5831
|
+
}
|
|
5832
|
+
return toObject;
|
|
5833
|
+
}
|
|
6179
5834
|
function countTokensConfigToMldev(apiClient, fromObject) {
|
|
6180
5835
|
const toObject = {};
|
|
6181
5836
|
if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
|
|
@@ -6197,14 +5852,13 @@ function countTokensParametersToMldev(apiClient, fromObject) {
|
|
|
6197
5852
|
}
|
|
6198
5853
|
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
6199
5854
|
if (fromContents != null) {
|
|
6200
|
-
|
|
6201
|
-
|
|
5855
|
+
let transformedList = tContents(apiClient, fromContents);
|
|
5856
|
+
if (Array.isArray(transformedList)) {
|
|
5857
|
+
transformedList = transformedList.map((item) => {
|
|
6202
5858
|
return contentToMldev(apiClient, item);
|
|
6203
|
-
})
|
|
6204
|
-
}
|
|
6205
|
-
else {
|
|
6206
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
5859
|
+
});
|
|
6207
5860
|
}
|
|
5861
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
6208
5862
|
}
|
|
6209
5863
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6210
5864
|
if (fromConfig != null) {
|
|
@@ -6349,14 +6003,13 @@ function contentToVertex(apiClient, fromObject) {
|
|
|
6349
6003
|
const toObject = {};
|
|
6350
6004
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
6351
6005
|
if (fromParts != null) {
|
|
6352
|
-
|
|
6353
|
-
|
|
6006
|
+
let transformedList = fromParts;
|
|
6007
|
+
if (Array.isArray(transformedList)) {
|
|
6008
|
+
transformedList = transformedList.map((item) => {
|
|
6354
6009
|
return partToVertex(apiClient, item);
|
|
6355
|
-
})
|
|
6356
|
-
}
|
|
6357
|
-
else {
|
|
6358
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
6010
|
+
});
|
|
6359
6011
|
}
|
|
6012
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
6360
6013
|
}
|
|
6361
6014
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
6362
6015
|
if (fromRole != null) {
|
|
@@ -6364,104 +6017,6 @@ function contentToVertex(apiClient, fromObject) {
|
|
|
6364
6017
|
}
|
|
6365
6018
|
return toObject;
|
|
6366
6019
|
}
|
|
6367
|
-
function schemaToVertex(apiClient, fromObject) {
|
|
6368
|
-
const toObject = {};
|
|
6369
|
-
const fromExample = getValueByPath(fromObject, ['example']);
|
|
6370
|
-
if (fromExample != null) {
|
|
6371
|
-
setValueByPath(toObject, ['example'], fromExample);
|
|
6372
|
-
}
|
|
6373
|
-
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
6374
|
-
if (fromPattern != null) {
|
|
6375
|
-
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
6376
|
-
}
|
|
6377
|
-
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
6378
|
-
if (fromDefault != null) {
|
|
6379
|
-
setValueByPath(toObject, ['default'], fromDefault);
|
|
6380
|
-
}
|
|
6381
|
-
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
6382
|
-
if (fromMaxLength != null) {
|
|
6383
|
-
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
6384
|
-
}
|
|
6385
|
-
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
6386
|
-
if (fromMinLength != null) {
|
|
6387
|
-
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
6388
|
-
}
|
|
6389
|
-
const fromMinProperties = getValueByPath(fromObject, [
|
|
6390
|
-
'minProperties',
|
|
6391
|
-
]);
|
|
6392
|
-
if (fromMinProperties != null) {
|
|
6393
|
-
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
6394
|
-
}
|
|
6395
|
-
const fromMaxProperties = getValueByPath(fromObject, [
|
|
6396
|
-
'maxProperties',
|
|
6397
|
-
]);
|
|
6398
|
-
if (fromMaxProperties != null) {
|
|
6399
|
-
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
6400
|
-
}
|
|
6401
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
6402
|
-
if (fromAnyOf != null) {
|
|
6403
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
6404
|
-
}
|
|
6405
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
6406
|
-
if (fromDescription != null) {
|
|
6407
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
6408
|
-
}
|
|
6409
|
-
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
6410
|
-
if (fromEnum != null) {
|
|
6411
|
-
setValueByPath(toObject, ['enum'], fromEnum);
|
|
6412
|
-
}
|
|
6413
|
-
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
6414
|
-
if (fromFormat != null) {
|
|
6415
|
-
setValueByPath(toObject, ['format'], fromFormat);
|
|
6416
|
-
}
|
|
6417
|
-
const fromItems = getValueByPath(fromObject, ['items']);
|
|
6418
|
-
if (fromItems != null) {
|
|
6419
|
-
setValueByPath(toObject, ['items'], fromItems);
|
|
6420
|
-
}
|
|
6421
|
-
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
6422
|
-
if (fromMaxItems != null) {
|
|
6423
|
-
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
6424
|
-
}
|
|
6425
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
6426
|
-
if (fromMaximum != null) {
|
|
6427
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
6428
|
-
}
|
|
6429
|
-
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
6430
|
-
if (fromMinItems != null) {
|
|
6431
|
-
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
6432
|
-
}
|
|
6433
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
6434
|
-
if (fromMinimum != null) {
|
|
6435
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
6436
|
-
}
|
|
6437
|
-
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
6438
|
-
if (fromNullable != null) {
|
|
6439
|
-
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
6440
|
-
}
|
|
6441
|
-
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
6442
|
-
if (fromProperties != null) {
|
|
6443
|
-
setValueByPath(toObject, ['properties'], fromProperties);
|
|
6444
|
-
}
|
|
6445
|
-
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
6446
|
-
'propertyOrdering',
|
|
6447
|
-
]);
|
|
6448
|
-
if (fromPropertyOrdering != null) {
|
|
6449
|
-
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
6450
|
-
}
|
|
6451
|
-
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
6452
|
-
if (fromRequired != null) {
|
|
6453
|
-
setValueByPath(toObject, ['required'], fromRequired);
|
|
6454
|
-
}
|
|
6455
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
6456
|
-
if (fromTitle != null) {
|
|
6457
|
-
setValueByPath(toObject, ['title'], fromTitle);
|
|
6458
|
-
}
|
|
6459
|
-
const fromType = getValueByPath(fromObject, ['type']);
|
|
6460
|
-
if (fromType != null) {
|
|
6461
|
-
setValueByPath(toObject, ['type'], fromType);
|
|
6462
|
-
}
|
|
6463
|
-
return toObject;
|
|
6464
|
-
}
|
|
6465
6020
|
function modelSelectionConfigToVertex(apiClient, fromObject) {
|
|
6466
6021
|
const toObject = {};
|
|
6467
6022
|
const fromFeatureSelectionPreference = getValueByPath(fromObject, [
|
|
@@ -6488,26 +6043,6 @@ function safetySettingToVertex(apiClient, fromObject) {
|
|
|
6488
6043
|
}
|
|
6489
6044
|
return toObject;
|
|
6490
6045
|
}
|
|
6491
|
-
function functionDeclarationToVertex(apiClient, fromObject) {
|
|
6492
|
-
const toObject = {};
|
|
6493
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
6494
|
-
if (fromResponse != null) {
|
|
6495
|
-
setValueByPath(toObject, ['response'], schemaToVertex(apiClient, fromResponse));
|
|
6496
|
-
}
|
|
6497
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
6498
|
-
if (fromDescription != null) {
|
|
6499
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
6500
|
-
}
|
|
6501
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
6502
|
-
if (fromName != null) {
|
|
6503
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
6504
|
-
}
|
|
6505
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
6506
|
-
if (fromParameters != null) {
|
|
6507
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
6508
|
-
}
|
|
6509
|
-
return toObject;
|
|
6510
|
-
}
|
|
6511
6046
|
function googleSearchToVertex() {
|
|
6512
6047
|
const toObject = {};
|
|
6513
6048
|
return toObject;
|
|
@@ -6538,19 +6073,6 @@ function googleSearchRetrievalToVertex(apiClient, fromObject) {
|
|
|
6538
6073
|
}
|
|
6539
6074
|
function toolToVertex(apiClient, fromObject) {
|
|
6540
6075
|
const toObject = {};
|
|
6541
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
6542
|
-
'functionDeclarations',
|
|
6543
|
-
]);
|
|
6544
|
-
if (fromFunctionDeclarations != null) {
|
|
6545
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
6546
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
6547
|
-
return functionDeclarationToVertex(apiClient, item);
|
|
6548
|
-
}));
|
|
6549
|
-
}
|
|
6550
|
-
else {
|
|
6551
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
6552
|
-
}
|
|
6553
|
-
}
|
|
6554
6076
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
6555
6077
|
if (fromRetrieval != null) {
|
|
6556
6078
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
@@ -6571,6 +6093,12 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
6571
6093
|
if (fromCodeExecution != null) {
|
|
6572
6094
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
6573
6095
|
}
|
|
6096
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
6097
|
+
'functionDeclarations',
|
|
6098
|
+
]);
|
|
6099
|
+
if (fromFunctionDeclarations != null) {
|
|
6100
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
6101
|
+
}
|
|
6574
6102
|
return toObject;
|
|
6575
6103
|
}
|
|
6576
6104
|
function functionCallingConfigToVertex(apiClient, fromObject) {
|
|
@@ -6717,7 +6245,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
6717
6245
|
'responseSchema',
|
|
6718
6246
|
]);
|
|
6719
6247
|
if (fromResponseSchema != null) {
|
|
6720
|
-
setValueByPath(toObject, ['responseSchema'],
|
|
6248
|
+
setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
|
|
6721
6249
|
}
|
|
6722
6250
|
const fromRoutingConfig = getValueByPath(fromObject, [
|
|
6723
6251
|
'routingConfig',
|
|
@@ -6735,25 +6263,23 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
6735
6263
|
'safetySettings',
|
|
6736
6264
|
]);
|
|
6737
6265
|
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
6738
|
-
|
|
6739
|
-
|
|
6266
|
+
let transformedList = fromSafetySettings;
|
|
6267
|
+
if (Array.isArray(transformedList)) {
|
|
6268
|
+
transformedList = transformedList.map((item) => {
|
|
6740
6269
|
return safetySettingToVertex(apiClient, item);
|
|
6741
|
-
})
|
|
6742
|
-
}
|
|
6743
|
-
else {
|
|
6744
|
-
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
|
|
6270
|
+
});
|
|
6745
6271
|
}
|
|
6272
|
+
setValueByPath(parentObject, ['safetySettings'], transformedList);
|
|
6746
6273
|
}
|
|
6747
6274
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
6748
6275
|
if (parentObject !== undefined && fromTools != null) {
|
|
6749
|
-
|
|
6750
|
-
|
|
6276
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
6277
|
+
if (Array.isArray(transformedList)) {
|
|
6278
|
+
transformedList = transformedList.map((item) => {
|
|
6751
6279
|
return toolToVertex(apiClient, tTool(apiClient, item));
|
|
6752
|
-
})
|
|
6753
|
-
}
|
|
6754
|
-
else {
|
|
6755
|
-
setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
|
|
6280
|
+
});
|
|
6756
6281
|
}
|
|
6282
|
+
setValueByPath(parentObject, ['tools'], transformedList);
|
|
6757
6283
|
}
|
|
6758
6284
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
6759
6285
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
@@ -6807,14 +6333,13 @@ function generateContentParametersToVertex(apiClient, fromObject) {
|
|
|
6807
6333
|
}
|
|
6808
6334
|
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
6809
6335
|
if (fromContents != null) {
|
|
6810
|
-
|
|
6811
|
-
|
|
6336
|
+
let transformedList = tContents(apiClient, fromContents);
|
|
6337
|
+
if (Array.isArray(transformedList)) {
|
|
6338
|
+
transformedList = transformedList.map((item) => {
|
|
6812
6339
|
return contentToVertex(apiClient, item);
|
|
6813
|
-
})
|
|
6814
|
-
}
|
|
6815
|
-
else {
|
|
6816
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
6340
|
+
});
|
|
6817
6341
|
}
|
|
6342
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
6818
6343
|
}
|
|
6819
6344
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6820
6345
|
if (fromConfig != null) {
|
|
@@ -6976,6 +6501,42 @@ function getModelParametersToVertex(apiClient, fromObject) {
|
|
|
6976
6501
|
}
|
|
6977
6502
|
return toObject;
|
|
6978
6503
|
}
|
|
6504
|
+
function updateModelConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6505
|
+
const toObject = {};
|
|
6506
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6507
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
6508
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
6509
|
+
}
|
|
6510
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
6511
|
+
if (parentObject !== undefined && fromDescription != null) {
|
|
6512
|
+
setValueByPath(parentObject, ['description'], fromDescription);
|
|
6513
|
+
}
|
|
6514
|
+
return toObject;
|
|
6515
|
+
}
|
|
6516
|
+
function updateModelParametersToVertex(apiClient, fromObject) {
|
|
6517
|
+
const toObject = {};
|
|
6518
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6519
|
+
if (fromModel != null) {
|
|
6520
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
6521
|
+
}
|
|
6522
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6523
|
+
if (fromConfig != null) {
|
|
6524
|
+
setValueByPath(toObject, ['config'], updateModelConfigToVertex(apiClient, fromConfig, toObject));
|
|
6525
|
+
}
|
|
6526
|
+
return toObject;
|
|
6527
|
+
}
|
|
6528
|
+
function deleteModelParametersToVertex(apiClient, fromObject) {
|
|
6529
|
+
const toObject = {};
|
|
6530
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6531
|
+
if (fromModel != null) {
|
|
6532
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
6533
|
+
}
|
|
6534
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6535
|
+
if (fromConfig != null) {
|
|
6536
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
6537
|
+
}
|
|
6538
|
+
return toObject;
|
|
6539
|
+
}
|
|
6979
6540
|
function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
6980
6541
|
const toObject = {};
|
|
6981
6542
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
@@ -6986,14 +6547,13 @@ function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
6986
6547
|
}
|
|
6987
6548
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
6988
6549
|
if (parentObject !== undefined && fromTools != null) {
|
|
6989
|
-
|
|
6990
|
-
|
|
6550
|
+
let transformedList = fromTools;
|
|
6551
|
+
if (Array.isArray(transformedList)) {
|
|
6552
|
+
transformedList = transformedList.map((item) => {
|
|
6991
6553
|
return toolToVertex(apiClient, item);
|
|
6992
|
-
})
|
|
6993
|
-
}
|
|
6994
|
-
else {
|
|
6995
|
-
setValueByPath(parentObject, ['tools'], fromTools);
|
|
6554
|
+
});
|
|
6996
6555
|
}
|
|
6556
|
+
setValueByPath(parentObject, ['tools'], transformedList);
|
|
6997
6557
|
}
|
|
6998
6558
|
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
6999
6559
|
'generationConfig',
|
|
@@ -7011,14 +6571,13 @@ function countTokensParametersToVertex(apiClient, fromObject) {
|
|
|
7011
6571
|
}
|
|
7012
6572
|
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
7013
6573
|
if (fromContents != null) {
|
|
7014
|
-
|
|
7015
|
-
|
|
6574
|
+
let transformedList = tContents(apiClient, fromContents);
|
|
6575
|
+
if (Array.isArray(transformedList)) {
|
|
6576
|
+
transformedList = transformedList.map((item) => {
|
|
7016
6577
|
return contentToVertex(apiClient, item);
|
|
7017
|
-
})
|
|
7018
|
-
}
|
|
7019
|
-
else {
|
|
7020
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
6578
|
+
});
|
|
7021
6579
|
}
|
|
6580
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
7022
6581
|
}
|
|
7023
6582
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7024
6583
|
if (fromConfig != null) {
|
|
@@ -7034,14 +6593,13 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
7034
6593
|
}
|
|
7035
6594
|
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
7036
6595
|
if (fromContents != null) {
|
|
7037
|
-
|
|
7038
|
-
|
|
6596
|
+
let transformedList = tContents(apiClient, fromContents);
|
|
6597
|
+
if (Array.isArray(transformedList)) {
|
|
6598
|
+
transformedList = transformedList.map((item) => {
|
|
7039
6599
|
return contentToVertex(apiClient, item);
|
|
7040
|
-
})
|
|
7041
|
-
}
|
|
7042
|
-
else {
|
|
7043
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
6600
|
+
});
|
|
7044
6601
|
}
|
|
6602
|
+
setValueByPath(toObject, ['contents'], transformedList);
|
|
7045
6603
|
}
|
|
7046
6604
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7047
6605
|
if (fromConfig != null) {
|
|
@@ -7189,14 +6747,13 @@ function contentFromMldev(apiClient, fromObject) {
|
|
|
7189
6747
|
const toObject = {};
|
|
7190
6748
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7191
6749
|
if (fromParts != null) {
|
|
7192
|
-
|
|
7193
|
-
|
|
6750
|
+
let transformedList = fromParts;
|
|
6751
|
+
if (Array.isArray(transformedList)) {
|
|
6752
|
+
transformedList = transformedList.map((item) => {
|
|
7194
6753
|
return partFromMldev(apiClient, item);
|
|
7195
|
-
})
|
|
7196
|
-
}
|
|
7197
|
-
else {
|
|
7198
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
6754
|
+
});
|
|
7199
6755
|
}
|
|
6756
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
7200
6757
|
}
|
|
7201
6758
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
7202
6759
|
if (fromRole != null) {
|
|
@@ -7264,14 +6821,13 @@ function generateContentResponseFromMldev(apiClient, fromObject) {
|
|
|
7264
6821
|
const toObject = {};
|
|
7265
6822
|
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
7266
6823
|
if (fromCandidates != null) {
|
|
7267
|
-
|
|
7268
|
-
|
|
6824
|
+
let transformedList = fromCandidates;
|
|
6825
|
+
if (Array.isArray(transformedList)) {
|
|
6826
|
+
transformedList = transformedList.map((item) => {
|
|
7269
6827
|
return candidateFromMldev(apiClient, item);
|
|
7270
|
-
})
|
|
7271
|
-
}
|
|
7272
|
-
else {
|
|
7273
|
-
setValueByPath(toObject, ['candidates'], fromCandidates);
|
|
6828
|
+
});
|
|
7274
6829
|
}
|
|
6830
|
+
setValueByPath(toObject, ['candidates'], transformedList);
|
|
7275
6831
|
}
|
|
7276
6832
|
const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
|
|
7277
6833
|
if (fromModelVersion != null) {
|
|
@@ -7307,14 +6863,13 @@ function embedContentResponseFromMldev(apiClient, fromObject) {
|
|
|
7307
6863
|
const toObject = {};
|
|
7308
6864
|
const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
|
|
7309
6865
|
if (fromEmbeddings != null) {
|
|
7310
|
-
|
|
7311
|
-
|
|
6866
|
+
let transformedList = fromEmbeddings;
|
|
6867
|
+
if (Array.isArray(transformedList)) {
|
|
6868
|
+
transformedList = transformedList.map((item) => {
|
|
7312
6869
|
return contentEmbeddingFromMldev(apiClient, item);
|
|
7313
|
-
})
|
|
7314
|
-
}
|
|
7315
|
-
else {
|
|
7316
|
-
setValueByPath(toObject, ['embeddings'], fromEmbeddings);
|
|
6870
|
+
});
|
|
7317
6871
|
}
|
|
6872
|
+
setValueByPath(toObject, ['embeddings'], transformedList);
|
|
7318
6873
|
}
|
|
7319
6874
|
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
7320
6875
|
if (fromMetadata != null) {
|
|
@@ -7382,14 +6937,13 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
|
|
|
7382
6937
|
'predictions',
|
|
7383
6938
|
]);
|
|
7384
6939
|
if (fromGeneratedImages != null) {
|
|
7385
|
-
|
|
7386
|
-
|
|
6940
|
+
let transformedList = fromGeneratedImages;
|
|
6941
|
+
if (Array.isArray(transformedList)) {
|
|
6942
|
+
transformedList = transformedList.map((item) => {
|
|
7387
6943
|
return generatedImageFromMldev(apiClient, item);
|
|
7388
|
-
})
|
|
7389
|
-
}
|
|
7390
|
-
else {
|
|
7391
|
-
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
6944
|
+
});
|
|
7392
6945
|
}
|
|
6946
|
+
setValueByPath(toObject, ['generatedImages'], transformedList);
|
|
7393
6947
|
}
|
|
7394
6948
|
const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
|
|
7395
6949
|
'positivePromptSafetyAttributes',
|
|
@@ -7457,6 +7011,10 @@ function modelFromMldev(apiClient, fromObject) {
|
|
|
7457
7011
|
}
|
|
7458
7012
|
return toObject;
|
|
7459
7013
|
}
|
|
7014
|
+
function deleteModelResponseFromMldev() {
|
|
7015
|
+
const toObject = {};
|
|
7016
|
+
return toObject;
|
|
7017
|
+
}
|
|
7460
7018
|
function countTokensResponseFromMldev(apiClient, fromObject) {
|
|
7461
7019
|
const toObject = {};
|
|
7462
7020
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
@@ -7504,14 +7062,13 @@ function generateVideosResponseFromMldev$1(apiClient, fromObject) {
|
|
|
7504
7062
|
'generatedSamples',
|
|
7505
7063
|
]);
|
|
7506
7064
|
if (fromGeneratedVideos != null) {
|
|
7507
|
-
|
|
7508
|
-
|
|
7065
|
+
let transformedList = fromGeneratedVideos;
|
|
7066
|
+
if (Array.isArray(transformedList)) {
|
|
7067
|
+
transformedList = transformedList.map((item) => {
|
|
7509
7068
|
return generatedVideoFromMldev$1(apiClient, item);
|
|
7510
|
-
})
|
|
7511
|
-
}
|
|
7512
|
-
else {
|
|
7513
|
-
setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
|
|
7069
|
+
});
|
|
7514
7070
|
}
|
|
7071
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
7515
7072
|
}
|
|
7516
7073
|
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
7517
7074
|
'raiMediaFilteredCount',
|
|
@@ -7606,14 +7163,13 @@ function contentFromVertex(apiClient, fromObject) {
|
|
|
7606
7163
|
const toObject = {};
|
|
7607
7164
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7608
7165
|
if (fromParts != null) {
|
|
7609
|
-
|
|
7610
|
-
|
|
7166
|
+
let transformedList = fromParts;
|
|
7167
|
+
if (Array.isArray(transformedList)) {
|
|
7168
|
+
transformedList = transformedList.map((item) => {
|
|
7611
7169
|
return partFromVertex(apiClient, item);
|
|
7612
|
-
})
|
|
7613
|
-
}
|
|
7614
|
-
else {
|
|
7615
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
7170
|
+
});
|
|
7616
7171
|
}
|
|
7172
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
7617
7173
|
}
|
|
7618
7174
|
const fromRole = getValueByPath(fromObject, ['role']);
|
|
7619
7175
|
if (fromRole != null) {
|
|
@@ -7683,14 +7239,13 @@ function generateContentResponseFromVertex(apiClient, fromObject) {
|
|
|
7683
7239
|
const toObject = {};
|
|
7684
7240
|
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
7685
7241
|
if (fromCandidates != null) {
|
|
7686
|
-
|
|
7687
|
-
|
|
7242
|
+
let transformedList = fromCandidates;
|
|
7243
|
+
if (Array.isArray(transformedList)) {
|
|
7244
|
+
transformedList = transformedList.map((item) => {
|
|
7688
7245
|
return candidateFromVertex(apiClient, item);
|
|
7689
|
-
})
|
|
7690
|
-
}
|
|
7691
|
-
else {
|
|
7692
|
-
setValueByPath(toObject, ['candidates'], fromCandidates);
|
|
7246
|
+
});
|
|
7693
7247
|
}
|
|
7248
|
+
setValueByPath(toObject, ['candidates'], transformedList);
|
|
7694
7249
|
}
|
|
7695
7250
|
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
7696
7251
|
if (fromCreateTime != null) {
|
|
@@ -7759,14 +7314,13 @@ function embedContentResponseFromVertex(apiClient, fromObject) {
|
|
|
7759
7314
|
'embeddings',
|
|
7760
7315
|
]);
|
|
7761
7316
|
if (fromEmbeddings != null) {
|
|
7762
|
-
|
|
7763
|
-
|
|
7317
|
+
let transformedList = fromEmbeddings;
|
|
7318
|
+
if (Array.isArray(transformedList)) {
|
|
7319
|
+
transformedList = transformedList.map((item) => {
|
|
7764
7320
|
return contentEmbeddingFromVertex(apiClient, item);
|
|
7765
|
-
})
|
|
7766
|
-
}
|
|
7767
|
-
else {
|
|
7768
|
-
setValueByPath(toObject, ['embeddings'], fromEmbeddings);
|
|
7321
|
+
});
|
|
7769
7322
|
}
|
|
7323
|
+
setValueByPath(toObject, ['embeddings'], transformedList);
|
|
7770
7324
|
}
|
|
7771
7325
|
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
7772
7326
|
if (fromMetadata != null) {
|
|
@@ -7842,14 +7396,13 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
7842
7396
|
'predictions',
|
|
7843
7397
|
]);
|
|
7844
7398
|
if (fromGeneratedImages != null) {
|
|
7845
|
-
|
|
7846
|
-
|
|
7399
|
+
let transformedList = fromGeneratedImages;
|
|
7400
|
+
if (Array.isArray(transformedList)) {
|
|
7401
|
+
transformedList = transformedList.map((item) => {
|
|
7847
7402
|
return generatedImageFromVertex(apiClient, item);
|
|
7848
|
-
})
|
|
7849
|
-
}
|
|
7850
|
-
else {
|
|
7851
|
-
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
7403
|
+
});
|
|
7852
7404
|
}
|
|
7405
|
+
setValueByPath(toObject, ['generatedImages'], transformedList);
|
|
7853
7406
|
}
|
|
7854
7407
|
const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
|
|
7855
7408
|
'positivePromptSafetyAttributes',
|
|
@@ -7912,14 +7465,13 @@ function modelFromVertex(apiClient, fromObject) {
|
|
|
7912
7465
|
}
|
|
7913
7466
|
const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
|
|
7914
7467
|
if (fromEndpoints != null) {
|
|
7915
|
-
|
|
7916
|
-
|
|
7468
|
+
let transformedList = fromEndpoints;
|
|
7469
|
+
if (Array.isArray(transformedList)) {
|
|
7470
|
+
transformedList = transformedList.map((item) => {
|
|
7917
7471
|
return endpointFromVertex(apiClient, item);
|
|
7918
|
-
})
|
|
7919
|
-
}
|
|
7920
|
-
else {
|
|
7921
|
-
setValueByPath(toObject, ['endpoints'], fromEndpoints);
|
|
7472
|
+
});
|
|
7922
7473
|
}
|
|
7474
|
+
setValueByPath(toObject, ['endpoints'], transformedList);
|
|
7923
7475
|
}
|
|
7924
7476
|
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
7925
7477
|
if (fromLabels != null) {
|
|
@@ -7931,6 +7483,10 @@ function modelFromVertex(apiClient, fromObject) {
|
|
|
7931
7483
|
}
|
|
7932
7484
|
return toObject;
|
|
7933
7485
|
}
|
|
7486
|
+
function deleteModelResponseFromVertex() {
|
|
7487
|
+
const toObject = {};
|
|
7488
|
+
return toObject;
|
|
7489
|
+
}
|
|
7934
7490
|
function countTokensResponseFromVertex(apiClient, fromObject) {
|
|
7935
7491
|
const toObject = {};
|
|
7936
7492
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
@@ -7977,14 +7533,13 @@ function generateVideosResponseFromVertex$1(apiClient, fromObject) {
|
|
|
7977
7533
|
const toObject = {};
|
|
7978
7534
|
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
7979
7535
|
if (fromGeneratedVideos != null) {
|
|
7980
|
-
|
|
7981
|
-
|
|
7536
|
+
let transformedList = fromGeneratedVideos;
|
|
7537
|
+
if (Array.isArray(transformedList)) {
|
|
7538
|
+
transformedList = transformedList.map((item) => {
|
|
7982
7539
|
return generatedVideoFromVertex$1(apiClient, item);
|
|
7983
|
-
})
|
|
7984
|
-
}
|
|
7985
|
-
else {
|
|
7986
|
-
setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
|
|
7540
|
+
});
|
|
7987
7541
|
}
|
|
7542
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
7988
7543
|
}
|
|
7989
7544
|
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
7990
7545
|
'raiMediaFilteredCount',
|
|
@@ -8927,6 +8482,146 @@ class Models extends BaseModule {
|
|
|
8927
8482
|
});
|
|
8928
8483
|
}
|
|
8929
8484
|
}
|
|
8485
|
+
/**
|
|
8486
|
+
* Updates a tuned model by its name.
|
|
8487
|
+
*
|
|
8488
|
+
* @param params - The parameters for updating the model.
|
|
8489
|
+
* @return The response from the API.
|
|
8490
|
+
*
|
|
8491
|
+
* @example
|
|
8492
|
+
* ```ts
|
|
8493
|
+
* const response = await ai.models.update({
|
|
8494
|
+
* model: 'tuned-model-name',
|
|
8495
|
+
* config: {
|
|
8496
|
+
* displayName: 'New display name',
|
|
8497
|
+
* description: 'New description',
|
|
8498
|
+
* },
|
|
8499
|
+
* });
|
|
8500
|
+
* ```
|
|
8501
|
+
*/
|
|
8502
|
+
async update(params) {
|
|
8503
|
+
var _a, _b, _c, _d;
|
|
8504
|
+
let response;
|
|
8505
|
+
let path = '';
|
|
8506
|
+
let queryParams = {};
|
|
8507
|
+
if (this.apiClient.isVertexAI()) {
|
|
8508
|
+
const body = updateModelParametersToVertex(this.apiClient, params);
|
|
8509
|
+
path = formatMap('{model}', body['_url']);
|
|
8510
|
+
queryParams = body['_query'];
|
|
8511
|
+
delete body['config'];
|
|
8512
|
+
delete body['_url'];
|
|
8513
|
+
delete body['_query'];
|
|
8514
|
+
response = this.apiClient
|
|
8515
|
+
.request({
|
|
8516
|
+
path: path,
|
|
8517
|
+
queryParams: queryParams,
|
|
8518
|
+
body: JSON.stringify(body),
|
|
8519
|
+
httpMethod: 'PATCH',
|
|
8520
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8521
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8522
|
+
})
|
|
8523
|
+
.then((httpResponse) => {
|
|
8524
|
+
return httpResponse.json();
|
|
8525
|
+
});
|
|
8526
|
+
return response.then((apiResponse) => {
|
|
8527
|
+
const resp = modelFromVertex(this.apiClient, apiResponse);
|
|
8528
|
+
return resp;
|
|
8529
|
+
});
|
|
8530
|
+
}
|
|
8531
|
+
else {
|
|
8532
|
+
const body = updateModelParametersToMldev(this.apiClient, params);
|
|
8533
|
+
path = formatMap('{name}', body['_url']);
|
|
8534
|
+
queryParams = body['_query'];
|
|
8535
|
+
delete body['config'];
|
|
8536
|
+
delete body['_url'];
|
|
8537
|
+
delete body['_query'];
|
|
8538
|
+
response = this.apiClient
|
|
8539
|
+
.request({
|
|
8540
|
+
path: path,
|
|
8541
|
+
queryParams: queryParams,
|
|
8542
|
+
body: JSON.stringify(body),
|
|
8543
|
+
httpMethod: 'PATCH',
|
|
8544
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
8545
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8546
|
+
})
|
|
8547
|
+
.then((httpResponse) => {
|
|
8548
|
+
return httpResponse.json();
|
|
8549
|
+
});
|
|
8550
|
+
return response.then((apiResponse) => {
|
|
8551
|
+
const resp = modelFromMldev(this.apiClient, apiResponse);
|
|
8552
|
+
return resp;
|
|
8553
|
+
});
|
|
8554
|
+
}
|
|
8555
|
+
}
|
|
8556
|
+
/**
|
|
8557
|
+
* Deletes a tuned model by its name.
|
|
8558
|
+
*
|
|
8559
|
+
* @param params - The parameters for deleting the model.
|
|
8560
|
+
* @return The response from the API.
|
|
8561
|
+
*
|
|
8562
|
+
* @example
|
|
8563
|
+
* ```ts
|
|
8564
|
+
* const response = await ai.models.delete({model: 'tuned-model-name'});
|
|
8565
|
+
* ```
|
|
8566
|
+
*/
|
|
8567
|
+
async delete(params) {
|
|
8568
|
+
var _a, _b, _c, _d;
|
|
8569
|
+
let response;
|
|
8570
|
+
let path = '';
|
|
8571
|
+
let queryParams = {};
|
|
8572
|
+
if (this.apiClient.isVertexAI()) {
|
|
8573
|
+
const body = deleteModelParametersToVertex(this.apiClient, params);
|
|
8574
|
+
path = formatMap('{name}', body['_url']);
|
|
8575
|
+
queryParams = body['_query'];
|
|
8576
|
+
delete body['config'];
|
|
8577
|
+
delete body['_url'];
|
|
8578
|
+
delete body['_query'];
|
|
8579
|
+
response = this.apiClient
|
|
8580
|
+
.request({
|
|
8581
|
+
path: path,
|
|
8582
|
+
queryParams: queryParams,
|
|
8583
|
+
body: JSON.stringify(body),
|
|
8584
|
+
httpMethod: 'DELETE',
|
|
8585
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8586
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8587
|
+
})
|
|
8588
|
+
.then((httpResponse) => {
|
|
8589
|
+
return httpResponse.json();
|
|
8590
|
+
});
|
|
8591
|
+
return response.then(() => {
|
|
8592
|
+
const resp = deleteModelResponseFromVertex();
|
|
8593
|
+
const typedResp = new DeleteModelResponse();
|
|
8594
|
+
Object.assign(typedResp, resp);
|
|
8595
|
+
return typedResp;
|
|
8596
|
+
});
|
|
8597
|
+
}
|
|
8598
|
+
else {
|
|
8599
|
+
const body = deleteModelParametersToMldev(this.apiClient, params);
|
|
8600
|
+
path = formatMap('{name}', body['_url']);
|
|
8601
|
+
queryParams = body['_query'];
|
|
8602
|
+
delete body['config'];
|
|
8603
|
+
delete body['_url'];
|
|
8604
|
+
delete body['_query'];
|
|
8605
|
+
response = this.apiClient
|
|
8606
|
+
.request({
|
|
8607
|
+
path: path,
|
|
8608
|
+
queryParams: queryParams,
|
|
8609
|
+
body: JSON.stringify(body),
|
|
8610
|
+
httpMethod: 'DELETE',
|
|
8611
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
8612
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
8613
|
+
})
|
|
8614
|
+
.then((httpResponse) => {
|
|
8615
|
+
return httpResponse.json();
|
|
8616
|
+
});
|
|
8617
|
+
return response.then(() => {
|
|
8618
|
+
const resp = deleteModelResponseFromMldev();
|
|
8619
|
+
const typedResp = new DeleteModelResponse();
|
|
8620
|
+
Object.assign(typedResp, resp);
|
|
8621
|
+
return typedResp;
|
|
8622
|
+
});
|
|
8623
|
+
}
|
|
8624
|
+
}
|
|
8930
8625
|
/**
|
|
8931
8626
|
* Counts the number of tokens in the given contents. Multimodal input is
|
|
8932
8627
|
* supported for Gemini models.
|
|
@@ -9217,14 +8912,13 @@ function generateVideosResponseFromMldev(apiClient, fromObject) {
|
|
|
9217
8912
|
'generatedSamples',
|
|
9218
8913
|
]);
|
|
9219
8914
|
if (fromGeneratedVideos != null) {
|
|
9220
|
-
|
|
9221
|
-
|
|
8915
|
+
let transformedList = fromGeneratedVideos;
|
|
8916
|
+
if (Array.isArray(transformedList)) {
|
|
8917
|
+
transformedList = transformedList.map((item) => {
|
|
9222
8918
|
return generatedVideoFromMldev(apiClient, item);
|
|
9223
|
-
})
|
|
9224
|
-
}
|
|
9225
|
-
else {
|
|
9226
|
-
setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
|
|
8919
|
+
});
|
|
9227
8920
|
}
|
|
8921
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
9228
8922
|
}
|
|
9229
8923
|
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
9230
8924
|
'raiMediaFilteredCount',
|
|
@@ -9297,14 +8991,13 @@ function generateVideosResponseFromVertex(apiClient, fromObject) {
|
|
|
9297
8991
|
const toObject = {};
|
|
9298
8992
|
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
9299
8993
|
if (fromGeneratedVideos != null) {
|
|
9300
|
-
|
|
9301
|
-
|
|
8994
|
+
let transformedList = fromGeneratedVideos;
|
|
8995
|
+
if (Array.isArray(transformedList)) {
|
|
8996
|
+
transformedList = transformedList.map((item) => {
|
|
9302
8997
|
return generatedVideoFromVertex(apiClient, item);
|
|
9303
|
-
})
|
|
9304
|
-
}
|
|
9305
|
-
else {
|
|
9306
|
-
setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
|
|
8998
|
+
});
|
|
9307
8999
|
}
|
|
9000
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
9308
9001
|
}
|
|
9309
9002
|
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
9310
9003
|
'raiMediaFilteredCount',
|
|
@@ -9475,6 +9168,736 @@ class Operations extends BaseModule {
|
|
|
9475
9168
|
}
|
|
9476
9169
|
}
|
|
9477
9170
|
|
|
9171
|
+
/**
|
|
9172
|
+
* @license
|
|
9173
|
+
* Copyright 2025 Google LLC
|
|
9174
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9175
|
+
*/
|
|
9176
|
+
function getTuningJobParametersToMldev(apiClient, fromObject) {
|
|
9177
|
+
const toObject = {};
|
|
9178
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9179
|
+
if (fromName != null) {
|
|
9180
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
9181
|
+
}
|
|
9182
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
9183
|
+
if (fromConfig != null) {
|
|
9184
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
9185
|
+
}
|
|
9186
|
+
return toObject;
|
|
9187
|
+
}
|
|
9188
|
+
function listTuningJobsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
9189
|
+
const toObject = {};
|
|
9190
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
9191
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
9192
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
9193
|
+
}
|
|
9194
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
9195
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
9196
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
9197
|
+
}
|
|
9198
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
9199
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
9200
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
9201
|
+
}
|
|
9202
|
+
return toObject;
|
|
9203
|
+
}
|
|
9204
|
+
function listTuningJobsParametersToMldev(apiClient, fromObject) {
|
|
9205
|
+
const toObject = {};
|
|
9206
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
9207
|
+
if (fromConfig != null) {
|
|
9208
|
+
setValueByPath(toObject, ['config'], listTuningJobsConfigToMldev(apiClient, fromConfig, toObject));
|
|
9209
|
+
}
|
|
9210
|
+
return toObject;
|
|
9211
|
+
}
|
|
9212
|
+
function tuningExampleToMldev(apiClient, fromObject) {
|
|
9213
|
+
const toObject = {};
|
|
9214
|
+
const fromTextInput = getValueByPath(fromObject, ['textInput']);
|
|
9215
|
+
if (fromTextInput != null) {
|
|
9216
|
+
setValueByPath(toObject, ['textInput'], fromTextInput);
|
|
9217
|
+
}
|
|
9218
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
9219
|
+
if (fromOutput != null) {
|
|
9220
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
9221
|
+
}
|
|
9222
|
+
return toObject;
|
|
9223
|
+
}
|
|
9224
|
+
function tuningDatasetToMldev(apiClient, fromObject) {
|
|
9225
|
+
const toObject = {};
|
|
9226
|
+
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
9227
|
+
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
9228
|
+
}
|
|
9229
|
+
const fromExamples = getValueByPath(fromObject, ['examples']);
|
|
9230
|
+
if (fromExamples != null) {
|
|
9231
|
+
let transformedList = fromExamples;
|
|
9232
|
+
if (Array.isArray(transformedList)) {
|
|
9233
|
+
transformedList = transformedList.map((item) => {
|
|
9234
|
+
return tuningExampleToMldev(apiClient, item);
|
|
9235
|
+
});
|
|
9236
|
+
}
|
|
9237
|
+
setValueByPath(toObject, ['examples', 'examples'], transformedList);
|
|
9238
|
+
}
|
|
9239
|
+
return toObject;
|
|
9240
|
+
}
|
|
9241
|
+
function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
|
|
9242
|
+
const toObject = {};
|
|
9243
|
+
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
9244
|
+
throw new Error('validationDataset parameter is not supported in Gemini API.');
|
|
9245
|
+
}
|
|
9246
|
+
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
9247
|
+
'tunedModelDisplayName',
|
|
9248
|
+
]);
|
|
9249
|
+
if (parentObject !== undefined && fromTunedModelDisplayName != null) {
|
|
9250
|
+
setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
|
|
9251
|
+
}
|
|
9252
|
+
if (getValueByPath(fromObject, ['description']) !== undefined) {
|
|
9253
|
+
throw new Error('description parameter is not supported in Gemini API.');
|
|
9254
|
+
}
|
|
9255
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
9256
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
9257
|
+
setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'epochCount'], fromEpochCount);
|
|
9258
|
+
}
|
|
9259
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
9260
|
+
'learningRateMultiplier',
|
|
9261
|
+
]);
|
|
9262
|
+
if (fromLearningRateMultiplier != null) {
|
|
9263
|
+
setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
9264
|
+
}
|
|
9265
|
+
if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
|
|
9266
|
+
throw new Error('adapterSize parameter is not supported in Gemini API.');
|
|
9267
|
+
}
|
|
9268
|
+
const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
|
|
9269
|
+
if (parentObject !== undefined && fromBatchSize != null) {
|
|
9270
|
+
setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
|
|
9271
|
+
}
|
|
9272
|
+
const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
|
|
9273
|
+
if (parentObject !== undefined && fromLearningRate != null) {
|
|
9274
|
+
setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
|
|
9275
|
+
}
|
|
9276
|
+
return toObject;
|
|
9277
|
+
}
|
|
9278
|
+
function createTuningJobParametersToMldev(apiClient, fromObject) {
|
|
9279
|
+
const toObject = {};
|
|
9280
|
+
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
9281
|
+
if (fromBaseModel != null) {
|
|
9282
|
+
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
9283
|
+
}
|
|
9284
|
+
const fromTrainingDataset = getValueByPath(fromObject, [
|
|
9285
|
+
'trainingDataset',
|
|
9286
|
+
]);
|
|
9287
|
+
if (fromTrainingDataset != null) {
|
|
9288
|
+
setValueByPath(toObject, ['tuningTask', 'trainingData'], tuningDatasetToMldev(apiClient, fromTrainingDataset));
|
|
9289
|
+
}
|
|
9290
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
9291
|
+
if (fromConfig != null) {
|
|
9292
|
+
setValueByPath(toObject, ['config'], createTuningJobConfigToMldev(apiClient, fromConfig, toObject));
|
|
9293
|
+
}
|
|
9294
|
+
return toObject;
|
|
9295
|
+
}
|
|
9296
|
+
function getTuningJobParametersToVertex(apiClient, fromObject) {
|
|
9297
|
+
const toObject = {};
|
|
9298
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9299
|
+
if (fromName != null) {
|
|
9300
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
9301
|
+
}
|
|
9302
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
9303
|
+
if (fromConfig != null) {
|
|
9304
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
9305
|
+
}
|
|
9306
|
+
return toObject;
|
|
9307
|
+
}
|
|
9308
|
+
function listTuningJobsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
9309
|
+
const toObject = {};
|
|
9310
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
9311
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
9312
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
9313
|
+
}
|
|
9314
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
9315
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
9316
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
9317
|
+
}
|
|
9318
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
9319
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
9320
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
9321
|
+
}
|
|
9322
|
+
return toObject;
|
|
9323
|
+
}
|
|
9324
|
+
function listTuningJobsParametersToVertex(apiClient, fromObject) {
|
|
9325
|
+
const toObject = {};
|
|
9326
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
9327
|
+
if (fromConfig != null) {
|
|
9328
|
+
setValueByPath(toObject, ['config'], listTuningJobsConfigToVertex(apiClient, fromConfig, toObject));
|
|
9329
|
+
}
|
|
9330
|
+
return toObject;
|
|
9331
|
+
}
|
|
9332
|
+
function tuningDatasetToVertex(apiClient, fromObject, parentObject) {
|
|
9333
|
+
const toObject = {};
|
|
9334
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
9335
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
9336
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
9337
|
+
}
|
|
9338
|
+
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
9339
|
+
throw new Error('examples parameter is not supported in Vertex AI.');
|
|
9340
|
+
}
|
|
9341
|
+
return toObject;
|
|
9342
|
+
}
|
|
9343
|
+
function tuningValidationDatasetToVertex(apiClient, fromObject) {
|
|
9344
|
+
const toObject = {};
|
|
9345
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
9346
|
+
if (fromGcsUri != null) {
|
|
9347
|
+
setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
|
|
9348
|
+
}
|
|
9349
|
+
return toObject;
|
|
9350
|
+
}
|
|
9351
|
+
function createTuningJobConfigToVertex(apiClient, fromObject, parentObject) {
|
|
9352
|
+
const toObject = {};
|
|
9353
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
9354
|
+
'validationDataset',
|
|
9355
|
+
]);
|
|
9356
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
9357
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(apiClient, fromValidationDataset));
|
|
9358
|
+
}
|
|
9359
|
+
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
9360
|
+
'tunedModelDisplayName',
|
|
9361
|
+
]);
|
|
9362
|
+
if (parentObject !== undefined && fromTunedModelDisplayName != null) {
|
|
9363
|
+
setValueByPath(parentObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
|
|
9364
|
+
}
|
|
9365
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
9366
|
+
if (parentObject !== undefined && fromDescription != null) {
|
|
9367
|
+
setValueByPath(parentObject, ['description'], fromDescription);
|
|
9368
|
+
}
|
|
9369
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
9370
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
9371
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
9372
|
+
}
|
|
9373
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
9374
|
+
'learningRateMultiplier',
|
|
9375
|
+
]);
|
|
9376
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
9377
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
9378
|
+
}
|
|
9379
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
9380
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
9381
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
9382
|
+
}
|
|
9383
|
+
if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
|
|
9384
|
+
throw new Error('batchSize parameter is not supported in Vertex AI.');
|
|
9385
|
+
}
|
|
9386
|
+
if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
|
|
9387
|
+
throw new Error('learningRate parameter is not supported in Vertex AI.');
|
|
9388
|
+
}
|
|
9389
|
+
return toObject;
|
|
9390
|
+
}
|
|
9391
|
+
function createTuningJobParametersToVertex(apiClient, fromObject) {
|
|
9392
|
+
const toObject = {};
|
|
9393
|
+
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
9394
|
+
if (fromBaseModel != null) {
|
|
9395
|
+
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
9396
|
+
}
|
|
9397
|
+
const fromTrainingDataset = getValueByPath(fromObject, [
|
|
9398
|
+
'trainingDataset',
|
|
9399
|
+
]);
|
|
9400
|
+
if (fromTrainingDataset != null) {
|
|
9401
|
+
setValueByPath(toObject, ['supervisedTuningSpec', 'trainingDatasetUri'], tuningDatasetToVertex(apiClient, fromTrainingDataset, toObject));
|
|
9402
|
+
}
|
|
9403
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
9404
|
+
if (fromConfig != null) {
|
|
9405
|
+
setValueByPath(toObject, ['config'], createTuningJobConfigToVertex(apiClient, fromConfig, toObject));
|
|
9406
|
+
}
|
|
9407
|
+
return toObject;
|
|
9408
|
+
}
|
|
9409
|
+
function tunedModelFromMldev(apiClient, fromObject) {
|
|
9410
|
+
const toObject = {};
|
|
9411
|
+
const fromModel = getValueByPath(fromObject, ['name']);
|
|
9412
|
+
if (fromModel != null) {
|
|
9413
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
9414
|
+
}
|
|
9415
|
+
const fromEndpoint = getValueByPath(fromObject, ['name']);
|
|
9416
|
+
if (fromEndpoint != null) {
|
|
9417
|
+
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
9418
|
+
}
|
|
9419
|
+
return toObject;
|
|
9420
|
+
}
|
|
9421
|
+
function tuningJobFromMldev(apiClient, fromObject) {
|
|
9422
|
+
const toObject = {};
|
|
9423
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9424
|
+
if (fromName != null) {
|
|
9425
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9426
|
+
}
|
|
9427
|
+
const fromState = getValueByPath(fromObject, ['state']);
|
|
9428
|
+
if (fromState != null) {
|
|
9429
|
+
setValueByPath(toObject, ['state'], tTuningJobStatus(apiClient, fromState));
|
|
9430
|
+
}
|
|
9431
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
9432
|
+
if (fromCreateTime != null) {
|
|
9433
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
9434
|
+
}
|
|
9435
|
+
const fromStartTime = getValueByPath(fromObject, [
|
|
9436
|
+
'tuningTask',
|
|
9437
|
+
'startTime',
|
|
9438
|
+
]);
|
|
9439
|
+
if (fromStartTime != null) {
|
|
9440
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
9441
|
+
}
|
|
9442
|
+
const fromEndTime = getValueByPath(fromObject, [
|
|
9443
|
+
'tuningTask',
|
|
9444
|
+
'completeTime',
|
|
9445
|
+
]);
|
|
9446
|
+
if (fromEndTime != null) {
|
|
9447
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
9448
|
+
}
|
|
9449
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
9450
|
+
if (fromUpdateTime != null) {
|
|
9451
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
9452
|
+
}
|
|
9453
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
9454
|
+
if (fromDescription != null) {
|
|
9455
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
9456
|
+
}
|
|
9457
|
+
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
9458
|
+
if (fromBaseModel != null) {
|
|
9459
|
+
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
9460
|
+
}
|
|
9461
|
+
const fromTunedModel = getValueByPath(fromObject, ['_self']);
|
|
9462
|
+
if (fromTunedModel != null) {
|
|
9463
|
+
setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(apiClient, fromTunedModel));
|
|
9464
|
+
}
|
|
9465
|
+
const fromDistillationSpec = getValueByPath(fromObject, [
|
|
9466
|
+
'distillationSpec',
|
|
9467
|
+
]);
|
|
9468
|
+
if (fromDistillationSpec != null) {
|
|
9469
|
+
setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
|
|
9470
|
+
}
|
|
9471
|
+
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
9472
|
+
if (fromExperiment != null) {
|
|
9473
|
+
setValueByPath(toObject, ['experiment'], fromExperiment);
|
|
9474
|
+
}
|
|
9475
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
9476
|
+
if (fromLabels != null) {
|
|
9477
|
+
setValueByPath(toObject, ['labels'], fromLabels);
|
|
9478
|
+
}
|
|
9479
|
+
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
9480
|
+
if (fromPipelineJob != null) {
|
|
9481
|
+
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
9482
|
+
}
|
|
9483
|
+
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
9484
|
+
'tunedModelDisplayName',
|
|
9485
|
+
]);
|
|
9486
|
+
if (fromTunedModelDisplayName != null) {
|
|
9487
|
+
setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
|
|
9488
|
+
}
|
|
9489
|
+
return toObject;
|
|
9490
|
+
}
|
|
9491
|
+
function listTuningJobsResponseFromMldev(apiClient, fromObject) {
|
|
9492
|
+
const toObject = {};
|
|
9493
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
9494
|
+
'nextPageToken',
|
|
9495
|
+
]);
|
|
9496
|
+
if (fromNextPageToken != null) {
|
|
9497
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
9498
|
+
}
|
|
9499
|
+
const fromTuningJobs = getValueByPath(fromObject, ['tunedModels']);
|
|
9500
|
+
if (fromTuningJobs != null) {
|
|
9501
|
+
let transformedList = fromTuningJobs;
|
|
9502
|
+
if (Array.isArray(transformedList)) {
|
|
9503
|
+
transformedList = transformedList.map((item) => {
|
|
9504
|
+
return tuningJobFromMldev(apiClient, item);
|
|
9505
|
+
});
|
|
9506
|
+
}
|
|
9507
|
+
setValueByPath(toObject, ['tuningJobs'], transformedList);
|
|
9508
|
+
}
|
|
9509
|
+
return toObject;
|
|
9510
|
+
}
|
|
9511
|
+
function operationFromMldev(apiClient, fromObject) {
|
|
9512
|
+
const toObject = {};
|
|
9513
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9514
|
+
if (fromName != null) {
|
|
9515
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9516
|
+
}
|
|
9517
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
9518
|
+
if (fromMetadata != null) {
|
|
9519
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
9520
|
+
}
|
|
9521
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
9522
|
+
if (fromDone != null) {
|
|
9523
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
9524
|
+
}
|
|
9525
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
9526
|
+
if (fromError != null) {
|
|
9527
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
9528
|
+
}
|
|
9529
|
+
return toObject;
|
|
9530
|
+
}
|
|
9531
|
+
function tunedModelFromVertex(apiClient, fromObject) {
|
|
9532
|
+
const toObject = {};
|
|
9533
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
9534
|
+
if (fromModel != null) {
|
|
9535
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
9536
|
+
}
|
|
9537
|
+
const fromEndpoint = getValueByPath(fromObject, ['endpoint']);
|
|
9538
|
+
if (fromEndpoint != null) {
|
|
9539
|
+
setValueByPath(toObject, ['endpoint'], fromEndpoint);
|
|
9540
|
+
}
|
|
9541
|
+
return toObject;
|
|
9542
|
+
}
|
|
9543
|
+
function tuningJobFromVertex(apiClient, fromObject) {
|
|
9544
|
+
const toObject = {};
|
|
9545
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9546
|
+
if (fromName != null) {
|
|
9547
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9548
|
+
}
|
|
9549
|
+
const fromState = getValueByPath(fromObject, ['state']);
|
|
9550
|
+
if (fromState != null) {
|
|
9551
|
+
setValueByPath(toObject, ['state'], tTuningJobStatus(apiClient, fromState));
|
|
9552
|
+
}
|
|
9553
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
9554
|
+
if (fromCreateTime != null) {
|
|
9555
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
9556
|
+
}
|
|
9557
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
9558
|
+
if (fromStartTime != null) {
|
|
9559
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
9560
|
+
}
|
|
9561
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
9562
|
+
if (fromEndTime != null) {
|
|
9563
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
9564
|
+
}
|
|
9565
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
9566
|
+
if (fromUpdateTime != null) {
|
|
9567
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
9568
|
+
}
|
|
9569
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
9570
|
+
if (fromError != null) {
|
|
9571
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
9572
|
+
}
|
|
9573
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
9574
|
+
if (fromDescription != null) {
|
|
9575
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
9576
|
+
}
|
|
9577
|
+
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
9578
|
+
if (fromBaseModel != null) {
|
|
9579
|
+
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
9580
|
+
}
|
|
9581
|
+
const fromTunedModel = getValueByPath(fromObject, ['tunedModel']);
|
|
9582
|
+
if (fromTunedModel != null) {
|
|
9583
|
+
setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(apiClient, fromTunedModel));
|
|
9584
|
+
}
|
|
9585
|
+
const fromSupervisedTuningSpec = getValueByPath(fromObject, [
|
|
9586
|
+
'supervisedTuningSpec',
|
|
9587
|
+
]);
|
|
9588
|
+
if (fromSupervisedTuningSpec != null) {
|
|
9589
|
+
setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
|
|
9590
|
+
}
|
|
9591
|
+
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
9592
|
+
'tuningDataStats',
|
|
9593
|
+
]);
|
|
9594
|
+
if (fromTuningDataStats != null) {
|
|
9595
|
+
setValueByPath(toObject, ['tuningDataStats'], fromTuningDataStats);
|
|
9596
|
+
}
|
|
9597
|
+
const fromEncryptionSpec = getValueByPath(fromObject, [
|
|
9598
|
+
'encryptionSpec',
|
|
9599
|
+
]);
|
|
9600
|
+
if (fromEncryptionSpec != null) {
|
|
9601
|
+
setValueByPath(toObject, ['encryptionSpec'], fromEncryptionSpec);
|
|
9602
|
+
}
|
|
9603
|
+
const fromPartnerModelTuningSpec = getValueByPath(fromObject, [
|
|
9604
|
+
'partnerModelTuningSpec',
|
|
9605
|
+
]);
|
|
9606
|
+
if (fromPartnerModelTuningSpec != null) {
|
|
9607
|
+
setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
|
|
9608
|
+
}
|
|
9609
|
+
const fromDistillationSpec = getValueByPath(fromObject, [
|
|
9610
|
+
'distillationSpec',
|
|
9611
|
+
]);
|
|
9612
|
+
if (fromDistillationSpec != null) {
|
|
9613
|
+
setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
|
|
9614
|
+
}
|
|
9615
|
+
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
9616
|
+
if (fromExperiment != null) {
|
|
9617
|
+
setValueByPath(toObject, ['experiment'], fromExperiment);
|
|
9618
|
+
}
|
|
9619
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
9620
|
+
if (fromLabels != null) {
|
|
9621
|
+
setValueByPath(toObject, ['labels'], fromLabels);
|
|
9622
|
+
}
|
|
9623
|
+
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
9624
|
+
if (fromPipelineJob != null) {
|
|
9625
|
+
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
9626
|
+
}
|
|
9627
|
+
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
9628
|
+
'tunedModelDisplayName',
|
|
9629
|
+
]);
|
|
9630
|
+
if (fromTunedModelDisplayName != null) {
|
|
9631
|
+
setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
|
|
9632
|
+
}
|
|
9633
|
+
return toObject;
|
|
9634
|
+
}
|
|
9635
|
+
function listTuningJobsResponseFromVertex(apiClient, fromObject) {
|
|
9636
|
+
const toObject = {};
|
|
9637
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
9638
|
+
'nextPageToken',
|
|
9639
|
+
]);
|
|
9640
|
+
if (fromNextPageToken != null) {
|
|
9641
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
9642
|
+
}
|
|
9643
|
+
const fromTuningJobs = getValueByPath(fromObject, ['tuningJobs']);
|
|
9644
|
+
if (fromTuningJobs != null) {
|
|
9645
|
+
let transformedList = fromTuningJobs;
|
|
9646
|
+
if (Array.isArray(transformedList)) {
|
|
9647
|
+
transformedList = transformedList.map((item) => {
|
|
9648
|
+
return tuningJobFromVertex(apiClient, item);
|
|
9649
|
+
});
|
|
9650
|
+
}
|
|
9651
|
+
setValueByPath(toObject, ['tuningJobs'], transformedList);
|
|
9652
|
+
}
|
|
9653
|
+
return toObject;
|
|
9654
|
+
}
|
|
9655
|
+
|
|
9656
|
+
/**
|
|
9657
|
+
* @license
|
|
9658
|
+
* Copyright 2025 Google LLC
|
|
9659
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9660
|
+
*/
|
|
9661
|
+
class Tunings extends BaseModule {
|
|
9662
|
+
constructor(apiClient) {
|
|
9663
|
+
super();
|
|
9664
|
+
this.apiClient = apiClient;
|
|
9665
|
+
/**
|
|
9666
|
+
* Gets a TuningJob.
|
|
9667
|
+
*
|
|
9668
|
+
* @param name - The resource name of the tuning job.
|
|
9669
|
+
* @return - A TuningJob object.
|
|
9670
|
+
*
|
|
9671
|
+
* @experimental - The SDK's tuning implementation is experimental, and may
|
|
9672
|
+
* change in future versions.
|
|
9673
|
+
*/
|
|
9674
|
+
this.get = async (params) => {
|
|
9675
|
+
return await this.getInternal(params);
|
|
9676
|
+
};
|
|
9677
|
+
/**
|
|
9678
|
+
* Lists tuning jobs.
|
|
9679
|
+
*
|
|
9680
|
+
* @param config - The configuration for the list request.
|
|
9681
|
+
* @return - A list of tuning jobs.
|
|
9682
|
+
*
|
|
9683
|
+
* @experimental - The SDK's tuning implementation is experimental, and may
|
|
9684
|
+
* change in future versions.
|
|
9685
|
+
*/
|
|
9686
|
+
this.list = async (params = {}) => {
|
|
9687
|
+
return new Pager(PagedItem.PAGED_ITEM_TUNING_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
9688
|
+
};
|
|
9689
|
+
/**
|
|
9690
|
+
* Creates a supervised fine-tuning job.
|
|
9691
|
+
*
|
|
9692
|
+
* @param params - The parameters for the tuning job.
|
|
9693
|
+
* @return - A TuningJob operation.
|
|
9694
|
+
*
|
|
9695
|
+
* @experimental - The SDK's tuning implementation is experimental, and may
|
|
9696
|
+
* change in future versions.
|
|
9697
|
+
*/
|
|
9698
|
+
this.tune = async (params) => {
|
|
9699
|
+
if (this.apiClient.isVertexAI()) {
|
|
9700
|
+
return await this.tuneInternal(params);
|
|
9701
|
+
}
|
|
9702
|
+
else {
|
|
9703
|
+
const operation = await this.tuneMldevInternal(params);
|
|
9704
|
+
let tunedModelName = '';
|
|
9705
|
+
if (operation['metadata'] !== undefined &&
|
|
9706
|
+
operation['metadata']['tunedModel'] !== undefined) {
|
|
9707
|
+
tunedModelName = operation['metadata']['tunedModel'];
|
|
9708
|
+
}
|
|
9709
|
+
else if (operation['name'] !== undefined &&
|
|
9710
|
+
operation['name'].includes('/operations/')) {
|
|
9711
|
+
tunedModelName = operation['name'].split('/operations/')[0];
|
|
9712
|
+
}
|
|
9713
|
+
const tuningJob = {
|
|
9714
|
+
name: tunedModelName,
|
|
9715
|
+
state: JobState.JOB_STATE_QUEUED,
|
|
9716
|
+
};
|
|
9717
|
+
return tuningJob;
|
|
9718
|
+
}
|
|
9719
|
+
};
|
|
9720
|
+
}
|
|
9721
|
+
async getInternal(params) {
|
|
9722
|
+
var _a, _b, _c, _d;
|
|
9723
|
+
let response;
|
|
9724
|
+
let path = '';
|
|
9725
|
+
let queryParams = {};
|
|
9726
|
+
if (this.apiClient.isVertexAI()) {
|
|
9727
|
+
const body = getTuningJobParametersToVertex(this.apiClient, params);
|
|
9728
|
+
path = formatMap('{name}', body['_url']);
|
|
9729
|
+
queryParams = body['_query'];
|
|
9730
|
+
delete body['config'];
|
|
9731
|
+
delete body['_url'];
|
|
9732
|
+
delete body['_query'];
|
|
9733
|
+
response = this.apiClient
|
|
9734
|
+
.request({
|
|
9735
|
+
path: path,
|
|
9736
|
+
queryParams: queryParams,
|
|
9737
|
+
body: JSON.stringify(body),
|
|
9738
|
+
httpMethod: 'GET',
|
|
9739
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9740
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9741
|
+
})
|
|
9742
|
+
.then((httpResponse) => {
|
|
9743
|
+
return httpResponse.json();
|
|
9744
|
+
});
|
|
9745
|
+
return response.then((apiResponse) => {
|
|
9746
|
+
const resp = tuningJobFromVertex(this.apiClient, apiResponse);
|
|
9747
|
+
return resp;
|
|
9748
|
+
});
|
|
9749
|
+
}
|
|
9750
|
+
else {
|
|
9751
|
+
const body = getTuningJobParametersToMldev(this.apiClient, params);
|
|
9752
|
+
path = formatMap('{name}', body['_url']);
|
|
9753
|
+
queryParams = body['_query'];
|
|
9754
|
+
delete body['config'];
|
|
9755
|
+
delete body['_url'];
|
|
9756
|
+
delete body['_query'];
|
|
9757
|
+
response = this.apiClient
|
|
9758
|
+
.request({
|
|
9759
|
+
path: path,
|
|
9760
|
+
queryParams: queryParams,
|
|
9761
|
+
body: JSON.stringify(body),
|
|
9762
|
+
httpMethod: 'GET',
|
|
9763
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
9764
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
9765
|
+
})
|
|
9766
|
+
.then((httpResponse) => {
|
|
9767
|
+
return httpResponse.json();
|
|
9768
|
+
});
|
|
9769
|
+
return response.then((apiResponse) => {
|
|
9770
|
+
const resp = tuningJobFromMldev(this.apiClient, apiResponse);
|
|
9771
|
+
return resp;
|
|
9772
|
+
});
|
|
9773
|
+
}
|
|
9774
|
+
}
|
|
9775
|
+
async listInternal(params) {
|
|
9776
|
+
var _a, _b, _c, _d;
|
|
9777
|
+
let response;
|
|
9778
|
+
let path = '';
|
|
9779
|
+
let queryParams = {};
|
|
9780
|
+
if (this.apiClient.isVertexAI()) {
|
|
9781
|
+
const body = listTuningJobsParametersToVertex(this.apiClient, params);
|
|
9782
|
+
path = formatMap('tuningJobs', body['_url']);
|
|
9783
|
+
queryParams = body['_query'];
|
|
9784
|
+
delete body['config'];
|
|
9785
|
+
delete body['_url'];
|
|
9786
|
+
delete body['_query'];
|
|
9787
|
+
response = this.apiClient
|
|
9788
|
+
.request({
|
|
9789
|
+
path: path,
|
|
9790
|
+
queryParams: queryParams,
|
|
9791
|
+
body: JSON.stringify(body),
|
|
9792
|
+
httpMethod: 'GET',
|
|
9793
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9794
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9795
|
+
})
|
|
9796
|
+
.then((httpResponse) => {
|
|
9797
|
+
return httpResponse.json();
|
|
9798
|
+
});
|
|
9799
|
+
return response.then((apiResponse) => {
|
|
9800
|
+
const resp = listTuningJobsResponseFromVertex(this.apiClient, apiResponse);
|
|
9801
|
+
const typedResp = new ListTuningJobsResponse();
|
|
9802
|
+
Object.assign(typedResp, resp);
|
|
9803
|
+
return typedResp;
|
|
9804
|
+
});
|
|
9805
|
+
}
|
|
9806
|
+
else {
|
|
9807
|
+
const body = listTuningJobsParametersToMldev(this.apiClient, params);
|
|
9808
|
+
path = formatMap('tunedModels', body['_url']);
|
|
9809
|
+
queryParams = body['_query'];
|
|
9810
|
+
delete body['config'];
|
|
9811
|
+
delete body['_url'];
|
|
9812
|
+
delete body['_query'];
|
|
9813
|
+
response = this.apiClient
|
|
9814
|
+
.request({
|
|
9815
|
+
path: path,
|
|
9816
|
+
queryParams: queryParams,
|
|
9817
|
+
body: JSON.stringify(body),
|
|
9818
|
+
httpMethod: 'GET',
|
|
9819
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
9820
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
9821
|
+
})
|
|
9822
|
+
.then((httpResponse) => {
|
|
9823
|
+
return httpResponse.json();
|
|
9824
|
+
});
|
|
9825
|
+
return response.then((apiResponse) => {
|
|
9826
|
+
const resp = listTuningJobsResponseFromMldev(this.apiClient, apiResponse);
|
|
9827
|
+
const typedResp = new ListTuningJobsResponse();
|
|
9828
|
+
Object.assign(typedResp, resp);
|
|
9829
|
+
return typedResp;
|
|
9830
|
+
});
|
|
9831
|
+
}
|
|
9832
|
+
}
|
|
9833
|
+
async tuneInternal(params) {
|
|
9834
|
+
var _a, _b;
|
|
9835
|
+
let response;
|
|
9836
|
+
let path = '';
|
|
9837
|
+
let queryParams = {};
|
|
9838
|
+
if (this.apiClient.isVertexAI()) {
|
|
9839
|
+
const body = createTuningJobParametersToVertex(this.apiClient, params);
|
|
9840
|
+
path = formatMap('tuningJobs', body['_url']);
|
|
9841
|
+
queryParams = body['_query'];
|
|
9842
|
+
delete body['config'];
|
|
9843
|
+
delete body['_url'];
|
|
9844
|
+
delete body['_query'];
|
|
9845
|
+
response = this.apiClient
|
|
9846
|
+
.request({
|
|
9847
|
+
path: path,
|
|
9848
|
+
queryParams: queryParams,
|
|
9849
|
+
body: JSON.stringify(body),
|
|
9850
|
+
httpMethod: 'POST',
|
|
9851
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9852
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9853
|
+
})
|
|
9854
|
+
.then((httpResponse) => {
|
|
9855
|
+
return httpResponse.json();
|
|
9856
|
+
});
|
|
9857
|
+
return response.then((apiResponse) => {
|
|
9858
|
+
const resp = tuningJobFromVertex(this.apiClient, apiResponse);
|
|
9859
|
+
return resp;
|
|
9860
|
+
});
|
|
9861
|
+
}
|
|
9862
|
+
else {
|
|
9863
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9866
|
+
async tuneMldevInternal(params) {
|
|
9867
|
+
var _a, _b;
|
|
9868
|
+
let response;
|
|
9869
|
+
let path = '';
|
|
9870
|
+
let queryParams = {};
|
|
9871
|
+
if (this.apiClient.isVertexAI()) {
|
|
9872
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
9873
|
+
}
|
|
9874
|
+
else {
|
|
9875
|
+
const body = createTuningJobParametersToMldev(this.apiClient, params);
|
|
9876
|
+
path = formatMap('tunedModels', body['_url']);
|
|
9877
|
+
queryParams = body['_query'];
|
|
9878
|
+
delete body['config'];
|
|
9879
|
+
delete body['_url'];
|
|
9880
|
+
delete body['_query'];
|
|
9881
|
+
response = this.apiClient
|
|
9882
|
+
.request({
|
|
9883
|
+
path: path,
|
|
9884
|
+
queryParams: queryParams,
|
|
9885
|
+
body: JSON.stringify(body),
|
|
9886
|
+
httpMethod: 'POST',
|
|
9887
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
9888
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
9889
|
+
})
|
|
9890
|
+
.then((httpResponse) => {
|
|
9891
|
+
return httpResponse.json();
|
|
9892
|
+
});
|
|
9893
|
+
return response.then((apiResponse) => {
|
|
9894
|
+
const resp = operationFromMldev(this.apiClient, apiResponse);
|
|
9895
|
+
return resp;
|
|
9896
|
+
});
|
|
9897
|
+
}
|
|
9898
|
+
}
|
|
9899
|
+
}
|
|
9900
|
+
|
|
9478
9901
|
/**
|
|
9479
9902
|
* @license
|
|
9480
9903
|
* Copyright 2025 Google LLC
|
|
@@ -9556,8 +9979,9 @@ class GoogleGenAI {
|
|
|
9556
9979
|
this.caches = new Caches(this.apiClient);
|
|
9557
9980
|
this.files = new Files(this.apiClient);
|
|
9558
9981
|
this.operations = new Operations(this.apiClient);
|
|
9982
|
+
this.tunings = new Tunings(this.apiClient);
|
|
9559
9983
|
}
|
|
9560
9984
|
}
|
|
9561
9985
|
|
|
9562
|
-
export { ActivityHandling, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DynamicRetrievalConfigMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, 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 };
|
|
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 };
|
|
9563
9987
|
//# sourceMappingURL=index.mjs.map
|