@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/web/index.mjs
CHANGED
|
@@ -231,7 +231,8 @@ function tContent(apiClient, origin) {
|
|
|
231
231
|
throw new Error('ContentUnion is required');
|
|
232
232
|
}
|
|
233
233
|
if (_isContent(origin)) {
|
|
234
|
-
// @ts-expect-error: _isContent is a utility function that checks if the
|
|
234
|
+
// @ts-expect-error: _isContent is a utility function that checks if the
|
|
235
|
+
// origin is a Content.
|
|
235
236
|
return origin;
|
|
236
237
|
}
|
|
237
238
|
if (_isUserPart(origin)) {
|
|
@@ -344,9 +345,6 @@ function tContents(apiClient, origin) {
|
|
|
344
345
|
}
|
|
345
346
|
function processSchema(apiClient, schema) {
|
|
346
347
|
if (!apiClient.isVertexAI()) {
|
|
347
|
-
if ('title' in schema) {
|
|
348
|
-
delete schema['title'];
|
|
349
|
-
}
|
|
350
348
|
if ('default' in schema) {
|
|
351
349
|
throw new Error('Default value is not supported in the response schema for the Gemini API.');
|
|
352
350
|
}
|
|
@@ -358,6 +356,18 @@ function processSchema(apiClient, schema) {
|
|
|
358
356
|
}
|
|
359
357
|
}
|
|
360
358
|
}
|
|
359
|
+
if ('items' in schema) {
|
|
360
|
+
if (schema['items'] !== undefined) {
|
|
361
|
+
processSchema(apiClient, schema['items']);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if ('properties' in schema) {
|
|
365
|
+
if (schema['properties'] !== undefined) {
|
|
366
|
+
for (const subSchema of Object.values(schema['properties'])) {
|
|
367
|
+
processSchema(apiClient, subSchema);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
361
371
|
}
|
|
362
372
|
function tSchema(apiClient, schema) {
|
|
363
373
|
processSchema(apiClient, schema);
|
|
@@ -540,54 +550,6 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
540
550
|
}
|
|
541
551
|
return toObject;
|
|
542
552
|
}
|
|
543
|
-
function partToVertex$1(apiClient, fromObject) {
|
|
544
|
-
const toObject = {};
|
|
545
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
546
|
-
'videoMetadata',
|
|
547
|
-
]);
|
|
548
|
-
if (fromVideoMetadata != null) {
|
|
549
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
550
|
-
}
|
|
551
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
552
|
-
if (fromThought != null) {
|
|
553
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
554
|
-
}
|
|
555
|
-
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
556
|
-
'codeExecutionResult',
|
|
557
|
-
]);
|
|
558
|
-
if (fromCodeExecutionResult != null) {
|
|
559
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
560
|
-
}
|
|
561
|
-
const fromExecutableCode = getValueByPath(fromObject, [
|
|
562
|
-
'executableCode',
|
|
563
|
-
]);
|
|
564
|
-
if (fromExecutableCode != null) {
|
|
565
|
-
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
566
|
-
}
|
|
567
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
568
|
-
if (fromFileData != null) {
|
|
569
|
-
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
570
|
-
}
|
|
571
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
572
|
-
if (fromFunctionCall != null) {
|
|
573
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
574
|
-
}
|
|
575
|
-
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
576
|
-
'functionResponse',
|
|
577
|
-
]);
|
|
578
|
-
if (fromFunctionResponse != null) {
|
|
579
|
-
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
580
|
-
}
|
|
581
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
582
|
-
if (fromInlineData != null) {
|
|
583
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
584
|
-
}
|
|
585
|
-
const fromText = getValueByPath(fromObject, ['text']);
|
|
586
|
-
if (fromText != null) {
|
|
587
|
-
setValueByPath(toObject, ['text'], fromText);
|
|
588
|
-
}
|
|
589
|
-
return toObject;
|
|
590
|
-
}
|
|
591
553
|
function contentToMldev$1(apiClient, fromObject) {
|
|
592
554
|
const toObject = {};
|
|
593
555
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -607,123 +569,6 @@ function contentToMldev$1(apiClient, fromObject) {
|
|
|
607
569
|
}
|
|
608
570
|
return toObject;
|
|
609
571
|
}
|
|
610
|
-
function contentToVertex$1(apiClient, fromObject) {
|
|
611
|
-
const toObject = {};
|
|
612
|
-
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
613
|
-
if (fromParts != null) {
|
|
614
|
-
if (Array.isArray(fromParts)) {
|
|
615
|
-
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
616
|
-
return partToVertex$1(apiClient, item);
|
|
617
|
-
}));
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
const fromRole = getValueByPath(fromObject, ['role']);
|
|
624
|
-
if (fromRole != null) {
|
|
625
|
-
setValueByPath(toObject, ['role'], fromRole);
|
|
626
|
-
}
|
|
627
|
-
return toObject;
|
|
628
|
-
}
|
|
629
|
-
function schemaToVertex$1(apiClient, fromObject) {
|
|
630
|
-
const toObject = {};
|
|
631
|
-
const fromExample = getValueByPath(fromObject, ['example']);
|
|
632
|
-
if (fromExample != null) {
|
|
633
|
-
setValueByPath(toObject, ['example'], fromExample);
|
|
634
|
-
}
|
|
635
|
-
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
636
|
-
if (fromPattern != null) {
|
|
637
|
-
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
638
|
-
}
|
|
639
|
-
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
640
|
-
if (fromDefault != null) {
|
|
641
|
-
setValueByPath(toObject, ['default'], fromDefault);
|
|
642
|
-
}
|
|
643
|
-
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
644
|
-
if (fromMaxLength != null) {
|
|
645
|
-
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
646
|
-
}
|
|
647
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
648
|
-
if (fromTitle != null) {
|
|
649
|
-
setValueByPath(toObject, ['title'], fromTitle);
|
|
650
|
-
}
|
|
651
|
-
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
652
|
-
if (fromMinLength != null) {
|
|
653
|
-
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
654
|
-
}
|
|
655
|
-
const fromMinProperties = getValueByPath(fromObject, [
|
|
656
|
-
'minProperties',
|
|
657
|
-
]);
|
|
658
|
-
if (fromMinProperties != null) {
|
|
659
|
-
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
660
|
-
}
|
|
661
|
-
const fromMaxProperties = getValueByPath(fromObject, [
|
|
662
|
-
'maxProperties',
|
|
663
|
-
]);
|
|
664
|
-
if (fromMaxProperties != null) {
|
|
665
|
-
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
666
|
-
}
|
|
667
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
668
|
-
if (fromAnyOf != null) {
|
|
669
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
670
|
-
}
|
|
671
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
672
|
-
if (fromDescription != null) {
|
|
673
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
674
|
-
}
|
|
675
|
-
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
676
|
-
if (fromEnum != null) {
|
|
677
|
-
setValueByPath(toObject, ['enum'], fromEnum);
|
|
678
|
-
}
|
|
679
|
-
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
680
|
-
if (fromFormat != null) {
|
|
681
|
-
setValueByPath(toObject, ['format'], fromFormat);
|
|
682
|
-
}
|
|
683
|
-
const fromItems = getValueByPath(fromObject, ['items']);
|
|
684
|
-
if (fromItems != null) {
|
|
685
|
-
setValueByPath(toObject, ['items'], fromItems);
|
|
686
|
-
}
|
|
687
|
-
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
688
|
-
if (fromMaxItems != null) {
|
|
689
|
-
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
690
|
-
}
|
|
691
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
692
|
-
if (fromMaximum != null) {
|
|
693
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
694
|
-
}
|
|
695
|
-
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
696
|
-
if (fromMinItems != null) {
|
|
697
|
-
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
698
|
-
}
|
|
699
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
700
|
-
if (fromMinimum != null) {
|
|
701
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
702
|
-
}
|
|
703
|
-
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
704
|
-
if (fromNullable != null) {
|
|
705
|
-
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
706
|
-
}
|
|
707
|
-
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
708
|
-
if (fromProperties != null) {
|
|
709
|
-
setValueByPath(toObject, ['properties'], fromProperties);
|
|
710
|
-
}
|
|
711
|
-
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
712
|
-
'propertyOrdering',
|
|
713
|
-
]);
|
|
714
|
-
if (fromPropertyOrdering != null) {
|
|
715
|
-
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
716
|
-
}
|
|
717
|
-
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
718
|
-
if (fromRequired != null) {
|
|
719
|
-
setValueByPath(toObject, ['required'], fromRequired);
|
|
720
|
-
}
|
|
721
|
-
const fromType = getValueByPath(fromObject, ['type']);
|
|
722
|
-
if (fromType != null) {
|
|
723
|
-
setValueByPath(toObject, ['type'], fromType);
|
|
724
|
-
}
|
|
725
|
-
return toObject;
|
|
726
|
-
}
|
|
727
572
|
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
728
573
|
const toObject = {};
|
|
729
574
|
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
@@ -743,34 +588,10 @@ function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
|
743
588
|
}
|
|
744
589
|
return toObject;
|
|
745
590
|
}
|
|
746
|
-
function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
747
|
-
const toObject = {};
|
|
748
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
749
|
-
if (fromResponse != null) {
|
|
750
|
-
setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
|
|
751
|
-
}
|
|
752
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
753
|
-
if (fromDescription != null) {
|
|
754
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
755
|
-
}
|
|
756
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
757
|
-
if (fromName != null) {
|
|
758
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
759
|
-
}
|
|
760
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
761
|
-
if (fromParameters != null) {
|
|
762
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
763
|
-
}
|
|
764
|
-
return toObject;
|
|
765
|
-
}
|
|
766
591
|
function googleSearchToMldev$1() {
|
|
767
592
|
const toObject = {};
|
|
768
593
|
return toObject;
|
|
769
594
|
}
|
|
770
|
-
function googleSearchToVertex$1() {
|
|
771
|
-
const toObject = {};
|
|
772
|
-
return toObject;
|
|
773
|
-
}
|
|
774
595
|
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
775
596
|
const toObject = {};
|
|
776
597
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
@@ -785,20 +606,6 @@ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
|
785
606
|
}
|
|
786
607
|
return toObject;
|
|
787
608
|
}
|
|
788
|
-
function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
789
|
-
const toObject = {};
|
|
790
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
791
|
-
if (fromMode != null) {
|
|
792
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
793
|
-
}
|
|
794
|
-
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
795
|
-
'dynamicThreshold',
|
|
796
|
-
]);
|
|
797
|
-
if (fromDynamicThreshold != null) {
|
|
798
|
-
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
799
|
-
}
|
|
800
|
-
return toObject;
|
|
801
|
-
}
|
|
802
609
|
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
803
610
|
const toObject = {};
|
|
804
611
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
@@ -809,16 +616,6 @@ function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
|
809
616
|
}
|
|
810
617
|
return toObject;
|
|
811
618
|
}
|
|
812
|
-
function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
|
|
813
|
-
const toObject = {};
|
|
814
|
-
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
815
|
-
'dynamicRetrievalConfig',
|
|
816
|
-
]);
|
|
817
|
-
if (fromDynamicRetrievalConfig != null) {
|
|
818
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
|
|
819
|
-
}
|
|
820
|
-
return toObject;
|
|
821
|
-
}
|
|
822
619
|
function toolToMldev$1(apiClient, fromObject) {
|
|
823
620
|
const toObject = {};
|
|
824
621
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -855,68 +652,17 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
855
652
|
}
|
|
856
653
|
return toObject;
|
|
857
654
|
}
|
|
858
|
-
function
|
|
655
|
+
function functionCallingConfigToMldev$1(apiClient, fromObject) {
|
|
859
656
|
const toObject = {};
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
if (fromFunctionDeclarations != null) {
|
|
864
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
865
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
866
|
-
return functionDeclarationToVertex$1(apiClient, item);
|
|
867
|
-
}));
|
|
868
|
-
}
|
|
869
|
-
else {
|
|
870
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
874
|
-
if (fromRetrieval != null) {
|
|
875
|
-
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
876
|
-
}
|
|
877
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
878
|
-
if (fromGoogleSearch != null) {
|
|
879
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
|
|
657
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
658
|
+
if (fromMode != null) {
|
|
659
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
880
660
|
}
|
|
881
|
-
const
|
|
882
|
-
'
|
|
661
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
662
|
+
'allowedFunctionNames',
|
|
883
663
|
]);
|
|
884
|
-
if (
|
|
885
|
-
setValueByPath(toObject, ['
|
|
886
|
-
}
|
|
887
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
888
|
-
'codeExecution',
|
|
889
|
-
]);
|
|
890
|
-
if (fromCodeExecution != null) {
|
|
891
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
892
|
-
}
|
|
893
|
-
return toObject;
|
|
894
|
-
}
|
|
895
|
-
function functionCallingConfigToMldev$1(apiClient, fromObject) {
|
|
896
|
-
const toObject = {};
|
|
897
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
898
|
-
if (fromMode != null) {
|
|
899
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
900
|
-
}
|
|
901
|
-
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
902
|
-
'allowedFunctionNames',
|
|
903
|
-
]);
|
|
904
|
-
if (fromAllowedFunctionNames != null) {
|
|
905
|
-
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
906
|
-
}
|
|
907
|
-
return toObject;
|
|
908
|
-
}
|
|
909
|
-
function functionCallingConfigToVertex$1(apiClient, fromObject) {
|
|
910
|
-
const toObject = {};
|
|
911
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
912
|
-
if (fromMode != null) {
|
|
913
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
914
|
-
}
|
|
915
|
-
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
916
|
-
'allowedFunctionNames',
|
|
917
|
-
]);
|
|
918
|
-
if (fromAllowedFunctionNames != null) {
|
|
919
|
-
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
664
|
+
if (fromAllowedFunctionNames != null) {
|
|
665
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
920
666
|
}
|
|
921
667
|
return toObject;
|
|
922
668
|
}
|
|
@@ -930,16 +676,6 @@ function toolConfigToMldev$1(apiClient, fromObject) {
|
|
|
930
676
|
}
|
|
931
677
|
return toObject;
|
|
932
678
|
}
|
|
933
|
-
function toolConfigToVertex$1(apiClient, fromObject) {
|
|
934
|
-
const toObject = {};
|
|
935
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
936
|
-
'functionCallingConfig',
|
|
937
|
-
]);
|
|
938
|
-
if (fromFunctionCallingConfig != null) {
|
|
939
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex$1(apiClient, fromFunctionCallingConfig));
|
|
940
|
-
}
|
|
941
|
-
return toObject;
|
|
942
|
-
}
|
|
943
679
|
function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
944
680
|
const toObject = {};
|
|
945
681
|
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
@@ -988,54 +724,6 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
988
724
|
}
|
|
989
725
|
return toObject;
|
|
990
726
|
}
|
|
991
|
-
function createCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
992
|
-
const toObject = {};
|
|
993
|
-
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
994
|
-
if (parentObject !== undefined && fromTtl != null) {
|
|
995
|
-
setValueByPath(parentObject, ['ttl'], fromTtl);
|
|
996
|
-
}
|
|
997
|
-
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
998
|
-
if (parentObject !== undefined && fromExpireTime != null) {
|
|
999
|
-
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
1000
|
-
}
|
|
1001
|
-
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
1002
|
-
if (parentObject !== undefined && fromDisplayName != null) {
|
|
1003
|
-
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
1004
|
-
}
|
|
1005
|
-
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
1006
|
-
if (parentObject !== undefined && fromContents != null) {
|
|
1007
|
-
if (Array.isArray(fromContents)) {
|
|
1008
|
-
setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
1009
|
-
return contentToVertex$1(apiClient, item);
|
|
1010
|
-
})));
|
|
1011
|
-
}
|
|
1012
|
-
else {
|
|
1013
|
-
setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
1017
|
-
'systemInstruction',
|
|
1018
|
-
]);
|
|
1019
|
-
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
1020
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
1021
|
-
}
|
|
1022
|
-
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
1023
|
-
if (parentObject !== undefined && fromTools != null) {
|
|
1024
|
-
if (Array.isArray(fromTools)) {
|
|
1025
|
-
setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
|
|
1026
|
-
return toolToVertex$1(apiClient, item);
|
|
1027
|
-
}));
|
|
1028
|
-
}
|
|
1029
|
-
else {
|
|
1030
|
-
setValueByPath(parentObject, ['tools'], fromTools);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
1034
|
-
if (parentObject !== undefined && fromToolConfig != null) {
|
|
1035
|
-
setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex$1(apiClient, fromToolConfig));
|
|
1036
|
-
}
|
|
1037
|
-
return toObject;
|
|
1038
|
-
}
|
|
1039
727
|
function createCachedContentParametersToMldev(apiClient, fromObject) {
|
|
1040
728
|
const toObject = {};
|
|
1041
729
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -1048,18 +736,6 @@ function createCachedContentParametersToMldev(apiClient, fromObject) {
|
|
|
1048
736
|
}
|
|
1049
737
|
return toObject;
|
|
1050
738
|
}
|
|
1051
|
-
function createCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1052
|
-
const toObject = {};
|
|
1053
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
1054
|
-
if (fromModel != null) {
|
|
1055
|
-
setValueByPath(toObject, ['model'], tCachesModel(apiClient, fromModel));
|
|
1056
|
-
}
|
|
1057
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1058
|
-
if (fromConfig != null) {
|
|
1059
|
-
setValueByPath(toObject, ['config'], createCachedContentConfigToVertex(apiClient, fromConfig, toObject));
|
|
1060
|
-
}
|
|
1061
|
-
return toObject;
|
|
1062
|
-
}
|
|
1063
739
|
function getCachedContentParametersToMldev(apiClient, fromObject) {
|
|
1064
740
|
const toObject = {};
|
|
1065
741
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -1072,18 +748,6 @@ function getCachedContentParametersToMldev(apiClient, fromObject) {
|
|
|
1072
748
|
}
|
|
1073
749
|
return toObject;
|
|
1074
750
|
}
|
|
1075
|
-
function getCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1076
|
-
const toObject = {};
|
|
1077
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
1078
|
-
if (fromName != null) {
|
|
1079
|
-
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1080
|
-
}
|
|
1081
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1082
|
-
if (fromConfig != null) {
|
|
1083
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
1084
|
-
}
|
|
1085
|
-
return toObject;
|
|
1086
|
-
}
|
|
1087
751
|
function deleteCachedContentParametersToMldev(apiClient, fromObject) {
|
|
1088
752
|
const toObject = {};
|
|
1089
753
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -1096,18 +760,6 @@ function deleteCachedContentParametersToMldev(apiClient, fromObject) {
|
|
|
1096
760
|
}
|
|
1097
761
|
return toObject;
|
|
1098
762
|
}
|
|
1099
|
-
function deleteCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1100
|
-
const toObject = {};
|
|
1101
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
1102
|
-
if (fromName != null) {
|
|
1103
|
-
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1104
|
-
}
|
|
1105
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1106
|
-
if (fromConfig != null) {
|
|
1107
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
1108
|
-
}
|
|
1109
|
-
return toObject;
|
|
1110
|
-
}
|
|
1111
763
|
function updateCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
1112
764
|
const toObject = {};
|
|
1113
765
|
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
@@ -1120,18 +772,6 @@ function updateCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
1120
772
|
}
|
|
1121
773
|
return toObject;
|
|
1122
774
|
}
|
|
1123
|
-
function updateCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1124
|
-
const toObject = {};
|
|
1125
|
-
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
1126
|
-
if (parentObject !== undefined && fromTtl != null) {
|
|
1127
|
-
setValueByPath(parentObject, ['ttl'], fromTtl);
|
|
1128
|
-
}
|
|
1129
|
-
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1130
|
-
if (parentObject !== undefined && fromExpireTime != null) {
|
|
1131
|
-
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
1132
|
-
}
|
|
1133
|
-
return toObject;
|
|
1134
|
-
}
|
|
1135
775
|
function updateCachedContentParametersToMldev(apiClient, fromObject) {
|
|
1136
776
|
const toObject = {};
|
|
1137
777
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -1144,18 +784,6 @@ function updateCachedContentParametersToMldev(apiClient, fromObject) {
|
|
|
1144
784
|
}
|
|
1145
785
|
return toObject;
|
|
1146
786
|
}
|
|
1147
|
-
function updateCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1148
|
-
const toObject = {};
|
|
1149
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
1150
|
-
if (fromName != null) {
|
|
1151
|
-
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1152
|
-
}
|
|
1153
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1154
|
-
if (fromConfig != null) {
|
|
1155
|
-
setValueByPath(toObject, ['config'], updateCachedContentConfigToVertex(apiClient, fromConfig, toObject));
|
|
1156
|
-
}
|
|
1157
|
-
return toObject;
|
|
1158
|
-
}
|
|
1159
787
|
function listCachedContentsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
1160
788
|
const toObject = {};
|
|
1161
789
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
@@ -1168,18 +796,6 @@ function listCachedContentsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
1168
796
|
}
|
|
1169
797
|
return toObject;
|
|
1170
798
|
}
|
|
1171
|
-
function listCachedContentsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1172
|
-
const toObject = {};
|
|
1173
|
-
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
1174
|
-
if (parentObject !== undefined && fromPageSize != null) {
|
|
1175
|
-
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
1176
|
-
}
|
|
1177
|
-
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
1178
|
-
if (parentObject !== undefined && fromPageToken != null) {
|
|
1179
|
-
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
1180
|
-
}
|
|
1181
|
-
return toObject;
|
|
1182
|
-
}
|
|
1183
799
|
function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
1184
800
|
const toObject = {};
|
|
1185
801
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -1188,135 +804,529 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
|
1188
804
|
}
|
|
1189
805
|
return toObject;
|
|
1190
806
|
}
|
|
1191
|
-
function
|
|
1192
|
-
const toObject = {};
|
|
1193
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1194
|
-
if (fromConfig != null) {
|
|
1195
|
-
setValueByPath(toObject, ['config'], listCachedContentsConfigToVertex(apiClient, fromConfig, toObject));
|
|
1196
|
-
}
|
|
1197
|
-
return toObject;
|
|
1198
|
-
}
|
|
1199
|
-
function cachedContentFromMldev(apiClient, fromObject) {
|
|
807
|
+
function partToVertex$1(apiClient, fromObject) {
|
|
1200
808
|
const toObject = {};
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
|
|
809
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
810
|
+
'videoMetadata',
|
|
811
|
+
]);
|
|
812
|
+
if (fromVideoMetadata != null) {
|
|
813
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
1204
814
|
}
|
|
1205
|
-
const
|
|
1206
|
-
if (
|
|
1207
|
-
setValueByPath(toObject, ['
|
|
815
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
816
|
+
if (fromThought != null) {
|
|
817
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
1208
818
|
}
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
|
|
819
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
820
|
+
'codeExecutionResult',
|
|
821
|
+
]);
|
|
822
|
+
if (fromCodeExecutionResult != null) {
|
|
823
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
1212
824
|
}
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
|
|
825
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
826
|
+
'executableCode',
|
|
827
|
+
]);
|
|
828
|
+
if (fromExecutableCode != null) {
|
|
829
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
1216
830
|
}
|
|
1217
|
-
const
|
|
1218
|
-
if (
|
|
1219
|
-
setValueByPath(toObject, ['
|
|
831
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
832
|
+
if (fromFileData != null) {
|
|
833
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
1220
834
|
}
|
|
1221
|
-
const
|
|
1222
|
-
if (
|
|
1223
|
-
setValueByPath(toObject, ['
|
|
835
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
836
|
+
if (fromFunctionCall != null) {
|
|
837
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
1224
838
|
}
|
|
1225
|
-
const
|
|
1226
|
-
'
|
|
839
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
840
|
+
'functionResponse',
|
|
1227
841
|
]);
|
|
1228
|
-
if (
|
|
1229
|
-
setValueByPath(toObject, ['
|
|
842
|
+
if (fromFunctionResponse != null) {
|
|
843
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
844
|
+
}
|
|
845
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
846
|
+
if (fromInlineData != null) {
|
|
847
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
848
|
+
}
|
|
849
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
850
|
+
if (fromText != null) {
|
|
851
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
1230
852
|
}
|
|
1231
853
|
return toObject;
|
|
1232
854
|
}
|
|
1233
|
-
function
|
|
855
|
+
function contentToVertex$1(apiClient, fromObject) {
|
|
1234
856
|
const toObject = {};
|
|
1235
|
-
const
|
|
1236
|
-
if (
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
857
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
858
|
+
if (fromParts != null) {
|
|
859
|
+
if (Array.isArray(fromParts)) {
|
|
860
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
861
|
+
return partToVertex$1(apiClient, item);
|
|
862
|
+
}));
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
866
|
+
}
|
|
1242
867
|
}
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
setValueByPath(toObject, ['
|
|
868
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
869
|
+
if (fromRole != null) {
|
|
870
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
1246
871
|
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
872
|
+
return toObject;
|
|
873
|
+
}
|
|
874
|
+
function schemaToVertex$1(apiClient, fromObject) {
|
|
875
|
+
const toObject = {};
|
|
876
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
877
|
+
if (fromExample != null) {
|
|
878
|
+
setValueByPath(toObject, ['example'], fromExample);
|
|
1250
879
|
}
|
|
1251
|
-
const
|
|
1252
|
-
if (
|
|
1253
|
-
setValueByPath(toObject, ['
|
|
880
|
+
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
881
|
+
if (fromPattern != null) {
|
|
882
|
+
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
1254
883
|
}
|
|
1255
|
-
const
|
|
1256
|
-
if (
|
|
1257
|
-
setValueByPath(toObject, ['
|
|
884
|
+
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
885
|
+
if (fromDefault != null) {
|
|
886
|
+
setValueByPath(toObject, ['default'], fromDefault);
|
|
1258
887
|
}
|
|
1259
|
-
const
|
|
1260
|
-
|
|
888
|
+
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
889
|
+
if (fromMaxLength != null) {
|
|
890
|
+
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
891
|
+
}
|
|
892
|
+
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
893
|
+
if (fromMinLength != null) {
|
|
894
|
+
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
895
|
+
}
|
|
896
|
+
const fromMinProperties = getValueByPath(fromObject, [
|
|
897
|
+
'minProperties',
|
|
1261
898
|
]);
|
|
1262
|
-
if (
|
|
1263
|
-
setValueByPath(toObject, ['
|
|
899
|
+
if (fromMinProperties != null) {
|
|
900
|
+
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
901
|
+
}
|
|
902
|
+
const fromMaxProperties = getValueByPath(fromObject, [
|
|
903
|
+
'maxProperties',
|
|
904
|
+
]);
|
|
905
|
+
if (fromMaxProperties != null) {
|
|
906
|
+
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
907
|
+
}
|
|
908
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
909
|
+
if (fromAnyOf != null) {
|
|
910
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
911
|
+
}
|
|
912
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
913
|
+
if (fromDescription != null) {
|
|
914
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
915
|
+
}
|
|
916
|
+
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
917
|
+
if (fromEnum != null) {
|
|
918
|
+
setValueByPath(toObject, ['enum'], fromEnum);
|
|
919
|
+
}
|
|
920
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
921
|
+
if (fromFormat != null) {
|
|
922
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
923
|
+
}
|
|
924
|
+
const fromItems = getValueByPath(fromObject, ['items']);
|
|
925
|
+
if (fromItems != null) {
|
|
926
|
+
setValueByPath(toObject, ['items'], fromItems);
|
|
927
|
+
}
|
|
928
|
+
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
929
|
+
if (fromMaxItems != null) {
|
|
930
|
+
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
931
|
+
}
|
|
932
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
933
|
+
if (fromMaximum != null) {
|
|
934
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
935
|
+
}
|
|
936
|
+
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
937
|
+
if (fromMinItems != null) {
|
|
938
|
+
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
939
|
+
}
|
|
940
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
941
|
+
if (fromMinimum != null) {
|
|
942
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
943
|
+
}
|
|
944
|
+
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
945
|
+
if (fromNullable != null) {
|
|
946
|
+
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
947
|
+
}
|
|
948
|
+
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
949
|
+
if (fromProperties != null) {
|
|
950
|
+
setValueByPath(toObject, ['properties'], fromProperties);
|
|
951
|
+
}
|
|
952
|
+
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
953
|
+
'propertyOrdering',
|
|
954
|
+
]);
|
|
955
|
+
if (fromPropertyOrdering != null) {
|
|
956
|
+
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
957
|
+
}
|
|
958
|
+
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
959
|
+
if (fromRequired != null) {
|
|
960
|
+
setValueByPath(toObject, ['required'], fromRequired);
|
|
961
|
+
}
|
|
962
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
963
|
+
if (fromTitle != null) {
|
|
964
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
965
|
+
}
|
|
966
|
+
const fromType = getValueByPath(fromObject, ['type']);
|
|
967
|
+
if (fromType != null) {
|
|
968
|
+
setValueByPath(toObject, ['type'], fromType);
|
|
1264
969
|
}
|
|
1265
970
|
return toObject;
|
|
1266
971
|
}
|
|
1267
|
-
function
|
|
972
|
+
function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
1268
973
|
const toObject = {};
|
|
974
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
975
|
+
if (fromResponse != null) {
|
|
976
|
+
setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
|
|
977
|
+
}
|
|
978
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
979
|
+
if (fromDescription != null) {
|
|
980
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
981
|
+
}
|
|
982
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
983
|
+
if (fromName != null) {
|
|
984
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
985
|
+
}
|
|
986
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
987
|
+
if (fromParameters != null) {
|
|
988
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
989
|
+
}
|
|
1269
990
|
return toObject;
|
|
1270
991
|
}
|
|
1271
|
-
function
|
|
992
|
+
function googleSearchToVertex$1() {
|
|
1272
993
|
const toObject = {};
|
|
1273
994
|
return toObject;
|
|
1274
995
|
}
|
|
1275
|
-
function
|
|
996
|
+
function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
1276
997
|
const toObject = {};
|
|
1277
|
-
const
|
|
1278
|
-
|
|
998
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
999
|
+
if (fromMode != null) {
|
|
1000
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
1001
|
+
}
|
|
1002
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
1003
|
+
'dynamicThreshold',
|
|
1279
1004
|
]);
|
|
1280
|
-
if (
|
|
1281
|
-
setValueByPath(toObject, ['
|
|
1005
|
+
if (fromDynamicThreshold != null) {
|
|
1006
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
1282
1007
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1008
|
+
return toObject;
|
|
1009
|
+
}
|
|
1010
|
+
function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
|
|
1011
|
+
const toObject = {};
|
|
1012
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
1013
|
+
'dynamicRetrievalConfig',
|
|
1285
1014
|
]);
|
|
1286
|
-
if (
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1015
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
1016
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
|
|
1017
|
+
}
|
|
1018
|
+
return toObject;
|
|
1019
|
+
}
|
|
1020
|
+
function toolToVertex$1(apiClient, fromObject) {
|
|
1021
|
+
const toObject = {};
|
|
1022
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
1023
|
+
'functionDeclarations',
|
|
1024
|
+
]);
|
|
1025
|
+
if (fromFunctionDeclarations != null) {
|
|
1026
|
+
if (Array.isArray(fromFunctionDeclarations)) {
|
|
1027
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
1028
|
+
return functionDeclarationToVertex$1(apiClient, item);
|
|
1290
1029
|
}));
|
|
1291
1030
|
}
|
|
1292
1031
|
else {
|
|
1293
|
-
setValueByPath(toObject, ['
|
|
1032
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
1294
1033
|
}
|
|
1295
1034
|
}
|
|
1035
|
+
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
1036
|
+
if (fromRetrieval != null) {
|
|
1037
|
+
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
1038
|
+
}
|
|
1039
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
1040
|
+
if (fromGoogleSearch != null) {
|
|
1041
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
|
|
1042
|
+
}
|
|
1043
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
1044
|
+
'googleSearchRetrieval',
|
|
1045
|
+
]);
|
|
1046
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
1047
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
|
|
1048
|
+
}
|
|
1049
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
1050
|
+
'codeExecution',
|
|
1051
|
+
]);
|
|
1052
|
+
if (fromCodeExecution != null) {
|
|
1053
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
1054
|
+
}
|
|
1296
1055
|
return toObject;
|
|
1297
1056
|
}
|
|
1298
|
-
function
|
|
1057
|
+
function functionCallingConfigToVertex$1(apiClient, fromObject) {
|
|
1299
1058
|
const toObject = {};
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1059
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
1060
|
+
if (fromMode != null) {
|
|
1061
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
1062
|
+
}
|
|
1063
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
1064
|
+
'allowedFunctionNames',
|
|
1302
1065
|
]);
|
|
1303
|
-
if (
|
|
1304
|
-
setValueByPath(toObject, ['
|
|
1066
|
+
if (fromAllowedFunctionNames != null) {
|
|
1067
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
1305
1068
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1069
|
+
return toObject;
|
|
1070
|
+
}
|
|
1071
|
+
function toolConfigToVertex$1(apiClient, fromObject) {
|
|
1072
|
+
const toObject = {};
|
|
1073
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
1074
|
+
'functionCallingConfig',
|
|
1308
1075
|
]);
|
|
1309
|
-
if (
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1076
|
+
if (fromFunctionCallingConfig != null) {
|
|
1077
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex$1(apiClient, fromFunctionCallingConfig));
|
|
1078
|
+
}
|
|
1079
|
+
return toObject;
|
|
1080
|
+
}
|
|
1081
|
+
function createCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1082
|
+
const toObject = {};
|
|
1083
|
+
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
1084
|
+
if (parentObject !== undefined && fromTtl != null) {
|
|
1085
|
+
setValueByPath(parentObject, ['ttl'], fromTtl);
|
|
1086
|
+
}
|
|
1087
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1088
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
1089
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
1090
|
+
}
|
|
1091
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
1092
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
1093
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
1094
|
+
}
|
|
1095
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
1096
|
+
if (parentObject !== undefined && fromContents != null) {
|
|
1097
|
+
if (Array.isArray(fromContents)) {
|
|
1098
|
+
setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
1099
|
+
return contentToVertex$1(apiClient, item);
|
|
1100
|
+
})));
|
|
1101
|
+
}
|
|
1102
|
+
else {
|
|
1103
|
+
setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
1107
|
+
'systemInstruction',
|
|
1108
|
+
]);
|
|
1109
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
1110
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
1111
|
+
}
|
|
1112
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
1113
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
1114
|
+
if (Array.isArray(fromTools)) {
|
|
1115
|
+
setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
|
|
1116
|
+
return toolToVertex$1(apiClient, item);
|
|
1313
1117
|
}));
|
|
1314
1118
|
}
|
|
1315
1119
|
else {
|
|
1316
|
-
setValueByPath(
|
|
1120
|
+
setValueByPath(parentObject, ['tools'], fromTools);
|
|
1317
1121
|
}
|
|
1318
1122
|
}
|
|
1319
|
-
|
|
1123
|
+
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
1124
|
+
if (parentObject !== undefined && fromToolConfig != null) {
|
|
1125
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex$1(apiClient, fromToolConfig));
|
|
1126
|
+
}
|
|
1127
|
+
return toObject;
|
|
1128
|
+
}
|
|
1129
|
+
function createCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1130
|
+
const toObject = {};
|
|
1131
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
1132
|
+
if (fromModel != null) {
|
|
1133
|
+
setValueByPath(toObject, ['model'], tCachesModel(apiClient, fromModel));
|
|
1134
|
+
}
|
|
1135
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1136
|
+
if (fromConfig != null) {
|
|
1137
|
+
setValueByPath(toObject, ['config'], createCachedContentConfigToVertex(apiClient, fromConfig, toObject));
|
|
1138
|
+
}
|
|
1139
|
+
return toObject;
|
|
1140
|
+
}
|
|
1141
|
+
function getCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1142
|
+
const toObject = {};
|
|
1143
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1144
|
+
if (fromName != null) {
|
|
1145
|
+
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1146
|
+
}
|
|
1147
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1148
|
+
if (fromConfig != null) {
|
|
1149
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
1150
|
+
}
|
|
1151
|
+
return toObject;
|
|
1152
|
+
}
|
|
1153
|
+
function deleteCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1154
|
+
const toObject = {};
|
|
1155
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1156
|
+
if (fromName != null) {
|
|
1157
|
+
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1158
|
+
}
|
|
1159
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1160
|
+
if (fromConfig != null) {
|
|
1161
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
1162
|
+
}
|
|
1163
|
+
return toObject;
|
|
1164
|
+
}
|
|
1165
|
+
function updateCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1166
|
+
const toObject = {};
|
|
1167
|
+
const fromTtl = getValueByPath(fromObject, ['ttl']);
|
|
1168
|
+
if (parentObject !== undefined && fromTtl != null) {
|
|
1169
|
+
setValueByPath(parentObject, ['ttl'], fromTtl);
|
|
1170
|
+
}
|
|
1171
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1172
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
1173
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
1174
|
+
}
|
|
1175
|
+
return toObject;
|
|
1176
|
+
}
|
|
1177
|
+
function updateCachedContentParametersToVertex(apiClient, fromObject) {
|
|
1178
|
+
const toObject = {};
|
|
1179
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1180
|
+
if (fromName != null) {
|
|
1181
|
+
setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
|
|
1182
|
+
}
|
|
1183
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1184
|
+
if (fromConfig != null) {
|
|
1185
|
+
setValueByPath(toObject, ['config'], updateCachedContentConfigToVertex(apiClient, fromConfig, toObject));
|
|
1186
|
+
}
|
|
1187
|
+
return toObject;
|
|
1188
|
+
}
|
|
1189
|
+
function listCachedContentsConfigToVertex(apiClient, fromObject, parentObject) {
|
|
1190
|
+
const toObject = {};
|
|
1191
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
1192
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
1193
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
1194
|
+
}
|
|
1195
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
1196
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
1197
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
1198
|
+
}
|
|
1199
|
+
return toObject;
|
|
1200
|
+
}
|
|
1201
|
+
function listCachedContentsParametersToVertex(apiClient, fromObject) {
|
|
1202
|
+
const toObject = {};
|
|
1203
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
1204
|
+
if (fromConfig != null) {
|
|
1205
|
+
setValueByPath(toObject, ['config'], listCachedContentsConfigToVertex(apiClient, fromConfig, toObject));
|
|
1206
|
+
}
|
|
1207
|
+
return toObject;
|
|
1208
|
+
}
|
|
1209
|
+
function cachedContentFromMldev(apiClient, fromObject) {
|
|
1210
|
+
const toObject = {};
|
|
1211
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1212
|
+
if (fromName != null) {
|
|
1213
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
1214
|
+
}
|
|
1215
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
1216
|
+
if (fromDisplayName != null) {
|
|
1217
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
1218
|
+
}
|
|
1219
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
1220
|
+
if (fromModel != null) {
|
|
1221
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
1222
|
+
}
|
|
1223
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
1224
|
+
if (fromCreateTime != null) {
|
|
1225
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
1226
|
+
}
|
|
1227
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
1228
|
+
if (fromUpdateTime != null) {
|
|
1229
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
1230
|
+
}
|
|
1231
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1232
|
+
if (fromExpireTime != null) {
|
|
1233
|
+
setValueByPath(toObject, ['expireTime'], fromExpireTime);
|
|
1234
|
+
}
|
|
1235
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
1236
|
+
'usageMetadata',
|
|
1237
|
+
]);
|
|
1238
|
+
if (fromUsageMetadata != null) {
|
|
1239
|
+
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
1240
|
+
}
|
|
1241
|
+
return toObject;
|
|
1242
|
+
}
|
|
1243
|
+
function deleteCachedContentResponseFromMldev() {
|
|
1244
|
+
const toObject = {};
|
|
1245
|
+
return toObject;
|
|
1246
|
+
}
|
|
1247
|
+
function listCachedContentsResponseFromMldev(apiClient, fromObject) {
|
|
1248
|
+
const toObject = {};
|
|
1249
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
1250
|
+
'nextPageToken',
|
|
1251
|
+
]);
|
|
1252
|
+
if (fromNextPageToken != null) {
|
|
1253
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
1254
|
+
}
|
|
1255
|
+
const fromCachedContents = getValueByPath(fromObject, [
|
|
1256
|
+
'cachedContents',
|
|
1257
|
+
]);
|
|
1258
|
+
if (fromCachedContents != null) {
|
|
1259
|
+
if (Array.isArray(fromCachedContents)) {
|
|
1260
|
+
setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
|
|
1261
|
+
return cachedContentFromMldev(apiClient, item);
|
|
1262
|
+
}));
|
|
1263
|
+
}
|
|
1264
|
+
else {
|
|
1265
|
+
setValueByPath(toObject, ['cachedContents'], fromCachedContents);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
return toObject;
|
|
1269
|
+
}
|
|
1270
|
+
function cachedContentFromVertex(apiClient, fromObject) {
|
|
1271
|
+
const toObject = {};
|
|
1272
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
1273
|
+
if (fromName != null) {
|
|
1274
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
1275
|
+
}
|
|
1276
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
1277
|
+
if (fromDisplayName != null) {
|
|
1278
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
1279
|
+
}
|
|
1280
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
1281
|
+
if (fromModel != null) {
|
|
1282
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
1283
|
+
}
|
|
1284
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
1285
|
+
if (fromCreateTime != null) {
|
|
1286
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
1287
|
+
}
|
|
1288
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
1289
|
+
if (fromUpdateTime != null) {
|
|
1290
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
1291
|
+
}
|
|
1292
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
1293
|
+
if (fromExpireTime != null) {
|
|
1294
|
+
setValueByPath(toObject, ['expireTime'], fromExpireTime);
|
|
1295
|
+
}
|
|
1296
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
1297
|
+
'usageMetadata',
|
|
1298
|
+
]);
|
|
1299
|
+
if (fromUsageMetadata != null) {
|
|
1300
|
+
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
1301
|
+
}
|
|
1302
|
+
return toObject;
|
|
1303
|
+
}
|
|
1304
|
+
function deleteCachedContentResponseFromVertex() {
|
|
1305
|
+
const toObject = {};
|
|
1306
|
+
return toObject;
|
|
1307
|
+
}
|
|
1308
|
+
function listCachedContentsResponseFromVertex(apiClient, fromObject) {
|
|
1309
|
+
const toObject = {};
|
|
1310
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
1311
|
+
'nextPageToken',
|
|
1312
|
+
]);
|
|
1313
|
+
if (fromNextPageToken != null) {
|
|
1314
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
1315
|
+
}
|
|
1316
|
+
const fromCachedContents = getValueByPath(fromObject, [
|
|
1317
|
+
'cachedContents',
|
|
1318
|
+
]);
|
|
1319
|
+
if (fromCachedContents != null) {
|
|
1320
|
+
if (Array.isArray(fromCachedContents)) {
|
|
1321
|
+
setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
|
|
1322
|
+
return cachedContentFromVertex(apiClient, item);
|
|
1323
|
+
}));
|
|
1324
|
+
}
|
|
1325
|
+
else {
|
|
1326
|
+
setValueByPath(toObject, ['cachedContents'], fromCachedContents);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
return toObject;
|
|
1320
1330
|
}
|
|
1321
1331
|
|
|
1322
1332
|
/**
|
|
@@ -2052,6 +2062,9 @@ class HttpResponse {
|
|
|
2052
2062
|
/** Response for the create file method. */
|
|
2053
2063
|
class CreateFileResponse {
|
|
2054
2064
|
}
|
|
2065
|
+
/** Response for the delete file method. */
|
|
2066
|
+
class DeleteFileResponse {
|
|
2067
|
+
}
|
|
2055
2068
|
/** Represents a single response in a replay. */
|
|
2056
2069
|
class ReplayResponse {
|
|
2057
2070
|
}
|
|
@@ -2785,54 +2798,655 @@ class Chat {
|
|
|
2785
2798
|
this.history.push(...outputContents);
|
|
2786
2799
|
}
|
|
2787
2800
|
}
|
|
2788
|
-
|
|
2789
|
-
/**
|
|
2790
|
-
* @license
|
|
2791
|
-
* Copyright 2025 Google LLC
|
|
2792
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2793
|
-
*/
|
|
2794
|
-
function partToMldev(apiClient, fromObject) {
|
|
2801
|
+
|
|
2802
|
+
/**
|
|
2803
|
+
* @license
|
|
2804
|
+
* Copyright 2025 Google LLC
|
|
2805
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2806
|
+
*/
|
|
2807
|
+
function partToMldev(apiClient, fromObject) {
|
|
2808
|
+
const toObject = {};
|
|
2809
|
+
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
2810
|
+
throw new Error('videoMetadata parameter is not supported in Gemini API.');
|
|
2811
|
+
}
|
|
2812
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2813
|
+
if (fromThought != null) {
|
|
2814
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
2815
|
+
}
|
|
2816
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2817
|
+
'codeExecutionResult',
|
|
2818
|
+
]);
|
|
2819
|
+
if (fromCodeExecutionResult != null) {
|
|
2820
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
2821
|
+
}
|
|
2822
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
2823
|
+
'executableCode',
|
|
2824
|
+
]);
|
|
2825
|
+
if (fromExecutableCode != null) {
|
|
2826
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2827
|
+
}
|
|
2828
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2829
|
+
if (fromFileData != null) {
|
|
2830
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
2831
|
+
}
|
|
2832
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2833
|
+
if (fromFunctionCall != null) {
|
|
2834
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2835
|
+
}
|
|
2836
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2837
|
+
'functionResponse',
|
|
2838
|
+
]);
|
|
2839
|
+
if (fromFunctionResponse != null) {
|
|
2840
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
2841
|
+
}
|
|
2842
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2843
|
+
if (fromInlineData != null) {
|
|
2844
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
2845
|
+
}
|
|
2846
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
2847
|
+
if (fromText != null) {
|
|
2848
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
2849
|
+
}
|
|
2850
|
+
return toObject;
|
|
2851
|
+
}
|
|
2852
|
+
function contentToMldev(apiClient, fromObject) {
|
|
2853
|
+
const toObject = {};
|
|
2854
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2855
|
+
if (fromParts != null) {
|
|
2856
|
+
if (Array.isArray(fromParts)) {
|
|
2857
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
2858
|
+
return partToMldev(apiClient, item);
|
|
2859
|
+
}));
|
|
2860
|
+
}
|
|
2861
|
+
else {
|
|
2862
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
2866
|
+
if (fromRole != null) {
|
|
2867
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
2868
|
+
}
|
|
2869
|
+
return toObject;
|
|
2870
|
+
}
|
|
2871
|
+
function schemaToMldev(apiClient, fromObject) {
|
|
2872
|
+
const toObject = {};
|
|
2873
|
+
if (getValueByPath(fromObject, ['example']) !== undefined) {
|
|
2874
|
+
throw new Error('example parameter is not supported in Gemini API.');
|
|
2875
|
+
}
|
|
2876
|
+
if (getValueByPath(fromObject, ['pattern']) !== undefined) {
|
|
2877
|
+
throw new Error('pattern parameter is not supported in Gemini API.');
|
|
2878
|
+
}
|
|
2879
|
+
if (getValueByPath(fromObject, ['default']) !== undefined) {
|
|
2880
|
+
throw new Error('default parameter is not supported in Gemini API.');
|
|
2881
|
+
}
|
|
2882
|
+
if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
|
|
2883
|
+
throw new Error('maxLength parameter is not supported in Gemini API.');
|
|
2884
|
+
}
|
|
2885
|
+
if (getValueByPath(fromObject, ['minLength']) !== undefined) {
|
|
2886
|
+
throw new Error('minLength parameter is not supported in Gemini API.');
|
|
2887
|
+
}
|
|
2888
|
+
if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
|
|
2889
|
+
throw new Error('minProperties parameter is not supported in Gemini API.');
|
|
2890
|
+
}
|
|
2891
|
+
if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
|
|
2892
|
+
throw new Error('maxProperties parameter is not supported in Gemini API.');
|
|
2893
|
+
}
|
|
2894
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
2895
|
+
if (fromAnyOf != null) {
|
|
2896
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
2897
|
+
}
|
|
2898
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2899
|
+
if (fromDescription != null) {
|
|
2900
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
2901
|
+
}
|
|
2902
|
+
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
2903
|
+
if (fromEnum != null) {
|
|
2904
|
+
setValueByPath(toObject, ['enum'], fromEnum);
|
|
2905
|
+
}
|
|
2906
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
2907
|
+
if (fromFormat != null) {
|
|
2908
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
2909
|
+
}
|
|
2910
|
+
const fromItems = getValueByPath(fromObject, ['items']);
|
|
2911
|
+
if (fromItems != null) {
|
|
2912
|
+
setValueByPath(toObject, ['items'], fromItems);
|
|
2913
|
+
}
|
|
2914
|
+
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
2915
|
+
if (fromMaxItems != null) {
|
|
2916
|
+
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
2917
|
+
}
|
|
2918
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
2919
|
+
if (fromMaximum != null) {
|
|
2920
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
2921
|
+
}
|
|
2922
|
+
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
2923
|
+
if (fromMinItems != null) {
|
|
2924
|
+
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
2925
|
+
}
|
|
2926
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
2927
|
+
if (fromMinimum != null) {
|
|
2928
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
2929
|
+
}
|
|
2930
|
+
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
2931
|
+
if (fromNullable != null) {
|
|
2932
|
+
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
2933
|
+
}
|
|
2934
|
+
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
2935
|
+
if (fromProperties != null) {
|
|
2936
|
+
setValueByPath(toObject, ['properties'], fromProperties);
|
|
2937
|
+
}
|
|
2938
|
+
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
2939
|
+
'propertyOrdering',
|
|
2940
|
+
]);
|
|
2941
|
+
if (fromPropertyOrdering != null) {
|
|
2942
|
+
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
2943
|
+
}
|
|
2944
|
+
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
2945
|
+
if (fromRequired != null) {
|
|
2946
|
+
setValueByPath(toObject, ['required'], fromRequired);
|
|
2947
|
+
}
|
|
2948
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
2949
|
+
if (fromTitle != null) {
|
|
2950
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
2951
|
+
}
|
|
2952
|
+
const fromType = getValueByPath(fromObject, ['type']);
|
|
2953
|
+
if (fromType != null) {
|
|
2954
|
+
setValueByPath(toObject, ['type'], fromType);
|
|
2955
|
+
}
|
|
2956
|
+
return toObject;
|
|
2957
|
+
}
|
|
2958
|
+
function safetySettingToMldev(apiClient, fromObject) {
|
|
2959
|
+
const toObject = {};
|
|
2960
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
2961
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
2962
|
+
}
|
|
2963
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
2964
|
+
if (fromCategory != null) {
|
|
2965
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
2966
|
+
}
|
|
2967
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
2968
|
+
if (fromThreshold != null) {
|
|
2969
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
2970
|
+
}
|
|
2971
|
+
return toObject;
|
|
2972
|
+
}
|
|
2973
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
2974
|
+
const toObject = {};
|
|
2975
|
+
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
2976
|
+
throw new Error('response parameter is not supported in Gemini API.');
|
|
2977
|
+
}
|
|
2978
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2979
|
+
if (fromDescription != null) {
|
|
2980
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
2981
|
+
}
|
|
2982
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
2983
|
+
if (fromName != null) {
|
|
2984
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
2985
|
+
}
|
|
2986
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
2987
|
+
if (fromParameters != null) {
|
|
2988
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
2989
|
+
}
|
|
2990
|
+
return toObject;
|
|
2991
|
+
}
|
|
2992
|
+
function googleSearchToMldev() {
|
|
2993
|
+
const toObject = {};
|
|
2994
|
+
return toObject;
|
|
2995
|
+
}
|
|
2996
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
2997
|
+
const toObject = {};
|
|
2998
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2999
|
+
if (fromMode != null) {
|
|
3000
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3001
|
+
}
|
|
3002
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3003
|
+
'dynamicThreshold',
|
|
3004
|
+
]);
|
|
3005
|
+
if (fromDynamicThreshold != null) {
|
|
3006
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3007
|
+
}
|
|
3008
|
+
return toObject;
|
|
3009
|
+
}
|
|
3010
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
3011
|
+
const toObject = {};
|
|
3012
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
3013
|
+
'dynamicRetrievalConfig',
|
|
3014
|
+
]);
|
|
3015
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
3016
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
3017
|
+
}
|
|
3018
|
+
return toObject;
|
|
3019
|
+
}
|
|
3020
|
+
function toolToMldev(apiClient, fromObject) {
|
|
3021
|
+
const toObject = {};
|
|
3022
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
3023
|
+
'functionDeclarations',
|
|
3024
|
+
]);
|
|
3025
|
+
if (fromFunctionDeclarations != null) {
|
|
3026
|
+
if (Array.isArray(fromFunctionDeclarations)) {
|
|
3027
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
3028
|
+
return functionDeclarationToMldev(apiClient, item);
|
|
3029
|
+
}));
|
|
3030
|
+
}
|
|
3031
|
+
else {
|
|
3032
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
3036
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
3037
|
+
}
|
|
3038
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
3039
|
+
if (fromGoogleSearch != null) {
|
|
3040
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev());
|
|
3041
|
+
}
|
|
3042
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
3043
|
+
'googleSearchRetrieval',
|
|
3044
|
+
]);
|
|
3045
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
3046
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
3047
|
+
}
|
|
3048
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3049
|
+
'codeExecution',
|
|
3050
|
+
]);
|
|
3051
|
+
if (fromCodeExecution != null) {
|
|
3052
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
3053
|
+
}
|
|
3054
|
+
return toObject;
|
|
3055
|
+
}
|
|
3056
|
+
function functionCallingConfigToMldev(apiClient, fromObject) {
|
|
3057
|
+
const toObject = {};
|
|
3058
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3059
|
+
if (fromMode != null) {
|
|
3060
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3061
|
+
}
|
|
3062
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3063
|
+
'allowedFunctionNames',
|
|
3064
|
+
]);
|
|
3065
|
+
if (fromAllowedFunctionNames != null) {
|
|
3066
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3067
|
+
}
|
|
3068
|
+
return toObject;
|
|
3069
|
+
}
|
|
3070
|
+
function toolConfigToMldev(apiClient, fromObject) {
|
|
3071
|
+
const toObject = {};
|
|
3072
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
3073
|
+
'functionCallingConfig',
|
|
3074
|
+
]);
|
|
3075
|
+
if (fromFunctionCallingConfig != null) {
|
|
3076
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(apiClient, fromFunctionCallingConfig));
|
|
3077
|
+
}
|
|
3078
|
+
return toObject;
|
|
3079
|
+
}
|
|
3080
|
+
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
3081
|
+
const toObject = {};
|
|
3082
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
3083
|
+
if (fromVoiceName != null) {
|
|
3084
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
3085
|
+
}
|
|
3086
|
+
return toObject;
|
|
3087
|
+
}
|
|
3088
|
+
function voiceConfigToMldev(apiClient, fromObject) {
|
|
3089
|
+
const toObject = {};
|
|
3090
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
3091
|
+
'prebuiltVoiceConfig',
|
|
3092
|
+
]);
|
|
3093
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
3094
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
3095
|
+
}
|
|
3096
|
+
return toObject;
|
|
3097
|
+
}
|
|
3098
|
+
function speechConfigToMldev(apiClient, fromObject) {
|
|
3099
|
+
const toObject = {};
|
|
3100
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3101
|
+
if (fromVoiceConfig != null) {
|
|
3102
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
3103
|
+
}
|
|
3104
|
+
return toObject;
|
|
3105
|
+
}
|
|
3106
|
+
function thinkingConfigToMldev(apiClient, fromObject) {
|
|
3107
|
+
const toObject = {};
|
|
3108
|
+
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3109
|
+
'includeThoughts',
|
|
3110
|
+
]);
|
|
3111
|
+
if (fromIncludeThoughts != null) {
|
|
3112
|
+
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3113
|
+
}
|
|
3114
|
+
return toObject;
|
|
3115
|
+
}
|
|
3116
|
+
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3117
|
+
const toObject = {};
|
|
3118
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
3119
|
+
'systemInstruction',
|
|
3120
|
+
]);
|
|
3121
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
3122
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
3123
|
+
}
|
|
3124
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
3125
|
+
if (fromTemperature != null) {
|
|
3126
|
+
setValueByPath(toObject, ['temperature'], fromTemperature);
|
|
3127
|
+
}
|
|
3128
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
3129
|
+
if (fromTopP != null) {
|
|
3130
|
+
setValueByPath(toObject, ['topP'], fromTopP);
|
|
3131
|
+
}
|
|
3132
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
3133
|
+
if (fromTopK != null) {
|
|
3134
|
+
setValueByPath(toObject, ['topK'], fromTopK);
|
|
3135
|
+
}
|
|
3136
|
+
const fromCandidateCount = getValueByPath(fromObject, [
|
|
3137
|
+
'candidateCount',
|
|
3138
|
+
]);
|
|
3139
|
+
if (fromCandidateCount != null) {
|
|
3140
|
+
setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
|
|
3141
|
+
}
|
|
3142
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
3143
|
+
'maxOutputTokens',
|
|
3144
|
+
]);
|
|
3145
|
+
if (fromMaxOutputTokens != null) {
|
|
3146
|
+
setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
|
|
3147
|
+
}
|
|
3148
|
+
const fromStopSequences = getValueByPath(fromObject, [
|
|
3149
|
+
'stopSequences',
|
|
3150
|
+
]);
|
|
3151
|
+
if (fromStopSequences != null) {
|
|
3152
|
+
setValueByPath(toObject, ['stopSequences'], fromStopSequences);
|
|
3153
|
+
}
|
|
3154
|
+
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
3155
|
+
'responseLogprobs',
|
|
3156
|
+
]);
|
|
3157
|
+
if (fromResponseLogprobs != null) {
|
|
3158
|
+
setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
|
|
3159
|
+
}
|
|
3160
|
+
const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
|
|
3161
|
+
if (fromLogprobs != null) {
|
|
3162
|
+
setValueByPath(toObject, ['logprobs'], fromLogprobs);
|
|
3163
|
+
}
|
|
3164
|
+
const fromPresencePenalty = getValueByPath(fromObject, [
|
|
3165
|
+
'presencePenalty',
|
|
3166
|
+
]);
|
|
3167
|
+
if (fromPresencePenalty != null) {
|
|
3168
|
+
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
3169
|
+
}
|
|
3170
|
+
const fromFrequencyPenalty = getValueByPath(fromObject, [
|
|
3171
|
+
'frequencyPenalty',
|
|
3172
|
+
]);
|
|
3173
|
+
if (fromFrequencyPenalty != null) {
|
|
3174
|
+
setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
|
|
3175
|
+
}
|
|
3176
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
3177
|
+
if (fromSeed != null) {
|
|
3178
|
+
setValueByPath(toObject, ['seed'], fromSeed);
|
|
3179
|
+
}
|
|
3180
|
+
const fromResponseMimeType = getValueByPath(fromObject, [
|
|
3181
|
+
'responseMimeType',
|
|
3182
|
+
]);
|
|
3183
|
+
if (fromResponseMimeType != null) {
|
|
3184
|
+
setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
|
|
3185
|
+
}
|
|
3186
|
+
const fromResponseSchema = getValueByPath(fromObject, [
|
|
3187
|
+
'responseSchema',
|
|
3188
|
+
]);
|
|
3189
|
+
if (fromResponseSchema != null) {
|
|
3190
|
+
setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
|
|
3191
|
+
}
|
|
3192
|
+
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
3193
|
+
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
3194
|
+
}
|
|
3195
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
3196
|
+
'safetySettings',
|
|
3197
|
+
]);
|
|
3198
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
3199
|
+
if (Array.isArray(fromSafetySettings)) {
|
|
3200
|
+
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
|
|
3201
|
+
return safetySettingToMldev(apiClient, item);
|
|
3202
|
+
}));
|
|
3203
|
+
}
|
|
3204
|
+
else {
|
|
3205
|
+
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
3209
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
3210
|
+
if (Array.isArray(fromTools)) {
|
|
3211
|
+
setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
|
|
3212
|
+
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
3213
|
+
})));
|
|
3214
|
+
}
|
|
3215
|
+
else {
|
|
3216
|
+
setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
3220
|
+
if (parentObject !== undefined && fromToolConfig != null) {
|
|
3221
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(apiClient, fromToolConfig));
|
|
3222
|
+
}
|
|
3223
|
+
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
3224
|
+
throw new Error('labels parameter is not supported in Gemini API.');
|
|
3225
|
+
}
|
|
3226
|
+
const fromCachedContent = getValueByPath(fromObject, [
|
|
3227
|
+
'cachedContent',
|
|
3228
|
+
]);
|
|
3229
|
+
if (parentObject !== undefined && fromCachedContent != null) {
|
|
3230
|
+
setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
|
|
3231
|
+
}
|
|
3232
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
3233
|
+
'responseModalities',
|
|
3234
|
+
]);
|
|
3235
|
+
if (fromResponseModalities != null) {
|
|
3236
|
+
setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
|
|
3237
|
+
}
|
|
3238
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
3239
|
+
'mediaResolution',
|
|
3240
|
+
]);
|
|
3241
|
+
if (fromMediaResolution != null) {
|
|
3242
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
3243
|
+
}
|
|
3244
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
3245
|
+
if (fromSpeechConfig != null) {
|
|
3246
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
3247
|
+
}
|
|
3248
|
+
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
3249
|
+
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
3250
|
+
}
|
|
3251
|
+
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
3252
|
+
'thinkingConfig',
|
|
3253
|
+
]);
|
|
3254
|
+
if (fromThinkingConfig != null) {
|
|
3255
|
+
setValueByPath(toObject, ['thinkingConfig'], thinkingConfigToMldev(apiClient, fromThinkingConfig));
|
|
3256
|
+
}
|
|
3257
|
+
return toObject;
|
|
3258
|
+
}
|
|
3259
|
+
function generateContentParametersToMldev(apiClient, fromObject) {
|
|
3260
|
+
const toObject = {};
|
|
3261
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3262
|
+
if (fromModel != null) {
|
|
3263
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3264
|
+
}
|
|
3265
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3266
|
+
if (fromContents != null) {
|
|
3267
|
+
if (Array.isArray(fromContents)) {
|
|
3268
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
3269
|
+
return contentToMldev(apiClient, item);
|
|
3270
|
+
})));
|
|
3271
|
+
}
|
|
3272
|
+
else {
|
|
3273
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3277
|
+
if (fromConfig != null) {
|
|
3278
|
+
setValueByPath(toObject, ['generationConfig'], generateContentConfigToMldev(apiClient, fromConfig, toObject));
|
|
3279
|
+
}
|
|
3280
|
+
return toObject;
|
|
3281
|
+
}
|
|
3282
|
+
function embedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3283
|
+
const toObject = {};
|
|
3284
|
+
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3285
|
+
if (parentObject !== undefined && fromTaskType != null) {
|
|
3286
|
+
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3287
|
+
}
|
|
3288
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3289
|
+
if (parentObject !== undefined && fromTitle != null) {
|
|
3290
|
+
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3291
|
+
}
|
|
3292
|
+
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3293
|
+
'outputDimensionality',
|
|
3294
|
+
]);
|
|
3295
|
+
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3296
|
+
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3297
|
+
}
|
|
3298
|
+
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3299
|
+
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3300
|
+
}
|
|
3301
|
+
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3302
|
+
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3303
|
+
}
|
|
3304
|
+
return toObject;
|
|
3305
|
+
}
|
|
3306
|
+
function embedContentParametersToMldev(apiClient, fromObject) {
|
|
3307
|
+
const toObject = {};
|
|
3308
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3309
|
+
if (fromModel != null) {
|
|
3310
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3311
|
+
}
|
|
3312
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3313
|
+
if (fromContents != null) {
|
|
3314
|
+
setValueByPath(toObject, ['requests[]', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3315
|
+
}
|
|
3316
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3317
|
+
if (fromConfig != null) {
|
|
3318
|
+
setValueByPath(toObject, ['config'], embedContentConfigToMldev(apiClient, fromConfig, toObject));
|
|
3319
|
+
}
|
|
3320
|
+
const fromModelForEmbedContent = getValueByPath(fromObject, ['model']);
|
|
3321
|
+
if (fromModelForEmbedContent !== undefined) {
|
|
3322
|
+
setValueByPath(toObject, ['requests[]', 'model'], tModel(apiClient, fromModelForEmbedContent));
|
|
3323
|
+
}
|
|
3324
|
+
return toObject;
|
|
3325
|
+
}
|
|
3326
|
+
function generateImagesConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3327
|
+
const toObject = {};
|
|
3328
|
+
if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
|
|
3329
|
+
throw new Error('outputGcsUri parameter is not supported in Gemini API.');
|
|
3330
|
+
}
|
|
3331
|
+
if (getValueByPath(fromObject, ['negativePrompt']) !== undefined) {
|
|
3332
|
+
throw new Error('negativePrompt parameter is not supported in Gemini API.');
|
|
3333
|
+
}
|
|
3334
|
+
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
3335
|
+
'numberOfImages',
|
|
3336
|
+
]);
|
|
3337
|
+
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
3338
|
+
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
3339
|
+
}
|
|
3340
|
+
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
3341
|
+
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
3342
|
+
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
3343
|
+
}
|
|
3344
|
+
const fromGuidanceScale = getValueByPath(fromObject, [
|
|
3345
|
+
'guidanceScale',
|
|
3346
|
+
]);
|
|
3347
|
+
if (parentObject !== undefined && fromGuidanceScale != null) {
|
|
3348
|
+
setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
|
|
3349
|
+
}
|
|
3350
|
+
if (getValueByPath(fromObject, ['seed']) !== undefined) {
|
|
3351
|
+
throw new Error('seed parameter is not supported in Gemini API.');
|
|
3352
|
+
}
|
|
3353
|
+
const fromSafetyFilterLevel = getValueByPath(fromObject, [
|
|
3354
|
+
'safetyFilterLevel',
|
|
3355
|
+
]);
|
|
3356
|
+
if (parentObject !== undefined && fromSafetyFilterLevel != null) {
|
|
3357
|
+
setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
|
|
3358
|
+
}
|
|
3359
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
3360
|
+
'personGeneration',
|
|
3361
|
+
]);
|
|
3362
|
+
if (parentObject !== undefined && fromPersonGeneration != null) {
|
|
3363
|
+
setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
|
|
3364
|
+
}
|
|
3365
|
+
const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
|
|
3366
|
+
'includeSafetyAttributes',
|
|
3367
|
+
]);
|
|
3368
|
+
if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
|
|
3369
|
+
setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
|
|
3370
|
+
}
|
|
3371
|
+
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
3372
|
+
'includeRaiReason',
|
|
3373
|
+
]);
|
|
3374
|
+
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
3375
|
+
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
3376
|
+
}
|
|
3377
|
+
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
3378
|
+
if (parentObject !== undefined && fromLanguage != null) {
|
|
3379
|
+
setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
|
|
3380
|
+
}
|
|
3381
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
3382
|
+
'outputMimeType',
|
|
3383
|
+
]);
|
|
3384
|
+
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
3385
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
3386
|
+
}
|
|
3387
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
3388
|
+
'outputCompressionQuality',
|
|
3389
|
+
]);
|
|
3390
|
+
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
3391
|
+
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
3392
|
+
}
|
|
3393
|
+
if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
|
|
3394
|
+
throw new Error('addWatermark parameter is not supported in Gemini API.');
|
|
3395
|
+
}
|
|
3396
|
+
if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
|
|
3397
|
+
throw new Error('enhancePrompt parameter is not supported in Gemini API.');
|
|
3398
|
+
}
|
|
3399
|
+
return toObject;
|
|
3400
|
+
}
|
|
3401
|
+
function generateImagesParametersToMldev(apiClient, fromObject) {
|
|
2795
3402
|
const toObject = {};
|
|
2796
|
-
|
|
2797
|
-
|
|
3403
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3404
|
+
if (fromModel != null) {
|
|
3405
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
2798
3406
|
}
|
|
2799
|
-
const
|
|
2800
|
-
if (
|
|
2801
|
-
setValueByPath(toObject, ['
|
|
3407
|
+
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
3408
|
+
if (fromPrompt != null) {
|
|
3409
|
+
setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
2802
3410
|
}
|
|
2803
|
-
const
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
if (fromCodeExecutionResult != null) {
|
|
2807
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
3411
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3412
|
+
if (fromConfig != null) {
|
|
3413
|
+
setValueByPath(toObject, ['config'], generateImagesConfigToMldev(apiClient, fromConfig, toObject));
|
|
2808
3414
|
}
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
3415
|
+
return toObject;
|
|
3416
|
+
}
|
|
3417
|
+
function countTokensConfigToMldev(apiClient, fromObject) {
|
|
3418
|
+
const toObject = {};
|
|
3419
|
+
if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
|
|
3420
|
+
throw new Error('systemInstruction parameter is not supported in Gemini API.');
|
|
2814
3421
|
}
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
3422
|
+
if (getValueByPath(fromObject, ['tools']) !== undefined) {
|
|
3423
|
+
throw new Error('tools parameter is not supported in Gemini API.');
|
|
2818
3424
|
}
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3425
|
+
if (getValueByPath(fromObject, ['generationConfig']) !== undefined) {
|
|
3426
|
+
throw new Error('generationConfig parameter is not supported in Gemini API.');
|
|
2822
3427
|
}
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
3428
|
+
return toObject;
|
|
3429
|
+
}
|
|
3430
|
+
function countTokensParametersToMldev(apiClient, fromObject) {
|
|
3431
|
+
const toObject = {};
|
|
3432
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3433
|
+
if (fromModel != null) {
|
|
3434
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
2828
3435
|
}
|
|
2829
|
-
const
|
|
2830
|
-
if (
|
|
2831
|
-
|
|
3436
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3437
|
+
if (fromContents != null) {
|
|
3438
|
+
if (Array.isArray(fromContents)) {
|
|
3439
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
3440
|
+
return contentToMldev(apiClient, item);
|
|
3441
|
+
})));
|
|
3442
|
+
}
|
|
3443
|
+
else {
|
|
3444
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
3445
|
+
}
|
|
2832
3446
|
}
|
|
2833
|
-
const
|
|
2834
|
-
if (
|
|
2835
|
-
setValueByPath(toObject, ['
|
|
3447
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3448
|
+
if (fromConfig != null) {
|
|
3449
|
+
setValueByPath(toObject, ['config'], countTokensConfigToMldev(apiClient, fromConfig));
|
|
2836
3450
|
}
|
|
2837
3451
|
return toObject;
|
|
2838
3452
|
}
|
|
@@ -2884,25 +3498,6 @@ function partToVertex(apiClient, fromObject) {
|
|
|
2884
3498
|
}
|
|
2885
3499
|
return toObject;
|
|
2886
3500
|
}
|
|
2887
|
-
function contentToMldev(apiClient, fromObject) {
|
|
2888
|
-
const toObject = {};
|
|
2889
|
-
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2890
|
-
if (fromParts != null) {
|
|
2891
|
-
if (Array.isArray(fromParts)) {
|
|
2892
|
-
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
2893
|
-
return partToMldev(apiClient, item);
|
|
2894
|
-
}));
|
|
2895
|
-
}
|
|
2896
|
-
else {
|
|
2897
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
2898
|
-
}
|
|
2899
|
-
}
|
|
2900
|
-
const fromRole = getValueByPath(fromObject, ['role']);
|
|
2901
|
-
if (fromRole != null) {
|
|
2902
|
-
setValueByPath(toObject, ['role'], fromRole);
|
|
2903
|
-
}
|
|
2904
|
-
return toObject;
|
|
2905
|
-
}
|
|
2906
3501
|
function contentToVertex(apiClient, fromObject) {
|
|
2907
3502
|
const toObject = {};
|
|
2908
3503
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -2922,92 +3517,6 @@ function contentToVertex(apiClient, fromObject) {
|
|
|
2922
3517
|
}
|
|
2923
3518
|
return toObject;
|
|
2924
3519
|
}
|
|
2925
|
-
function schemaToMldev(apiClient, fromObject) {
|
|
2926
|
-
const toObject = {};
|
|
2927
|
-
if (getValueByPath(fromObject, ['example']) !== undefined) {
|
|
2928
|
-
throw new Error('example parameter is not supported in Gemini API.');
|
|
2929
|
-
}
|
|
2930
|
-
if (getValueByPath(fromObject, ['pattern']) !== undefined) {
|
|
2931
|
-
throw new Error('pattern parameter is not supported in Gemini API.');
|
|
2932
|
-
}
|
|
2933
|
-
if (getValueByPath(fromObject, ['default']) !== undefined) {
|
|
2934
|
-
throw new Error('default parameter is not supported in Gemini API.');
|
|
2935
|
-
}
|
|
2936
|
-
if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
|
|
2937
|
-
throw new Error('maxLength parameter is not supported in Gemini API.');
|
|
2938
|
-
}
|
|
2939
|
-
if (getValueByPath(fromObject, ['title']) !== undefined) {
|
|
2940
|
-
throw new Error('title parameter is not supported in Gemini API.');
|
|
2941
|
-
}
|
|
2942
|
-
if (getValueByPath(fromObject, ['minLength']) !== undefined) {
|
|
2943
|
-
throw new Error('minLength parameter is not supported in Gemini API.');
|
|
2944
|
-
}
|
|
2945
|
-
if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
|
|
2946
|
-
throw new Error('minProperties parameter is not supported in Gemini API.');
|
|
2947
|
-
}
|
|
2948
|
-
if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
|
|
2949
|
-
throw new Error('maxProperties parameter is not supported in Gemini API.');
|
|
2950
|
-
}
|
|
2951
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
2952
|
-
if (fromAnyOf != null) {
|
|
2953
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
2954
|
-
}
|
|
2955
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2956
|
-
if (fromDescription != null) {
|
|
2957
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
2958
|
-
}
|
|
2959
|
-
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
2960
|
-
if (fromEnum != null) {
|
|
2961
|
-
setValueByPath(toObject, ['enum'], fromEnum);
|
|
2962
|
-
}
|
|
2963
|
-
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
2964
|
-
if (fromFormat != null) {
|
|
2965
|
-
setValueByPath(toObject, ['format'], fromFormat);
|
|
2966
|
-
}
|
|
2967
|
-
const fromItems = getValueByPath(fromObject, ['items']);
|
|
2968
|
-
if (fromItems != null) {
|
|
2969
|
-
setValueByPath(toObject, ['items'], fromItems);
|
|
2970
|
-
}
|
|
2971
|
-
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
2972
|
-
if (fromMaxItems != null) {
|
|
2973
|
-
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
2974
|
-
}
|
|
2975
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
2976
|
-
if (fromMaximum != null) {
|
|
2977
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
2978
|
-
}
|
|
2979
|
-
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
2980
|
-
if (fromMinItems != null) {
|
|
2981
|
-
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
2982
|
-
}
|
|
2983
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
2984
|
-
if (fromMinimum != null) {
|
|
2985
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
2986
|
-
}
|
|
2987
|
-
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
2988
|
-
if (fromNullable != null) {
|
|
2989
|
-
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
2990
|
-
}
|
|
2991
|
-
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
2992
|
-
if (fromProperties != null) {
|
|
2993
|
-
setValueByPath(toObject, ['properties'], fromProperties);
|
|
2994
|
-
}
|
|
2995
|
-
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
2996
|
-
'propertyOrdering',
|
|
2997
|
-
]);
|
|
2998
|
-
if (fromPropertyOrdering != null) {
|
|
2999
|
-
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
3000
|
-
}
|
|
3001
|
-
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
3002
|
-
if (fromRequired != null) {
|
|
3003
|
-
setValueByPath(toObject, ['required'], fromRequired);
|
|
3004
|
-
}
|
|
3005
|
-
const fromType = getValueByPath(fromObject, ['type']);
|
|
3006
|
-
if (fromType != null) {
|
|
3007
|
-
setValueByPath(toObject, ['type'], fromType);
|
|
3008
|
-
}
|
|
3009
|
-
return toObject;
|
|
3010
|
-
}
|
|
3011
3520
|
function schemaToVertex(apiClient, fromObject) {
|
|
3012
3521
|
const toObject = {};
|
|
3013
3522
|
const fromExample = getValueByPath(fromObject, ['example']);
|
|
@@ -3026,10 +3535,6 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
3026
3535
|
if (fromMaxLength != null) {
|
|
3027
3536
|
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
3028
3537
|
}
|
|
3029
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3030
|
-
if (fromTitle != null) {
|
|
3031
|
-
setValueByPath(toObject, ['title'], fromTitle);
|
|
3032
|
-
}
|
|
3033
3538
|
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
3034
3539
|
if (fromMinLength != null) {
|
|
3035
3540
|
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
@@ -3100,27 +3605,16 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
3100
3605
|
if (fromRequired != null) {
|
|
3101
3606
|
setValueByPath(toObject, ['required'], fromRequired);
|
|
3102
3607
|
}
|
|
3608
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3609
|
+
if (fromTitle != null) {
|
|
3610
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
3611
|
+
}
|
|
3103
3612
|
const fromType = getValueByPath(fromObject, ['type']);
|
|
3104
3613
|
if (fromType != null) {
|
|
3105
3614
|
setValueByPath(toObject, ['type'], fromType);
|
|
3106
3615
|
}
|
|
3107
3616
|
return toObject;
|
|
3108
3617
|
}
|
|
3109
|
-
function safetySettingToMldev(apiClient, fromObject) {
|
|
3110
|
-
const toObject = {};
|
|
3111
|
-
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
3112
|
-
throw new Error('method parameter is not supported in Gemini API.');
|
|
3113
|
-
}
|
|
3114
|
-
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
3115
|
-
if (fromCategory != null) {
|
|
3116
|
-
setValueByPath(toObject, ['category'], fromCategory);
|
|
3117
|
-
}
|
|
3118
|
-
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
3119
|
-
if (fromThreshold != null) {
|
|
3120
|
-
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
3121
|
-
}
|
|
3122
|
-
return toObject;
|
|
3123
|
-
}
|
|
3124
3618
|
function safetySettingToVertex(apiClient, fromObject) {
|
|
3125
3619
|
const toObject = {};
|
|
3126
3620
|
const fromMethod = getValueByPath(fromObject, ['method']);
|
|
@@ -3137,25 +3631,6 @@ function safetySettingToVertex(apiClient, fromObject) {
|
|
|
3137
3631
|
}
|
|
3138
3632
|
return toObject;
|
|
3139
3633
|
}
|
|
3140
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
3141
|
-
const toObject = {};
|
|
3142
|
-
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
3143
|
-
throw new Error('response parameter is not supported in Gemini API.');
|
|
3144
|
-
}
|
|
3145
|
-
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
3146
|
-
if (fromDescription != null) {
|
|
3147
|
-
setValueByPath(toObject, ['description'], fromDescription);
|
|
3148
|
-
}
|
|
3149
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
3150
|
-
if (fromName != null) {
|
|
3151
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
3152
|
-
}
|
|
3153
|
-
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
3154
|
-
if (fromParameters != null) {
|
|
3155
|
-
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
3156
|
-
}
|
|
3157
|
-
return toObject;
|
|
3158
|
-
}
|
|
3159
3634
|
function functionDeclarationToVertex(apiClient, fromObject) {
|
|
3160
3635
|
const toObject = {};
|
|
3161
3636
|
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
@@ -3176,49 +3651,21 @@ function functionDeclarationToVertex(apiClient, fromObject) {
|
|
|
3176
3651
|
}
|
|
3177
3652
|
return toObject;
|
|
3178
3653
|
}
|
|
3179
|
-
function googleSearchToMldev() {
|
|
3180
|
-
const toObject = {};
|
|
3181
|
-
return toObject;
|
|
3182
|
-
}
|
|
3183
3654
|
function googleSearchToVertex() {
|
|
3184
3655
|
const toObject = {};
|
|
3185
3656
|
return toObject;
|
|
3186
3657
|
}
|
|
3187
|
-
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
3188
|
-
const toObject = {};
|
|
3189
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3190
|
-
if (fromMode != null) {
|
|
3191
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3192
|
-
}
|
|
3193
|
-
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3194
|
-
'dynamicThreshold',
|
|
3195
|
-
]);
|
|
3196
|
-
if (fromDynamicThreshold != null) {
|
|
3197
|
-
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3198
|
-
}
|
|
3199
|
-
return toObject;
|
|
3200
|
-
}
|
|
3201
3658
|
function dynamicRetrievalConfigToVertex(apiClient, fromObject) {
|
|
3202
3659
|
const toObject = {};
|
|
3203
3660
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3204
3661
|
if (fromMode != null) {
|
|
3205
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3206
|
-
}
|
|
3207
|
-
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3208
|
-
'dynamicThreshold',
|
|
3209
|
-
]);
|
|
3210
|
-
if (fromDynamicThreshold != null) {
|
|
3211
|
-
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3212
|
-
}
|
|
3213
|
-
return toObject;
|
|
3214
|
-
}
|
|
3215
|
-
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
3216
|
-
const toObject = {};
|
|
3217
|
-
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
3218
|
-
'dynamicRetrievalConfig',
|
|
3662
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3663
|
+
}
|
|
3664
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3665
|
+
'dynamicThreshold',
|
|
3219
3666
|
]);
|
|
3220
|
-
if (
|
|
3221
|
-
setValueByPath(toObject, ['
|
|
3667
|
+
if (fromDynamicThreshold != null) {
|
|
3668
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3222
3669
|
}
|
|
3223
3670
|
return toObject;
|
|
3224
3671
|
}
|
|
@@ -3232,42 +3679,6 @@ function googleSearchRetrievalToVertex(apiClient, fromObject) {
|
|
|
3232
3679
|
}
|
|
3233
3680
|
return toObject;
|
|
3234
3681
|
}
|
|
3235
|
-
function toolToMldev(apiClient, fromObject) {
|
|
3236
|
-
const toObject = {};
|
|
3237
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
3238
|
-
'functionDeclarations',
|
|
3239
|
-
]);
|
|
3240
|
-
if (fromFunctionDeclarations != null) {
|
|
3241
|
-
if (Array.isArray(fromFunctionDeclarations)) {
|
|
3242
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
3243
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
3244
|
-
}));
|
|
3245
|
-
}
|
|
3246
|
-
else {
|
|
3247
|
-
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
3251
|
-
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
3252
|
-
}
|
|
3253
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
3254
|
-
if (fromGoogleSearch != null) {
|
|
3255
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev());
|
|
3256
|
-
}
|
|
3257
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
3258
|
-
'googleSearchRetrieval',
|
|
3259
|
-
]);
|
|
3260
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
3261
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
3262
|
-
}
|
|
3263
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3264
|
-
'codeExecution',
|
|
3265
|
-
]);
|
|
3266
|
-
if (fromCodeExecution != null) {
|
|
3267
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
3268
|
-
}
|
|
3269
|
-
return toObject;
|
|
3270
|
-
}
|
|
3271
3682
|
function toolToVertex(apiClient, fromObject) {
|
|
3272
3683
|
const toObject = {};
|
|
3273
3684
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -3305,20 +3716,6 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
3305
3716
|
}
|
|
3306
3717
|
return toObject;
|
|
3307
3718
|
}
|
|
3308
|
-
function functionCallingConfigToMldev(apiClient, fromObject) {
|
|
3309
|
-
const toObject = {};
|
|
3310
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3311
|
-
if (fromMode != null) {
|
|
3312
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3313
|
-
}
|
|
3314
|
-
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3315
|
-
'allowedFunctionNames',
|
|
3316
|
-
]);
|
|
3317
|
-
if (fromAllowedFunctionNames != null) {
|
|
3318
|
-
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3319
|
-
}
|
|
3320
|
-
return toObject;
|
|
3321
|
-
}
|
|
3322
3719
|
function functionCallingConfigToVertex(apiClient, fromObject) {
|
|
3323
3720
|
const toObject = {};
|
|
3324
3721
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
@@ -3333,16 +3730,6 @@ function functionCallingConfigToVertex(apiClient, fromObject) {
|
|
|
3333
3730
|
}
|
|
3334
3731
|
return toObject;
|
|
3335
3732
|
}
|
|
3336
|
-
function toolConfigToMldev(apiClient, fromObject) {
|
|
3337
|
-
const toObject = {};
|
|
3338
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
3339
|
-
'functionCallingConfig',
|
|
3340
|
-
]);
|
|
3341
|
-
if (fromFunctionCallingConfig != null) {
|
|
3342
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(apiClient, fromFunctionCallingConfig));
|
|
3343
|
-
}
|
|
3344
|
-
return toObject;
|
|
3345
|
-
}
|
|
3346
3733
|
function toolConfigToVertex(apiClient, fromObject) {
|
|
3347
3734
|
const toObject = {};
|
|
3348
3735
|
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
@@ -3353,14 +3740,6 @@ function toolConfigToVertex(apiClient, fromObject) {
|
|
|
3353
3740
|
}
|
|
3354
3741
|
return toObject;
|
|
3355
3742
|
}
|
|
3356
|
-
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
3357
|
-
const toObject = {};
|
|
3358
|
-
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
3359
|
-
if (fromVoiceName != null) {
|
|
3360
|
-
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
3361
|
-
}
|
|
3362
|
-
return toObject;
|
|
3363
|
-
}
|
|
3364
3743
|
function prebuiltVoiceConfigToVertex(apiClient, fromObject) {
|
|
3365
3744
|
const toObject = {};
|
|
3366
3745
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
@@ -3369,16 +3748,6 @@ function prebuiltVoiceConfigToVertex(apiClient, fromObject) {
|
|
|
3369
3748
|
}
|
|
3370
3749
|
return toObject;
|
|
3371
3750
|
}
|
|
3372
|
-
function voiceConfigToMldev(apiClient, fromObject) {
|
|
3373
|
-
const toObject = {};
|
|
3374
|
-
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
3375
|
-
'prebuiltVoiceConfig',
|
|
3376
|
-
]);
|
|
3377
|
-
if (fromPrebuiltVoiceConfig != null) {
|
|
3378
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
3379
|
-
}
|
|
3380
|
-
return toObject;
|
|
3381
|
-
}
|
|
3382
3751
|
function voiceConfigToVertex(apiClient, fromObject) {
|
|
3383
3752
|
const toObject = {};
|
|
3384
3753
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
@@ -3389,182 +3758,21 @@ function voiceConfigToVertex(apiClient, fromObject) {
|
|
|
3389
3758
|
}
|
|
3390
3759
|
return toObject;
|
|
3391
3760
|
}
|
|
3392
|
-
function
|
|
3393
|
-
const toObject = {};
|
|
3394
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3395
|
-
if (fromVoiceConfig != null) {
|
|
3396
|
-
setValueByPath(toObject, ['voiceConfig'],
|
|
3397
|
-
}
|
|
3398
|
-
return toObject;
|
|
3399
|
-
}
|
|
3400
|
-
function speechConfigToVertex(apiClient, fromObject) {
|
|
3401
|
-
const toObject = {};
|
|
3402
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3403
|
-
if (fromVoiceConfig != null) {
|
|
3404
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
|
|
3405
|
-
}
|
|
3406
|
-
return toObject;
|
|
3407
|
-
}
|
|
3408
|
-
function thinkingConfigToMldev(apiClient, fromObject) {
|
|
3409
|
-
const toObject = {};
|
|
3410
|
-
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3411
|
-
'includeThoughts',
|
|
3412
|
-
]);
|
|
3413
|
-
if (fromIncludeThoughts != null) {
|
|
3414
|
-
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3415
|
-
}
|
|
3416
|
-
return toObject;
|
|
3417
|
-
}
|
|
3418
|
-
function thinkingConfigToVertex(apiClient, fromObject) {
|
|
3419
|
-
const toObject = {};
|
|
3420
|
-
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3421
|
-
'includeThoughts',
|
|
3422
|
-
]);
|
|
3423
|
-
if (fromIncludeThoughts != null) {
|
|
3424
|
-
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3425
|
-
}
|
|
3426
|
-
return toObject;
|
|
3427
|
-
}
|
|
3428
|
-
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3429
|
-
const toObject = {};
|
|
3430
|
-
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
3431
|
-
'systemInstruction',
|
|
3432
|
-
]);
|
|
3433
|
-
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
3434
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
3435
|
-
}
|
|
3436
|
-
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
3437
|
-
if (fromTemperature != null) {
|
|
3438
|
-
setValueByPath(toObject, ['temperature'], fromTemperature);
|
|
3439
|
-
}
|
|
3440
|
-
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
3441
|
-
if (fromTopP != null) {
|
|
3442
|
-
setValueByPath(toObject, ['topP'], fromTopP);
|
|
3443
|
-
}
|
|
3444
|
-
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
3445
|
-
if (fromTopK != null) {
|
|
3446
|
-
setValueByPath(toObject, ['topK'], fromTopK);
|
|
3447
|
-
}
|
|
3448
|
-
const fromCandidateCount = getValueByPath(fromObject, [
|
|
3449
|
-
'candidateCount',
|
|
3450
|
-
]);
|
|
3451
|
-
if (fromCandidateCount != null) {
|
|
3452
|
-
setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
|
|
3453
|
-
}
|
|
3454
|
-
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
3455
|
-
'maxOutputTokens',
|
|
3456
|
-
]);
|
|
3457
|
-
if (fromMaxOutputTokens != null) {
|
|
3458
|
-
setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
|
|
3459
|
-
}
|
|
3460
|
-
const fromStopSequences = getValueByPath(fromObject, [
|
|
3461
|
-
'stopSequences',
|
|
3462
|
-
]);
|
|
3463
|
-
if (fromStopSequences != null) {
|
|
3464
|
-
setValueByPath(toObject, ['stopSequences'], fromStopSequences);
|
|
3465
|
-
}
|
|
3466
|
-
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
3467
|
-
'responseLogprobs',
|
|
3468
|
-
]);
|
|
3469
|
-
if (fromResponseLogprobs != null) {
|
|
3470
|
-
setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
|
|
3471
|
-
}
|
|
3472
|
-
const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
|
|
3473
|
-
if (fromLogprobs != null) {
|
|
3474
|
-
setValueByPath(toObject, ['logprobs'], fromLogprobs);
|
|
3475
|
-
}
|
|
3476
|
-
const fromPresencePenalty = getValueByPath(fromObject, [
|
|
3477
|
-
'presencePenalty',
|
|
3478
|
-
]);
|
|
3479
|
-
if (fromPresencePenalty != null) {
|
|
3480
|
-
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
3481
|
-
}
|
|
3482
|
-
const fromFrequencyPenalty = getValueByPath(fromObject, [
|
|
3483
|
-
'frequencyPenalty',
|
|
3484
|
-
]);
|
|
3485
|
-
if (fromFrequencyPenalty != null) {
|
|
3486
|
-
setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
|
|
3487
|
-
}
|
|
3488
|
-
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
3489
|
-
if (fromSeed != null) {
|
|
3490
|
-
setValueByPath(toObject, ['seed'], fromSeed);
|
|
3491
|
-
}
|
|
3492
|
-
const fromResponseMimeType = getValueByPath(fromObject, [
|
|
3493
|
-
'responseMimeType',
|
|
3494
|
-
]);
|
|
3495
|
-
if (fromResponseMimeType != null) {
|
|
3496
|
-
setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
|
|
3497
|
-
}
|
|
3498
|
-
const fromResponseSchema = getValueByPath(fromObject, [
|
|
3499
|
-
'responseSchema',
|
|
3500
|
-
]);
|
|
3501
|
-
if (fromResponseSchema != null) {
|
|
3502
|
-
setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
|
|
3503
|
-
}
|
|
3504
|
-
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
3505
|
-
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
3506
|
-
}
|
|
3507
|
-
const fromSafetySettings = getValueByPath(fromObject, [
|
|
3508
|
-
'safetySettings',
|
|
3509
|
-
]);
|
|
3510
|
-
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
3511
|
-
if (Array.isArray(fromSafetySettings)) {
|
|
3512
|
-
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
|
|
3513
|
-
return safetySettingToMldev(apiClient, item);
|
|
3514
|
-
}));
|
|
3515
|
-
}
|
|
3516
|
-
else {
|
|
3517
|
-
setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
|
|
3518
|
-
}
|
|
3519
|
-
}
|
|
3520
|
-
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
3521
|
-
if (parentObject !== undefined && fromTools != null) {
|
|
3522
|
-
if (Array.isArray(fromTools)) {
|
|
3523
|
-
setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
|
|
3524
|
-
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
3525
|
-
})));
|
|
3526
|
-
}
|
|
3527
|
-
else {
|
|
3528
|
-
setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
|
|
3529
|
-
}
|
|
3530
|
-
}
|
|
3531
|
-
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
3532
|
-
if (parentObject !== undefined && fromToolConfig != null) {
|
|
3533
|
-
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(apiClient, fromToolConfig));
|
|
3534
|
-
}
|
|
3535
|
-
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
3536
|
-
throw new Error('labels parameter is not supported in Gemini API.');
|
|
3537
|
-
}
|
|
3538
|
-
const fromCachedContent = getValueByPath(fromObject, [
|
|
3539
|
-
'cachedContent',
|
|
3540
|
-
]);
|
|
3541
|
-
if (parentObject !== undefined && fromCachedContent != null) {
|
|
3542
|
-
setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
|
|
3543
|
-
}
|
|
3544
|
-
const fromResponseModalities = getValueByPath(fromObject, [
|
|
3545
|
-
'responseModalities',
|
|
3546
|
-
]);
|
|
3547
|
-
if (fromResponseModalities != null) {
|
|
3548
|
-
setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
|
|
3549
|
-
}
|
|
3550
|
-
const fromMediaResolution = getValueByPath(fromObject, [
|
|
3551
|
-
'mediaResolution',
|
|
3552
|
-
]);
|
|
3553
|
-
if (fromMediaResolution != null) {
|
|
3554
|
-
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
3555
|
-
}
|
|
3556
|
-
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
3557
|
-
if (fromSpeechConfig != null) {
|
|
3558
|
-
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
3559
|
-
}
|
|
3560
|
-
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
3561
|
-
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
3761
|
+
function speechConfigToVertex(apiClient, fromObject) {
|
|
3762
|
+
const toObject = {};
|
|
3763
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3764
|
+
if (fromVoiceConfig != null) {
|
|
3765
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
|
|
3562
3766
|
}
|
|
3563
|
-
|
|
3564
|
-
|
|
3767
|
+
return toObject;
|
|
3768
|
+
}
|
|
3769
|
+
function thinkingConfigToVertex(apiClient, fromObject) {
|
|
3770
|
+
const toObject = {};
|
|
3771
|
+
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3772
|
+
'includeThoughts',
|
|
3565
3773
|
]);
|
|
3566
|
-
if (
|
|
3567
|
-
setValueByPath(toObject, ['
|
|
3774
|
+
if (fromIncludeThoughts != null) {
|
|
3775
|
+
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3568
3776
|
}
|
|
3569
3777
|
return toObject;
|
|
3570
3778
|
}
|
|
@@ -3718,29 +3926,6 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
3718
3926
|
}
|
|
3719
3927
|
return toObject;
|
|
3720
3928
|
}
|
|
3721
|
-
function generateContentParametersToMldev(apiClient, fromObject) {
|
|
3722
|
-
const toObject = {};
|
|
3723
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3724
|
-
if (fromModel != null) {
|
|
3725
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3726
|
-
}
|
|
3727
|
-
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3728
|
-
if (fromContents != null) {
|
|
3729
|
-
if (Array.isArray(fromContents)) {
|
|
3730
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
3731
|
-
return contentToMldev(apiClient, item);
|
|
3732
|
-
})));
|
|
3733
|
-
}
|
|
3734
|
-
else {
|
|
3735
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
3736
|
-
}
|
|
3737
|
-
}
|
|
3738
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3739
|
-
if (fromConfig != null) {
|
|
3740
|
-
setValueByPath(toObject, ['generationConfig'], generateContentConfigToMldev(apiClient, fromConfig, toObject));
|
|
3741
|
-
}
|
|
3742
|
-
return toObject;
|
|
3743
|
-
}
|
|
3744
3929
|
function generateContentParametersToVertex(apiClient, fromObject) {
|
|
3745
3930
|
const toObject = {};
|
|
3746
3931
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -3764,30 +3949,6 @@ function generateContentParametersToVertex(apiClient, fromObject) {
|
|
|
3764
3949
|
}
|
|
3765
3950
|
return toObject;
|
|
3766
3951
|
}
|
|
3767
|
-
function embedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3768
|
-
const toObject = {};
|
|
3769
|
-
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3770
|
-
if (parentObject !== undefined && fromTaskType != null) {
|
|
3771
|
-
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3772
|
-
}
|
|
3773
|
-
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3774
|
-
if (parentObject !== undefined && fromTitle != null) {
|
|
3775
|
-
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3776
|
-
}
|
|
3777
|
-
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3778
|
-
'outputDimensionality',
|
|
3779
|
-
]);
|
|
3780
|
-
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3781
|
-
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3782
|
-
}
|
|
3783
|
-
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3784
|
-
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3785
|
-
}
|
|
3786
|
-
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3787
|
-
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3788
|
-
}
|
|
3789
|
-
return toObject;
|
|
3790
|
-
}
|
|
3791
3952
|
function embedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
3792
3953
|
const toObject = {};
|
|
3793
3954
|
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
@@ -3814,26 +3975,6 @@ function embedContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
3814
3975
|
}
|
|
3815
3976
|
return toObject;
|
|
3816
3977
|
}
|
|
3817
|
-
function embedContentParametersToMldev(apiClient, fromObject) {
|
|
3818
|
-
const toObject = {};
|
|
3819
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3820
|
-
if (fromModel != null) {
|
|
3821
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3822
|
-
}
|
|
3823
|
-
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3824
|
-
if (fromContents != null) {
|
|
3825
|
-
setValueByPath(toObject, ['requests[]', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3826
|
-
}
|
|
3827
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3828
|
-
if (fromConfig != null) {
|
|
3829
|
-
setValueByPath(toObject, ['config'], embedContentConfigToMldev(apiClient, fromConfig, toObject));
|
|
3830
|
-
}
|
|
3831
|
-
const fromModelForEmbedContent = getValueByPath(fromObject, ['model']);
|
|
3832
|
-
if (fromModelForEmbedContent !== undefined) {
|
|
3833
|
-
setValueByPath(toObject, ['requests[]', 'model'], tModel(apiClient, fromModelForEmbedContent));
|
|
3834
|
-
}
|
|
3835
|
-
return toObject;
|
|
3836
|
-
}
|
|
3837
3978
|
function embedContentParametersToVertex(apiClient, fromObject) {
|
|
3838
3979
|
const toObject = {};
|
|
3839
3980
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -3850,81 +3991,6 @@ function embedContentParametersToVertex(apiClient, fromObject) {
|
|
|
3850
3991
|
}
|
|
3851
3992
|
return toObject;
|
|
3852
3993
|
}
|
|
3853
|
-
function generateImagesConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3854
|
-
const toObject = {};
|
|
3855
|
-
if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
|
|
3856
|
-
throw new Error('outputGcsUri parameter is not supported in Gemini API.');
|
|
3857
|
-
}
|
|
3858
|
-
if (getValueByPath(fromObject, ['negativePrompt']) !== undefined) {
|
|
3859
|
-
throw new Error('negativePrompt parameter is not supported in Gemini API.');
|
|
3860
|
-
}
|
|
3861
|
-
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
3862
|
-
'numberOfImages',
|
|
3863
|
-
]);
|
|
3864
|
-
if (parentObject !== undefined && fromNumberOfImages != null) {
|
|
3865
|
-
setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
|
|
3866
|
-
}
|
|
3867
|
-
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
3868
|
-
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
3869
|
-
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
3870
|
-
}
|
|
3871
|
-
const fromGuidanceScale = getValueByPath(fromObject, [
|
|
3872
|
-
'guidanceScale',
|
|
3873
|
-
]);
|
|
3874
|
-
if (parentObject !== undefined && fromGuidanceScale != null) {
|
|
3875
|
-
setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
|
|
3876
|
-
}
|
|
3877
|
-
if (getValueByPath(fromObject, ['seed']) !== undefined) {
|
|
3878
|
-
throw new Error('seed parameter is not supported in Gemini API.');
|
|
3879
|
-
}
|
|
3880
|
-
const fromSafetyFilterLevel = getValueByPath(fromObject, [
|
|
3881
|
-
'safetyFilterLevel',
|
|
3882
|
-
]);
|
|
3883
|
-
if (parentObject !== undefined && fromSafetyFilterLevel != null) {
|
|
3884
|
-
setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
|
|
3885
|
-
}
|
|
3886
|
-
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
3887
|
-
'personGeneration',
|
|
3888
|
-
]);
|
|
3889
|
-
if (parentObject !== undefined && fromPersonGeneration != null) {
|
|
3890
|
-
setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
|
|
3891
|
-
}
|
|
3892
|
-
const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
|
|
3893
|
-
'includeSafetyAttributes',
|
|
3894
|
-
]);
|
|
3895
|
-
if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
|
|
3896
|
-
setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
|
|
3897
|
-
}
|
|
3898
|
-
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
3899
|
-
'includeRaiReason',
|
|
3900
|
-
]);
|
|
3901
|
-
if (parentObject !== undefined && fromIncludeRaiReason != null) {
|
|
3902
|
-
setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
|
|
3903
|
-
}
|
|
3904
|
-
const fromLanguage = getValueByPath(fromObject, ['language']);
|
|
3905
|
-
if (parentObject !== undefined && fromLanguage != null) {
|
|
3906
|
-
setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
|
|
3907
|
-
}
|
|
3908
|
-
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
3909
|
-
'outputMimeType',
|
|
3910
|
-
]);
|
|
3911
|
-
if (parentObject !== undefined && fromOutputMimeType != null) {
|
|
3912
|
-
setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
|
|
3913
|
-
}
|
|
3914
|
-
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
3915
|
-
'outputCompressionQuality',
|
|
3916
|
-
]);
|
|
3917
|
-
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
3918
|
-
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
3919
|
-
}
|
|
3920
|
-
if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
|
|
3921
|
-
throw new Error('addWatermark parameter is not supported in Gemini API.');
|
|
3922
|
-
}
|
|
3923
|
-
if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
|
|
3924
|
-
throw new Error('enhancePrompt parameter is not supported in Gemini API.');
|
|
3925
|
-
}
|
|
3926
|
-
return toObject;
|
|
3927
|
-
}
|
|
3928
3994
|
function generateImagesConfigToVertex(apiClient, fromObject, parentObject) {
|
|
3929
3995
|
const toObject = {};
|
|
3930
3996
|
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
@@ -4009,22 +4075,6 @@ function generateImagesConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
4009
4075
|
}
|
|
4010
4076
|
return toObject;
|
|
4011
4077
|
}
|
|
4012
|
-
function generateImagesParametersToMldev(apiClient, fromObject) {
|
|
4013
|
-
const toObject = {};
|
|
4014
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
4015
|
-
if (fromModel != null) {
|
|
4016
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
4017
|
-
}
|
|
4018
|
-
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
4019
|
-
if (fromPrompt != null) {
|
|
4020
|
-
setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
4021
|
-
}
|
|
4022
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4023
|
-
if (fromConfig != null) {
|
|
4024
|
-
setValueByPath(toObject, ['config'], generateImagesConfigToMldev(apiClient, fromConfig, toObject));
|
|
4025
|
-
}
|
|
4026
|
-
return toObject;
|
|
4027
|
-
}
|
|
4028
4078
|
function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
4029
4079
|
const toObject = {};
|
|
4030
4080
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -4041,19 +4091,6 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
4041
4091
|
}
|
|
4042
4092
|
return toObject;
|
|
4043
4093
|
}
|
|
4044
|
-
function countTokensConfigToMldev(apiClient, fromObject) {
|
|
4045
|
-
const toObject = {};
|
|
4046
|
-
if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
|
|
4047
|
-
throw new Error('systemInstruction parameter is not supported in Gemini API.');
|
|
4048
|
-
}
|
|
4049
|
-
if (getValueByPath(fromObject, ['tools']) !== undefined) {
|
|
4050
|
-
throw new Error('tools parameter is not supported in Gemini API.');
|
|
4051
|
-
}
|
|
4052
|
-
if (getValueByPath(fromObject, ['generationConfig']) !== undefined) {
|
|
4053
|
-
throw new Error('generationConfig parameter is not supported in Gemini API.');
|
|
4054
|
-
}
|
|
4055
|
-
return toObject;
|
|
4056
|
-
}
|
|
4057
4094
|
function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
4058
4095
|
const toObject = {};
|
|
4059
4096
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
@@ -4081,29 +4118,6 @@ function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
4081
4118
|
}
|
|
4082
4119
|
return toObject;
|
|
4083
4120
|
}
|
|
4084
|
-
function countTokensParametersToMldev(apiClient, fromObject) {
|
|
4085
|
-
const toObject = {};
|
|
4086
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
4087
|
-
if (fromModel != null) {
|
|
4088
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
4089
|
-
}
|
|
4090
|
-
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
4091
|
-
if (fromContents != null) {
|
|
4092
|
-
if (Array.isArray(fromContents)) {
|
|
4093
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
4094
|
-
return contentToMldev(apiClient, item);
|
|
4095
|
-
})));
|
|
4096
|
-
}
|
|
4097
|
-
else {
|
|
4098
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
4099
|
-
}
|
|
4100
|
-
}
|
|
4101
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4102
|
-
if (fromConfig != null) {
|
|
4103
|
-
setValueByPath(toObject, ['config'], countTokensConfigToMldev(apiClient, fromConfig));
|
|
4104
|
-
}
|
|
4105
|
-
return toObject;
|
|
4106
|
-
}
|
|
4107
4121
|
function countTokensParametersToVertex(apiClient, fromObject) {
|
|
4108
4122
|
const toObject = {};
|
|
4109
4123
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -4140,66 +4154,18 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
4140
4154
|
return contentToVertex(apiClient, item);
|
|
4141
4155
|
})));
|
|
4142
4156
|
}
|
|
4143
|
-
else {
|
|
4144
|
-
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
4145
|
-
}
|
|
4146
|
-
}
|
|
4147
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4148
|
-
if (fromConfig != null) {
|
|
4149
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
4150
|
-
}
|
|
4151
|
-
return toObject;
|
|
4152
|
-
}
|
|
4153
|
-
function partFromMldev(apiClient, fromObject) {
|
|
4154
|
-
const toObject = {};
|
|
4155
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4156
|
-
if (fromThought != null) {
|
|
4157
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
4158
|
-
}
|
|
4159
|
-
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4160
|
-
'codeExecutionResult',
|
|
4161
|
-
]);
|
|
4162
|
-
if (fromCodeExecutionResult != null) {
|
|
4163
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
4164
|
-
}
|
|
4165
|
-
const fromExecutableCode = getValueByPath(fromObject, [
|
|
4166
|
-
'executableCode',
|
|
4167
|
-
]);
|
|
4168
|
-
if (fromExecutableCode != null) {
|
|
4169
|
-
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4170
|
-
}
|
|
4171
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4172
|
-
if (fromFileData != null) {
|
|
4173
|
-
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
4174
|
-
}
|
|
4175
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4176
|
-
if (fromFunctionCall != null) {
|
|
4177
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4178
|
-
}
|
|
4179
|
-
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4180
|
-
'functionResponse',
|
|
4181
|
-
]);
|
|
4182
|
-
if (fromFunctionResponse != null) {
|
|
4183
|
-
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4184
|
-
}
|
|
4185
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4186
|
-
if (fromInlineData != null) {
|
|
4187
|
-
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4157
|
+
else {
|
|
4158
|
+
setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
|
|
4159
|
+
}
|
|
4188
4160
|
}
|
|
4189
|
-
const
|
|
4190
|
-
if (
|
|
4191
|
-
setValueByPath(toObject, ['
|
|
4161
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4162
|
+
if (fromConfig != null) {
|
|
4163
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
4192
4164
|
}
|
|
4193
4165
|
return toObject;
|
|
4194
4166
|
}
|
|
4195
|
-
function
|
|
4167
|
+
function partFromMldev(apiClient, fromObject) {
|
|
4196
4168
|
const toObject = {};
|
|
4197
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
4198
|
-
'videoMetadata',
|
|
4199
|
-
]);
|
|
4200
|
-
if (fromVideoMetadata != null) {
|
|
4201
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
4202
|
-
}
|
|
4203
4169
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4204
4170
|
if (fromThought != null) {
|
|
4205
4171
|
setValueByPath(toObject, ['thought'], fromThought);
|
|
@@ -4259,25 +4225,6 @@ function contentFromMldev(apiClient, fromObject) {
|
|
|
4259
4225
|
}
|
|
4260
4226
|
return toObject;
|
|
4261
4227
|
}
|
|
4262
|
-
function contentFromVertex(apiClient, fromObject) {
|
|
4263
|
-
const toObject = {};
|
|
4264
|
-
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4265
|
-
if (fromParts != null) {
|
|
4266
|
-
if (Array.isArray(fromParts)) {
|
|
4267
|
-
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
4268
|
-
return partFromVertex(apiClient, item);
|
|
4269
|
-
}));
|
|
4270
|
-
}
|
|
4271
|
-
else {
|
|
4272
|
-
setValueByPath(toObject, ['parts'], fromParts);
|
|
4273
|
-
}
|
|
4274
|
-
}
|
|
4275
|
-
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4276
|
-
if (fromRole != null) {
|
|
4277
|
-
setValueByPath(toObject, ['role'], fromRole);
|
|
4278
|
-
}
|
|
4279
|
-
return toObject;
|
|
4280
|
-
}
|
|
4281
4228
|
function citationMetadataFromMldev(apiClient, fromObject) {
|
|
4282
4229
|
const toObject = {};
|
|
4283
4230
|
const fromCitations = getValueByPath(fromObject, ['citationSources']);
|
|
@@ -4286,14 +4233,6 @@ function citationMetadataFromMldev(apiClient, fromObject) {
|
|
|
4286
4233
|
}
|
|
4287
4234
|
return toObject;
|
|
4288
4235
|
}
|
|
4289
|
-
function citationMetadataFromVertex(apiClient, fromObject) {
|
|
4290
|
-
const toObject = {};
|
|
4291
|
-
const fromCitations = getValueByPath(fromObject, ['citations']);
|
|
4292
|
-
if (fromCitations != null) {
|
|
4293
|
-
setValueByPath(toObject, ['citations'], fromCitations);
|
|
4294
|
-
}
|
|
4295
|
-
return toObject;
|
|
4296
|
-
}
|
|
4297
4236
|
function candidateFromMldev(apiClient, fromObject) {
|
|
4298
4237
|
const toObject = {};
|
|
4299
4238
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
@@ -4318,27 +4257,255 @@ function candidateFromMldev(apiClient, fromObject) {
|
|
|
4318
4257
|
if (fromAvgLogprobs != null) {
|
|
4319
4258
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
4320
4259
|
}
|
|
4321
|
-
const fromGroundingMetadata = getValueByPath(fromObject, [
|
|
4322
|
-
'groundingMetadata',
|
|
4323
|
-
]);
|
|
4324
|
-
if (fromGroundingMetadata != null) {
|
|
4325
|
-
setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
|
|
4260
|
+
const fromGroundingMetadata = getValueByPath(fromObject, [
|
|
4261
|
+
'groundingMetadata',
|
|
4262
|
+
]);
|
|
4263
|
+
if (fromGroundingMetadata != null) {
|
|
4264
|
+
setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
|
|
4265
|
+
}
|
|
4266
|
+
const fromIndex = getValueByPath(fromObject, ['index']);
|
|
4267
|
+
if (fromIndex != null) {
|
|
4268
|
+
setValueByPath(toObject, ['index'], fromIndex);
|
|
4269
|
+
}
|
|
4270
|
+
const fromLogprobsResult = getValueByPath(fromObject, [
|
|
4271
|
+
'logprobsResult',
|
|
4272
|
+
]);
|
|
4273
|
+
if (fromLogprobsResult != null) {
|
|
4274
|
+
setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
|
|
4275
|
+
}
|
|
4276
|
+
const fromSafetyRatings = getValueByPath(fromObject, [
|
|
4277
|
+
'safetyRatings',
|
|
4278
|
+
]);
|
|
4279
|
+
if (fromSafetyRatings != null) {
|
|
4280
|
+
setValueByPath(toObject, ['safetyRatings'], fromSafetyRatings);
|
|
4281
|
+
}
|
|
4282
|
+
return toObject;
|
|
4283
|
+
}
|
|
4284
|
+
function generateContentResponseFromMldev(apiClient, fromObject) {
|
|
4285
|
+
const toObject = {};
|
|
4286
|
+
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
4287
|
+
if (fromCandidates != null) {
|
|
4288
|
+
if (Array.isArray(fromCandidates)) {
|
|
4289
|
+
setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
|
|
4290
|
+
return candidateFromMldev(apiClient, item);
|
|
4291
|
+
}));
|
|
4292
|
+
}
|
|
4293
|
+
else {
|
|
4294
|
+
setValueByPath(toObject, ['candidates'], fromCandidates);
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
|
|
4298
|
+
if (fromModelVersion != null) {
|
|
4299
|
+
setValueByPath(toObject, ['modelVersion'], fromModelVersion);
|
|
4300
|
+
}
|
|
4301
|
+
const fromPromptFeedback = getValueByPath(fromObject, [
|
|
4302
|
+
'promptFeedback',
|
|
4303
|
+
]);
|
|
4304
|
+
if (fromPromptFeedback != null) {
|
|
4305
|
+
setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
|
|
4306
|
+
}
|
|
4307
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
4308
|
+
'usageMetadata',
|
|
4309
|
+
]);
|
|
4310
|
+
if (fromUsageMetadata != null) {
|
|
4311
|
+
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
4312
|
+
}
|
|
4313
|
+
return toObject;
|
|
4314
|
+
}
|
|
4315
|
+
function contentEmbeddingFromMldev(apiClient, fromObject) {
|
|
4316
|
+
const toObject = {};
|
|
4317
|
+
const fromValues = getValueByPath(fromObject, ['values']);
|
|
4318
|
+
if (fromValues != null) {
|
|
4319
|
+
setValueByPath(toObject, ['values'], fromValues);
|
|
4320
|
+
}
|
|
4321
|
+
return toObject;
|
|
4322
|
+
}
|
|
4323
|
+
function embedContentMetadataFromMldev() {
|
|
4324
|
+
const toObject = {};
|
|
4325
|
+
return toObject;
|
|
4326
|
+
}
|
|
4327
|
+
function embedContentResponseFromMldev(apiClient, fromObject) {
|
|
4328
|
+
const toObject = {};
|
|
4329
|
+
const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
|
|
4330
|
+
if (fromEmbeddings != null) {
|
|
4331
|
+
if (Array.isArray(fromEmbeddings)) {
|
|
4332
|
+
setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
|
|
4333
|
+
return contentEmbeddingFromMldev(apiClient, item);
|
|
4334
|
+
}));
|
|
4335
|
+
}
|
|
4336
|
+
else {
|
|
4337
|
+
setValueByPath(toObject, ['embeddings'], fromEmbeddings);
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
4341
|
+
if (fromMetadata != null) {
|
|
4342
|
+
setValueByPath(toObject, ['metadata'], embedContentMetadataFromMldev());
|
|
4343
|
+
}
|
|
4344
|
+
return toObject;
|
|
4345
|
+
}
|
|
4346
|
+
function imageFromMldev(apiClient, fromObject) {
|
|
4347
|
+
const toObject = {};
|
|
4348
|
+
const fromImageBytes = getValueByPath(fromObject, [
|
|
4349
|
+
'bytesBase64Encoded',
|
|
4350
|
+
]);
|
|
4351
|
+
if (fromImageBytes != null) {
|
|
4352
|
+
setValueByPath(toObject, ['imageBytes'], tBytes(apiClient, fromImageBytes));
|
|
4353
|
+
}
|
|
4354
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4355
|
+
if (fromMimeType != null) {
|
|
4356
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4357
|
+
}
|
|
4358
|
+
return toObject;
|
|
4359
|
+
}
|
|
4360
|
+
function safetyAttributesFromMldev(apiClient, fromObject) {
|
|
4361
|
+
const toObject = {};
|
|
4362
|
+
const fromCategories = getValueByPath(fromObject, [
|
|
4363
|
+
'safetyAttributes',
|
|
4364
|
+
'categories',
|
|
4365
|
+
]);
|
|
4366
|
+
if (fromCategories != null) {
|
|
4367
|
+
setValueByPath(toObject, ['categories'], fromCategories);
|
|
4368
|
+
}
|
|
4369
|
+
const fromScores = getValueByPath(fromObject, [
|
|
4370
|
+
'safetyAttributes',
|
|
4371
|
+
'scores',
|
|
4372
|
+
]);
|
|
4373
|
+
if (fromScores != null) {
|
|
4374
|
+
setValueByPath(toObject, ['scores'], fromScores);
|
|
4375
|
+
}
|
|
4376
|
+
const fromContentType = getValueByPath(fromObject, ['contentType']);
|
|
4377
|
+
if (fromContentType != null) {
|
|
4378
|
+
setValueByPath(toObject, ['contentType'], fromContentType);
|
|
4379
|
+
}
|
|
4380
|
+
return toObject;
|
|
4381
|
+
}
|
|
4382
|
+
function generatedImageFromMldev(apiClient, fromObject) {
|
|
4383
|
+
const toObject = {};
|
|
4384
|
+
const fromImage = getValueByPath(fromObject, ['_self']);
|
|
4385
|
+
if (fromImage != null) {
|
|
4386
|
+
setValueByPath(toObject, ['image'], imageFromMldev(apiClient, fromImage));
|
|
4387
|
+
}
|
|
4388
|
+
const fromRaiFilteredReason = getValueByPath(fromObject, [
|
|
4389
|
+
'raiFilteredReason',
|
|
4390
|
+
]);
|
|
4391
|
+
if (fromRaiFilteredReason != null) {
|
|
4392
|
+
setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
|
|
4393
|
+
}
|
|
4394
|
+
const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
|
|
4395
|
+
if (fromSafetyAttributes != null) {
|
|
4396
|
+
setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromMldev(apiClient, fromSafetyAttributes));
|
|
4397
|
+
}
|
|
4398
|
+
return toObject;
|
|
4399
|
+
}
|
|
4400
|
+
function generateImagesResponseFromMldev(apiClient, fromObject) {
|
|
4401
|
+
const toObject = {};
|
|
4402
|
+
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
4403
|
+
'predictions',
|
|
4404
|
+
]);
|
|
4405
|
+
if (fromGeneratedImages != null) {
|
|
4406
|
+
if (Array.isArray(fromGeneratedImages)) {
|
|
4407
|
+
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
|
|
4408
|
+
return generatedImageFromMldev(apiClient, item);
|
|
4409
|
+
}));
|
|
4410
|
+
}
|
|
4411
|
+
else {
|
|
4412
|
+
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
|
|
4416
|
+
'positivePromptSafetyAttributes',
|
|
4417
|
+
]);
|
|
4418
|
+
if (fromPositivePromptSafetyAttributes != null) {
|
|
4419
|
+
setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromMldev(apiClient, fromPositivePromptSafetyAttributes));
|
|
4420
|
+
}
|
|
4421
|
+
return toObject;
|
|
4422
|
+
}
|
|
4423
|
+
function countTokensResponseFromMldev(apiClient, fromObject) {
|
|
4424
|
+
const toObject = {};
|
|
4425
|
+
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
4426
|
+
if (fromTotalTokens != null) {
|
|
4427
|
+
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
4428
|
+
}
|
|
4429
|
+
const fromCachedContentTokenCount = getValueByPath(fromObject, [
|
|
4430
|
+
'cachedContentTokenCount',
|
|
4431
|
+
]);
|
|
4432
|
+
if (fromCachedContentTokenCount != null) {
|
|
4433
|
+
setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
|
|
4434
|
+
}
|
|
4435
|
+
return toObject;
|
|
4436
|
+
}
|
|
4437
|
+
function partFromVertex(apiClient, fromObject) {
|
|
4438
|
+
const toObject = {};
|
|
4439
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
4440
|
+
'videoMetadata',
|
|
4441
|
+
]);
|
|
4442
|
+
if (fromVideoMetadata != null) {
|
|
4443
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
4444
|
+
}
|
|
4445
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4446
|
+
if (fromThought != null) {
|
|
4447
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
4448
|
+
}
|
|
4449
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4450
|
+
'codeExecutionResult',
|
|
4451
|
+
]);
|
|
4452
|
+
if (fromCodeExecutionResult != null) {
|
|
4453
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
4454
|
+
}
|
|
4455
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
4456
|
+
'executableCode',
|
|
4457
|
+
]);
|
|
4458
|
+
if (fromExecutableCode != null) {
|
|
4459
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4460
|
+
}
|
|
4461
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4462
|
+
if (fromFileData != null) {
|
|
4463
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
4464
|
+
}
|
|
4465
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4466
|
+
if (fromFunctionCall != null) {
|
|
4467
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4468
|
+
}
|
|
4469
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4470
|
+
'functionResponse',
|
|
4471
|
+
]);
|
|
4472
|
+
if (fromFunctionResponse != null) {
|
|
4473
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4474
|
+
}
|
|
4475
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4476
|
+
if (fromInlineData != null) {
|
|
4477
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4478
|
+
}
|
|
4479
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
4480
|
+
if (fromText != null) {
|
|
4481
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
4326
4482
|
}
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4483
|
+
return toObject;
|
|
4484
|
+
}
|
|
4485
|
+
function contentFromVertex(apiClient, fromObject) {
|
|
4486
|
+
const toObject = {};
|
|
4487
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4488
|
+
if (fromParts != null) {
|
|
4489
|
+
if (Array.isArray(fromParts)) {
|
|
4490
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
4491
|
+
return partFromVertex(apiClient, item);
|
|
4492
|
+
}));
|
|
4493
|
+
}
|
|
4494
|
+
else {
|
|
4495
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
4496
|
+
}
|
|
4330
4497
|
}
|
|
4331
|
-
const
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
if (fromLogprobsResult != null) {
|
|
4335
|
-
setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
|
|
4498
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4499
|
+
if (fromRole != null) {
|
|
4500
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
4336
4501
|
}
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4502
|
+
return toObject;
|
|
4503
|
+
}
|
|
4504
|
+
function citationMetadataFromVertex(apiClient, fromObject) {
|
|
4505
|
+
const toObject = {};
|
|
4506
|
+
const fromCitations = getValueByPath(fromObject, ['citations']);
|
|
4507
|
+
if (fromCitations != null) {
|
|
4508
|
+
setValueByPath(toObject, ['citations'], fromCitations);
|
|
4342
4509
|
}
|
|
4343
4510
|
return toObject;
|
|
4344
4511
|
}
|
|
@@ -4392,37 +4559,6 @@ function candidateFromVertex(apiClient, fromObject) {
|
|
|
4392
4559
|
}
|
|
4393
4560
|
return toObject;
|
|
4394
4561
|
}
|
|
4395
|
-
function generateContentResponseFromMldev(apiClient, fromObject) {
|
|
4396
|
-
const toObject = {};
|
|
4397
|
-
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
4398
|
-
if (fromCandidates != null) {
|
|
4399
|
-
if (Array.isArray(fromCandidates)) {
|
|
4400
|
-
setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
|
|
4401
|
-
return candidateFromMldev(apiClient, item);
|
|
4402
|
-
}));
|
|
4403
|
-
}
|
|
4404
|
-
else {
|
|
4405
|
-
setValueByPath(toObject, ['candidates'], fromCandidates);
|
|
4406
|
-
}
|
|
4407
|
-
}
|
|
4408
|
-
const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
|
|
4409
|
-
if (fromModelVersion != null) {
|
|
4410
|
-
setValueByPath(toObject, ['modelVersion'], fromModelVersion);
|
|
4411
|
-
}
|
|
4412
|
-
const fromPromptFeedback = getValueByPath(fromObject, [
|
|
4413
|
-
'promptFeedback',
|
|
4414
|
-
]);
|
|
4415
|
-
if (fromPromptFeedback != null) {
|
|
4416
|
-
setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
|
|
4417
|
-
}
|
|
4418
|
-
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
4419
|
-
'usageMetadata',
|
|
4420
|
-
]);
|
|
4421
|
-
if (fromUsageMetadata != null) {
|
|
4422
|
-
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
4423
|
-
}
|
|
4424
|
-
return toObject;
|
|
4425
|
-
}
|
|
4426
4562
|
function generateContentResponseFromVertex(apiClient, fromObject) {
|
|
4427
4563
|
const toObject = {};
|
|
4428
4564
|
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
@@ -4474,14 +4610,6 @@ function contentEmbeddingStatisticsFromVertex(apiClient, fromObject) {
|
|
|
4474
4610
|
}
|
|
4475
4611
|
return toObject;
|
|
4476
4612
|
}
|
|
4477
|
-
function contentEmbeddingFromMldev(apiClient, fromObject) {
|
|
4478
|
-
const toObject = {};
|
|
4479
|
-
const fromValues = getValueByPath(fromObject, ['values']);
|
|
4480
|
-
if (fromValues != null) {
|
|
4481
|
-
setValueByPath(toObject, ['values'], fromValues);
|
|
4482
|
-
}
|
|
4483
|
-
return toObject;
|
|
4484
|
-
}
|
|
4485
4613
|
function contentEmbeddingFromVertex(apiClient, fromObject) {
|
|
4486
4614
|
const toObject = {};
|
|
4487
4615
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -4494,10 +4622,6 @@ function contentEmbeddingFromVertex(apiClient, fromObject) {
|
|
|
4494
4622
|
}
|
|
4495
4623
|
return toObject;
|
|
4496
4624
|
}
|
|
4497
|
-
function embedContentMetadataFromMldev() {
|
|
4498
|
-
const toObject = {};
|
|
4499
|
-
return toObject;
|
|
4500
|
-
}
|
|
4501
4625
|
function embedContentMetadataFromVertex(apiClient, fromObject) {
|
|
4502
4626
|
const toObject = {};
|
|
4503
4627
|
const fromBillableCharacterCount = getValueByPath(fromObject, [
|
|
@@ -4508,25 +4632,6 @@ function embedContentMetadataFromVertex(apiClient, fromObject) {
|
|
|
4508
4632
|
}
|
|
4509
4633
|
return toObject;
|
|
4510
4634
|
}
|
|
4511
|
-
function embedContentResponseFromMldev(apiClient, fromObject) {
|
|
4512
|
-
const toObject = {};
|
|
4513
|
-
const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
|
|
4514
|
-
if (fromEmbeddings != null) {
|
|
4515
|
-
if (Array.isArray(fromEmbeddings)) {
|
|
4516
|
-
setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
|
|
4517
|
-
return contentEmbeddingFromMldev(apiClient, item);
|
|
4518
|
-
}));
|
|
4519
|
-
}
|
|
4520
|
-
else {
|
|
4521
|
-
setValueByPath(toObject, ['embeddings'], fromEmbeddings);
|
|
4522
|
-
}
|
|
4523
|
-
}
|
|
4524
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
4525
|
-
if (fromMetadata != null) {
|
|
4526
|
-
setValueByPath(toObject, ['metadata'], embedContentMetadataFromMldev());
|
|
4527
|
-
}
|
|
4528
|
-
return toObject;
|
|
4529
|
-
}
|
|
4530
4635
|
function embedContentResponseFromVertex(apiClient, fromObject) {
|
|
4531
4636
|
const toObject = {};
|
|
4532
4637
|
const fromEmbeddings = getValueByPath(fromObject, [
|
|
@@ -4549,20 +4654,6 @@ function embedContentResponseFromVertex(apiClient, fromObject) {
|
|
|
4549
4654
|
}
|
|
4550
4655
|
return toObject;
|
|
4551
4656
|
}
|
|
4552
|
-
function imageFromMldev(apiClient, fromObject) {
|
|
4553
|
-
const toObject = {};
|
|
4554
|
-
const fromImageBytes = getValueByPath(fromObject, [
|
|
4555
|
-
'bytesBase64Encoded',
|
|
4556
|
-
]);
|
|
4557
|
-
if (fromImageBytes != null) {
|
|
4558
|
-
setValueByPath(toObject, ['imageBytes'], tBytes(apiClient, fromImageBytes));
|
|
4559
|
-
}
|
|
4560
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4561
|
-
if (fromMimeType != null) {
|
|
4562
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
4563
|
-
}
|
|
4564
|
-
return toObject;
|
|
4565
|
-
}
|
|
4566
4657
|
function imageFromVertex(apiClient, fromObject) {
|
|
4567
4658
|
const toObject = {};
|
|
4568
4659
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
@@ -4581,24 +4672,6 @@ function imageFromVertex(apiClient, fromObject) {
|
|
|
4581
4672
|
}
|
|
4582
4673
|
return toObject;
|
|
4583
4674
|
}
|
|
4584
|
-
function safetyAttributesFromMldev(apiClient, fromObject) {
|
|
4585
|
-
const toObject = {};
|
|
4586
|
-
const fromCategories = getValueByPath(fromObject, [
|
|
4587
|
-
'safetyAttributes',
|
|
4588
|
-
'categories',
|
|
4589
|
-
]);
|
|
4590
|
-
if (fromCategories != null) {
|
|
4591
|
-
setValueByPath(toObject, ['categories'], fromCategories);
|
|
4592
|
-
}
|
|
4593
|
-
const fromScores = getValueByPath(fromObject, [
|
|
4594
|
-
'safetyAttributes',
|
|
4595
|
-
'scores',
|
|
4596
|
-
]);
|
|
4597
|
-
if (fromScores != null) {
|
|
4598
|
-
setValueByPath(toObject, ['scores'], fromScores);
|
|
4599
|
-
}
|
|
4600
|
-
return toObject;
|
|
4601
|
-
}
|
|
4602
4675
|
function safetyAttributesFromVertex(apiClient, fromObject) {
|
|
4603
4676
|
const toObject = {};
|
|
4604
4677
|
const fromCategories = getValueByPath(fromObject, [
|
|
@@ -4615,23 +4688,9 @@ function safetyAttributesFromVertex(apiClient, fromObject) {
|
|
|
4615
4688
|
if (fromScores != null) {
|
|
4616
4689
|
setValueByPath(toObject, ['scores'], fromScores);
|
|
4617
4690
|
}
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
const toObject = {};
|
|
4622
|
-
const fromImage = getValueByPath(fromObject, ['_self']);
|
|
4623
|
-
if (fromImage != null) {
|
|
4624
|
-
setValueByPath(toObject, ['image'], imageFromMldev(apiClient, fromImage));
|
|
4625
|
-
}
|
|
4626
|
-
const fromRaiFilteredReason = getValueByPath(fromObject, [
|
|
4627
|
-
'raiFilteredReason',
|
|
4628
|
-
]);
|
|
4629
|
-
if (fromRaiFilteredReason != null) {
|
|
4630
|
-
setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
|
|
4631
|
-
}
|
|
4632
|
-
const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
|
|
4633
|
-
if (fromSafetyAttributes != null) {
|
|
4634
|
-
setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromMldev(apiClient, fromSafetyAttributes));
|
|
4691
|
+
const fromContentType = getValueByPath(fromObject, ['contentType']);
|
|
4692
|
+
if (fromContentType != null) {
|
|
4693
|
+
setValueByPath(toObject, ['contentType'], fromContentType);
|
|
4635
4694
|
}
|
|
4636
4695
|
return toObject;
|
|
4637
4696
|
}
|
|
@@ -4657,23 +4716,6 @@ function generatedImageFromVertex(apiClient, fromObject) {
|
|
|
4657
4716
|
}
|
|
4658
4717
|
return toObject;
|
|
4659
4718
|
}
|
|
4660
|
-
function generateImagesResponseFromMldev(apiClient, fromObject) {
|
|
4661
|
-
const toObject = {};
|
|
4662
|
-
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
4663
|
-
'predictions',
|
|
4664
|
-
]);
|
|
4665
|
-
if (fromGeneratedImages != null) {
|
|
4666
|
-
if (Array.isArray(fromGeneratedImages)) {
|
|
4667
|
-
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
|
|
4668
|
-
return generatedImageFromMldev(apiClient, item);
|
|
4669
|
-
}));
|
|
4670
|
-
}
|
|
4671
|
-
else {
|
|
4672
|
-
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
4673
|
-
}
|
|
4674
|
-
}
|
|
4675
|
-
return toObject;
|
|
4676
|
-
}
|
|
4677
4719
|
function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
4678
4720
|
const toObject = {};
|
|
4679
4721
|
const fromGeneratedImages = getValueByPath(fromObject, [
|
|
@@ -4689,19 +4731,11 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
4689
4731
|
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
4690
4732
|
}
|
|
4691
4733
|
}
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
function countTokensResponseFromMldev(apiClient, fromObject) {
|
|
4695
|
-
const toObject = {};
|
|
4696
|
-
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
4697
|
-
if (fromTotalTokens != null) {
|
|
4698
|
-
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
4699
|
-
}
|
|
4700
|
-
const fromCachedContentTokenCount = getValueByPath(fromObject, [
|
|
4701
|
-
'cachedContentTokenCount',
|
|
4734
|
+
const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
|
|
4735
|
+
'positivePromptSafetyAttributes',
|
|
4702
4736
|
]);
|
|
4703
|
-
if (
|
|
4704
|
-
setValueByPath(toObject, ['
|
|
4737
|
+
if (fromPositivePromptSafetyAttributes != null) {
|
|
4738
|
+
setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromVertex(apiClient, fromPositivePromptSafetyAttributes));
|
|
4705
4739
|
}
|
|
4706
4740
|
return toObject;
|
|
4707
4741
|
}
|
|
@@ -5446,6 +5480,59 @@ class Models extends BaseModule {
|
|
|
5446
5480
|
this.generateContentStream = async (params) => {
|
|
5447
5481
|
return await this.generateContentStreamInternal(params);
|
|
5448
5482
|
};
|
|
5483
|
+
/**
|
|
5484
|
+
* Generates an image based on a text description and configuration.
|
|
5485
|
+
*
|
|
5486
|
+
* @param model - The model to use.
|
|
5487
|
+
* @param prompt - A text description of the image to generate.
|
|
5488
|
+
* @param [config] - The config for image generation.
|
|
5489
|
+
* @return The response from the API.
|
|
5490
|
+
*
|
|
5491
|
+
* @example
|
|
5492
|
+
* ```ts
|
|
5493
|
+
* const response = await client.models.generateImages({
|
|
5494
|
+
* model: 'imagen-3.0-generate-002',
|
|
5495
|
+
* prompt: 'Robot holding a red skateboard',
|
|
5496
|
+
* config: {
|
|
5497
|
+
* numberOfImages: 1,
|
|
5498
|
+
* includeRaiReason: true,
|
|
5499
|
+
* },
|
|
5500
|
+
* });
|
|
5501
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
5502
|
+
* ```
|
|
5503
|
+
*/
|
|
5504
|
+
this.generateImages = async (params) => {
|
|
5505
|
+
return await this.generateImagesInternal(params).then((apiResponse) => {
|
|
5506
|
+
var _a;
|
|
5507
|
+
let positivePromptSafetyAttributes;
|
|
5508
|
+
const generatedImages = [];
|
|
5509
|
+
if (apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.generatedImages) {
|
|
5510
|
+
for (const generatedImage of apiResponse.generatedImages) {
|
|
5511
|
+
if (generatedImage &&
|
|
5512
|
+
(generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes) &&
|
|
5513
|
+
((_a = generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes) === null || _a === void 0 ? void 0 : _a.contentType) === 'Positive Prompt') {
|
|
5514
|
+
positivePromptSafetyAttributes = generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes;
|
|
5515
|
+
}
|
|
5516
|
+
else {
|
|
5517
|
+
generatedImages.push(generatedImage);
|
|
5518
|
+
}
|
|
5519
|
+
}
|
|
5520
|
+
}
|
|
5521
|
+
let response;
|
|
5522
|
+
if (positivePromptSafetyAttributes) {
|
|
5523
|
+
response = {
|
|
5524
|
+
generatedImages: generatedImages,
|
|
5525
|
+
positivePromptSafetyAttributes: positivePromptSafetyAttributes,
|
|
5526
|
+
};
|
|
5527
|
+
}
|
|
5528
|
+
else {
|
|
5529
|
+
response = {
|
|
5530
|
+
generatedImages: generatedImages,
|
|
5531
|
+
};
|
|
5532
|
+
}
|
|
5533
|
+
return response;
|
|
5534
|
+
});
|
|
5535
|
+
};
|
|
5449
5536
|
}
|
|
5450
5537
|
async generateContentInternal(params) {
|
|
5451
5538
|
var _a, _b;
|
|
@@ -5683,7 +5770,7 @@ class Models extends BaseModule {
|
|
|
5683
5770
|
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
5684
5771
|
* ```
|
|
5685
5772
|
*/
|
|
5686
|
-
async
|
|
5773
|
+
async generateImagesInternal(params) {
|
|
5687
5774
|
var _a, _b;
|
|
5688
5775
|
let response;
|
|
5689
5776
|
let path = '';
|
|
@@ -5873,7 +5960,7 @@ class Models extends BaseModule {
|
|
|
5873
5960
|
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
5874
5961
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
5875
5962
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
5876
|
-
const SDK_VERSION = '0.6.
|
|
5963
|
+
const SDK_VERSION = '0.6.1'; // x-release-please-version
|
|
5877
5964
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
5878
5965
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
5879
5966
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6418,6 +6505,18 @@ function getFileParametersToMldev(apiClient, fromObject) {
|
|
|
6418
6505
|
}
|
|
6419
6506
|
return toObject;
|
|
6420
6507
|
}
|
|
6508
|
+
function deleteFileParametersToMldev(apiClient, fromObject) {
|
|
6509
|
+
const toObject = {};
|
|
6510
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
6511
|
+
if (fromName != null) {
|
|
6512
|
+
setValueByPath(toObject, ['_url', 'file'], tFileName(apiClient, fromName));
|
|
6513
|
+
}
|
|
6514
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6515
|
+
if (fromConfig != null) {
|
|
6516
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
6517
|
+
}
|
|
6518
|
+
return toObject;
|
|
6519
|
+
}
|
|
6421
6520
|
function fileStatusFromMldev(apiClient, fromObject) {
|
|
6422
6521
|
const toObject = {};
|
|
6423
6522
|
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
@@ -6527,6 +6626,10 @@ function createFileResponseFromMldev(apiClient, fromObject) {
|
|
|
6527
6626
|
}
|
|
6528
6627
|
return toObject;
|
|
6529
6628
|
}
|
|
6629
|
+
function deleteFileResponseFromMldev() {
|
|
6630
|
+
const toObject = {};
|
|
6631
|
+
return toObject;
|
|
6632
|
+
}
|
|
6530
6633
|
|
|
6531
6634
|
/**
|
|
6532
6635
|
* @license
|
|
@@ -6726,6 +6829,53 @@ class Files extends BaseModule {
|
|
|
6726
6829
|
});
|
|
6727
6830
|
}
|
|
6728
6831
|
}
|
|
6832
|
+
/**
|
|
6833
|
+
* Deletes a remotely stored file.
|
|
6834
|
+
*
|
|
6835
|
+
* @param params - The parameters for the delete request.
|
|
6836
|
+
* @return The DeleteFileResponse, the response for the delete method.
|
|
6837
|
+
*
|
|
6838
|
+
* @example
|
|
6839
|
+
* The following code deletes an example file named "files/mehozpxf877d".
|
|
6840
|
+
*
|
|
6841
|
+
* ```ts
|
|
6842
|
+
* await ai.files.delete({name: file.name});
|
|
6843
|
+
* ```
|
|
6844
|
+
*/
|
|
6845
|
+
async delete(params) {
|
|
6846
|
+
var _a;
|
|
6847
|
+
let response;
|
|
6848
|
+
let path = '';
|
|
6849
|
+
let queryParams = {};
|
|
6850
|
+
if (this.apiClient.isVertexAI()) {
|
|
6851
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
6852
|
+
}
|
|
6853
|
+
else {
|
|
6854
|
+
const body = deleteFileParametersToMldev(this.apiClient, params);
|
|
6855
|
+
path = formatMap('files/{file}', body['_url']);
|
|
6856
|
+
queryParams = body['_query'];
|
|
6857
|
+
delete body['config'];
|
|
6858
|
+
delete body['_url'];
|
|
6859
|
+
delete body['_query'];
|
|
6860
|
+
response = this.apiClient
|
|
6861
|
+
.request({
|
|
6862
|
+
path: path,
|
|
6863
|
+
queryParams: queryParams,
|
|
6864
|
+
body: JSON.stringify(body),
|
|
6865
|
+
httpMethod: 'DELETE',
|
|
6866
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
6867
|
+
})
|
|
6868
|
+
.then((httpResponse) => {
|
|
6869
|
+
return httpResponse.json();
|
|
6870
|
+
});
|
|
6871
|
+
return response.then(() => {
|
|
6872
|
+
const resp = deleteFileResponseFromMldev();
|
|
6873
|
+
const typedResp = new DeleteFileResponse();
|
|
6874
|
+
Object.assign(typedResp, resp);
|
|
6875
|
+
return typedResp;
|
|
6876
|
+
});
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6729
6879
|
}
|
|
6730
6880
|
|
|
6731
6881
|
const MAX_CHUNK_SIZE = 1024 * 1024 * 8; // bytes
|
|
@@ -6928,5 +7078,5 @@ class GoogleGenAI {
|
|
|
6928
7078
|
}
|
|
6929
7079
|
}
|
|
6930
7080
|
|
|
6931
|
-
export { BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DynamicRetrievalConfigMode, EmbedContentResponse, FileSource, FileState, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, MaskReferenceMode, MediaResolution, Modality, Mode, Models, Outcome, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, State, SubjectReferenceType, Type, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent };
|
|
7081
|
+
export { BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DynamicRetrievalConfigMode, EmbedContentResponse, FileSource, FileState, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, MaskReferenceMode, MediaResolution, Modality, Mode, Models, Outcome, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, State, SubjectReferenceType, Type, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent };
|
|
6932
7082
|
//# sourceMappingURL=index.mjs.map
|