@google/genai 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/genai.d.ts +75 -6
- package/dist/index.js +1670 -1519
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1670 -1520
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +1543 -1392
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +75 -6
- package/dist/web/index.mjs +1543 -1393
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +75 -6
- package/package.json +2 -1
package/dist/node/index.js
CHANGED
|
@@ -257,7 +257,8 @@ function tContent(apiClient, origin) {
|
|
|
257
257
|
throw new Error('ContentUnion is required');
|
|
258
258
|
}
|
|
259
259
|
if (_isContent(origin)) {
|
|
260
|
-
// @ts-expect-error: _isContent is a utility function that checks if the
|
|
260
|
+
// @ts-expect-error: _isContent is a utility function that checks if the
|
|
261
|
+
// origin is a Content.
|
|
261
262
|
return origin;
|
|
262
263
|
}
|
|
263
264
|
if (_isUserPart(origin)) {
|
|
@@ -370,9 +371,6 @@ function tContents(apiClient, origin) {
|
|
|
370
371
|
}
|
|
371
372
|
function processSchema(apiClient, schema) {
|
|
372
373
|
if (!apiClient.isVertexAI()) {
|
|
373
|
-
if ('title' in schema) {
|
|
374
|
-
delete schema['title'];
|
|
375
|
-
}
|
|
376
374
|
if ('default' in schema) {
|
|
377
375
|
throw new Error('Default value is not supported in the response schema for the Gemini API.');
|
|
378
376
|
}
|
|
@@ -384,6 +382,18 @@ function processSchema(apiClient, schema) {
|
|
|
384
382
|
}
|
|
385
383
|
}
|
|
386
384
|
}
|
|
385
|
+
if ('items' in schema) {
|
|
386
|
+
if (schema['items'] !== undefined) {
|
|
387
|
+
processSchema(apiClient, schema['items']);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if ('properties' in schema) {
|
|
391
|
+
if (schema['properties'] !== undefined) {
|
|
392
|
+
for (const subSchema of Object.values(schema['properties'])) {
|
|
393
|
+
processSchema(apiClient, subSchema);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
387
397
|
}
|
|
388
398
|
function tSchema(apiClient, schema) {
|
|
389
399
|
processSchema(apiClient, schema);
|
|
@@ -566,54 +576,6 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
566
576
|
}
|
|
567
577
|
return toObject;
|
|
568
578
|
}
|
|
569
|
-
function partToVertex$1(apiClient, fromObject) {
|
|
570
|
-
const toObject = {};
|
|
571
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
572
|
-
'videoMetadata',
|
|
573
|
-
]);
|
|
574
|
-
if (fromVideoMetadata != null) {
|
|
575
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
576
|
-
}
|
|
577
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
578
|
-
if (fromThought != null) {
|
|
579
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
580
|
-
}
|
|
581
|
-
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
582
|
-
'codeExecutionResult',
|
|
583
|
-
]);
|
|
584
|
-
if (fromCodeExecutionResult != null) {
|
|
585
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
586
|
-
}
|
|
587
|
-
const fromExecutableCode = getValueByPath(fromObject, [
|
|
588
|
-
'executableCode',
|
|
589
|
-
]);
|
|
590
|
-
if (fromExecutableCode != null) {
|
|
591
|
-
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
592
|
-
}
|
|
593
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
594
|
-
if (fromFileData != null) {
|
|
595
|
-
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
596
|
-
}
|
|
597
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
598
|
-
if (fromFunctionCall != null) {
|
|
599
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
600
|
-
}
|
|
601
|
-
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
602
|
-
'functionResponse',
|
|
603
|
-
]);
|
|
604
|
-
if (fromFunctionResponse != null) {
|
|
605
|
-
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
606
|
-
}
|
|
607
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
608
|
-
if (fromInlineData != null) {
|
|
609
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
610
|
-
}
|
|
611
|
-
const fromText = getValueByPath(fromObject, ['text']);
|
|
612
|
-
if (fromText != null) {
|
|
613
|
-
setValueByPath(toObject, ['text'], fromText);
|
|
614
|
-
}
|
|
615
|
-
return toObject;
|
|
616
|
-
}
|
|
617
579
|
function contentToMldev$1(apiClient, fromObject) {
|
|
618
580
|
const toObject = {};
|
|
619
581
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -633,123 +595,6 @@ function contentToMldev$1(apiClient, fromObject) {
|
|
|
633
595
|
}
|
|
634
596
|
return toObject;
|
|
635
597
|
}
|
|
636
|
-
function contentToVertex$1(apiClient, fromObject) {
|
|
637
|
-
const toObject = {};
|
|
638
|
-
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
639
|
-
if (fromParts != null) {
|
|
640
|
-
if (Array.isArray(fromParts)) {
|
|
641
|
-
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
642
|
-
return partToVertex$1(apiClient, item);
|
|
643
|
-
}));
|
|
644
|
-
}
|
|
645
|
-
else {
|
|
646
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
const fromRole = getValueByPath(fromObject, ['role']);
|
|
650
|
-
if (fromRole != null) {
|
|
651
|
-
setValueByPath(toObject, ['role'], fromRole);
|
|
652
|
-
}
|
|
653
|
-
return toObject;
|
|
654
|
-
}
|
|
655
|
-
function schemaToVertex$1(apiClient, fromObject) {
|
|
656
|
-
const toObject = {};
|
|
657
|
-
const fromExample = getValueByPath(fromObject, ['example']);
|
|
658
|
-
if (fromExample != null) {
|
|
659
|
-
setValueByPath(toObject, ['example'], fromExample);
|
|
660
|
-
}
|
|
661
|
-
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
662
|
-
if (fromPattern != null) {
|
|
663
|
-
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
664
|
-
}
|
|
665
|
-
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
666
|
-
if (fromDefault != null) {
|
|
667
|
-
setValueByPath(toObject, ['default'], fromDefault);
|
|
668
|
-
}
|
|
669
|
-
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
670
|
-
if (fromMaxLength != null) {
|
|
671
|
-
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
672
|
-
}
|
|
673
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
674
|
-
if (fromTitle != null) {
|
|
675
|
-
setValueByPath(toObject, ['title'], fromTitle);
|
|
676
|
-
}
|
|
677
|
-
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
678
|
-
if (fromMinLength != null) {
|
|
679
|
-
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
680
|
-
}
|
|
681
|
-
const fromMinProperties = getValueByPath(fromObject, [
|
|
682
|
-
'minProperties',
|
|
683
|
-
]);
|
|
684
|
-
if (fromMinProperties != null) {
|
|
685
|
-
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
686
|
-
}
|
|
687
|
-
const fromMaxProperties = getValueByPath(fromObject, [
|
|
688
|
-
'maxProperties',
|
|
689
|
-
]);
|
|
690
|
-
if (fromMaxProperties != null) {
|
|
691
|
-
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
692
|
-
}
|
|
693
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
694
|
-
if (fromAnyOf != null) {
|
|
695
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
696
|
-
}
|
|
697
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
698
|
-
if (fromDescription != null) {
|
|
699
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
700
|
-
}
|
|
701
|
-
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
702
|
-
if (fromEnum != null) {
|
|
703
|
-
setValueByPath(toObject, ['enum'], fromEnum);
|
|
704
|
-
}
|
|
705
|
-
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
706
|
-
if (fromFormat != null) {
|
|
707
|
-
setValueByPath(toObject, ['format'], fromFormat);
|
|
708
|
-
}
|
|
709
|
-
const fromItems = getValueByPath(fromObject, ['items']);
|
|
710
|
-
if (fromItems != null) {
|
|
711
|
-
setValueByPath(toObject, ['items'], fromItems);
|
|
712
|
-
}
|
|
713
|
-
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
714
|
-
if (fromMaxItems != null) {
|
|
715
|
-
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
716
|
-
}
|
|
717
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
718
|
-
if (fromMaximum != null) {
|
|
719
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
720
|
-
}
|
|
721
|
-
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
722
|
-
if (fromMinItems != null) {
|
|
723
|
-
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
724
|
-
}
|
|
725
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
726
|
-
if (fromMinimum != null) {
|
|
727
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
728
|
-
}
|
|
729
|
-
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
730
|
-
if (fromNullable != null) {
|
|
731
|
-
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
732
|
-
}
|
|
733
|
-
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
734
|
-
if (fromProperties != null) {
|
|
735
|
-
setValueByPath(toObject, ['properties'], fromProperties);
|
|
736
|
-
}
|
|
737
|
-
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
738
|
-
'propertyOrdering',
|
|
739
|
-
]);
|
|
740
|
-
if (fromPropertyOrdering != null) {
|
|
741
|
-
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
742
|
-
}
|
|
743
|
-
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
744
|
-
if (fromRequired != null) {
|
|
745
|
-
setValueByPath(toObject, ['required'], fromRequired);
|
|
746
|
-
}
|
|
747
|
-
const fromType = getValueByPath(fromObject, ['type']);
|
|
748
|
-
if (fromType != null) {
|
|
749
|
-
setValueByPath(toObject, ['type'], fromType);
|
|
750
|
-
}
|
|
751
|
-
return toObject;
|
|
752
|
-
}
|
|
753
598
|
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
754
599
|
const toObject = {};
|
|
755
600
|
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
@@ -769,34 +614,10 @@ function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
|
769
614
|
}
|
|
770
615
|
return toObject;
|
|
771
616
|
}
|
|
772
|
-
function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
773
|
-
const toObject = {};
|
|
774
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
775
|
-
if (fromResponse != null) {
|
|
776
|
-
setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
|
|
777
|
-
}
|
|
778
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
779
|
-
if (fromDescription != null) {
|
|
780
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
781
|
-
}
|
|
782
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
783
|
-
if (fromName != null) {
|
|
784
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
785
|
-
}
|
|
786
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
787
|
-
if (fromParameters != null) {
|
|
788
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
789
|
-
}
|
|
790
|
-
return toObject;
|
|
791
|
-
}
|
|
792
617
|
function googleSearchToMldev$1() {
|
|
793
618
|
const toObject = {};
|
|
794
619
|
return toObject;
|
|
795
620
|
}
|
|
796
|
-
function googleSearchToVertex$1() {
|
|
797
|
-
const toObject = {};
|
|
798
|
-
return toObject;
|
|
799
|
-
}
|
|
800
621
|
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
801
622
|
const toObject = {};
|
|
802
623
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
@@ -811,20 +632,6 @@ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
|
811
632
|
}
|
|
812
633
|
return toObject;
|
|
813
634
|
}
|
|
814
|
-
function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
815
|
-
const toObject = {};
|
|
816
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
817
|
-
if (fromMode != null) {
|
|
818
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
819
|
-
}
|
|
820
|
-
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
821
|
-
'dynamicThreshold',
|
|
822
|
-
]);
|
|
823
|
-
if (fromDynamicThreshold != null) {
|
|
824
|
-
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
825
|
-
}
|
|
826
|
-
return toObject;
|
|
827
|
-
}
|
|
828
635
|
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
829
636
|
const toObject = {};
|
|
830
637
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
@@ -835,16 +642,6 @@ function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
|
835
642
|
}
|
|
836
643
|
return toObject;
|
|
837
644
|
}
|
|
838
|
-
function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
|
|
839
|
-
const toObject = {};
|
|
840
|
-
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
841
|
-
'dynamicRetrievalConfig',
|
|
842
|
-
]);
|
|
843
|
-
if (fromDynamicRetrievalConfig != null) {
|
|
844
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
|
|
845
|
-
}
|
|
846
|
-
return toObject;
|
|
847
|
-
}
|
|
848
645
|
function toolToMldev$1(apiClient, fromObject) {
|
|
849
646
|
const toObject = {};
|
|
850
647
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -881,68 +678,17 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
881
678
|
}
|
|
882
679
|
return toObject;
|
|
883
680
|
}
|
|
884
|
-
function
|
|
681
|
+
function functionCallingConfigToMldev$1(apiClient, fromObject) {
|
|
885
682
|
const toObject = {};
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
if (fromFunctionDeclarations != null) {
|
|
890
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
891
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
892
|
-
return functionDeclarationToVertex$1(apiClient, item);
|
|
893
|
-
}));
|
|
894
|
-
}
|
|
895
|
-
else {
|
|
896
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
900
|
-
if (fromRetrieval != null) {
|
|
901
|
-
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
902
|
-
}
|
|
903
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
904
|
-
if (fromGoogleSearch != null) {
|
|
905
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
|
|
683
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
684
|
+
if (fromMode != null) {
|
|
685
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
906
686
|
}
|
|
907
|
-
const
|
|
908
|
-
'
|
|
687
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
688
|
+
'allowedFunctionNames',
|
|
909
689
|
]);
|
|
910
|
-
if (
|
|
911
|
-
setValueByPath(toObject, ['
|
|
912
|
-
}
|
|
913
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
914
|
-
'codeExecution',
|
|
915
|
-
]);
|
|
916
|
-
if (fromCodeExecution != null) {
|
|
917
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
918
|
-
}
|
|
919
|
-
return toObject;
|
|
920
|
-
}
|
|
921
|
-
function functionCallingConfigToMldev$1(apiClient, fromObject) {
|
|
922
|
-
const toObject = {};
|
|
923
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
924
|
-
if (fromMode != null) {
|
|
925
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
926
|
-
}
|
|
927
|
-
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
928
|
-
'allowedFunctionNames',
|
|
929
|
-
]);
|
|
930
|
-
if (fromAllowedFunctionNames != null) {
|
|
931
|
-
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
932
|
-
}
|
|
933
|
-
return toObject;
|
|
934
|
-
}
|
|
935
|
-
function functionCallingConfigToVertex$1(apiClient, fromObject) {
|
|
936
|
-
const toObject = {};
|
|
937
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
938
|
-
if (fromMode != null) {
|
|
939
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
940
|
-
}
|
|
941
|
-
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
942
|
-
'allowedFunctionNames',
|
|
943
|
-
]);
|
|
944
|
-
if (fromAllowedFunctionNames != null) {
|
|
945
|
-
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
690
|
+
if (fromAllowedFunctionNames != null) {
|
|
691
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
946
692
|
}
|
|
947
693
|
return toObject;
|
|
948
694
|
}
|
|
@@ -956,16 +702,6 @@ function toolConfigToMldev$1(apiClient, fromObject) {
|
|
|
956
702
|
}
|
|
957
703
|
return toObject;
|
|
958
704
|
}
|
|
959
|
-
function toolConfigToVertex$1(apiClient, fromObject) {
|
|
960
|
-
const toObject = {};
|
|
961
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
962
|
-
'functionCallingConfig',
|
|
963
|
-
]);
|
|
964
|
-
if (fromFunctionCallingConfig != null) {
|
|
965
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex$1(apiClient, fromFunctionCallingConfig));
|
|
966
|
-
}
|
|
967
|
-
return toObject;
|
|
968
|
-
}
|
|
969
705
|
function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
970
706
|
const toObject = {};
|
|
971
707
|
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
@@ -1014,54 +750,6 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
1014
750
|
}
|
|
1015
751
|
return toObject;
|
|
1016
752
|
}
|
|
1017
|
-
function createCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1018
|
-
const toObject = {};
|
|
1019
|
-
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
1020
|
-
if (parentObject !== undefined && fromTtl != null) {
|
|
1021
|
-
setValueByPath(parentObject, ['ttl'], fromTtl);
|
|
1022
|
-
}
|
|
1023
|
-
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1024
|
-
if (parentObject !== undefined && fromExpireTime != null) {
|
|
1025
|
-
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
1026
|
-
}
|
|
1027
|
-
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
1028
|
-
if (parentObject !== undefined && fromDisplayName != null) {
|
|
1029
|
-
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
1030
|
-
}
|
|
1031
|
-
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
1032
|
-
if (parentObject !== undefined && fromContents != null) {
|
|
1033
|
-
if (Array.isArray(fromContents)) {
|
|
1034
|
-
setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
1035
|
-
return contentToVertex$1(apiClient, item);
|
|
1036
|
-
})));
|
|
1037
|
-
}
|
|
1038
|
-
else {
|
|
1039
|
-
setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
1043
|
-
'systemInstruction',
|
|
1044
|
-
]);
|
|
1045
|
-
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
1046
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
1047
|
-
}
|
|
1048
|
-
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
1049
|
-
if (parentObject !== undefined && fromTools != null) {
|
|
1050
|
-
if (Array.isArray(fromTools)) {
|
|
1051
|
-
setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
|
|
1052
|
-
return toolToVertex$1(apiClient, item);
|
|
1053
|
-
}));
|
|
1054
|
-
}
|
|
1055
|
-
else {
|
|
1056
|
-
setValueByPath(parentObject, ['tools'], fromTools);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
1060
|
-
if (parentObject !== undefined && fromToolConfig != null) {
|
|
1061
|
-
setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex$1(apiClient, fromToolConfig));
|
|
1062
|
-
}
|
|
1063
|
-
return toObject;
|
|
1064
|
-
}
|
|
1065
753
|
function createCachedContentParametersToMldev(apiClient, fromObject) {
|
|
1066
754
|
const toObject = {};
|
|
1067
755
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -1074,18 +762,6 @@ function createCachedContentParametersToMldev(apiClient, fromObject) {
|
|
|
1074
762
|
}
|
|
1075
763
|
return toObject;
|
|
1076
764
|
}
|
|
1077
|
-
function createCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1078
|
-
const toObject = {};
|
|
1079
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
1080
|
-
if (fromModel != null) {
|
|
1081
|
-
setValueByPath(toObject, ['model'], tCachesModel(apiClient, fromModel));
|
|
1082
|
-
}
|
|
1083
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1084
|
-
if (fromConfig != null) {
|
|
1085
|
-
setValueByPath(toObject, ['config'], createCachedContentConfigToVertex(apiClient, fromConfig, toObject));
|
|
1086
|
-
}
|
|
1087
|
-
return toObject;
|
|
1088
|
-
}
|
|
1089
765
|
function getCachedContentParametersToMldev(apiClient, fromObject) {
|
|
1090
766
|
const toObject = {};
|
|
1091
767
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -1098,18 +774,6 @@ function getCachedContentParametersToMldev(apiClient, fromObject) {
|
|
|
1098
774
|
}
|
|
1099
775
|
return toObject;
|
|
1100
776
|
}
|
|
1101
|
-
function getCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1102
|
-
const toObject = {};
|
|
1103
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
1104
|
-
if (fromName != null) {
|
|
1105
|
-
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1106
|
-
}
|
|
1107
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1108
|
-
if (fromConfig != null) {
|
|
1109
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
1110
|
-
}
|
|
1111
|
-
return toObject;
|
|
1112
|
-
}
|
|
1113
777
|
function deleteCachedContentParametersToMldev(apiClient, fromObject) {
|
|
1114
778
|
const toObject = {};
|
|
1115
779
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -1122,18 +786,6 @@ function deleteCachedContentParametersToMldev(apiClient, fromObject) {
|
|
|
1122
786
|
}
|
|
1123
787
|
return toObject;
|
|
1124
788
|
}
|
|
1125
|
-
function deleteCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1126
|
-
const toObject = {};
|
|
1127
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
1128
|
-
if (fromName != null) {
|
|
1129
|
-
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1130
|
-
}
|
|
1131
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1132
|
-
if (fromConfig != null) {
|
|
1133
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
1134
|
-
}
|
|
1135
|
-
return toObject;
|
|
1136
|
-
}
|
|
1137
789
|
function updateCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
1138
790
|
const toObject = {};
|
|
1139
791
|
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
@@ -1146,18 +798,6 @@ function updateCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
1146
798
|
}
|
|
1147
799
|
return toObject;
|
|
1148
800
|
}
|
|
1149
|
-
function updateCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1150
|
-
const toObject = {};
|
|
1151
|
-
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
1152
|
-
if (parentObject !== undefined && fromTtl != null) {
|
|
1153
|
-
setValueByPath(parentObject, ['ttl'], fromTtl);
|
|
1154
|
-
}
|
|
1155
|
-
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1156
|
-
if (parentObject !== undefined && fromExpireTime != null) {
|
|
1157
|
-
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
1158
|
-
}
|
|
1159
|
-
return toObject;
|
|
1160
|
-
}
|
|
1161
801
|
function updateCachedContentParametersToMldev(apiClient, fromObject) {
|
|
1162
802
|
const toObject = {};
|
|
1163
803
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -1170,18 +810,6 @@ function updateCachedContentParametersToMldev(apiClient, fromObject) {
|
|
|
1170
810
|
}
|
|
1171
811
|
return toObject;
|
|
1172
812
|
}
|
|
1173
|
-
function updateCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1174
|
-
const toObject = {};
|
|
1175
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
1176
|
-
if (fromName != null) {
|
|
1177
|
-
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1178
|
-
}
|
|
1179
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1180
|
-
if (fromConfig != null) {
|
|
1181
|
-
setValueByPath(toObject, ['config'], updateCachedContentConfigToVertex(apiClient, fromConfig, toObject));
|
|
1182
|
-
}
|
|
1183
|
-
return toObject;
|
|
1184
|
-
}
|
|
1185
813
|
function listCachedContentsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
1186
814
|
const toObject = {};
|
|
1187
815
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
@@ -1194,18 +822,6 @@ function listCachedContentsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
1194
822
|
}
|
|
1195
823
|
return toObject;
|
|
1196
824
|
}
|
|
1197
|
-
function listCachedContentsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1198
|
-
const toObject = {};
|
|
1199
|
-
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
1200
|
-
if (parentObject !== undefined && fromPageSize != null) {
|
|
1201
|
-
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
1202
|
-
}
|
|
1203
|
-
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
1204
|
-
if (parentObject !== undefined && fromPageToken != null) {
|
|
1205
|
-
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
1206
|
-
}
|
|
1207
|
-
return toObject;
|
|
1208
|
-
}
|
|
1209
825
|
function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
1210
826
|
const toObject = {};
|
|
1211
827
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -1214,135 +830,529 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
|
1214
830
|
}
|
|
1215
831
|
return toObject;
|
|
1216
832
|
}
|
|
1217
|
-
function
|
|
1218
|
-
const toObject = {};
|
|
1219
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1220
|
-
if (fromConfig != null) {
|
|
1221
|
-
setValueByPath(toObject, ['config'], listCachedContentsConfigToVertex(apiClient, fromConfig, toObject));
|
|
1222
|
-
}
|
|
1223
|
-
return toObject;
|
|
1224
|
-
}
|
|
1225
|
-
function cachedContentFromMldev(apiClient, fromObject) {
|
|
833
|
+
function partToVertex$1(apiClient, fromObject) {
|
|
1226
834
|
const toObject = {};
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1229
|
-
|
|
835
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
836
|
+
'videoMetadata',
|
|
837
|
+
]);
|
|
838
|
+
if (fromVideoMetadata != null) {
|
|
839
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
1230
840
|
}
|
|
1231
|
-
const
|
|
1232
|
-
if (
|
|
1233
|
-
setValueByPath(toObject, ['
|
|
841
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
842
|
+
if (fromThought != null) {
|
|
843
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
1234
844
|
}
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1237
|
-
|
|
845
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
846
|
+
'codeExecutionResult',
|
|
847
|
+
]);
|
|
848
|
+
if (fromCodeExecutionResult != null) {
|
|
849
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
1238
850
|
}
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1241
|
-
|
|
851
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
852
|
+
'executableCode',
|
|
853
|
+
]);
|
|
854
|
+
if (fromExecutableCode != null) {
|
|
855
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
1242
856
|
}
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
setValueByPath(toObject, ['
|
|
857
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
858
|
+
if (fromFileData != null) {
|
|
859
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
1246
860
|
}
|
|
1247
|
-
const
|
|
1248
|
-
if (
|
|
1249
|
-
setValueByPath(toObject, ['
|
|
861
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
862
|
+
if (fromFunctionCall != null) {
|
|
863
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
1250
864
|
}
|
|
1251
|
-
const
|
|
1252
|
-
'
|
|
865
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
866
|
+
'functionResponse',
|
|
1253
867
|
]);
|
|
1254
|
-
if (
|
|
1255
|
-
setValueByPath(toObject, ['
|
|
868
|
+
if (fromFunctionResponse != null) {
|
|
869
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
870
|
+
}
|
|
871
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
872
|
+
if (fromInlineData != null) {
|
|
873
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
874
|
+
}
|
|
875
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
876
|
+
if (fromText != null) {
|
|
877
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
1256
878
|
}
|
|
1257
879
|
return toObject;
|
|
1258
880
|
}
|
|
1259
|
-
function
|
|
881
|
+
function contentToVertex$1(apiClient, fromObject) {
|
|
1260
882
|
const toObject = {};
|
|
1261
|
-
const
|
|
1262
|
-
if (
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
883
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
884
|
+
if (fromParts != null) {
|
|
885
|
+
if (Array.isArray(fromParts)) {
|
|
886
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
887
|
+
return partToVertex$1(apiClient, item);
|
|
888
|
+
}));
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
892
|
+
}
|
|
1268
893
|
}
|
|
1269
|
-
const
|
|
1270
|
-
if (
|
|
1271
|
-
setValueByPath(toObject, ['
|
|
894
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
895
|
+
if (fromRole != null) {
|
|
896
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
1272
897
|
}
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
898
|
+
return toObject;
|
|
899
|
+
}
|
|
900
|
+
function schemaToVertex$1(apiClient, fromObject) {
|
|
901
|
+
const toObject = {};
|
|
902
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
903
|
+
if (fromExample != null) {
|
|
904
|
+
setValueByPath(toObject, ['example'], fromExample);
|
|
1276
905
|
}
|
|
1277
|
-
const
|
|
1278
|
-
if (
|
|
1279
|
-
setValueByPath(toObject, ['
|
|
906
|
+
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
907
|
+
if (fromPattern != null) {
|
|
908
|
+
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
1280
909
|
}
|
|
1281
|
-
const
|
|
1282
|
-
if (
|
|
1283
|
-
setValueByPath(toObject, ['
|
|
910
|
+
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
911
|
+
if (fromDefault != null) {
|
|
912
|
+
setValueByPath(toObject, ['default'], fromDefault);
|
|
1284
913
|
}
|
|
1285
|
-
const
|
|
1286
|
-
|
|
914
|
+
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
915
|
+
if (fromMaxLength != null) {
|
|
916
|
+
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
917
|
+
}
|
|
918
|
+
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
919
|
+
if (fromMinLength != null) {
|
|
920
|
+
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
921
|
+
}
|
|
922
|
+
const fromMinProperties = getValueByPath(fromObject, [
|
|
923
|
+
'minProperties',
|
|
1287
924
|
]);
|
|
1288
|
-
if (
|
|
1289
|
-
setValueByPath(toObject, ['
|
|
925
|
+
if (fromMinProperties != null) {
|
|
926
|
+
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
927
|
+
}
|
|
928
|
+
const fromMaxProperties = getValueByPath(fromObject, [
|
|
929
|
+
'maxProperties',
|
|
930
|
+
]);
|
|
931
|
+
if (fromMaxProperties != null) {
|
|
932
|
+
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
933
|
+
}
|
|
934
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
935
|
+
if (fromAnyOf != null) {
|
|
936
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
937
|
+
}
|
|
938
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
939
|
+
if (fromDescription != null) {
|
|
940
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
941
|
+
}
|
|
942
|
+
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
943
|
+
if (fromEnum != null) {
|
|
944
|
+
setValueByPath(toObject, ['enum'], fromEnum);
|
|
945
|
+
}
|
|
946
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
947
|
+
if (fromFormat != null) {
|
|
948
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
949
|
+
}
|
|
950
|
+
const fromItems = getValueByPath(fromObject, ['items']);
|
|
951
|
+
if (fromItems != null) {
|
|
952
|
+
setValueByPath(toObject, ['items'], fromItems);
|
|
953
|
+
}
|
|
954
|
+
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
955
|
+
if (fromMaxItems != null) {
|
|
956
|
+
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
957
|
+
}
|
|
958
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
959
|
+
if (fromMaximum != null) {
|
|
960
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
961
|
+
}
|
|
962
|
+
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
963
|
+
if (fromMinItems != null) {
|
|
964
|
+
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
965
|
+
}
|
|
966
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
967
|
+
if (fromMinimum != null) {
|
|
968
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
969
|
+
}
|
|
970
|
+
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
971
|
+
if (fromNullable != null) {
|
|
972
|
+
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
973
|
+
}
|
|
974
|
+
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
975
|
+
if (fromProperties != null) {
|
|
976
|
+
setValueByPath(toObject, ['properties'], fromProperties);
|
|
977
|
+
}
|
|
978
|
+
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
979
|
+
'propertyOrdering',
|
|
980
|
+
]);
|
|
981
|
+
if (fromPropertyOrdering != null) {
|
|
982
|
+
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
983
|
+
}
|
|
984
|
+
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
985
|
+
if (fromRequired != null) {
|
|
986
|
+
setValueByPath(toObject, ['required'], fromRequired);
|
|
987
|
+
}
|
|
988
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
989
|
+
if (fromTitle != null) {
|
|
990
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
991
|
+
}
|
|
992
|
+
const fromType = getValueByPath(fromObject, ['type']);
|
|
993
|
+
if (fromType != null) {
|
|
994
|
+
setValueByPath(toObject, ['type'], fromType);
|
|
1290
995
|
}
|
|
1291
996
|
return toObject;
|
|
1292
997
|
}
|
|
1293
|
-
function
|
|
998
|
+
function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
1294
999
|
const toObject = {};
|
|
1000
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
1001
|
+
if (fromResponse != null) {
|
|
1002
|
+
setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
|
|
1003
|
+
}
|
|
1004
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
1005
|
+
if (fromDescription != null) {
|
|
1006
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
1007
|
+
}
|
|
1008
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1009
|
+
if (fromName != null) {
|
|
1010
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
1011
|
+
}
|
|
1012
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
1013
|
+
if (fromParameters != null) {
|
|
1014
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
1015
|
+
}
|
|
1295
1016
|
return toObject;
|
|
1296
1017
|
}
|
|
1297
|
-
function
|
|
1018
|
+
function googleSearchToVertex$1() {
|
|
1298
1019
|
const toObject = {};
|
|
1299
1020
|
return toObject;
|
|
1300
1021
|
}
|
|
1301
|
-
function
|
|
1022
|
+
function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
1302
1023
|
const toObject = {};
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1024
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
1025
|
+
if (fromMode != null) {
|
|
1026
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
1027
|
+
}
|
|
1028
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
1029
|
+
'dynamicThreshold',
|
|
1305
1030
|
]);
|
|
1306
|
-
if (
|
|
1307
|
-
setValueByPath(toObject, ['
|
|
1031
|
+
if (fromDynamicThreshold != null) {
|
|
1032
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
1308
1033
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1034
|
+
return toObject;
|
|
1035
|
+
}
|
|
1036
|
+
function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
|
|
1037
|
+
const toObject = {};
|
|
1038
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
1039
|
+
'dynamicRetrievalConfig',
|
|
1311
1040
|
]);
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1041
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
1042
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
|
|
1043
|
+
}
|
|
1044
|
+
return toObject;
|
|
1045
|
+
}
|
|
1046
|
+
function toolToVertex$1(apiClient, fromObject) {
|
|
1047
|
+
const toObject = {};
|
|
1048
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
1049
|
+
'functionDeclarations',
|
|
1050
|
+
]);
|
|
1051
|
+
if (fromFunctionDeclarations != null) {
|
|
1052
|
+
if (Array.isArray(fromFunctionDeclarations)) {
|
|
1053
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
1054
|
+
return functionDeclarationToVertex$1(apiClient, item);
|
|
1316
1055
|
}));
|
|
1317
1056
|
}
|
|
1318
1057
|
else {
|
|
1319
|
-
setValueByPath(toObject, ['
|
|
1058
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
1320
1059
|
}
|
|
1321
1060
|
}
|
|
1061
|
+
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
1062
|
+
if (fromRetrieval != null) {
|
|
1063
|
+
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
1064
|
+
}
|
|
1065
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
1066
|
+
if (fromGoogleSearch != null) {
|
|
1067
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
|
|
1068
|
+
}
|
|
1069
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
1070
|
+
'googleSearchRetrieval',
|
|
1071
|
+
]);
|
|
1072
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
1073
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
|
|
1074
|
+
}
|
|
1075
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
1076
|
+
'codeExecution',
|
|
1077
|
+
]);
|
|
1078
|
+
if (fromCodeExecution != null) {
|
|
1079
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
1080
|
+
}
|
|
1322
1081
|
return toObject;
|
|
1323
1082
|
}
|
|
1324
|
-
function
|
|
1083
|
+
function functionCallingConfigToVertex$1(apiClient, fromObject) {
|
|
1325
1084
|
const toObject = {};
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1085
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
1086
|
+
if (fromMode != null) {
|
|
1087
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
1088
|
+
}
|
|
1089
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
1090
|
+
'allowedFunctionNames',
|
|
1328
1091
|
]);
|
|
1329
|
-
if (
|
|
1330
|
-
setValueByPath(toObject, ['
|
|
1092
|
+
if (fromAllowedFunctionNames != null) {
|
|
1093
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
1331
1094
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1095
|
+
return toObject;
|
|
1096
|
+
}
|
|
1097
|
+
function toolConfigToVertex$1(apiClient, fromObject) {
|
|
1098
|
+
const toObject = {};
|
|
1099
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
1100
|
+
'functionCallingConfig',
|
|
1334
1101
|
]);
|
|
1335
|
-
if (
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1102
|
+
if (fromFunctionCallingConfig != null) {
|
|
1103
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex$1(apiClient, fromFunctionCallingConfig));
|
|
1104
|
+
}
|
|
1105
|
+
return toObject;
|
|
1106
|
+
}
|
|
1107
|
+
function createCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1108
|
+
const toObject = {};
|
|
1109
|
+
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
1110
|
+
if (parentObject !== undefined && fromTtl != null) {
|
|
1111
|
+
setValueByPath(parentObject, ['ttl'], fromTtl);
|
|
1112
|
+
}
|
|
1113
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1114
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
1115
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
1116
|
+
}
|
|
1117
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
1118
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
1119
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
1120
|
+
}
|
|
1121
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
1122
|
+
if (parentObject !== undefined && fromContents != null) {
|
|
1123
|
+
if (Array.isArray(fromContents)) {
|
|
1124
|
+
setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
1125
|
+
return contentToVertex$1(apiClient, item);
|
|
1126
|
+
})));
|
|
1127
|
+
}
|
|
1128
|
+
else {
|
|
1129
|
+
setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
1133
|
+
'systemInstruction',
|
|
1134
|
+
]);
|
|
1135
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
1136
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
1137
|
+
}
|
|
1138
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
1139
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
1140
|
+
if (Array.isArray(fromTools)) {
|
|
1141
|
+
setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
|
|
1142
|
+
return toolToVertex$1(apiClient, item);
|
|
1339
1143
|
}));
|
|
1340
1144
|
}
|
|
1341
1145
|
else {
|
|
1342
|
-
setValueByPath(
|
|
1146
|
+
setValueByPath(parentObject, ['tools'], fromTools);
|
|
1343
1147
|
}
|
|
1344
1148
|
}
|
|
1345
|
-
|
|
1149
|
+
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
1150
|
+
if (parentObject !== undefined && fromToolConfig != null) {
|
|
1151
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex$1(apiClient, fromToolConfig));
|
|
1152
|
+
}
|
|
1153
|
+
return toObject;
|
|
1154
|
+
}
|
|
1155
|
+
function createCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1156
|
+
const toObject = {};
|
|
1157
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
1158
|
+
if (fromModel != null) {
|
|
1159
|
+
setValueByPath(toObject, ['model'], tCachesModel(apiClient, fromModel));
|
|
1160
|
+
}
|
|
1161
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1162
|
+
if (fromConfig != null) {
|
|
1163
|
+
setValueByPath(toObject, ['config'], createCachedContentConfigToVertex(apiClient, fromConfig, toObject));
|
|
1164
|
+
}
|
|
1165
|
+
return toObject;
|
|
1166
|
+
}
|
|
1167
|
+
function getCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1168
|
+
const toObject = {};
|
|
1169
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1170
|
+
if (fromName != null) {
|
|
1171
|
+
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1172
|
+
}
|
|
1173
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1174
|
+
if (fromConfig != null) {
|
|
1175
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
1176
|
+
}
|
|
1177
|
+
return toObject;
|
|
1178
|
+
}
|
|
1179
|
+
function deleteCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1180
|
+
const toObject = {};
|
|
1181
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1182
|
+
if (fromName != null) {
|
|
1183
|
+
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1184
|
+
}
|
|
1185
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1186
|
+
if (fromConfig != null) {
|
|
1187
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
1188
|
+
}
|
|
1189
|
+
return toObject;
|
|
1190
|
+
}
|
|
1191
|
+
function updateCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1192
|
+
const toObject = {};
|
|
1193
|
+
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
1194
|
+
if (parentObject !== undefined && fromTtl != null) {
|
|
1195
|
+
setValueByPath(parentObject, ['ttl'], fromTtl);
|
|
1196
|
+
}
|
|
1197
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1198
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
1199
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
1200
|
+
}
|
|
1201
|
+
return toObject;
|
|
1202
|
+
}
|
|
1203
|
+
function updateCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1204
|
+
const toObject = {};
|
|
1205
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1206
|
+
if (fromName != null) {
|
|
1207
|
+
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1208
|
+
}
|
|
1209
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1210
|
+
if (fromConfig != null) {
|
|
1211
|
+
setValueByPath(toObject, ['config'], updateCachedContentConfigToVertex(apiClient, fromConfig, toObject));
|
|
1212
|
+
}
|
|
1213
|
+
return toObject;
|
|
1214
|
+
}
|
|
1215
|
+
function listCachedContentsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1216
|
+
const toObject = {};
|
|
1217
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
1218
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
1219
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
1220
|
+
}
|
|
1221
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
1222
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
1223
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
1224
|
+
}
|
|
1225
|
+
return toObject;
|
|
1226
|
+
}
|
|
1227
|
+
function listCachedContentsParametersToVertex(apiClient, fromObject) {
|
|
1228
|
+
const toObject = {};
|
|
1229
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1230
|
+
if (fromConfig != null) {
|
|
1231
|
+
setValueByPath(toObject, ['config'], listCachedContentsConfigToVertex(apiClient, fromConfig, toObject));
|
|
1232
|
+
}
|
|
1233
|
+
return toObject;
|
|
1234
|
+
}
|
|
1235
|
+
function cachedContentFromMldev(apiClient, fromObject) {
|
|
1236
|
+
const toObject = {};
|
|
1237
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1238
|
+
if (fromName != null) {
|
|
1239
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
1240
|
+
}
|
|
1241
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
1242
|
+
if (fromDisplayName != null) {
|
|
1243
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
1244
|
+
}
|
|
1245
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
1246
|
+
if (fromModel != null) {
|
|
1247
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
1248
|
+
}
|
|
1249
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
1250
|
+
if (fromCreateTime != null) {
|
|
1251
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
1252
|
+
}
|
|
1253
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
1254
|
+
if (fromUpdateTime != null) {
|
|
1255
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
1256
|
+
}
|
|
1257
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1258
|
+
if (fromExpireTime != null) {
|
|
1259
|
+
setValueByPath(toObject, ['expireTime'], fromExpireTime);
|
|
1260
|
+
}
|
|
1261
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
1262
|
+
'usageMetadata',
|
|
1263
|
+
]);
|
|
1264
|
+
if (fromUsageMetadata != null) {
|
|
1265
|
+
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
1266
|
+
}
|
|
1267
|
+
return toObject;
|
|
1268
|
+
}
|
|
1269
|
+
function deleteCachedContentResponseFromMldev() {
|
|
1270
|
+
const toObject = {};
|
|
1271
|
+
return toObject;
|
|
1272
|
+
}
|
|
1273
|
+
function listCachedContentsResponseFromMldev(apiClient, fromObject) {
|
|
1274
|
+
const toObject = {};
|
|
1275
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
1276
|
+
'nextPageToken',
|
|
1277
|
+
]);
|
|
1278
|
+
if (fromNextPageToken != null) {
|
|
1279
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
1280
|
+
}
|
|
1281
|
+
const fromCachedContents = getValueByPath(fromObject, [
|
|
1282
|
+
'cachedContents',
|
|
1283
|
+
]);
|
|
1284
|
+
if (fromCachedContents != null) {
|
|
1285
|
+
if (Array.isArray(fromCachedContents)) {
|
|
1286
|
+
setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
|
|
1287
|
+
return cachedContentFromMldev(apiClient, item);
|
|
1288
|
+
}));
|
|
1289
|
+
}
|
|
1290
|
+
else {
|
|
1291
|
+
setValueByPath(toObject, ['cachedContents'], fromCachedContents);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
return toObject;
|
|
1295
|
+
}
|
|
1296
|
+
function cachedContentFromVertex(apiClient, fromObject) {
|
|
1297
|
+
const toObject = {};
|
|
1298
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1299
|
+
if (fromName != null) {
|
|
1300
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
1301
|
+
}
|
|
1302
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
1303
|
+
if (fromDisplayName != null) {
|
|
1304
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
1305
|
+
}
|
|
1306
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
1307
|
+
if (fromModel != null) {
|
|
1308
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
1309
|
+
}
|
|
1310
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
1311
|
+
if (fromCreateTime != null) {
|
|
1312
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
1313
|
+
}
|
|
1314
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
1315
|
+
if (fromUpdateTime != null) {
|
|
1316
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
1317
|
+
}
|
|
1318
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1319
|
+
if (fromExpireTime != null) {
|
|
1320
|
+
setValueByPath(toObject, ['expireTime'], fromExpireTime);
|
|
1321
|
+
}
|
|
1322
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
1323
|
+
'usageMetadata',
|
|
1324
|
+
]);
|
|
1325
|
+
if (fromUsageMetadata != null) {
|
|
1326
|
+
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
1327
|
+
}
|
|
1328
|
+
return toObject;
|
|
1329
|
+
}
|
|
1330
|
+
function deleteCachedContentResponseFromVertex() {
|
|
1331
|
+
const toObject = {};
|
|
1332
|
+
return toObject;
|
|
1333
|
+
}
|
|
1334
|
+
function listCachedContentsResponseFromVertex(apiClient, fromObject) {
|
|
1335
|
+
const toObject = {};
|
|
1336
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
1337
|
+
'nextPageToken',
|
|
1338
|
+
]);
|
|
1339
|
+
if (fromNextPageToken != null) {
|
|
1340
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
1341
|
+
}
|
|
1342
|
+
const fromCachedContents = getValueByPath(fromObject, [
|
|
1343
|
+
'cachedContents',
|
|
1344
|
+
]);
|
|
1345
|
+
if (fromCachedContents != null) {
|
|
1346
|
+
if (Array.isArray(fromCachedContents)) {
|
|
1347
|
+
setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
|
|
1348
|
+
return cachedContentFromVertex(apiClient, item);
|
|
1349
|
+
}));
|
|
1350
|
+
}
|
|
1351
|
+
else {
|
|
1352
|
+
setValueByPath(toObject, ['cachedContents'], fromCachedContents);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
return toObject;
|
|
1346
1356
|
}
|
|
1347
1357
|
|
|
1348
1358
|
/**
|
|
@@ -2078,6 +2088,9 @@ class HttpResponse {
|
|
|
2078
2088
|
/** Response for the create file method. */
|
|
2079
2089
|
class CreateFileResponse {
|
|
2080
2090
|
}
|
|
2091
|
+
/** Response for the delete file method. */
|
|
2092
|
+
class DeleteFileResponse {
|
|
2093
|
+
}
|
|
2081
2094
|
/** Represents a single response in a replay. */
|
|
2082
2095
|
class ReplayResponse {
|
|
2083
2096
|
}
|
|
@@ -2811,54 +2824,655 @@ class Chat {
|
|
|
2811
2824
|
this.history.push(...outputContents);
|
|
2812
2825
|
}
|
|
2813
2826
|
}
|
|
2814
|
-
|
|
2815
|
-
/**
|
|
2816
|
-
* @license
|
|
2817
|
-
* Copyright 2025 Google LLC
|
|
2818
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2819
|
-
*/
|
|
2820
|
-
function partToMldev(apiClient, fromObject) {
|
|
2827
|
+
|
|
2828
|
+
/**
|
|
2829
|
+
* @license
|
|
2830
|
+
* Copyright 2025 Google LLC
|
|
2831
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2832
|
+
*/
|
|
2833
|
+
function partToMldev(apiClient, fromObject) {
|
|
2834
|
+
const toObject = {};
|
|
2835
|
+
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
2836
|
+
throw new Error('videoMetadata parameter is not supported in Gemini API.');
|
|
2837
|
+
}
|
|
2838
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2839
|
+
if (fromThought != null) {
|
|
2840
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
2841
|
+
}
|
|
2842
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2843
|
+
'codeExecutionResult',
|
|
2844
|
+
]);
|
|
2845
|
+
if (fromCodeExecutionResult != null) {
|
|
2846
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
2847
|
+
}
|
|
2848
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
2849
|
+
'executableCode',
|
|
2850
|
+
]);
|
|
2851
|
+
if (fromExecutableCode != null) {
|
|
2852
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2853
|
+
}
|
|
2854
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2855
|
+
if (fromFileData != null) {
|
|
2856
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
2857
|
+
}
|
|
2858
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2859
|
+
if (fromFunctionCall != null) {
|
|
2860
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2861
|
+
}
|
|
2862
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2863
|
+
'functionResponse',
|
|
2864
|
+
]);
|
|
2865
|
+
if (fromFunctionResponse != null) {
|
|
2866
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
2867
|
+
}
|
|
2868
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2869
|
+
if (fromInlineData != null) {
|
|
2870
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
2871
|
+
}
|
|
2872
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
2873
|
+
if (fromText != null) {
|
|
2874
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
2875
|
+
}
|
|
2876
|
+
return toObject;
|
|
2877
|
+
}
|
|
2878
|
+
function contentToMldev(apiClient, fromObject) {
|
|
2879
|
+
const toObject = {};
|
|
2880
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2881
|
+
if (fromParts != null) {
|
|
2882
|
+
if (Array.isArray(fromParts)) {
|
|
2883
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
2884
|
+
return partToMldev(apiClient, item);
|
|
2885
|
+
}));
|
|
2886
|
+
}
|
|
2887
|
+
else {
|
|
2888
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
2892
|
+
if (fromRole != null) {
|
|
2893
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
2894
|
+
}
|
|
2895
|
+
return toObject;
|
|
2896
|
+
}
|
|
2897
|
+
function schemaToMldev(apiClient, fromObject) {
|
|
2898
|
+
const toObject = {};
|
|
2899
|
+
if (getValueByPath(fromObject, ['example']) !== undefined) {
|
|
2900
|
+
throw new Error('example parameter is not supported in Gemini API.');
|
|
2901
|
+
}
|
|
2902
|
+
if (getValueByPath(fromObject, ['pattern']) !== undefined) {
|
|
2903
|
+
throw new Error('pattern parameter is not supported in Gemini API.');
|
|
2904
|
+
}
|
|
2905
|
+
if (getValueByPath(fromObject, ['default']) !== undefined) {
|
|
2906
|
+
throw new Error('default parameter is not supported in Gemini API.');
|
|
2907
|
+
}
|
|
2908
|
+
if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
|
|
2909
|
+
throw new Error('maxLength parameter is not supported in Gemini API.');
|
|
2910
|
+
}
|
|
2911
|
+
if (getValueByPath(fromObject, ['minLength']) !== undefined) {
|
|
2912
|
+
throw new Error('minLength parameter is not supported in Gemini API.');
|
|
2913
|
+
}
|
|
2914
|
+
if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
|
|
2915
|
+
throw new Error('minProperties parameter is not supported in Gemini API.');
|
|
2916
|
+
}
|
|
2917
|
+
if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
|
|
2918
|
+
throw new Error('maxProperties parameter is not supported in Gemini API.');
|
|
2919
|
+
}
|
|
2920
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
2921
|
+
if (fromAnyOf != null) {
|
|
2922
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
2923
|
+
}
|
|
2924
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2925
|
+
if (fromDescription != null) {
|
|
2926
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
2927
|
+
}
|
|
2928
|
+
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
2929
|
+
if (fromEnum != null) {
|
|
2930
|
+
setValueByPath(toObject, ['enum'], fromEnum);
|
|
2931
|
+
}
|
|
2932
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
2933
|
+
if (fromFormat != null) {
|
|
2934
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
2935
|
+
}
|
|
2936
|
+
const fromItems = getValueByPath(fromObject, ['items']);
|
|
2937
|
+
if (fromItems != null) {
|
|
2938
|
+
setValueByPath(toObject, ['items'], fromItems);
|
|
2939
|
+
}
|
|
2940
|
+
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
2941
|
+
if (fromMaxItems != null) {
|
|
2942
|
+
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
2943
|
+
}
|
|
2944
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
2945
|
+
if (fromMaximum != null) {
|
|
2946
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
2947
|
+
}
|
|
2948
|
+
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
2949
|
+
if (fromMinItems != null) {
|
|
2950
|
+
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
2951
|
+
}
|
|
2952
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
2953
|
+
if (fromMinimum != null) {
|
|
2954
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
2955
|
+
}
|
|
2956
|
+
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
2957
|
+
if (fromNullable != null) {
|
|
2958
|
+
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
2959
|
+
}
|
|
2960
|
+
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
2961
|
+
if (fromProperties != null) {
|
|
2962
|
+
setValueByPath(toObject, ['properties'], fromProperties);
|
|
2963
|
+
}
|
|
2964
|
+
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
2965
|
+
'propertyOrdering',
|
|
2966
|
+
]);
|
|
2967
|
+
if (fromPropertyOrdering != null) {
|
|
2968
|
+
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
2969
|
+
}
|
|
2970
|
+
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
2971
|
+
if (fromRequired != null) {
|
|
2972
|
+
setValueByPath(toObject, ['required'], fromRequired);
|
|
2973
|
+
}
|
|
2974
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
2975
|
+
if (fromTitle != null) {
|
|
2976
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
2977
|
+
}
|
|
2978
|
+
const fromType = getValueByPath(fromObject, ['type']);
|
|
2979
|
+
if (fromType != null) {
|
|
2980
|
+
setValueByPath(toObject, ['type'], fromType);
|
|
2981
|
+
}
|
|
2982
|
+
return toObject;
|
|
2983
|
+
}
|
|
2984
|
+
function safetySettingToMldev(apiClient, fromObject) {
|
|
2985
|
+
const toObject = {};
|
|
2986
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
2987
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
2988
|
+
}
|
|
2989
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
2990
|
+
if (fromCategory != null) {
|
|
2991
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
2992
|
+
}
|
|
2993
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
2994
|
+
if (fromThreshold != null) {
|
|
2995
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
2996
|
+
}
|
|
2997
|
+
return toObject;
|
|
2998
|
+
}
|
|
2999
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
3000
|
+
const toObject = {};
|
|
3001
|
+
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
3002
|
+
throw new Error('response parameter is not supported in Gemini API.');
|
|
3003
|
+
}
|
|
3004
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
3005
|
+
if (fromDescription != null) {
|
|
3006
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
3007
|
+
}
|
|
3008
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3009
|
+
if (fromName != null) {
|
|
3010
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3011
|
+
}
|
|
3012
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
3013
|
+
if (fromParameters != null) {
|
|
3014
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
3015
|
+
}
|
|
3016
|
+
return toObject;
|
|
3017
|
+
}
|
|
3018
|
+
function googleSearchToMldev() {
|
|
3019
|
+
const toObject = {};
|
|
3020
|
+
return toObject;
|
|
3021
|
+
}
|
|
3022
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
3023
|
+
const toObject = {};
|
|
3024
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3025
|
+
if (fromMode != null) {
|
|
3026
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3027
|
+
}
|
|
3028
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3029
|
+
'dynamicThreshold',
|
|
3030
|
+
]);
|
|
3031
|
+
if (fromDynamicThreshold != null) {
|
|
3032
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3033
|
+
}
|
|
3034
|
+
return toObject;
|
|
3035
|
+
}
|
|
3036
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
3037
|
+
const toObject = {};
|
|
3038
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
3039
|
+
'dynamicRetrievalConfig',
|
|
3040
|
+
]);
|
|
3041
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
3042
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
3043
|
+
}
|
|
3044
|
+
return toObject;
|
|
3045
|
+
}
|
|
3046
|
+
function toolToMldev(apiClient, fromObject) {
|
|
3047
|
+
const toObject = {};
|
|
3048
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
3049
|
+
'functionDeclarations',
|
|
3050
|
+
]);
|
|
3051
|
+
if (fromFunctionDeclarations != null) {
|
|
3052
|
+
if (Array.isArray(fromFunctionDeclarations)) {
|
|
3053
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
3054
|
+
return functionDeclarationToMldev(apiClient, item);
|
|
3055
|
+
}));
|
|
3056
|
+
}
|
|
3057
|
+
else {
|
|
3058
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
3062
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
3063
|
+
}
|
|
3064
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
3065
|
+
if (fromGoogleSearch != null) {
|
|
3066
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev());
|
|
3067
|
+
}
|
|
3068
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
3069
|
+
'googleSearchRetrieval',
|
|
3070
|
+
]);
|
|
3071
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
3072
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
3073
|
+
}
|
|
3074
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3075
|
+
'codeExecution',
|
|
3076
|
+
]);
|
|
3077
|
+
if (fromCodeExecution != null) {
|
|
3078
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
3079
|
+
}
|
|
3080
|
+
return toObject;
|
|
3081
|
+
}
|
|
3082
|
+
function functionCallingConfigToMldev(apiClient, fromObject) {
|
|
3083
|
+
const toObject = {};
|
|
3084
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3085
|
+
if (fromMode != null) {
|
|
3086
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3087
|
+
}
|
|
3088
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3089
|
+
'allowedFunctionNames',
|
|
3090
|
+
]);
|
|
3091
|
+
if (fromAllowedFunctionNames != null) {
|
|
3092
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3093
|
+
}
|
|
3094
|
+
return toObject;
|
|
3095
|
+
}
|
|
3096
|
+
function toolConfigToMldev(apiClient, fromObject) {
|
|
3097
|
+
const toObject = {};
|
|
3098
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
3099
|
+
'functionCallingConfig',
|
|
3100
|
+
]);
|
|
3101
|
+
if (fromFunctionCallingConfig != null) {
|
|
3102
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(apiClient, fromFunctionCallingConfig));
|
|
3103
|
+
}
|
|
3104
|
+
return toObject;
|
|
3105
|
+
}
|
|
3106
|
+
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
3107
|
+
const toObject = {};
|
|
3108
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
3109
|
+
if (fromVoiceName != null) {
|
|
3110
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
3111
|
+
}
|
|
3112
|
+
return toObject;
|
|
3113
|
+
}
|
|
3114
|
+
function voiceConfigToMldev(apiClient, fromObject) {
|
|
3115
|
+
const toObject = {};
|
|
3116
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
3117
|
+
'prebuiltVoiceConfig',
|
|
3118
|
+
]);
|
|
3119
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
3120
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
3121
|
+
}
|
|
3122
|
+
return toObject;
|
|
3123
|
+
}
|
|
3124
|
+
function speechConfigToMldev(apiClient, fromObject) {
|
|
3125
|
+
const toObject = {};
|
|
3126
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3127
|
+
if (fromVoiceConfig != null) {
|
|
3128
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
3129
|
+
}
|
|
3130
|
+
return toObject;
|
|
3131
|
+
}
|
|
3132
|
+
function thinkingConfigToMldev(apiClient, fromObject) {
|
|
3133
|
+
const toObject = {};
|
|
3134
|
+
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3135
|
+
'includeThoughts',
|
|
3136
|
+
]);
|
|
3137
|
+
if (fromIncludeThoughts != null) {
|
|
3138
|
+
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3139
|
+
}
|
|
3140
|
+
return toObject;
|
|
3141
|
+
}
|
|
3142
|
+
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3143
|
+
const toObject = {};
|
|
3144
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
3145
|
+
'systemInstruction',
|
|
3146
|
+
]);
|
|
3147
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
3148
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
3149
|
+
}
|
|
3150
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
3151
|
+
if (fromTemperature != null) {
|
|
3152
|
+
setValueByPath(toObject, ['temperature'], fromTemperature);
|
|
3153
|
+
}
|
|
3154
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
3155
|
+
if (fromTopP != null) {
|
|
3156
|
+
setValueByPath(toObject, ['topP'], fromTopP);
|
|
3157
|
+
}
|
|
3158
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
3159
|
+
if (fromTopK != null) {
|
|
3160
|
+
setValueByPath(toObject, ['topK'], fromTopK);
|
|
3161
|
+
}
|
|
3162
|
+
const fromCandidateCount = getValueByPath(fromObject, [
|
|
3163
|
+
'candidateCount',
|
|
3164
|
+
]);
|
|
3165
|
+
if (fromCandidateCount != null) {
|
|
3166
|
+
setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
|
|
3167
|
+
}
|
|
3168
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
3169
|
+
'maxOutputTokens',
|
|
3170
|
+
]);
|
|
3171
|
+
if (fromMaxOutputTokens != null) {
|
|
3172
|
+
setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
|
|
3173
|
+
}
|
|
3174
|
+
const fromStopSequences = getValueByPath(fromObject, [
|
|
3175
|
+
'stopSequences',
|
|
3176
|
+
]);
|
|
3177
|
+
if (fromStopSequences != null) {
|
|
3178
|
+
setValueByPath(toObject, ['stopSequences'], fromStopSequences);
|
|
3179
|
+
}
|
|
3180
|
+
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
3181
|
+
'responseLogprobs',
|
|
3182
|
+
]);
|
|
3183
|
+
if (fromResponseLogprobs != null) {
|
|
3184
|
+
setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
|
|
3185
|
+
}
|
|
3186
|
+
const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
|
|
3187
|
+
if (fromLogprobs != null) {
|
|
3188
|
+
setValueByPath(toObject, ['logprobs'], fromLogprobs);
|
|
3189
|
+
}
|
|
3190
|
+
const fromPresencePenalty = getValueByPath(fromObject, [
|
|
3191
|
+
'presencePenalty',
|
|
3192
|
+
]);
|
|
3193
|
+
if (fromPresencePenalty != null) {
|
|
3194
|
+
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
3195
|
+
}
|
|
3196
|
+
const fromFrequencyPenalty = getValueByPath(fromObject, [
|
|
3197
|
+
'frequencyPenalty',
|
|
3198
|
+
]);
|
|
3199
|
+
if (fromFrequencyPenalty != null) {
|
|
3200
|
+
setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
|
|
3201
|
+
}
|
|
3202
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
3203
|
+
if (fromSeed != null) {
|
|
3204
|
+
setValueByPath(toObject, ['seed'], fromSeed);
|
|
3205
|
+
}
|
|
3206
|
+
const fromResponseMimeType = getValueByPath(fromObject, [
|
|
3207
|
+
'responseMimeType',
|
|
3208
|
+
]);
|
|
3209
|
+
if (fromResponseMimeType != null) {
|
|
3210
|
+
setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
|
|
3211
|
+
}
|
|
3212
|
+
const fromResponseSchema = getValueByPath(fromObject, [
|
|
3213
|
+
'responseSchema',
|
|
3214
|
+
]);
|
|
3215
|
+
if (fromResponseSchema != null) {
|
|
3216
|
+
setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
|
|
3217
|
+
}
|
|
3218
|
+
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
3219
|
+
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
3220
|
+
}
|
|
3221
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
3222
|
+
'safetySettings',
|
|
3223
|
+
]);
|
|
3224
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
3225
|
+
if (Array.isArray(fromSafetySettings)) {
|
|
3226
|
+
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
|
|
3227
|
+
return safetySettingToMldev(apiClient, item);
|
|
3228
|
+
}));
|
|
3229
|
+
}
|
|
3230
|
+
else {
|
|
3231
|
+
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
3235
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
3236
|
+
if (Array.isArray(fromTools)) {
|
|
3237
|
+
setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
|
|
3238
|
+
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
3239
|
+
})));
|
|
3240
|
+
}
|
|
3241
|
+
else {
|
|
3242
|
+
setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
3246
|
+
if (parentObject !== undefined && fromToolConfig != null) {
|
|
3247
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(apiClient, fromToolConfig));
|
|
3248
|
+
}
|
|
3249
|
+
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
3250
|
+
throw new Error('labels parameter is not supported in Gemini API.');
|
|
3251
|
+
}
|
|
3252
|
+
const fromCachedContent = getValueByPath(fromObject, [
|
|
3253
|
+
'cachedContent',
|
|
3254
|
+
]);
|
|
3255
|
+
if (parentObject !== undefined && fromCachedContent != null) {
|
|
3256
|
+
setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
|
|
3257
|
+
}
|
|
3258
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
3259
|
+
'responseModalities',
|
|
3260
|
+
]);
|
|
3261
|
+
if (fromResponseModalities != null) {
|
|
3262
|
+
setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
|
|
3263
|
+
}
|
|
3264
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
3265
|
+
'mediaResolution',
|
|
3266
|
+
]);
|
|
3267
|
+
if (fromMediaResolution != null) {
|
|
3268
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
3269
|
+
}
|
|
3270
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
3271
|
+
if (fromSpeechConfig != null) {
|
|
3272
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
3273
|
+
}
|
|
3274
|
+
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
3275
|
+
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
3276
|
+
}
|
|
3277
|
+
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
3278
|
+
'thinkingConfig',
|
|
3279
|
+
]);
|
|
3280
|
+
if (fromThinkingConfig != null) {
|
|
3281
|
+
setValueByPath(toObject, ['thinkingConfig'], thinkingConfigToMldev(apiClient, fromThinkingConfig));
|
|
3282
|
+
}
|
|
3283
|
+
return toObject;
|
|
3284
|
+
}
|
|
3285
|
+
function generateContentParametersToMldev(apiClient, fromObject) {
|
|
3286
|
+
const toObject = {};
|
|
3287
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3288
|
+
if (fromModel != null) {
|
|
3289
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3290
|
+
}
|
|
3291
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3292
|
+
if (fromContents != null) {
|
|
3293
|
+
if (Array.isArray(fromContents)) {
|
|
3294
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
3295
|
+
return contentToMldev(apiClient, item);
|
|
3296
|
+
})));
|
|
3297
|
+
}
|
|
3298
|
+
else {
|
|
3299
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3303
|
+
if (fromConfig != null) {
|
|
3304
|
+
setValueByPath(toObject, ['generationConfig'], generateContentConfigToMldev(apiClient, fromConfig, toObject));
|
|
3305
|
+
}
|
|
3306
|
+
return toObject;
|
|
3307
|
+
}
|
|
3308
|
+
function embedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3309
|
+
const toObject = {};
|
|
3310
|
+
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3311
|
+
if (parentObject !== undefined && fromTaskType != null) {
|
|
3312
|
+
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3313
|
+
}
|
|
3314
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3315
|
+
if (parentObject !== undefined && fromTitle != null) {
|
|
3316
|
+
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3317
|
+
}
|
|
3318
|
+
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3319
|
+
'outputDimensionality',
|
|
3320
|
+
]);
|
|
3321
|
+
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3322
|
+
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3323
|
+
}
|
|
3324
|
+
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3325
|
+
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3326
|
+
}
|
|
3327
|
+
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3328
|
+
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3329
|
+
}
|
|
3330
|
+
return toObject;
|
|
3331
|
+
}
|
|
3332
|
+
function embedContentParametersToMldev(apiClient, fromObject) {
|
|
3333
|
+
const toObject = {};
|
|
3334
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3335
|
+
if (fromModel != null) {
|
|
3336
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3337
|
+
}
|
|
3338
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3339
|
+
if (fromContents != null) {
|
|
3340
|
+
setValueByPath(toObject, ['requests[]', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3341
|
+
}
|
|
3342
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3343
|
+
if (fromConfig != null) {
|
|
3344
|
+
setValueByPath(toObject, ['config'], embedContentConfigToMldev(apiClient, fromConfig, toObject));
|
|
3345
|
+
}
|
|
3346
|
+
const fromModelForEmbedContent = getValueByPath(fromObject, ['model']);
|
|
3347
|
+
if (fromModelForEmbedContent !== undefined) {
|
|
3348
|
+
setValueByPath(toObject, ['requests[]', 'model'], tModel(apiClient, fromModelForEmbedContent));
|
|
3349
|
+
}
|
|
3350
|
+
return toObject;
|
|
3351
|
+
}
|
|
3352
|
+
function generateImagesConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3353
|
+
const toObject = {};
|
|
3354
|
+
if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
|
|
3355
|
+
throw new Error('outputGcsUri parameter is not supported in Gemini API.');
|
|
3356
|
+
}
|
|
3357
|
+
if (getValueByPath(fromObject, ['negativePrompt']) !== undefined) {
|
|
3358
|
+
throw new Error('negativePrompt parameter is not supported in Gemini API.');
|
|
3359
|
+
}
|
|
3360
|
+
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
3361
|
+
'numberOfImages',
|
|
3362
|
+
]);
|
|
3363
|
+
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
3364
|
+
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
3365
|
+
}
|
|
3366
|
+
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
3367
|
+
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
3368
|
+
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
3369
|
+
}
|
|
3370
|
+
const fromGuidanceScale = getValueByPath(fromObject, [
|
|
3371
|
+
'guidanceScale',
|
|
3372
|
+
]);
|
|
3373
|
+
if (parentObject !== undefined && fromGuidanceScale != null) {
|
|
3374
|
+
setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
|
|
3375
|
+
}
|
|
3376
|
+
if (getValueByPath(fromObject, ['seed']) !== undefined) {
|
|
3377
|
+
throw new Error('seed parameter is not supported in Gemini API.');
|
|
3378
|
+
}
|
|
3379
|
+
const fromSafetyFilterLevel = getValueByPath(fromObject, [
|
|
3380
|
+
'safetyFilterLevel',
|
|
3381
|
+
]);
|
|
3382
|
+
if (parentObject !== undefined && fromSafetyFilterLevel != null) {
|
|
3383
|
+
setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
|
|
3384
|
+
}
|
|
3385
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
3386
|
+
'personGeneration',
|
|
3387
|
+
]);
|
|
3388
|
+
if (parentObject !== undefined && fromPersonGeneration != null) {
|
|
3389
|
+
setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
|
|
3390
|
+
}
|
|
3391
|
+
const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
|
|
3392
|
+
'includeSafetyAttributes',
|
|
3393
|
+
]);
|
|
3394
|
+
if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
|
|
3395
|
+
setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
|
|
3396
|
+
}
|
|
3397
|
+
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
3398
|
+
'includeRaiReason',
|
|
3399
|
+
]);
|
|
3400
|
+
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
3401
|
+
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
3402
|
+
}
|
|
3403
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
3404
|
+
if (parentObject !== undefined && fromLanguage != null) {
|
|
3405
|
+
setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
|
|
3406
|
+
}
|
|
3407
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
3408
|
+
'outputMimeType',
|
|
3409
|
+
]);
|
|
3410
|
+
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
3411
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
3412
|
+
}
|
|
3413
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
3414
|
+
'outputCompressionQuality',
|
|
3415
|
+
]);
|
|
3416
|
+
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
3417
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
3418
|
+
}
|
|
3419
|
+
if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
|
|
3420
|
+
throw new Error('addWatermark parameter is not supported in Gemini API.');
|
|
3421
|
+
}
|
|
3422
|
+
if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
|
|
3423
|
+
throw new Error('enhancePrompt parameter is not supported in Gemini API.');
|
|
3424
|
+
}
|
|
3425
|
+
return toObject;
|
|
3426
|
+
}
|
|
3427
|
+
function generateImagesParametersToMldev(apiClient, fromObject) {
|
|
2821
3428
|
const toObject = {};
|
|
2822
|
-
|
|
2823
|
-
|
|
3429
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3430
|
+
if (fromModel != null) {
|
|
3431
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
2824
3432
|
}
|
|
2825
|
-
const
|
|
2826
|
-
if (
|
|
2827
|
-
setValueByPath(toObject, ['
|
|
3433
|
+
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
3434
|
+
if (fromPrompt != null) {
|
|
3435
|
+
setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
2828
3436
|
}
|
|
2829
|
-
const
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
if (fromCodeExecutionResult != null) {
|
|
2833
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
3437
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3438
|
+
if (fromConfig != null) {
|
|
3439
|
+
setValueByPath(toObject, ['config'], generateImagesConfigToMldev(apiClient, fromConfig, toObject));
|
|
2834
3440
|
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
3441
|
+
return toObject;
|
|
3442
|
+
}
|
|
3443
|
+
function countTokensConfigToMldev(apiClient, fromObject) {
|
|
3444
|
+
const toObject = {};
|
|
3445
|
+
if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
|
|
3446
|
+
throw new Error('systemInstruction parameter is not supported in Gemini API.');
|
|
2840
3447
|
}
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
3448
|
+
if (getValueByPath(fromObject, ['tools']) !== undefined) {
|
|
3449
|
+
throw new Error('tools parameter is not supported in Gemini API.');
|
|
2844
3450
|
}
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3451
|
+
if (getValueByPath(fromObject, ['generationConfig']) !== undefined) {
|
|
3452
|
+
throw new Error('generationConfig parameter is not supported in Gemini API.');
|
|
2848
3453
|
}
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
3454
|
+
return toObject;
|
|
3455
|
+
}
|
|
3456
|
+
function countTokensParametersToMldev(apiClient, fromObject) {
|
|
3457
|
+
const toObject = {};
|
|
3458
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3459
|
+
if (fromModel != null) {
|
|
3460
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
2854
3461
|
}
|
|
2855
|
-
const
|
|
2856
|
-
if (
|
|
2857
|
-
|
|
3462
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3463
|
+
if (fromContents != null) {
|
|
3464
|
+
if (Array.isArray(fromContents)) {
|
|
3465
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
3466
|
+
return contentToMldev(apiClient, item);
|
|
3467
|
+
})));
|
|
3468
|
+
}
|
|
3469
|
+
else {
|
|
3470
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
3471
|
+
}
|
|
2858
3472
|
}
|
|
2859
|
-
const
|
|
2860
|
-
if (
|
|
2861
|
-
setValueByPath(toObject, ['
|
|
3473
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3474
|
+
if (fromConfig != null) {
|
|
3475
|
+
setValueByPath(toObject, ['config'], countTokensConfigToMldev(apiClient, fromConfig));
|
|
2862
3476
|
}
|
|
2863
3477
|
return toObject;
|
|
2864
3478
|
}
|
|
@@ -2910,25 +3524,6 @@ function partToVertex(apiClient, fromObject) {
|
|
|
2910
3524
|
}
|
|
2911
3525
|
return toObject;
|
|
2912
3526
|
}
|
|
2913
|
-
function contentToMldev(apiClient, fromObject) {
|
|
2914
|
-
const toObject = {};
|
|
2915
|
-
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2916
|
-
if (fromParts != null) {
|
|
2917
|
-
if (Array.isArray(fromParts)) {
|
|
2918
|
-
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
2919
|
-
return partToMldev(apiClient, item);
|
|
2920
|
-
}));
|
|
2921
|
-
}
|
|
2922
|
-
else {
|
|
2923
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
2924
|
-
}
|
|
2925
|
-
}
|
|
2926
|
-
const fromRole = getValueByPath(fromObject, ['role']);
|
|
2927
|
-
if (fromRole != null) {
|
|
2928
|
-
setValueByPath(toObject, ['role'], fromRole);
|
|
2929
|
-
}
|
|
2930
|
-
return toObject;
|
|
2931
|
-
}
|
|
2932
3527
|
function contentToVertex(apiClient, fromObject) {
|
|
2933
3528
|
const toObject = {};
|
|
2934
3529
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -2948,92 +3543,6 @@ function contentToVertex(apiClient, fromObject) {
|
|
|
2948
3543
|
}
|
|
2949
3544
|
return toObject;
|
|
2950
3545
|
}
|
|
2951
|
-
function schemaToMldev(apiClient, fromObject) {
|
|
2952
|
-
const toObject = {};
|
|
2953
|
-
if (getValueByPath(fromObject, ['example']) !== undefined) {
|
|
2954
|
-
throw new Error('example parameter is not supported in Gemini API.');
|
|
2955
|
-
}
|
|
2956
|
-
if (getValueByPath(fromObject, ['pattern']) !== undefined) {
|
|
2957
|
-
throw new Error('pattern parameter is not supported in Gemini API.');
|
|
2958
|
-
}
|
|
2959
|
-
if (getValueByPath(fromObject, ['default']) !== undefined) {
|
|
2960
|
-
throw new Error('default parameter is not supported in Gemini API.');
|
|
2961
|
-
}
|
|
2962
|
-
if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
|
|
2963
|
-
throw new Error('maxLength parameter is not supported in Gemini API.');
|
|
2964
|
-
}
|
|
2965
|
-
if (getValueByPath(fromObject, ['title']) !== undefined) {
|
|
2966
|
-
throw new Error('title parameter is not supported in Gemini API.');
|
|
2967
|
-
}
|
|
2968
|
-
if (getValueByPath(fromObject, ['minLength']) !== undefined) {
|
|
2969
|
-
throw new Error('minLength parameter is not supported in Gemini API.');
|
|
2970
|
-
}
|
|
2971
|
-
if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
|
|
2972
|
-
throw new Error('minProperties parameter is not supported in Gemini API.');
|
|
2973
|
-
}
|
|
2974
|
-
if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
|
|
2975
|
-
throw new Error('maxProperties parameter is not supported in Gemini API.');
|
|
2976
|
-
}
|
|
2977
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
2978
|
-
if (fromAnyOf != null) {
|
|
2979
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
2980
|
-
}
|
|
2981
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2982
|
-
if (fromDescription != null) {
|
|
2983
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
2984
|
-
}
|
|
2985
|
-
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
2986
|
-
if (fromEnum != null) {
|
|
2987
|
-
setValueByPath(toObject, ['enum'], fromEnum);
|
|
2988
|
-
}
|
|
2989
|
-
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
2990
|
-
if (fromFormat != null) {
|
|
2991
|
-
setValueByPath(toObject, ['format'], fromFormat);
|
|
2992
|
-
}
|
|
2993
|
-
const fromItems = getValueByPath(fromObject, ['items']);
|
|
2994
|
-
if (fromItems != null) {
|
|
2995
|
-
setValueByPath(toObject, ['items'], fromItems);
|
|
2996
|
-
}
|
|
2997
|
-
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
2998
|
-
if (fromMaxItems != null) {
|
|
2999
|
-
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
3000
|
-
}
|
|
3001
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
3002
|
-
if (fromMaximum != null) {
|
|
3003
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
3004
|
-
}
|
|
3005
|
-
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
3006
|
-
if (fromMinItems != null) {
|
|
3007
|
-
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
3008
|
-
}
|
|
3009
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
3010
|
-
if (fromMinimum != null) {
|
|
3011
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
3012
|
-
}
|
|
3013
|
-
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
3014
|
-
if (fromNullable != null) {
|
|
3015
|
-
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
3016
|
-
}
|
|
3017
|
-
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
3018
|
-
if (fromProperties != null) {
|
|
3019
|
-
setValueByPath(toObject, ['properties'], fromProperties);
|
|
3020
|
-
}
|
|
3021
|
-
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
3022
|
-
'propertyOrdering',
|
|
3023
|
-
]);
|
|
3024
|
-
if (fromPropertyOrdering != null) {
|
|
3025
|
-
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
3026
|
-
}
|
|
3027
|
-
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
3028
|
-
if (fromRequired != null) {
|
|
3029
|
-
setValueByPath(toObject, ['required'], fromRequired);
|
|
3030
|
-
}
|
|
3031
|
-
const fromType = getValueByPath(fromObject, ['type']);
|
|
3032
|
-
if (fromType != null) {
|
|
3033
|
-
setValueByPath(toObject, ['type'], fromType);
|
|
3034
|
-
}
|
|
3035
|
-
return toObject;
|
|
3036
|
-
}
|
|
3037
3546
|
function schemaToVertex(apiClient, fromObject) {
|
|
3038
3547
|
const toObject = {};
|
|
3039
3548
|
const fromExample = getValueByPath(fromObject, ['example']);
|
|
@@ -3052,10 +3561,6 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
3052
3561
|
if (fromMaxLength != null) {
|
|
3053
3562
|
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
3054
3563
|
}
|
|
3055
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3056
|
-
if (fromTitle != null) {
|
|
3057
|
-
setValueByPath(toObject, ['title'], fromTitle);
|
|
3058
|
-
}
|
|
3059
3564
|
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
3060
3565
|
if (fromMinLength != null) {
|
|
3061
3566
|
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
@@ -3126,27 +3631,16 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
3126
3631
|
if (fromRequired != null) {
|
|
3127
3632
|
setValueByPath(toObject, ['required'], fromRequired);
|
|
3128
3633
|
}
|
|
3634
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3635
|
+
if (fromTitle != null) {
|
|
3636
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
3637
|
+
}
|
|
3129
3638
|
const fromType = getValueByPath(fromObject, ['type']);
|
|
3130
3639
|
if (fromType != null) {
|
|
3131
3640
|
setValueByPath(toObject, ['type'], fromType);
|
|
3132
3641
|
}
|
|
3133
3642
|
return toObject;
|
|
3134
3643
|
}
|
|
3135
|
-
function safetySettingToMldev(apiClient, fromObject) {
|
|
3136
|
-
const toObject = {};
|
|
3137
|
-
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
3138
|
-
throw new Error('method parameter is not supported in Gemini API.');
|
|
3139
|
-
}
|
|
3140
|
-
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
3141
|
-
if (fromCategory != null) {
|
|
3142
|
-
setValueByPath(toObject, ['category'], fromCategory);
|
|
3143
|
-
}
|
|
3144
|
-
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
3145
|
-
if (fromThreshold != null) {
|
|
3146
|
-
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
3147
|
-
}
|
|
3148
|
-
return toObject;
|
|
3149
|
-
}
|
|
3150
3644
|
function safetySettingToVertex(apiClient, fromObject) {
|
|
3151
3645
|
const toObject = {};
|
|
3152
3646
|
const fromMethod = getValueByPath(fromObject, ['method']);
|
|
@@ -3163,25 +3657,6 @@ function safetySettingToVertex(apiClient, fromObject) {
|
|
|
3163
3657
|
}
|
|
3164
3658
|
return toObject;
|
|
3165
3659
|
}
|
|
3166
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
3167
|
-
const toObject = {};
|
|
3168
|
-
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
3169
|
-
throw new Error('response parameter is not supported in Gemini API.');
|
|
3170
|
-
}
|
|
3171
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
3172
|
-
if (fromDescription != null) {
|
|
3173
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
3174
|
-
}
|
|
3175
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
3176
|
-
if (fromName != null) {
|
|
3177
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
3178
|
-
}
|
|
3179
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
3180
|
-
if (fromParameters != null) {
|
|
3181
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
3182
|
-
}
|
|
3183
|
-
return toObject;
|
|
3184
|
-
}
|
|
3185
3660
|
function functionDeclarationToVertex(apiClient, fromObject) {
|
|
3186
3661
|
const toObject = {};
|
|
3187
3662
|
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
@@ -3202,49 +3677,21 @@ function functionDeclarationToVertex(apiClient, fromObject) {
|
|
|
3202
3677
|
}
|
|
3203
3678
|
return toObject;
|
|
3204
3679
|
}
|
|
3205
|
-
function googleSearchToMldev() {
|
|
3206
|
-
const toObject = {};
|
|
3207
|
-
return toObject;
|
|
3208
|
-
}
|
|
3209
3680
|
function googleSearchToVertex() {
|
|
3210
3681
|
const toObject = {};
|
|
3211
3682
|
return toObject;
|
|
3212
3683
|
}
|
|
3213
|
-
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
3214
|
-
const toObject = {};
|
|
3215
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3216
|
-
if (fromMode != null) {
|
|
3217
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3218
|
-
}
|
|
3219
|
-
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3220
|
-
'dynamicThreshold',
|
|
3221
|
-
]);
|
|
3222
|
-
if (fromDynamicThreshold != null) {
|
|
3223
|
-
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3224
|
-
}
|
|
3225
|
-
return toObject;
|
|
3226
|
-
}
|
|
3227
3684
|
function dynamicRetrievalConfigToVertex(apiClient, fromObject) {
|
|
3228
3685
|
const toObject = {};
|
|
3229
3686
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3230
3687
|
if (fromMode != null) {
|
|
3231
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3232
|
-
}
|
|
3233
|
-
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3234
|
-
'dynamicThreshold',
|
|
3235
|
-
]);
|
|
3236
|
-
if (fromDynamicThreshold != null) {
|
|
3237
|
-
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3238
|
-
}
|
|
3239
|
-
return toObject;
|
|
3240
|
-
}
|
|
3241
|
-
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
3242
|
-
const toObject = {};
|
|
3243
|
-
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
3244
|
-
'dynamicRetrievalConfig',
|
|
3688
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3689
|
+
}
|
|
3690
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3691
|
+
'dynamicThreshold',
|
|
3245
3692
|
]);
|
|
3246
|
-
if (
|
|
3247
|
-
setValueByPath(toObject, ['
|
|
3693
|
+
if (fromDynamicThreshold != null) {
|
|
3694
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3248
3695
|
}
|
|
3249
3696
|
return toObject;
|
|
3250
3697
|
}
|
|
@@ -3258,42 +3705,6 @@ function googleSearchRetrievalToVertex(apiClient, fromObject) {
|
|
|
3258
3705
|
}
|
|
3259
3706
|
return toObject;
|
|
3260
3707
|
}
|
|
3261
|
-
function toolToMldev(apiClient, fromObject) {
|
|
3262
|
-
const toObject = {};
|
|
3263
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
3264
|
-
'functionDeclarations',
|
|
3265
|
-
]);
|
|
3266
|
-
if (fromFunctionDeclarations != null) {
|
|
3267
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
3268
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
3269
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
3270
|
-
}));
|
|
3271
|
-
}
|
|
3272
|
-
else {
|
|
3273
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
|
-
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
3277
|
-
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
3278
|
-
}
|
|
3279
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
3280
|
-
if (fromGoogleSearch != null) {
|
|
3281
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev());
|
|
3282
|
-
}
|
|
3283
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
3284
|
-
'googleSearchRetrieval',
|
|
3285
|
-
]);
|
|
3286
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
3287
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
3288
|
-
}
|
|
3289
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3290
|
-
'codeExecution',
|
|
3291
|
-
]);
|
|
3292
|
-
if (fromCodeExecution != null) {
|
|
3293
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
3294
|
-
}
|
|
3295
|
-
return toObject;
|
|
3296
|
-
}
|
|
3297
3708
|
function toolToVertex(apiClient, fromObject) {
|
|
3298
3709
|
const toObject = {};
|
|
3299
3710
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -3331,20 +3742,6 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
3331
3742
|
}
|
|
3332
3743
|
return toObject;
|
|
3333
3744
|
}
|
|
3334
|
-
function functionCallingConfigToMldev(apiClient, fromObject) {
|
|
3335
|
-
const toObject = {};
|
|
3336
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3337
|
-
if (fromMode != null) {
|
|
3338
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3339
|
-
}
|
|
3340
|
-
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3341
|
-
'allowedFunctionNames',
|
|
3342
|
-
]);
|
|
3343
|
-
if (fromAllowedFunctionNames != null) {
|
|
3344
|
-
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3345
|
-
}
|
|
3346
|
-
return toObject;
|
|
3347
|
-
}
|
|
3348
3745
|
function functionCallingConfigToVertex(apiClient, fromObject) {
|
|
3349
3746
|
const toObject = {};
|
|
3350
3747
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
@@ -3359,16 +3756,6 @@ function functionCallingConfigToVertex(apiClient, fromObject) {
|
|
|
3359
3756
|
}
|
|
3360
3757
|
return toObject;
|
|
3361
3758
|
}
|
|
3362
|
-
function toolConfigToMldev(apiClient, fromObject) {
|
|
3363
|
-
const toObject = {};
|
|
3364
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
3365
|
-
'functionCallingConfig',
|
|
3366
|
-
]);
|
|
3367
|
-
if (fromFunctionCallingConfig != null) {
|
|
3368
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(apiClient, fromFunctionCallingConfig));
|
|
3369
|
-
}
|
|
3370
|
-
return toObject;
|
|
3371
|
-
}
|
|
3372
3759
|
function toolConfigToVertex(apiClient, fromObject) {
|
|
3373
3760
|
const toObject = {};
|
|
3374
3761
|
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
@@ -3379,14 +3766,6 @@ function toolConfigToVertex(apiClient, fromObject) {
|
|
|
3379
3766
|
}
|
|
3380
3767
|
return toObject;
|
|
3381
3768
|
}
|
|
3382
|
-
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
3383
|
-
const toObject = {};
|
|
3384
|
-
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
3385
|
-
if (fromVoiceName != null) {
|
|
3386
|
-
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
3387
|
-
}
|
|
3388
|
-
return toObject;
|
|
3389
|
-
}
|
|
3390
3769
|
function prebuiltVoiceConfigToVertex(apiClient, fromObject) {
|
|
3391
3770
|
const toObject = {};
|
|
3392
3771
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
@@ -3395,16 +3774,6 @@ function prebuiltVoiceConfigToVertex(apiClient, fromObject) {
|
|
|
3395
3774
|
}
|
|
3396
3775
|
return toObject;
|
|
3397
3776
|
}
|
|
3398
|
-
function voiceConfigToMldev(apiClient, fromObject) {
|
|
3399
|
-
const toObject = {};
|
|
3400
|
-
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
3401
|
-
'prebuiltVoiceConfig',
|
|
3402
|
-
]);
|
|
3403
|
-
if (fromPrebuiltVoiceConfig != null) {
|
|
3404
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
3405
|
-
}
|
|
3406
|
-
return toObject;
|
|
3407
|
-
}
|
|
3408
3777
|
function voiceConfigToVertex(apiClient, fromObject) {
|
|
3409
3778
|
const toObject = {};
|
|
3410
3779
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
@@ -3415,182 +3784,21 @@ function voiceConfigToVertex(apiClient, fromObject) {
|
|
|
3415
3784
|
}
|
|
3416
3785
|
return toObject;
|
|
3417
3786
|
}
|
|
3418
|
-
function
|
|
3419
|
-
const toObject = {};
|
|
3420
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3421
|
-
if (fromVoiceConfig != null) {
|
|
3422
|
-
setValueByPath(toObject, ['voiceConfig'],
|
|
3423
|
-
}
|
|
3424
|
-
return toObject;
|
|
3425
|
-
}
|
|
3426
|
-
function speechConfigToVertex(apiClient, fromObject) {
|
|
3427
|
-
const toObject = {};
|
|
3428
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3429
|
-
if (fromVoiceConfig != null) {
|
|
3430
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
|
|
3431
|
-
}
|
|
3432
|
-
return toObject;
|
|
3433
|
-
}
|
|
3434
|
-
function thinkingConfigToMldev(apiClient, fromObject) {
|
|
3435
|
-
const toObject = {};
|
|
3436
|
-
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3437
|
-
'includeThoughts',
|
|
3438
|
-
]);
|
|
3439
|
-
if (fromIncludeThoughts != null) {
|
|
3440
|
-
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3441
|
-
}
|
|
3442
|
-
return toObject;
|
|
3443
|
-
}
|
|
3444
|
-
function thinkingConfigToVertex(apiClient, fromObject) {
|
|
3445
|
-
const toObject = {};
|
|
3446
|
-
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3447
|
-
'includeThoughts',
|
|
3448
|
-
]);
|
|
3449
|
-
if (fromIncludeThoughts != null) {
|
|
3450
|
-
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3451
|
-
}
|
|
3452
|
-
return toObject;
|
|
3453
|
-
}
|
|
3454
|
-
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3455
|
-
const toObject = {};
|
|
3456
|
-
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
3457
|
-
'systemInstruction',
|
|
3458
|
-
]);
|
|
3459
|
-
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
3460
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
3461
|
-
}
|
|
3462
|
-
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
3463
|
-
if (fromTemperature != null) {
|
|
3464
|
-
setValueByPath(toObject, ['temperature'], fromTemperature);
|
|
3465
|
-
}
|
|
3466
|
-
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
3467
|
-
if (fromTopP != null) {
|
|
3468
|
-
setValueByPath(toObject, ['topP'], fromTopP);
|
|
3469
|
-
}
|
|
3470
|
-
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
3471
|
-
if (fromTopK != null) {
|
|
3472
|
-
setValueByPath(toObject, ['topK'], fromTopK);
|
|
3473
|
-
}
|
|
3474
|
-
const fromCandidateCount = getValueByPath(fromObject, [
|
|
3475
|
-
'candidateCount',
|
|
3476
|
-
]);
|
|
3477
|
-
if (fromCandidateCount != null) {
|
|
3478
|
-
setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
|
|
3479
|
-
}
|
|
3480
|
-
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
3481
|
-
'maxOutputTokens',
|
|
3482
|
-
]);
|
|
3483
|
-
if (fromMaxOutputTokens != null) {
|
|
3484
|
-
setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
|
|
3485
|
-
}
|
|
3486
|
-
const fromStopSequences = getValueByPath(fromObject, [
|
|
3487
|
-
'stopSequences',
|
|
3488
|
-
]);
|
|
3489
|
-
if (fromStopSequences != null) {
|
|
3490
|
-
setValueByPath(toObject, ['stopSequences'], fromStopSequences);
|
|
3491
|
-
}
|
|
3492
|
-
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
3493
|
-
'responseLogprobs',
|
|
3494
|
-
]);
|
|
3495
|
-
if (fromResponseLogprobs != null) {
|
|
3496
|
-
setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
|
|
3497
|
-
}
|
|
3498
|
-
const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
|
|
3499
|
-
if (fromLogprobs != null) {
|
|
3500
|
-
setValueByPath(toObject, ['logprobs'], fromLogprobs);
|
|
3501
|
-
}
|
|
3502
|
-
const fromPresencePenalty = getValueByPath(fromObject, [
|
|
3503
|
-
'presencePenalty',
|
|
3504
|
-
]);
|
|
3505
|
-
if (fromPresencePenalty != null) {
|
|
3506
|
-
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
3507
|
-
}
|
|
3508
|
-
const fromFrequencyPenalty = getValueByPath(fromObject, [
|
|
3509
|
-
'frequencyPenalty',
|
|
3510
|
-
]);
|
|
3511
|
-
if (fromFrequencyPenalty != null) {
|
|
3512
|
-
setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
|
|
3513
|
-
}
|
|
3514
|
-
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
3515
|
-
if (fromSeed != null) {
|
|
3516
|
-
setValueByPath(toObject, ['seed'], fromSeed);
|
|
3517
|
-
}
|
|
3518
|
-
const fromResponseMimeType = getValueByPath(fromObject, [
|
|
3519
|
-
'responseMimeType',
|
|
3520
|
-
]);
|
|
3521
|
-
if (fromResponseMimeType != null) {
|
|
3522
|
-
setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
|
|
3523
|
-
}
|
|
3524
|
-
const fromResponseSchema = getValueByPath(fromObject, [
|
|
3525
|
-
'responseSchema',
|
|
3526
|
-
]);
|
|
3527
|
-
if (fromResponseSchema != null) {
|
|
3528
|
-
setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
|
|
3529
|
-
}
|
|
3530
|
-
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
3531
|
-
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
3532
|
-
}
|
|
3533
|
-
const fromSafetySettings = getValueByPath(fromObject, [
|
|
3534
|
-
'safetySettings',
|
|
3535
|
-
]);
|
|
3536
|
-
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
3537
|
-
if (Array.isArray(fromSafetySettings)) {
|
|
3538
|
-
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
|
|
3539
|
-
return safetySettingToMldev(apiClient, item);
|
|
3540
|
-
}));
|
|
3541
|
-
}
|
|
3542
|
-
else {
|
|
3543
|
-
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
|
|
3544
|
-
}
|
|
3545
|
-
}
|
|
3546
|
-
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
3547
|
-
if (parentObject !== undefined && fromTools != null) {
|
|
3548
|
-
if (Array.isArray(fromTools)) {
|
|
3549
|
-
setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
|
|
3550
|
-
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
3551
|
-
})));
|
|
3552
|
-
}
|
|
3553
|
-
else {
|
|
3554
|
-
setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
|
|
3555
|
-
}
|
|
3556
|
-
}
|
|
3557
|
-
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
3558
|
-
if (parentObject !== undefined && fromToolConfig != null) {
|
|
3559
|
-
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(apiClient, fromToolConfig));
|
|
3560
|
-
}
|
|
3561
|
-
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
3562
|
-
throw new Error('labels parameter is not supported in Gemini API.');
|
|
3563
|
-
}
|
|
3564
|
-
const fromCachedContent = getValueByPath(fromObject, [
|
|
3565
|
-
'cachedContent',
|
|
3566
|
-
]);
|
|
3567
|
-
if (parentObject !== undefined && fromCachedContent != null) {
|
|
3568
|
-
setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
|
|
3569
|
-
}
|
|
3570
|
-
const fromResponseModalities = getValueByPath(fromObject, [
|
|
3571
|
-
'responseModalities',
|
|
3572
|
-
]);
|
|
3573
|
-
if (fromResponseModalities != null) {
|
|
3574
|
-
setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
|
|
3575
|
-
}
|
|
3576
|
-
const fromMediaResolution = getValueByPath(fromObject, [
|
|
3577
|
-
'mediaResolution',
|
|
3578
|
-
]);
|
|
3579
|
-
if (fromMediaResolution != null) {
|
|
3580
|
-
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
3581
|
-
}
|
|
3582
|
-
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
3583
|
-
if (fromSpeechConfig != null) {
|
|
3584
|
-
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
3585
|
-
}
|
|
3586
|
-
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
3587
|
-
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
3787
|
+
function speechConfigToVertex(apiClient, fromObject) {
|
|
3788
|
+
const toObject = {};
|
|
3789
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3790
|
+
if (fromVoiceConfig != null) {
|
|
3791
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
|
|
3588
3792
|
}
|
|
3589
|
-
|
|
3590
|
-
|
|
3793
|
+
return toObject;
|
|
3794
|
+
}
|
|
3795
|
+
function thinkingConfigToVertex(apiClient, fromObject) {
|
|
3796
|
+
const toObject = {};
|
|
3797
|
+
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3798
|
+
'includeThoughts',
|
|
3591
3799
|
]);
|
|
3592
|
-
if (
|
|
3593
|
-
setValueByPath(toObject, ['
|
|
3800
|
+
if (fromIncludeThoughts != null) {
|
|
3801
|
+
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3594
3802
|
}
|
|
3595
3803
|
return toObject;
|
|
3596
3804
|
}
|
|
@@ -3744,29 +3952,6 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
3744
3952
|
}
|
|
3745
3953
|
return toObject;
|
|
3746
3954
|
}
|
|
3747
|
-
function generateContentParametersToMldev(apiClient, fromObject) {
|
|
3748
|
-
const toObject = {};
|
|
3749
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3750
|
-
if (fromModel != null) {
|
|
3751
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3752
|
-
}
|
|
3753
|
-
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3754
|
-
if (fromContents != null) {
|
|
3755
|
-
if (Array.isArray(fromContents)) {
|
|
3756
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
3757
|
-
return contentToMldev(apiClient, item);
|
|
3758
|
-
})));
|
|
3759
|
-
}
|
|
3760
|
-
else {
|
|
3761
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
3762
|
-
}
|
|
3763
|
-
}
|
|
3764
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3765
|
-
if (fromConfig != null) {
|
|
3766
|
-
setValueByPath(toObject, ['generationConfig'], generateContentConfigToMldev(apiClient, fromConfig, toObject));
|
|
3767
|
-
}
|
|
3768
|
-
return toObject;
|
|
3769
|
-
}
|
|
3770
3955
|
function generateContentParametersToVertex(apiClient, fromObject) {
|
|
3771
3956
|
const toObject = {};
|
|
3772
3957
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -3790,30 +3975,6 @@ function generateContentParametersToVertex(apiClient, fromObject) {
|
|
|
3790
3975
|
}
|
|
3791
3976
|
return toObject;
|
|
3792
3977
|
}
|
|
3793
|
-
function embedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3794
|
-
const toObject = {};
|
|
3795
|
-
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3796
|
-
if (parentObject !== undefined && fromTaskType != null) {
|
|
3797
|
-
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3798
|
-
}
|
|
3799
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3800
|
-
if (parentObject !== undefined && fromTitle != null) {
|
|
3801
|
-
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3802
|
-
}
|
|
3803
|
-
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3804
|
-
'outputDimensionality',
|
|
3805
|
-
]);
|
|
3806
|
-
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3807
|
-
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3808
|
-
}
|
|
3809
|
-
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3810
|
-
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3811
|
-
}
|
|
3812
|
-
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3813
|
-
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3814
|
-
}
|
|
3815
|
-
return toObject;
|
|
3816
|
-
}
|
|
3817
3978
|
function embedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
3818
3979
|
const toObject = {};
|
|
3819
3980
|
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
@@ -3840,26 +4001,6 @@ function embedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
3840
4001
|
}
|
|
3841
4002
|
return toObject;
|
|
3842
4003
|
}
|
|
3843
|
-
function embedContentParametersToMldev(apiClient, fromObject) {
|
|
3844
|
-
const toObject = {};
|
|
3845
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3846
|
-
if (fromModel != null) {
|
|
3847
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3848
|
-
}
|
|
3849
|
-
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3850
|
-
if (fromContents != null) {
|
|
3851
|
-
setValueByPath(toObject, ['requests[]', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3852
|
-
}
|
|
3853
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3854
|
-
if (fromConfig != null) {
|
|
3855
|
-
setValueByPath(toObject, ['config'], embedContentConfigToMldev(apiClient, fromConfig, toObject));
|
|
3856
|
-
}
|
|
3857
|
-
const fromModelForEmbedContent = getValueByPath(fromObject, ['model']);
|
|
3858
|
-
if (fromModelForEmbedContent !== undefined) {
|
|
3859
|
-
setValueByPath(toObject, ['requests[]', 'model'], tModel(apiClient, fromModelForEmbedContent));
|
|
3860
|
-
}
|
|
3861
|
-
return toObject;
|
|
3862
|
-
}
|
|
3863
4004
|
function embedContentParametersToVertex(apiClient, fromObject) {
|
|
3864
4005
|
const toObject = {};
|
|
3865
4006
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -3876,81 +4017,6 @@ function embedContentParametersToVertex(apiClient, fromObject) {
|
|
|
3876
4017
|
}
|
|
3877
4018
|
return toObject;
|
|
3878
4019
|
}
|
|
3879
|
-
function generateImagesConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3880
|
-
const toObject = {};
|
|
3881
|
-
if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
|
|
3882
|
-
throw new Error('outputGcsUri parameter is not supported in Gemini API.');
|
|
3883
|
-
}
|
|
3884
|
-
if (getValueByPath(fromObject, ['negativePrompt']) !== undefined) {
|
|
3885
|
-
throw new Error('negativePrompt parameter is not supported in Gemini API.');
|
|
3886
|
-
}
|
|
3887
|
-
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
3888
|
-
'numberOfImages',
|
|
3889
|
-
]);
|
|
3890
|
-
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
3891
|
-
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
3892
|
-
}
|
|
3893
|
-
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
3894
|
-
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
3895
|
-
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
3896
|
-
}
|
|
3897
|
-
const fromGuidanceScale = getValueByPath(fromObject, [
|
|
3898
|
-
'guidanceScale',
|
|
3899
|
-
]);
|
|
3900
|
-
if (parentObject !== undefined && fromGuidanceScale != null) {
|
|
3901
|
-
setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
|
|
3902
|
-
}
|
|
3903
|
-
if (getValueByPath(fromObject, ['seed']) !== undefined) {
|
|
3904
|
-
throw new Error('seed parameter is not supported in Gemini API.');
|
|
3905
|
-
}
|
|
3906
|
-
const fromSafetyFilterLevel = getValueByPath(fromObject, [
|
|
3907
|
-
'safetyFilterLevel',
|
|
3908
|
-
]);
|
|
3909
|
-
if (parentObject !== undefined && fromSafetyFilterLevel != null) {
|
|
3910
|
-
setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
|
|
3911
|
-
}
|
|
3912
|
-
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
3913
|
-
'personGeneration',
|
|
3914
|
-
]);
|
|
3915
|
-
if (parentObject !== undefined && fromPersonGeneration != null) {
|
|
3916
|
-
setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
|
|
3917
|
-
}
|
|
3918
|
-
const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
|
|
3919
|
-
'includeSafetyAttributes',
|
|
3920
|
-
]);
|
|
3921
|
-
if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
|
|
3922
|
-
setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
|
|
3923
|
-
}
|
|
3924
|
-
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
3925
|
-
'includeRaiReason',
|
|
3926
|
-
]);
|
|
3927
|
-
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
3928
|
-
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
3929
|
-
}
|
|
3930
|
-
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
3931
|
-
if (parentObject !== undefined && fromLanguage != null) {
|
|
3932
|
-
setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
|
|
3933
|
-
}
|
|
3934
|
-
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
3935
|
-
'outputMimeType',
|
|
3936
|
-
]);
|
|
3937
|
-
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
3938
|
-
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
3939
|
-
}
|
|
3940
|
-
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
3941
|
-
'outputCompressionQuality',
|
|
3942
|
-
]);
|
|
3943
|
-
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
3944
|
-
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
3945
|
-
}
|
|
3946
|
-
if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
|
|
3947
|
-
throw new Error('addWatermark parameter is not supported in Gemini API.');
|
|
3948
|
-
}
|
|
3949
|
-
if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
|
|
3950
|
-
throw new Error('enhancePrompt parameter is not supported in Gemini API.');
|
|
3951
|
-
}
|
|
3952
|
-
return toObject;
|
|
3953
|
-
}
|
|
3954
4020
|
function generateImagesConfigToVertex(apiClient, fromObject, parentObject) {
|
|
3955
4021
|
const toObject = {};
|
|
3956
4022
|
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
@@ -4035,22 +4101,6 @@ function generateImagesConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
4035
4101
|
}
|
|
4036
4102
|
return toObject;
|
|
4037
4103
|
}
|
|
4038
|
-
function generateImagesParametersToMldev(apiClient, fromObject) {
|
|
4039
|
-
const toObject = {};
|
|
4040
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
4041
|
-
if (fromModel != null) {
|
|
4042
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
4043
|
-
}
|
|
4044
|
-
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
4045
|
-
if (fromPrompt != null) {
|
|
4046
|
-
setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
4047
|
-
}
|
|
4048
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4049
|
-
if (fromConfig != null) {
|
|
4050
|
-
setValueByPath(toObject, ['config'], generateImagesConfigToMldev(apiClient, fromConfig, toObject));
|
|
4051
|
-
}
|
|
4052
|
-
return toObject;
|
|
4053
|
-
}
|
|
4054
4104
|
function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
4055
4105
|
const toObject = {};
|
|
4056
4106
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -4067,19 +4117,6 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
4067
4117
|
}
|
|
4068
4118
|
return toObject;
|
|
4069
4119
|
}
|
|
4070
|
-
function countTokensConfigToMldev(apiClient, fromObject) {
|
|
4071
|
-
const toObject = {};
|
|
4072
|
-
if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
|
|
4073
|
-
throw new Error('systemInstruction parameter is not supported in Gemini API.');
|
|
4074
|
-
}
|
|
4075
|
-
if (getValueByPath(fromObject, ['tools']) !== undefined) {
|
|
4076
|
-
throw new Error('tools parameter is not supported in Gemini API.');
|
|
4077
|
-
}
|
|
4078
|
-
if (getValueByPath(fromObject, ['generationConfig']) !== undefined) {
|
|
4079
|
-
throw new Error('generationConfig parameter is not supported in Gemini API.');
|
|
4080
|
-
}
|
|
4081
|
-
return toObject;
|
|
4082
|
-
}
|
|
4083
4120
|
function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
4084
4121
|
const toObject = {};
|
|
4085
4122
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
@@ -4107,29 +4144,6 @@ function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
4107
4144
|
}
|
|
4108
4145
|
return toObject;
|
|
4109
4146
|
}
|
|
4110
|
-
function countTokensParametersToMldev(apiClient, fromObject) {
|
|
4111
|
-
const toObject = {};
|
|
4112
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
4113
|
-
if (fromModel != null) {
|
|
4114
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
4115
|
-
}
|
|
4116
|
-
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
4117
|
-
if (fromContents != null) {
|
|
4118
|
-
if (Array.isArray(fromContents)) {
|
|
4119
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
4120
|
-
return contentToMldev(apiClient, item);
|
|
4121
|
-
})));
|
|
4122
|
-
}
|
|
4123
|
-
else {
|
|
4124
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
4125
|
-
}
|
|
4126
|
-
}
|
|
4127
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4128
|
-
if (fromConfig != null) {
|
|
4129
|
-
setValueByPath(toObject, ['config'], countTokensConfigToMldev(apiClient, fromConfig));
|
|
4130
|
-
}
|
|
4131
|
-
return toObject;
|
|
4132
|
-
}
|
|
4133
4147
|
function countTokensParametersToVertex(apiClient, fromObject) {
|
|
4134
4148
|
const toObject = {};
|
|
4135
4149
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -4166,66 +4180,18 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
4166
4180
|
return contentToVertex(apiClient, item);
|
|
4167
4181
|
})));
|
|
4168
4182
|
}
|
|
4169
|
-
else {
|
|
4170
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
4171
|
-
}
|
|
4172
|
-
}
|
|
4173
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4174
|
-
if (fromConfig != null) {
|
|
4175
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
4176
|
-
}
|
|
4177
|
-
return toObject;
|
|
4178
|
-
}
|
|
4179
|
-
function partFromMldev(apiClient, fromObject) {
|
|
4180
|
-
const toObject = {};
|
|
4181
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4182
|
-
if (fromThought != null) {
|
|
4183
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
4184
|
-
}
|
|
4185
|
-
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4186
|
-
'codeExecutionResult',
|
|
4187
|
-
]);
|
|
4188
|
-
if (fromCodeExecutionResult != null) {
|
|
4189
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
4190
|
-
}
|
|
4191
|
-
const fromExecutableCode = getValueByPath(fromObject, [
|
|
4192
|
-
'executableCode',
|
|
4193
|
-
]);
|
|
4194
|
-
if (fromExecutableCode != null) {
|
|
4195
|
-
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4196
|
-
}
|
|
4197
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4198
|
-
if (fromFileData != null) {
|
|
4199
|
-
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
4200
|
-
}
|
|
4201
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4202
|
-
if (fromFunctionCall != null) {
|
|
4203
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4204
|
-
}
|
|
4205
|
-
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4206
|
-
'functionResponse',
|
|
4207
|
-
]);
|
|
4208
|
-
if (fromFunctionResponse != null) {
|
|
4209
|
-
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4210
|
-
}
|
|
4211
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4212
|
-
if (fromInlineData != null) {
|
|
4213
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4183
|
+
else {
|
|
4184
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
4185
|
+
}
|
|
4214
4186
|
}
|
|
4215
|
-
const
|
|
4216
|
-
if (
|
|
4217
|
-
setValueByPath(toObject, ['
|
|
4187
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4188
|
+
if (fromConfig != null) {
|
|
4189
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
4218
4190
|
}
|
|
4219
4191
|
return toObject;
|
|
4220
4192
|
}
|
|
4221
|
-
function
|
|
4193
|
+
function partFromMldev(apiClient, fromObject) {
|
|
4222
4194
|
const toObject = {};
|
|
4223
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
4224
|
-
'videoMetadata',
|
|
4225
|
-
]);
|
|
4226
|
-
if (fromVideoMetadata != null) {
|
|
4227
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
4228
|
-
}
|
|
4229
4195
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4230
4196
|
if (fromThought != null) {
|
|
4231
4197
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
@@ -4285,25 +4251,6 @@ function contentFromMldev(apiClient, fromObject) {
|
|
|
4285
4251
|
}
|
|
4286
4252
|
return toObject;
|
|
4287
4253
|
}
|
|
4288
|
-
function contentFromVertex(apiClient, fromObject) {
|
|
4289
|
-
const toObject = {};
|
|
4290
|
-
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4291
|
-
if (fromParts != null) {
|
|
4292
|
-
if (Array.isArray(fromParts)) {
|
|
4293
|
-
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
4294
|
-
return partFromVertex(apiClient, item);
|
|
4295
|
-
}));
|
|
4296
|
-
}
|
|
4297
|
-
else {
|
|
4298
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
4299
|
-
}
|
|
4300
|
-
}
|
|
4301
|
-
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4302
|
-
if (fromRole != null) {
|
|
4303
|
-
setValueByPath(toObject, ['role'], fromRole);
|
|
4304
|
-
}
|
|
4305
|
-
return toObject;
|
|
4306
|
-
}
|
|
4307
4254
|
function citationMetadataFromMldev(apiClient, fromObject) {
|
|
4308
4255
|
const toObject = {};
|
|
4309
4256
|
const fromCitations = getValueByPath(fromObject, ['citationSources']);
|
|
@@ -4312,14 +4259,6 @@ function citationMetadataFromMldev(apiClient, fromObject) {
|
|
|
4312
4259
|
}
|
|
4313
4260
|
return toObject;
|
|
4314
4261
|
}
|
|
4315
|
-
function citationMetadataFromVertex(apiClient, fromObject) {
|
|
4316
|
-
const toObject = {};
|
|
4317
|
-
const fromCitations = getValueByPath(fromObject, ['citations']);
|
|
4318
|
-
if (fromCitations != null) {
|
|
4319
|
-
setValueByPath(toObject, ['citations'], fromCitations);
|
|
4320
|
-
}
|
|
4321
|
-
return toObject;
|
|
4322
|
-
}
|
|
4323
4262
|
function candidateFromMldev(apiClient, fromObject) {
|
|
4324
4263
|
const toObject = {};
|
|
4325
4264
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
@@ -4344,27 +4283,255 @@ function candidateFromMldev(apiClient, fromObject) {
|
|
|
4344
4283
|
if (fromAvgLogprobs != null) {
|
|
4345
4284
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
4346
4285
|
}
|
|
4347
|
-
const fromGroundingMetadata = getValueByPath(fromObject, [
|
|
4348
|
-
'groundingMetadata',
|
|
4349
|
-
]);
|
|
4350
|
-
if (fromGroundingMetadata != null) {
|
|
4351
|
-
setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
|
|
4286
|
+
const fromGroundingMetadata = getValueByPath(fromObject, [
|
|
4287
|
+
'groundingMetadata',
|
|
4288
|
+
]);
|
|
4289
|
+
if (fromGroundingMetadata != null) {
|
|
4290
|
+
setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
|
|
4291
|
+
}
|
|
4292
|
+
const fromIndex = getValueByPath(fromObject, ['index']);
|
|
4293
|
+
if (fromIndex != null) {
|
|
4294
|
+
setValueByPath(toObject, ['index'], fromIndex);
|
|
4295
|
+
}
|
|
4296
|
+
const fromLogprobsResult = getValueByPath(fromObject, [
|
|
4297
|
+
'logprobsResult',
|
|
4298
|
+
]);
|
|
4299
|
+
if (fromLogprobsResult != null) {
|
|
4300
|
+
setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
|
|
4301
|
+
}
|
|
4302
|
+
const fromSafetyRatings = getValueByPath(fromObject, [
|
|
4303
|
+
'safetyRatings',
|
|
4304
|
+
]);
|
|
4305
|
+
if (fromSafetyRatings != null) {
|
|
4306
|
+
setValueByPath(toObject, ['safetyRatings'], fromSafetyRatings);
|
|
4307
|
+
}
|
|
4308
|
+
return toObject;
|
|
4309
|
+
}
|
|
4310
|
+
function generateContentResponseFromMldev(apiClient, fromObject) {
|
|
4311
|
+
const toObject = {};
|
|
4312
|
+
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
4313
|
+
if (fromCandidates != null) {
|
|
4314
|
+
if (Array.isArray(fromCandidates)) {
|
|
4315
|
+
setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
|
|
4316
|
+
return candidateFromMldev(apiClient, item);
|
|
4317
|
+
}));
|
|
4318
|
+
}
|
|
4319
|
+
else {
|
|
4320
|
+
setValueByPath(toObject, ['candidates'], fromCandidates);
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
|
|
4324
|
+
if (fromModelVersion != null) {
|
|
4325
|
+
setValueByPath(toObject, ['modelVersion'], fromModelVersion);
|
|
4326
|
+
}
|
|
4327
|
+
const fromPromptFeedback = getValueByPath(fromObject, [
|
|
4328
|
+
'promptFeedback',
|
|
4329
|
+
]);
|
|
4330
|
+
if (fromPromptFeedback != null) {
|
|
4331
|
+
setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
|
|
4332
|
+
}
|
|
4333
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
4334
|
+
'usageMetadata',
|
|
4335
|
+
]);
|
|
4336
|
+
if (fromUsageMetadata != null) {
|
|
4337
|
+
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
4338
|
+
}
|
|
4339
|
+
return toObject;
|
|
4340
|
+
}
|
|
4341
|
+
function contentEmbeddingFromMldev(apiClient, fromObject) {
|
|
4342
|
+
const toObject = {};
|
|
4343
|
+
const fromValues = getValueByPath(fromObject, ['values']);
|
|
4344
|
+
if (fromValues != null) {
|
|
4345
|
+
setValueByPath(toObject, ['values'], fromValues);
|
|
4346
|
+
}
|
|
4347
|
+
return toObject;
|
|
4348
|
+
}
|
|
4349
|
+
function embedContentMetadataFromMldev() {
|
|
4350
|
+
const toObject = {};
|
|
4351
|
+
return toObject;
|
|
4352
|
+
}
|
|
4353
|
+
function embedContentResponseFromMldev(apiClient, fromObject) {
|
|
4354
|
+
const toObject = {};
|
|
4355
|
+
const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
|
|
4356
|
+
if (fromEmbeddings != null) {
|
|
4357
|
+
if (Array.isArray(fromEmbeddings)) {
|
|
4358
|
+
setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
|
|
4359
|
+
return contentEmbeddingFromMldev(apiClient, item);
|
|
4360
|
+
}));
|
|
4361
|
+
}
|
|
4362
|
+
else {
|
|
4363
|
+
setValueByPath(toObject, ['embeddings'], fromEmbeddings);
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
4367
|
+
if (fromMetadata != null) {
|
|
4368
|
+
setValueByPath(toObject, ['metadata'], embedContentMetadataFromMldev());
|
|
4369
|
+
}
|
|
4370
|
+
return toObject;
|
|
4371
|
+
}
|
|
4372
|
+
function imageFromMldev(apiClient, fromObject) {
|
|
4373
|
+
const toObject = {};
|
|
4374
|
+
const fromImageBytes = getValueByPath(fromObject, [
|
|
4375
|
+
'bytesBase64Encoded',
|
|
4376
|
+
]);
|
|
4377
|
+
if (fromImageBytes != null) {
|
|
4378
|
+
setValueByPath(toObject, ['imageBytes'], tBytes(apiClient, fromImageBytes));
|
|
4379
|
+
}
|
|
4380
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4381
|
+
if (fromMimeType != null) {
|
|
4382
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4383
|
+
}
|
|
4384
|
+
return toObject;
|
|
4385
|
+
}
|
|
4386
|
+
function safetyAttributesFromMldev(apiClient, fromObject) {
|
|
4387
|
+
const toObject = {};
|
|
4388
|
+
const fromCategories = getValueByPath(fromObject, [
|
|
4389
|
+
'safetyAttributes',
|
|
4390
|
+
'categories',
|
|
4391
|
+
]);
|
|
4392
|
+
if (fromCategories != null) {
|
|
4393
|
+
setValueByPath(toObject, ['categories'], fromCategories);
|
|
4394
|
+
}
|
|
4395
|
+
const fromScores = getValueByPath(fromObject, [
|
|
4396
|
+
'safetyAttributes',
|
|
4397
|
+
'scores',
|
|
4398
|
+
]);
|
|
4399
|
+
if (fromScores != null) {
|
|
4400
|
+
setValueByPath(toObject, ['scores'], fromScores);
|
|
4401
|
+
}
|
|
4402
|
+
const fromContentType = getValueByPath(fromObject, ['contentType']);
|
|
4403
|
+
if (fromContentType != null) {
|
|
4404
|
+
setValueByPath(toObject, ['contentType'], fromContentType);
|
|
4405
|
+
}
|
|
4406
|
+
return toObject;
|
|
4407
|
+
}
|
|
4408
|
+
function generatedImageFromMldev(apiClient, fromObject) {
|
|
4409
|
+
const toObject = {};
|
|
4410
|
+
const fromImage = getValueByPath(fromObject, ['_self']);
|
|
4411
|
+
if (fromImage != null) {
|
|
4412
|
+
setValueByPath(toObject, ['image'], imageFromMldev(apiClient, fromImage));
|
|
4413
|
+
}
|
|
4414
|
+
const fromRaiFilteredReason = getValueByPath(fromObject, [
|
|
4415
|
+
'raiFilteredReason',
|
|
4416
|
+
]);
|
|
4417
|
+
if (fromRaiFilteredReason != null) {
|
|
4418
|
+
setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
|
|
4419
|
+
}
|
|
4420
|
+
const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
|
|
4421
|
+
if (fromSafetyAttributes != null) {
|
|
4422
|
+
setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromMldev(apiClient, fromSafetyAttributes));
|
|
4423
|
+
}
|
|
4424
|
+
return toObject;
|
|
4425
|
+
}
|
|
4426
|
+
function generateImagesResponseFromMldev(apiClient, fromObject) {
|
|
4427
|
+
const toObject = {};
|
|
4428
|
+
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
4429
|
+
'predictions',
|
|
4430
|
+
]);
|
|
4431
|
+
if (fromGeneratedImages != null) {
|
|
4432
|
+
if (Array.isArray(fromGeneratedImages)) {
|
|
4433
|
+
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
|
|
4434
|
+
return generatedImageFromMldev(apiClient, item);
|
|
4435
|
+
}));
|
|
4436
|
+
}
|
|
4437
|
+
else {
|
|
4438
|
+
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
4439
|
+
}
|
|
4440
|
+
}
|
|
4441
|
+
const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
|
|
4442
|
+
'positivePromptSafetyAttributes',
|
|
4443
|
+
]);
|
|
4444
|
+
if (fromPositivePromptSafetyAttributes != null) {
|
|
4445
|
+
setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromMldev(apiClient, fromPositivePromptSafetyAttributes));
|
|
4446
|
+
}
|
|
4447
|
+
return toObject;
|
|
4448
|
+
}
|
|
4449
|
+
function countTokensResponseFromMldev(apiClient, fromObject) {
|
|
4450
|
+
const toObject = {};
|
|
4451
|
+
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
4452
|
+
if (fromTotalTokens != null) {
|
|
4453
|
+
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
4454
|
+
}
|
|
4455
|
+
const fromCachedContentTokenCount = getValueByPath(fromObject, [
|
|
4456
|
+
'cachedContentTokenCount',
|
|
4457
|
+
]);
|
|
4458
|
+
if (fromCachedContentTokenCount != null) {
|
|
4459
|
+
setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
|
|
4460
|
+
}
|
|
4461
|
+
return toObject;
|
|
4462
|
+
}
|
|
4463
|
+
function partFromVertex(apiClient, fromObject) {
|
|
4464
|
+
const toObject = {};
|
|
4465
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
4466
|
+
'videoMetadata',
|
|
4467
|
+
]);
|
|
4468
|
+
if (fromVideoMetadata != null) {
|
|
4469
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
4470
|
+
}
|
|
4471
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4472
|
+
if (fromThought != null) {
|
|
4473
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
4474
|
+
}
|
|
4475
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4476
|
+
'codeExecutionResult',
|
|
4477
|
+
]);
|
|
4478
|
+
if (fromCodeExecutionResult != null) {
|
|
4479
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
4480
|
+
}
|
|
4481
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
4482
|
+
'executableCode',
|
|
4483
|
+
]);
|
|
4484
|
+
if (fromExecutableCode != null) {
|
|
4485
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4486
|
+
}
|
|
4487
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4488
|
+
if (fromFileData != null) {
|
|
4489
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
4490
|
+
}
|
|
4491
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4492
|
+
if (fromFunctionCall != null) {
|
|
4493
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4494
|
+
}
|
|
4495
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4496
|
+
'functionResponse',
|
|
4497
|
+
]);
|
|
4498
|
+
if (fromFunctionResponse != null) {
|
|
4499
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4500
|
+
}
|
|
4501
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4502
|
+
if (fromInlineData != null) {
|
|
4503
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4504
|
+
}
|
|
4505
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
4506
|
+
if (fromText != null) {
|
|
4507
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
4352
4508
|
}
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4509
|
+
return toObject;
|
|
4510
|
+
}
|
|
4511
|
+
function contentFromVertex(apiClient, fromObject) {
|
|
4512
|
+
const toObject = {};
|
|
4513
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4514
|
+
if (fromParts != null) {
|
|
4515
|
+
if (Array.isArray(fromParts)) {
|
|
4516
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
4517
|
+
return partFromVertex(apiClient, item);
|
|
4518
|
+
}));
|
|
4519
|
+
}
|
|
4520
|
+
else {
|
|
4521
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
4522
|
+
}
|
|
4356
4523
|
}
|
|
4357
|
-
const
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
if (fromLogprobsResult != null) {
|
|
4361
|
-
setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
|
|
4524
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4525
|
+
if (fromRole != null) {
|
|
4526
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
4362
4527
|
}
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4528
|
+
return toObject;
|
|
4529
|
+
}
|
|
4530
|
+
function citationMetadataFromVertex(apiClient, fromObject) {
|
|
4531
|
+
const toObject = {};
|
|
4532
|
+
const fromCitations = getValueByPath(fromObject, ['citations']);
|
|
4533
|
+
if (fromCitations != null) {
|
|
4534
|
+
setValueByPath(toObject, ['citations'], fromCitations);
|
|
4368
4535
|
}
|
|
4369
4536
|
return toObject;
|
|
4370
4537
|
}
|
|
@@ -4418,37 +4585,6 @@ function candidateFromVertex(apiClient, fromObject) {
|
|
|
4418
4585
|
}
|
|
4419
4586
|
return toObject;
|
|
4420
4587
|
}
|
|
4421
|
-
function generateContentResponseFromMldev(apiClient, fromObject) {
|
|
4422
|
-
const toObject = {};
|
|
4423
|
-
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
4424
|
-
if (fromCandidates != null) {
|
|
4425
|
-
if (Array.isArray(fromCandidates)) {
|
|
4426
|
-
setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
|
|
4427
|
-
return candidateFromMldev(apiClient, item);
|
|
4428
|
-
}));
|
|
4429
|
-
}
|
|
4430
|
-
else {
|
|
4431
|
-
setValueByPath(toObject, ['candidates'], fromCandidates);
|
|
4432
|
-
}
|
|
4433
|
-
}
|
|
4434
|
-
const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
|
|
4435
|
-
if (fromModelVersion != null) {
|
|
4436
|
-
setValueByPath(toObject, ['modelVersion'], fromModelVersion);
|
|
4437
|
-
}
|
|
4438
|
-
const fromPromptFeedback = getValueByPath(fromObject, [
|
|
4439
|
-
'promptFeedback',
|
|
4440
|
-
]);
|
|
4441
|
-
if (fromPromptFeedback != null) {
|
|
4442
|
-
setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
|
|
4443
|
-
}
|
|
4444
|
-
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
4445
|
-
'usageMetadata',
|
|
4446
|
-
]);
|
|
4447
|
-
if (fromUsageMetadata != null) {
|
|
4448
|
-
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
4449
|
-
}
|
|
4450
|
-
return toObject;
|
|
4451
|
-
}
|
|
4452
4588
|
function generateContentResponseFromVertex(apiClient, fromObject) {
|
|
4453
4589
|
const toObject = {};
|
|
4454
4590
|
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
@@ -4500,14 +4636,6 @@ function contentEmbeddingStatisticsFromVertex(apiClient, fromObject) {
|
|
|
4500
4636
|
}
|
|
4501
4637
|
return toObject;
|
|
4502
4638
|
}
|
|
4503
|
-
function contentEmbeddingFromMldev(apiClient, fromObject) {
|
|
4504
|
-
const toObject = {};
|
|
4505
|
-
const fromValues = getValueByPath(fromObject, ['values']);
|
|
4506
|
-
if (fromValues != null) {
|
|
4507
|
-
setValueByPath(toObject, ['values'], fromValues);
|
|
4508
|
-
}
|
|
4509
|
-
return toObject;
|
|
4510
|
-
}
|
|
4511
4639
|
function contentEmbeddingFromVertex(apiClient, fromObject) {
|
|
4512
4640
|
const toObject = {};
|
|
4513
4641
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -4520,10 +4648,6 @@ function contentEmbeddingFromVertex(apiClient, fromObject) {
|
|
|
4520
4648
|
}
|
|
4521
4649
|
return toObject;
|
|
4522
4650
|
}
|
|
4523
|
-
function embedContentMetadataFromMldev() {
|
|
4524
|
-
const toObject = {};
|
|
4525
|
-
return toObject;
|
|
4526
|
-
}
|
|
4527
4651
|
function embedContentMetadataFromVertex(apiClient, fromObject) {
|
|
4528
4652
|
const toObject = {};
|
|
4529
4653
|
const fromBillableCharacterCount = getValueByPath(fromObject, [
|
|
@@ -4534,25 +4658,6 @@ function embedContentMetadataFromVertex(apiClient, fromObject) {
|
|
|
4534
4658
|
}
|
|
4535
4659
|
return toObject;
|
|
4536
4660
|
}
|
|
4537
|
-
function embedContentResponseFromMldev(apiClient, fromObject) {
|
|
4538
|
-
const toObject = {};
|
|
4539
|
-
const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
|
|
4540
|
-
if (fromEmbeddings != null) {
|
|
4541
|
-
if (Array.isArray(fromEmbeddings)) {
|
|
4542
|
-
setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
|
|
4543
|
-
return contentEmbeddingFromMldev(apiClient, item);
|
|
4544
|
-
}));
|
|
4545
|
-
}
|
|
4546
|
-
else {
|
|
4547
|
-
setValueByPath(toObject, ['embeddings'], fromEmbeddings);
|
|
4548
|
-
}
|
|
4549
|
-
}
|
|
4550
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
4551
|
-
if (fromMetadata != null) {
|
|
4552
|
-
setValueByPath(toObject, ['metadata'], embedContentMetadataFromMldev());
|
|
4553
|
-
}
|
|
4554
|
-
return toObject;
|
|
4555
|
-
}
|
|
4556
4661
|
function embedContentResponseFromVertex(apiClient, fromObject) {
|
|
4557
4662
|
const toObject = {};
|
|
4558
4663
|
const fromEmbeddings = getValueByPath(fromObject, [
|
|
@@ -4575,20 +4680,6 @@ function embedContentResponseFromVertex(apiClient, fromObject) {
|
|
|
4575
4680
|
}
|
|
4576
4681
|
return toObject;
|
|
4577
4682
|
}
|
|
4578
|
-
function imageFromMldev(apiClient, fromObject) {
|
|
4579
|
-
const toObject = {};
|
|
4580
|
-
const fromImageBytes = getValueByPath(fromObject, [
|
|
4581
|
-
'bytesBase64Encoded',
|
|
4582
|
-
]);
|
|
4583
|
-
if (fromImageBytes != null) {
|
|
4584
|
-
setValueByPath(toObject, ['imageBytes'], tBytes(apiClient, fromImageBytes));
|
|
4585
|
-
}
|
|
4586
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4587
|
-
if (fromMimeType != null) {
|
|
4588
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4589
|
-
}
|
|
4590
|
-
return toObject;
|
|
4591
|
-
}
|
|
4592
4683
|
function imageFromVertex(apiClient, fromObject) {
|
|
4593
4684
|
const toObject = {};
|
|
4594
4685
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
@@ -4607,24 +4698,6 @@ function imageFromVertex(apiClient, fromObject) {
|
|
|
4607
4698
|
}
|
|
4608
4699
|
return toObject;
|
|
4609
4700
|
}
|
|
4610
|
-
function safetyAttributesFromMldev(apiClient, fromObject) {
|
|
4611
|
-
const toObject = {};
|
|
4612
|
-
const fromCategories = getValueByPath(fromObject, [
|
|
4613
|
-
'safetyAttributes',
|
|
4614
|
-
'categories',
|
|
4615
|
-
]);
|
|
4616
|
-
if (fromCategories != null) {
|
|
4617
|
-
setValueByPath(toObject, ['categories'], fromCategories);
|
|
4618
|
-
}
|
|
4619
|
-
const fromScores = getValueByPath(fromObject, [
|
|
4620
|
-
'safetyAttributes',
|
|
4621
|
-
'scores',
|
|
4622
|
-
]);
|
|
4623
|
-
if (fromScores != null) {
|
|
4624
|
-
setValueByPath(toObject, ['scores'], fromScores);
|
|
4625
|
-
}
|
|
4626
|
-
return toObject;
|
|
4627
|
-
}
|
|
4628
4701
|
function safetyAttributesFromVertex(apiClient, fromObject) {
|
|
4629
4702
|
const toObject = {};
|
|
4630
4703
|
const fromCategories = getValueByPath(fromObject, [
|
|
@@ -4641,23 +4714,9 @@ function safetyAttributesFromVertex(apiClient, fromObject) {
|
|
|
4641
4714
|
if (fromScores != null) {
|
|
4642
4715
|
setValueByPath(toObject, ['scores'], fromScores);
|
|
4643
4716
|
}
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
const toObject = {};
|
|
4648
|
-
const fromImage = getValueByPath(fromObject, ['_self']);
|
|
4649
|
-
if (fromImage != null) {
|
|
4650
|
-
setValueByPath(toObject, ['image'], imageFromMldev(apiClient, fromImage));
|
|
4651
|
-
}
|
|
4652
|
-
const fromRaiFilteredReason = getValueByPath(fromObject, [
|
|
4653
|
-
'raiFilteredReason',
|
|
4654
|
-
]);
|
|
4655
|
-
if (fromRaiFilteredReason != null) {
|
|
4656
|
-
setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
|
|
4657
|
-
}
|
|
4658
|
-
const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
|
|
4659
|
-
if (fromSafetyAttributes != null) {
|
|
4660
|
-
setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromMldev(apiClient, fromSafetyAttributes));
|
|
4717
|
+
const fromContentType = getValueByPath(fromObject, ['contentType']);
|
|
4718
|
+
if (fromContentType != null) {
|
|
4719
|
+
setValueByPath(toObject, ['contentType'], fromContentType);
|
|
4661
4720
|
}
|
|
4662
4721
|
return toObject;
|
|
4663
4722
|
}
|
|
@@ -4683,23 +4742,6 @@ function generatedImageFromVertex(apiClient, fromObject) {
|
|
|
4683
4742
|
}
|
|
4684
4743
|
return toObject;
|
|
4685
4744
|
}
|
|
4686
|
-
function generateImagesResponseFromMldev(apiClient, fromObject) {
|
|
4687
|
-
const toObject = {};
|
|
4688
|
-
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
4689
|
-
'predictions',
|
|
4690
|
-
]);
|
|
4691
|
-
if (fromGeneratedImages != null) {
|
|
4692
|
-
if (Array.isArray(fromGeneratedImages)) {
|
|
4693
|
-
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
|
|
4694
|
-
return generatedImageFromMldev(apiClient, item);
|
|
4695
|
-
}));
|
|
4696
|
-
}
|
|
4697
|
-
else {
|
|
4698
|
-
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
4699
|
-
}
|
|
4700
|
-
}
|
|
4701
|
-
return toObject;
|
|
4702
|
-
}
|
|
4703
4745
|
function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
4704
4746
|
const toObject = {};
|
|
4705
4747
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
@@ -4715,19 +4757,11 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
4715
4757
|
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
4716
4758
|
}
|
|
4717
4759
|
}
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
function countTokensResponseFromMldev(apiClient, fromObject) {
|
|
4721
|
-
const toObject = {};
|
|
4722
|
-
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
4723
|
-
if (fromTotalTokens != null) {
|
|
4724
|
-
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
4725
|
-
}
|
|
4726
|
-
const fromCachedContentTokenCount = getValueByPath(fromObject, [
|
|
4727
|
-
'cachedContentTokenCount',
|
|
4760
|
+
const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
|
|
4761
|
+
'positivePromptSafetyAttributes',
|
|
4728
4762
|
]);
|
|
4729
|
-
if (
|
|
4730
|
-
setValueByPath(toObject, ['
|
|
4763
|
+
if (fromPositivePromptSafetyAttributes != null) {
|
|
4764
|
+
setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromVertex(apiClient, fromPositivePromptSafetyAttributes));
|
|
4731
4765
|
}
|
|
4732
4766
|
return toObject;
|
|
4733
4767
|
}
|
|
@@ -5472,6 +5506,59 @@ class Models extends BaseModule {
|
|
|
5472
5506
|
this.generateContentStream = async (params) => {
|
|
5473
5507
|
return await this.generateContentStreamInternal(params);
|
|
5474
5508
|
};
|
|
5509
|
+
/**
|
|
5510
|
+
* Generates an image based on a text description and configuration.
|
|
5511
|
+
*
|
|
5512
|
+
* @param model - The model to use.
|
|
5513
|
+
* @param prompt - A text description of the image to generate.
|
|
5514
|
+
* @param [config] - The config for image generation.
|
|
5515
|
+
* @return The response from the API.
|
|
5516
|
+
*
|
|
5517
|
+
* @example
|
|
5518
|
+
* ```ts
|
|
5519
|
+
* const response = await client.models.generateImages({
|
|
5520
|
+
* model: 'imagen-3.0-generate-002',
|
|
5521
|
+
* prompt: 'Robot holding a red skateboard',
|
|
5522
|
+
* config: {
|
|
5523
|
+
* numberOfImages: 1,
|
|
5524
|
+
* includeRaiReason: true,
|
|
5525
|
+
* },
|
|
5526
|
+
* });
|
|
5527
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
5528
|
+
* ```
|
|
5529
|
+
*/
|
|
5530
|
+
this.generateImages = async (params) => {
|
|
5531
|
+
return await this.generateImagesInternal(params).then((apiResponse) => {
|
|
5532
|
+
var _a;
|
|
5533
|
+
let positivePromptSafetyAttributes;
|
|
5534
|
+
const generatedImages = [];
|
|
5535
|
+
if (apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.generatedImages) {
|
|
5536
|
+
for (const generatedImage of apiResponse.generatedImages) {
|
|
5537
|
+
if (generatedImage &&
|
|
5538
|
+
(generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes) &&
|
|
5539
|
+
((_a = generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes) === null || _a === void 0 ? void 0 : _a.contentType) === 'Positive Prompt') {
|
|
5540
|
+
positivePromptSafetyAttributes = generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes;
|
|
5541
|
+
}
|
|
5542
|
+
else {
|
|
5543
|
+
generatedImages.push(generatedImage);
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5546
|
+
}
|
|
5547
|
+
let response;
|
|
5548
|
+
if (positivePromptSafetyAttributes) {
|
|
5549
|
+
response = {
|
|
5550
|
+
generatedImages: generatedImages,
|
|
5551
|
+
positivePromptSafetyAttributes: positivePromptSafetyAttributes,
|
|
5552
|
+
};
|
|
5553
|
+
}
|
|
5554
|
+
else {
|
|
5555
|
+
response = {
|
|
5556
|
+
generatedImages: generatedImages,
|
|
5557
|
+
};
|
|
5558
|
+
}
|
|
5559
|
+
return response;
|
|
5560
|
+
});
|
|
5561
|
+
};
|
|
5475
5562
|
}
|
|
5476
5563
|
async generateContentInternal(params) {
|
|
5477
5564
|
var _a, _b;
|
|
@@ -5709,7 +5796,7 @@ class Models extends BaseModule {
|
|
|
5709
5796
|
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
5710
5797
|
* ```
|
|
5711
5798
|
*/
|
|
5712
|
-
async
|
|
5799
|
+
async generateImagesInternal(params) {
|
|
5713
5800
|
var _a, _b;
|
|
5714
5801
|
let response;
|
|
5715
5802
|
let path = '';
|
|
@@ -5899,7 +5986,7 @@ class Models extends BaseModule {
|
|
|
5899
5986
|
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
5900
5987
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
5901
5988
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
5902
|
-
const SDK_VERSION = '0.6.
|
|
5989
|
+
const SDK_VERSION = '0.6.1'; // x-release-please-version
|
|
5903
5990
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
5904
5991
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
5905
5992
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6444,6 +6531,18 @@ function getFileParametersToMldev(apiClient, fromObject) {
|
|
|
6444
6531
|
}
|
|
6445
6532
|
return toObject;
|
|
6446
6533
|
}
|
|
6534
|
+
function deleteFileParametersToMldev(apiClient, fromObject) {
|
|
6535
|
+
const toObject = {};
|
|
6536
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
6537
|
+
if (fromName != null) {
|
|
6538
|
+
setValueByPath(toObject, ['_url', 'file'], tFileName(apiClient, fromName));
|
|
6539
|
+
}
|
|
6540
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6541
|
+
if (fromConfig != null) {
|
|
6542
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
6543
|
+
}
|
|
6544
|
+
return toObject;
|
|
6545
|
+
}
|
|
6447
6546
|
function fileStatusFromMldev(apiClient, fromObject) {
|
|
6448
6547
|
const toObject = {};
|
|
6449
6548
|
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
@@ -6553,6 +6652,10 @@ function createFileResponseFromMldev(apiClient, fromObject) {
|
|
|
6553
6652
|
}
|
|
6554
6653
|
return toObject;
|
|
6555
6654
|
}
|
|
6655
|
+
function deleteFileResponseFromMldev() {
|
|
6656
|
+
const toObject = {};
|
|
6657
|
+
return toObject;
|
|
6658
|
+
}
|
|
6556
6659
|
|
|
6557
6660
|
/**
|
|
6558
6661
|
* @license
|
|
@@ -6752,6 +6855,53 @@ class Files extends BaseModule {
|
|
|
6752
6855
|
});
|
|
6753
6856
|
}
|
|
6754
6857
|
}
|
|
6858
|
+
/**
|
|
6859
|
+
* Deletes a remotely stored file.
|
|
6860
|
+
*
|
|
6861
|
+
* @param params - The parameters for the delete request.
|
|
6862
|
+
* @return The DeleteFileResponse, the response for the delete method.
|
|
6863
|
+
*
|
|
6864
|
+
* @example
|
|
6865
|
+
* The following code deletes an example file named "files/mehozpxf877d".
|
|
6866
|
+
*
|
|
6867
|
+
* ```ts
|
|
6868
|
+
* await ai.files.delete({name: file.name});
|
|
6869
|
+
* ```
|
|
6870
|
+
*/
|
|
6871
|
+
async delete(params) {
|
|
6872
|
+
var _a;
|
|
6873
|
+
let response;
|
|
6874
|
+
let path = '';
|
|
6875
|
+
let queryParams = {};
|
|
6876
|
+
if (this.apiClient.isVertexAI()) {
|
|
6877
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
6878
|
+
}
|
|
6879
|
+
else {
|
|
6880
|
+
const body = deleteFileParametersToMldev(this.apiClient, params);
|
|
6881
|
+
path = formatMap('files/{file}', body['_url']);
|
|
6882
|
+
queryParams = body['_query'];
|
|
6883
|
+
delete body['config'];
|
|
6884
|
+
delete body['_url'];
|
|
6885
|
+
delete body['_query'];
|
|
6886
|
+
response = this.apiClient
|
|
6887
|
+
.request({
|
|
6888
|
+
path: path,
|
|
6889
|
+
queryParams: queryParams,
|
|
6890
|
+
body: JSON.stringify(body),
|
|
6891
|
+
httpMethod: 'DELETE',
|
|
6892
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
6893
|
+
})
|
|
6894
|
+
.then((httpResponse) => {
|
|
6895
|
+
return httpResponse.json();
|
|
6896
|
+
});
|
|
6897
|
+
return response.then(() => {
|
|
6898
|
+
const resp = deleteFileResponseFromMldev();
|
|
6899
|
+
const typedResp = new DeleteFileResponse();
|
|
6900
|
+
Object.assign(typedResp, resp);
|
|
6901
|
+
return typedResp;
|
|
6902
|
+
});
|
|
6903
|
+
}
|
|
6904
|
+
}
|
|
6755
6905
|
}
|
|
6756
6906
|
|
|
6757
6907
|
/**
|
|
@@ -7222,6 +7372,7 @@ exports.ComputeTokensResponse = ComputeTokensResponse;
|
|
|
7222
7372
|
exports.CountTokensResponse = CountTokensResponse;
|
|
7223
7373
|
exports.CreateFileResponse = CreateFileResponse;
|
|
7224
7374
|
exports.DeleteCachedContentResponse = DeleteCachedContentResponse;
|
|
7375
|
+
exports.DeleteFileResponse = DeleteFileResponse;
|
|
7225
7376
|
exports.EmbedContentResponse = EmbedContentResponse;
|
|
7226
7377
|
exports.FunctionResponse = FunctionResponse;
|
|
7227
7378
|
exports.GenerateContentResponse = GenerateContentResponse;
|