@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/index.js CHANGED
@@ -233,7 +233,8 @@ function tContent(apiClient, origin) {
233
233
  throw new Error('ContentUnion is required');
234
234
  }
235
235
  if (_isContent(origin)) {
236
- // @ts-expect-error: _isContent is a utility function that checks if the origin is a Content.
236
+ // @ts-expect-error: _isContent is a utility function that checks if the
237
+ // origin is a Content.
237
238
  return origin;
238
239
  }
239
240
  if (_isUserPart(origin)) {
@@ -346,9 +347,6 @@ function tContents(apiClient, origin) {
346
347
  }
347
348
  function processSchema(apiClient, schema) {
348
349
  if (!apiClient.isVertexAI()) {
349
- if ('title' in schema) {
350
- delete schema['title'];
351
- }
352
350
  if ('default' in schema) {
353
351
  throw new Error('Default value is not supported in the response schema for the Gemini API.');
354
352
  }
@@ -360,6 +358,18 @@ function processSchema(apiClient, schema) {
360
358
  }
361
359
  }
362
360
  }
361
+ if ('items' in schema) {
362
+ if (schema['items'] !== undefined) {
363
+ processSchema(apiClient, schema['items']);
364
+ }
365
+ }
366
+ if ('properties' in schema) {
367
+ if (schema['properties'] !== undefined) {
368
+ for (const subSchema of Object.values(schema['properties'])) {
369
+ processSchema(apiClient, subSchema);
370
+ }
371
+ }
372
+ }
363
373
  }
364
374
  function tSchema(apiClient, schema) {
365
375
  processSchema(apiClient, schema);
@@ -542,54 +552,6 @@ function partToMldev$1(apiClient, fromObject) {
542
552
  }
543
553
  return toObject;
544
554
  }
545
- function partToVertex$1(apiClient, fromObject) {
546
- const toObject = {};
547
- const fromVideoMetadata = getValueByPath(fromObject, [
548
- 'videoMetadata',
549
- ]);
550
- if (fromVideoMetadata != null) {
551
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
552
- }
553
- const fromThought = getValueByPath(fromObject, ['thought']);
554
- if (fromThought != null) {
555
- setValueByPath(toObject, ['thought'], fromThought);
556
- }
557
- const fromCodeExecutionResult = getValueByPath(fromObject, [
558
- 'codeExecutionResult',
559
- ]);
560
- if (fromCodeExecutionResult != null) {
561
- setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
562
- }
563
- const fromExecutableCode = getValueByPath(fromObject, [
564
- 'executableCode',
565
- ]);
566
- if (fromExecutableCode != null) {
567
- setValueByPath(toObject, ['executableCode'], fromExecutableCode);
568
- }
569
- const fromFileData = getValueByPath(fromObject, ['fileData']);
570
- if (fromFileData != null) {
571
- setValueByPath(toObject, ['fileData'], fromFileData);
572
- }
573
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
574
- if (fromFunctionCall != null) {
575
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
576
- }
577
- const fromFunctionResponse = getValueByPath(fromObject, [
578
- 'functionResponse',
579
- ]);
580
- if (fromFunctionResponse != null) {
581
- setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
582
- }
583
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
584
- if (fromInlineData != null) {
585
- setValueByPath(toObject, ['inlineData'], fromInlineData);
586
- }
587
- const fromText = getValueByPath(fromObject, ['text']);
588
- if (fromText != null) {
589
- setValueByPath(toObject, ['text'], fromText);
590
- }
591
- return toObject;
592
- }
593
555
  function contentToMldev$1(apiClient, fromObject) {
594
556
  const toObject = {};
595
557
  const fromParts = getValueByPath(fromObject, ['parts']);
@@ -609,123 +571,6 @@ function contentToMldev$1(apiClient, fromObject) {
609
571
  }
610
572
  return toObject;
611
573
  }
612
- function contentToVertex$1(apiClient, fromObject) {
613
- const toObject = {};
614
- const fromParts = getValueByPath(fromObject, ['parts']);
615
- if (fromParts != null) {
616
- if (Array.isArray(fromParts)) {
617
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
618
- return partToVertex$1(apiClient, item);
619
- }));
620
- }
621
- else {
622
- setValueByPath(toObject, ['parts'], fromParts);
623
- }
624
- }
625
- const fromRole = getValueByPath(fromObject, ['role']);
626
- if (fromRole != null) {
627
- setValueByPath(toObject, ['role'], fromRole);
628
- }
629
- return toObject;
630
- }
631
- function schemaToVertex$1(apiClient, fromObject) {
632
- const toObject = {};
633
- const fromExample = getValueByPath(fromObject, ['example']);
634
- if (fromExample != null) {
635
- setValueByPath(toObject, ['example'], fromExample);
636
- }
637
- const fromPattern = getValueByPath(fromObject, ['pattern']);
638
- if (fromPattern != null) {
639
- setValueByPath(toObject, ['pattern'], fromPattern);
640
- }
641
- const fromDefault = getValueByPath(fromObject, ['default']);
642
- if (fromDefault != null) {
643
- setValueByPath(toObject, ['default'], fromDefault);
644
- }
645
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
646
- if (fromMaxLength != null) {
647
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
648
- }
649
- const fromTitle = getValueByPath(fromObject, ['title']);
650
- if (fromTitle != null) {
651
- setValueByPath(toObject, ['title'], fromTitle);
652
- }
653
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
654
- if (fromMinLength != null) {
655
- setValueByPath(toObject, ['minLength'], fromMinLength);
656
- }
657
- const fromMinProperties = getValueByPath(fromObject, [
658
- 'minProperties',
659
- ]);
660
- if (fromMinProperties != null) {
661
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
662
- }
663
- const fromMaxProperties = getValueByPath(fromObject, [
664
- 'maxProperties',
665
- ]);
666
- if (fromMaxProperties != null) {
667
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
668
- }
669
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
670
- if (fromAnyOf != null) {
671
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
672
- }
673
- const fromDescription = getValueByPath(fromObject, ['description']);
674
- if (fromDescription != null) {
675
- setValueByPath(toObject, ['description'], fromDescription);
676
- }
677
- const fromEnum = getValueByPath(fromObject, ['enum']);
678
- if (fromEnum != null) {
679
- setValueByPath(toObject, ['enum'], fromEnum);
680
- }
681
- const fromFormat = getValueByPath(fromObject, ['format']);
682
- if (fromFormat != null) {
683
- setValueByPath(toObject, ['format'], fromFormat);
684
- }
685
- const fromItems = getValueByPath(fromObject, ['items']);
686
- if (fromItems != null) {
687
- setValueByPath(toObject, ['items'], fromItems);
688
- }
689
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
690
- if (fromMaxItems != null) {
691
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
692
- }
693
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
694
- if (fromMaximum != null) {
695
- setValueByPath(toObject, ['maximum'], fromMaximum);
696
- }
697
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
698
- if (fromMinItems != null) {
699
- setValueByPath(toObject, ['minItems'], fromMinItems);
700
- }
701
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
702
- if (fromMinimum != null) {
703
- setValueByPath(toObject, ['minimum'], fromMinimum);
704
- }
705
- const fromNullable = getValueByPath(fromObject, ['nullable']);
706
- if (fromNullable != null) {
707
- setValueByPath(toObject, ['nullable'], fromNullable);
708
- }
709
- const fromProperties = getValueByPath(fromObject, ['properties']);
710
- if (fromProperties != null) {
711
- setValueByPath(toObject, ['properties'], fromProperties);
712
- }
713
- const fromPropertyOrdering = getValueByPath(fromObject, [
714
- 'propertyOrdering',
715
- ]);
716
- if (fromPropertyOrdering != null) {
717
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
718
- }
719
- const fromRequired = getValueByPath(fromObject, ['required']);
720
- if (fromRequired != null) {
721
- setValueByPath(toObject, ['required'], fromRequired);
722
- }
723
- const fromType = getValueByPath(fromObject, ['type']);
724
- if (fromType != null) {
725
- setValueByPath(toObject, ['type'], fromType);
726
- }
727
- return toObject;
728
- }
729
574
  function functionDeclarationToMldev$1(apiClient, fromObject) {
730
575
  const toObject = {};
731
576
  if (getValueByPath(fromObject, ['response']) !== undefined) {
@@ -745,34 +590,10 @@ function functionDeclarationToMldev$1(apiClient, fromObject) {
745
590
  }
746
591
  return toObject;
747
592
  }
748
- function functionDeclarationToVertex$1(apiClient, fromObject) {
749
- const toObject = {};
750
- const fromResponse = getValueByPath(fromObject, ['response']);
751
- if (fromResponse != null) {
752
- setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
753
- }
754
- const fromDescription = getValueByPath(fromObject, ['description']);
755
- if (fromDescription != null) {
756
- setValueByPath(toObject, ['description'], fromDescription);
757
- }
758
- const fromName = getValueByPath(fromObject, ['name']);
759
- if (fromName != null) {
760
- setValueByPath(toObject, ['name'], fromName);
761
- }
762
- const fromParameters = getValueByPath(fromObject, ['parameters']);
763
- if (fromParameters != null) {
764
- setValueByPath(toObject, ['parameters'], fromParameters);
765
- }
766
- return toObject;
767
- }
768
593
  function googleSearchToMldev$1() {
769
594
  const toObject = {};
770
595
  return toObject;
771
596
  }
772
- function googleSearchToVertex$1() {
773
- const toObject = {};
774
- return toObject;
775
- }
776
597
  function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
777
598
  const toObject = {};
778
599
  const fromMode = getValueByPath(fromObject, ['mode']);
@@ -787,20 +608,6 @@ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
787
608
  }
788
609
  return toObject;
789
610
  }
790
- function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
791
- const toObject = {};
792
- const fromMode = getValueByPath(fromObject, ['mode']);
793
- if (fromMode != null) {
794
- setValueByPath(toObject, ['mode'], fromMode);
795
- }
796
- const fromDynamicThreshold = getValueByPath(fromObject, [
797
- 'dynamicThreshold',
798
- ]);
799
- if (fromDynamicThreshold != null) {
800
- setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
801
- }
802
- return toObject;
803
- }
804
611
  function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
805
612
  const toObject = {};
806
613
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
@@ -811,16 +618,6 @@ function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
811
618
  }
812
619
  return toObject;
813
620
  }
814
- function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
815
- const toObject = {};
816
- const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
817
- 'dynamicRetrievalConfig',
818
- ]);
819
- if (fromDynamicRetrievalConfig != null) {
820
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
821
- }
822
- return toObject;
823
- }
824
621
  function toolToMldev$1(apiClient, fromObject) {
825
622
  const toObject = {};
826
623
  const fromFunctionDeclarations = getValueByPath(fromObject, [
@@ -857,68 +654,17 @@ function toolToMldev$1(apiClient, fromObject) {
857
654
  }
858
655
  return toObject;
859
656
  }
860
- function toolToVertex$1(apiClient, fromObject) {
657
+ function functionCallingConfigToMldev$1(apiClient, fromObject) {
861
658
  const toObject = {};
862
- const fromFunctionDeclarations = getValueByPath(fromObject, [
863
- 'functionDeclarations',
864
- ]);
865
- if (fromFunctionDeclarations != null) {
866
- if (Array.isArray(fromFunctionDeclarations)) {
867
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
868
- return functionDeclarationToVertex$1(apiClient, item);
869
- }));
870
- }
871
- else {
872
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
873
- }
874
- }
875
- const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
876
- if (fromRetrieval != null) {
877
- setValueByPath(toObject, ['retrieval'], fromRetrieval);
878
- }
879
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
880
- if (fromGoogleSearch != null) {
881
- setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
659
+ const fromMode = getValueByPath(fromObject, ['mode']);
660
+ if (fromMode != null) {
661
+ setValueByPath(toObject, ['mode'], fromMode);
882
662
  }
883
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
884
- 'googleSearchRetrieval',
663
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
664
+ 'allowedFunctionNames',
885
665
  ]);
886
- if (fromGoogleSearchRetrieval != null) {
887
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
888
- }
889
- const fromCodeExecution = getValueByPath(fromObject, [
890
- 'codeExecution',
891
- ]);
892
- if (fromCodeExecution != null) {
893
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
894
- }
895
- return toObject;
896
- }
897
- function functionCallingConfigToMldev$1(apiClient, fromObject) {
898
- const toObject = {};
899
- const fromMode = getValueByPath(fromObject, ['mode']);
900
- if (fromMode != null) {
901
- setValueByPath(toObject, ['mode'], fromMode);
902
- }
903
- const fromAllowedFunctionNames = getValueByPath(fromObject, [
904
- 'allowedFunctionNames',
905
- ]);
906
- if (fromAllowedFunctionNames != null) {
907
- setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
908
- }
909
- return toObject;
910
- }
911
- function functionCallingConfigToVertex$1(apiClient, fromObject) {
912
- const toObject = {};
913
- const fromMode = getValueByPath(fromObject, ['mode']);
914
- if (fromMode != null) {
915
- setValueByPath(toObject, ['mode'], fromMode);
916
- }
917
- const fromAllowedFunctionNames = getValueByPath(fromObject, [
918
- 'allowedFunctionNames',
919
- ]);
920
- if (fromAllowedFunctionNames != null) {
921
- setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
666
+ if (fromAllowedFunctionNames != null) {
667
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
922
668
  }
923
669
  return toObject;
924
670
  }
@@ -932,16 +678,6 @@ function toolConfigToMldev$1(apiClient, fromObject) {
932
678
  }
933
679
  return toObject;
934
680
  }
935
- function toolConfigToVertex$1(apiClient, fromObject) {
936
- const toObject = {};
937
- const fromFunctionCallingConfig = getValueByPath(fromObject, [
938
- 'functionCallingConfig',
939
- ]);
940
- if (fromFunctionCallingConfig != null) {
941
- setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex$1(apiClient, fromFunctionCallingConfig));
942
- }
943
- return toObject;
944
- }
945
681
  function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
946
682
  const toObject = {};
947
683
  const fromTtl = getValueByPath(fromObject, ['ttl']);
@@ -990,54 +726,6 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
990
726
  }
991
727
  return toObject;
992
728
  }
993
- function createCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
994
- const toObject = {};
995
- const fromTtl = getValueByPath(fromObject, ['ttl']);
996
- if (parentObject !== undefined && fromTtl != null) {
997
- setValueByPath(parentObject, ['ttl'], fromTtl);
998
- }
999
- const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
1000
- if (parentObject !== undefined && fromExpireTime != null) {
1001
- setValueByPath(parentObject, ['expireTime'], fromExpireTime);
1002
- }
1003
- const fromDisplayName = getValueByPath(fromObject, ['displayName']);
1004
- if (parentObject !== undefined && fromDisplayName != null) {
1005
- setValueByPath(parentObject, ['displayName'], fromDisplayName);
1006
- }
1007
- const fromContents = getValueByPath(fromObject, ['contents']);
1008
- if (parentObject !== undefined && fromContents != null) {
1009
- if (Array.isArray(fromContents)) {
1010
- setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
1011
- return contentToVertex$1(apiClient, item);
1012
- })));
1013
- }
1014
- else {
1015
- setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
1016
- }
1017
- }
1018
- const fromSystemInstruction = getValueByPath(fromObject, [
1019
- 'systemInstruction',
1020
- ]);
1021
- if (parentObject !== undefined && fromSystemInstruction != null) {
1022
- setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
1023
- }
1024
- const fromTools = getValueByPath(fromObject, ['tools']);
1025
- if (parentObject !== undefined && fromTools != null) {
1026
- if (Array.isArray(fromTools)) {
1027
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
1028
- return toolToVertex$1(apiClient, item);
1029
- }));
1030
- }
1031
- else {
1032
- setValueByPath(parentObject, ['tools'], fromTools);
1033
- }
1034
- }
1035
- const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
1036
- if (parentObject !== undefined && fromToolConfig != null) {
1037
- setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex$1(apiClient, fromToolConfig));
1038
- }
1039
- return toObject;
1040
- }
1041
729
  function createCachedContentParametersToMldev(apiClient, fromObject) {
1042
730
  const toObject = {};
1043
731
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -1050,18 +738,6 @@ function createCachedContentParametersToMldev(apiClient, fromObject) {
1050
738
  }
1051
739
  return toObject;
1052
740
  }
1053
- function createCachedContentParametersToVertex(apiClient, fromObject) {
1054
- const toObject = {};
1055
- const fromModel = getValueByPath(fromObject, ['model']);
1056
- if (fromModel != null) {
1057
- setValueByPath(toObject, ['model'], tCachesModel(apiClient, fromModel));
1058
- }
1059
- const fromConfig = getValueByPath(fromObject, ['config']);
1060
- if (fromConfig != null) {
1061
- setValueByPath(toObject, ['config'], createCachedContentConfigToVertex(apiClient, fromConfig, toObject));
1062
- }
1063
- return toObject;
1064
- }
1065
741
  function getCachedContentParametersToMldev(apiClient, fromObject) {
1066
742
  const toObject = {};
1067
743
  const fromName = getValueByPath(fromObject, ['name']);
@@ -1074,18 +750,6 @@ function getCachedContentParametersToMldev(apiClient, fromObject) {
1074
750
  }
1075
751
  return toObject;
1076
752
  }
1077
- function getCachedContentParametersToVertex(apiClient, fromObject) {
1078
- const toObject = {};
1079
- const fromName = getValueByPath(fromObject, ['name']);
1080
- if (fromName != null) {
1081
- setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
1082
- }
1083
- const fromConfig = getValueByPath(fromObject, ['config']);
1084
- if (fromConfig != null) {
1085
- setValueByPath(toObject, ['config'], fromConfig);
1086
- }
1087
- return toObject;
1088
- }
1089
753
  function deleteCachedContentParametersToMldev(apiClient, fromObject) {
1090
754
  const toObject = {};
1091
755
  const fromName = getValueByPath(fromObject, ['name']);
@@ -1098,18 +762,6 @@ function deleteCachedContentParametersToMldev(apiClient, fromObject) {
1098
762
  }
1099
763
  return toObject;
1100
764
  }
1101
- function deleteCachedContentParametersToVertex(apiClient, fromObject) {
1102
- const toObject = {};
1103
- const fromName = getValueByPath(fromObject, ['name']);
1104
- if (fromName != null) {
1105
- setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
1106
- }
1107
- const fromConfig = getValueByPath(fromObject, ['config']);
1108
- if (fromConfig != null) {
1109
- setValueByPath(toObject, ['config'], fromConfig);
1110
- }
1111
- return toObject;
1112
- }
1113
765
  function updateCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
1114
766
  const toObject = {};
1115
767
  const fromTtl = getValueByPath(fromObject, ['ttl']);
@@ -1122,18 +774,6 @@ function updateCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
1122
774
  }
1123
775
  return toObject;
1124
776
  }
1125
- function updateCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
1126
- const toObject = {};
1127
- const fromTtl = getValueByPath(fromObject, ['ttl']);
1128
- if (parentObject !== undefined && fromTtl != null) {
1129
- setValueByPath(parentObject, ['ttl'], fromTtl);
1130
- }
1131
- const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
1132
- if (parentObject !== undefined && fromExpireTime != null) {
1133
- setValueByPath(parentObject, ['expireTime'], fromExpireTime);
1134
- }
1135
- return toObject;
1136
- }
1137
777
  function updateCachedContentParametersToMldev(apiClient, fromObject) {
1138
778
  const toObject = {};
1139
779
  const fromName = getValueByPath(fromObject, ['name']);
@@ -1146,18 +786,6 @@ function updateCachedContentParametersToMldev(apiClient, fromObject) {
1146
786
  }
1147
787
  return toObject;
1148
788
  }
1149
- function updateCachedContentParametersToVertex(apiClient, fromObject) {
1150
- const toObject = {};
1151
- const fromName = getValueByPath(fromObject, ['name']);
1152
- if (fromName != null) {
1153
- setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
1154
- }
1155
- const fromConfig = getValueByPath(fromObject, ['config']);
1156
- if (fromConfig != null) {
1157
- setValueByPath(toObject, ['config'], updateCachedContentConfigToVertex(apiClient, fromConfig, toObject));
1158
- }
1159
- return toObject;
1160
- }
1161
789
  function listCachedContentsConfigToMldev(apiClient, fromObject, parentObject) {
1162
790
  const toObject = {};
1163
791
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
@@ -1170,18 +798,6 @@ function listCachedContentsConfigToMldev(apiClient, fromObject, parentObject) {
1170
798
  }
1171
799
  return toObject;
1172
800
  }
1173
- function listCachedContentsConfigToVertex(apiClient, fromObject, parentObject) {
1174
- const toObject = {};
1175
- const fromPageSize = getValueByPath(fromObject, ['pageSize']);
1176
- if (parentObject !== undefined && fromPageSize != null) {
1177
- setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
1178
- }
1179
- const fromPageToken = getValueByPath(fromObject, ['pageToken']);
1180
- if (parentObject !== undefined && fromPageToken != null) {
1181
- setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
1182
- }
1183
- return toObject;
1184
- }
1185
801
  function listCachedContentsParametersToMldev(apiClient, fromObject) {
1186
802
  const toObject = {};
1187
803
  const fromConfig = getValueByPath(fromObject, ['config']);
@@ -1190,135 +806,529 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
1190
806
  }
1191
807
  return toObject;
1192
808
  }
1193
- function listCachedContentsParametersToVertex(apiClient, fromObject) {
1194
- const toObject = {};
1195
- const fromConfig = getValueByPath(fromObject, ['config']);
1196
- if (fromConfig != null) {
1197
- setValueByPath(toObject, ['config'], listCachedContentsConfigToVertex(apiClient, fromConfig, toObject));
1198
- }
1199
- return toObject;
1200
- }
1201
- function cachedContentFromMldev(apiClient, fromObject) {
809
+ function partToVertex$1(apiClient, fromObject) {
1202
810
  const toObject = {};
1203
- const fromName = getValueByPath(fromObject, ['name']);
1204
- if (fromName != null) {
1205
- setValueByPath(toObject, ['name'], fromName);
811
+ const fromVideoMetadata = getValueByPath(fromObject, [
812
+ 'videoMetadata',
813
+ ]);
814
+ if (fromVideoMetadata != null) {
815
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
1206
816
  }
1207
- const fromDisplayName = getValueByPath(fromObject, ['displayName']);
1208
- if (fromDisplayName != null) {
1209
- setValueByPath(toObject, ['displayName'], fromDisplayName);
817
+ const fromThought = getValueByPath(fromObject, ['thought']);
818
+ if (fromThought != null) {
819
+ setValueByPath(toObject, ['thought'], fromThought);
1210
820
  }
1211
- const fromModel = getValueByPath(fromObject, ['model']);
1212
- if (fromModel != null) {
1213
- setValueByPath(toObject, ['model'], fromModel);
821
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
822
+ 'codeExecutionResult',
823
+ ]);
824
+ if (fromCodeExecutionResult != null) {
825
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
1214
826
  }
1215
- const fromCreateTime = getValueByPath(fromObject, ['createTime']);
1216
- if (fromCreateTime != null) {
1217
- setValueByPath(toObject, ['createTime'], fromCreateTime);
827
+ const fromExecutableCode = getValueByPath(fromObject, [
828
+ 'executableCode',
829
+ ]);
830
+ if (fromExecutableCode != null) {
831
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
1218
832
  }
1219
- const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
1220
- if (fromUpdateTime != null) {
1221
- setValueByPath(toObject, ['updateTime'], fromUpdateTime);
833
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
834
+ if (fromFileData != null) {
835
+ setValueByPath(toObject, ['fileData'], fromFileData);
1222
836
  }
1223
- const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
1224
- if (fromExpireTime != null) {
1225
- setValueByPath(toObject, ['expireTime'], fromExpireTime);
837
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
838
+ if (fromFunctionCall != null) {
839
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
1226
840
  }
1227
- const fromUsageMetadata = getValueByPath(fromObject, [
1228
- 'usageMetadata',
841
+ const fromFunctionResponse = getValueByPath(fromObject, [
842
+ 'functionResponse',
1229
843
  ]);
1230
- if (fromUsageMetadata != null) {
1231
- setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
844
+ if (fromFunctionResponse != null) {
845
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
846
+ }
847
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
848
+ if (fromInlineData != null) {
849
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
850
+ }
851
+ const fromText = getValueByPath(fromObject, ['text']);
852
+ if (fromText != null) {
853
+ setValueByPath(toObject, ['text'], fromText);
1232
854
  }
1233
855
  return toObject;
1234
856
  }
1235
- function cachedContentFromVertex(apiClient, fromObject) {
857
+ function contentToVertex$1(apiClient, fromObject) {
1236
858
  const toObject = {};
1237
- const fromName = getValueByPath(fromObject, ['name']);
1238
- if (fromName != null) {
1239
- setValueByPath(toObject, ['name'], fromName);
1240
- }
1241
- const fromDisplayName = getValueByPath(fromObject, ['displayName']);
1242
- if (fromDisplayName != null) {
1243
- setValueByPath(toObject, ['displayName'], fromDisplayName);
859
+ const fromParts = getValueByPath(fromObject, ['parts']);
860
+ if (fromParts != null) {
861
+ if (Array.isArray(fromParts)) {
862
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
863
+ return partToVertex$1(apiClient, item);
864
+ }));
865
+ }
866
+ else {
867
+ setValueByPath(toObject, ['parts'], fromParts);
868
+ }
1244
869
  }
1245
- const fromModel = getValueByPath(fromObject, ['model']);
1246
- if (fromModel != null) {
1247
- setValueByPath(toObject, ['model'], fromModel);
870
+ const fromRole = getValueByPath(fromObject, ['role']);
871
+ if (fromRole != null) {
872
+ setValueByPath(toObject, ['role'], fromRole);
1248
873
  }
1249
- const fromCreateTime = getValueByPath(fromObject, ['createTime']);
1250
- if (fromCreateTime != null) {
1251
- setValueByPath(toObject, ['createTime'], fromCreateTime);
874
+ return toObject;
875
+ }
876
+ function schemaToVertex$1(apiClient, fromObject) {
877
+ const toObject = {};
878
+ const fromExample = getValueByPath(fromObject, ['example']);
879
+ if (fromExample != null) {
880
+ setValueByPath(toObject, ['example'], fromExample);
1252
881
  }
1253
- const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
1254
- if (fromUpdateTime != null) {
1255
- setValueByPath(toObject, ['updateTime'], fromUpdateTime);
882
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
883
+ if (fromPattern != null) {
884
+ setValueByPath(toObject, ['pattern'], fromPattern);
1256
885
  }
1257
- const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
1258
- if (fromExpireTime != null) {
1259
- setValueByPath(toObject, ['expireTime'], fromExpireTime);
886
+ const fromDefault = getValueByPath(fromObject, ['default']);
887
+ if (fromDefault != null) {
888
+ setValueByPath(toObject, ['default'], fromDefault);
1260
889
  }
1261
- const fromUsageMetadata = getValueByPath(fromObject, [
1262
- 'usageMetadata',
890
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
891
+ if (fromMaxLength != null) {
892
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
893
+ }
894
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
895
+ if (fromMinLength != null) {
896
+ setValueByPath(toObject, ['minLength'], fromMinLength);
897
+ }
898
+ const fromMinProperties = getValueByPath(fromObject, [
899
+ 'minProperties',
1263
900
  ]);
1264
- if (fromUsageMetadata != null) {
1265
- setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
901
+ if (fromMinProperties != null) {
902
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
903
+ }
904
+ const fromMaxProperties = getValueByPath(fromObject, [
905
+ 'maxProperties',
906
+ ]);
907
+ if (fromMaxProperties != null) {
908
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
909
+ }
910
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
911
+ if (fromAnyOf != null) {
912
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
913
+ }
914
+ const fromDescription = getValueByPath(fromObject, ['description']);
915
+ if (fromDescription != null) {
916
+ setValueByPath(toObject, ['description'], fromDescription);
917
+ }
918
+ const fromEnum = getValueByPath(fromObject, ['enum']);
919
+ if (fromEnum != null) {
920
+ setValueByPath(toObject, ['enum'], fromEnum);
921
+ }
922
+ const fromFormat = getValueByPath(fromObject, ['format']);
923
+ if (fromFormat != null) {
924
+ setValueByPath(toObject, ['format'], fromFormat);
925
+ }
926
+ const fromItems = getValueByPath(fromObject, ['items']);
927
+ if (fromItems != null) {
928
+ setValueByPath(toObject, ['items'], fromItems);
929
+ }
930
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
931
+ if (fromMaxItems != null) {
932
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
933
+ }
934
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
935
+ if (fromMaximum != null) {
936
+ setValueByPath(toObject, ['maximum'], fromMaximum);
937
+ }
938
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
939
+ if (fromMinItems != null) {
940
+ setValueByPath(toObject, ['minItems'], fromMinItems);
941
+ }
942
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
943
+ if (fromMinimum != null) {
944
+ setValueByPath(toObject, ['minimum'], fromMinimum);
945
+ }
946
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
947
+ if (fromNullable != null) {
948
+ setValueByPath(toObject, ['nullable'], fromNullable);
949
+ }
950
+ const fromProperties = getValueByPath(fromObject, ['properties']);
951
+ if (fromProperties != null) {
952
+ setValueByPath(toObject, ['properties'], fromProperties);
953
+ }
954
+ const fromPropertyOrdering = getValueByPath(fromObject, [
955
+ 'propertyOrdering',
956
+ ]);
957
+ if (fromPropertyOrdering != null) {
958
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
959
+ }
960
+ const fromRequired = getValueByPath(fromObject, ['required']);
961
+ if (fromRequired != null) {
962
+ setValueByPath(toObject, ['required'], fromRequired);
963
+ }
964
+ const fromTitle = getValueByPath(fromObject, ['title']);
965
+ if (fromTitle != null) {
966
+ setValueByPath(toObject, ['title'], fromTitle);
967
+ }
968
+ const fromType = getValueByPath(fromObject, ['type']);
969
+ if (fromType != null) {
970
+ setValueByPath(toObject, ['type'], fromType);
1266
971
  }
1267
972
  return toObject;
1268
973
  }
1269
- function deleteCachedContentResponseFromMldev() {
974
+ function functionDeclarationToVertex$1(apiClient, fromObject) {
1270
975
  const toObject = {};
976
+ const fromResponse = getValueByPath(fromObject, ['response']);
977
+ if (fromResponse != null) {
978
+ setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
979
+ }
980
+ const fromDescription = getValueByPath(fromObject, ['description']);
981
+ if (fromDescription != null) {
982
+ setValueByPath(toObject, ['description'], fromDescription);
983
+ }
984
+ const fromName = getValueByPath(fromObject, ['name']);
985
+ if (fromName != null) {
986
+ setValueByPath(toObject, ['name'], fromName);
987
+ }
988
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
989
+ if (fromParameters != null) {
990
+ setValueByPath(toObject, ['parameters'], fromParameters);
991
+ }
1271
992
  return toObject;
1272
993
  }
1273
- function deleteCachedContentResponseFromVertex() {
994
+ function googleSearchToVertex$1() {
1274
995
  const toObject = {};
1275
996
  return toObject;
1276
997
  }
1277
- function listCachedContentsResponseFromMldev(apiClient, fromObject) {
998
+ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
1278
999
  const toObject = {};
1279
- const fromNextPageToken = getValueByPath(fromObject, [
1280
- 'nextPageToken',
1000
+ const fromMode = getValueByPath(fromObject, ['mode']);
1001
+ if (fromMode != null) {
1002
+ setValueByPath(toObject, ['mode'], fromMode);
1003
+ }
1004
+ const fromDynamicThreshold = getValueByPath(fromObject, [
1005
+ 'dynamicThreshold',
1281
1006
  ]);
1282
- if (fromNextPageToken != null) {
1283
- setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
1007
+ if (fromDynamicThreshold != null) {
1008
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
1284
1009
  }
1285
- const fromCachedContents = getValueByPath(fromObject, [
1286
- 'cachedContents',
1010
+ return toObject;
1011
+ }
1012
+ function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
1013
+ const toObject = {};
1014
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
1015
+ 'dynamicRetrievalConfig',
1287
1016
  ]);
1288
- if (fromCachedContents != null) {
1289
- if (Array.isArray(fromCachedContents)) {
1290
- setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1291
- return cachedContentFromMldev(apiClient, item);
1017
+ if (fromDynamicRetrievalConfig != null) {
1018
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
1019
+ }
1020
+ return toObject;
1021
+ }
1022
+ function toolToVertex$1(apiClient, fromObject) {
1023
+ const toObject = {};
1024
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
1025
+ 'functionDeclarations',
1026
+ ]);
1027
+ if (fromFunctionDeclarations != null) {
1028
+ if (Array.isArray(fromFunctionDeclarations)) {
1029
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
1030
+ return functionDeclarationToVertex$1(apiClient, item);
1292
1031
  }));
1293
1032
  }
1294
1033
  else {
1295
- setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1034
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
1296
1035
  }
1297
1036
  }
1037
+ const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
1038
+ if (fromRetrieval != null) {
1039
+ setValueByPath(toObject, ['retrieval'], fromRetrieval);
1040
+ }
1041
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
1042
+ if (fromGoogleSearch != null) {
1043
+ setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
1044
+ }
1045
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
1046
+ 'googleSearchRetrieval',
1047
+ ]);
1048
+ if (fromGoogleSearchRetrieval != null) {
1049
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
1050
+ }
1051
+ const fromCodeExecution = getValueByPath(fromObject, [
1052
+ 'codeExecution',
1053
+ ]);
1054
+ if (fromCodeExecution != null) {
1055
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
1056
+ }
1298
1057
  return toObject;
1299
1058
  }
1300
- function listCachedContentsResponseFromVertex(apiClient, fromObject) {
1059
+ function functionCallingConfigToVertex$1(apiClient, fromObject) {
1301
1060
  const toObject = {};
1302
- const fromNextPageToken = getValueByPath(fromObject, [
1303
- 'nextPageToken',
1061
+ const fromMode = getValueByPath(fromObject, ['mode']);
1062
+ if (fromMode != null) {
1063
+ setValueByPath(toObject, ['mode'], fromMode);
1064
+ }
1065
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
1066
+ 'allowedFunctionNames',
1304
1067
  ]);
1305
- if (fromNextPageToken != null) {
1306
- setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
1068
+ if (fromAllowedFunctionNames != null) {
1069
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
1307
1070
  }
1308
- const fromCachedContents = getValueByPath(fromObject, [
1309
- 'cachedContents',
1071
+ return toObject;
1072
+ }
1073
+ function toolConfigToVertex$1(apiClient, fromObject) {
1074
+ const toObject = {};
1075
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
1076
+ 'functionCallingConfig',
1310
1077
  ]);
1311
- if (fromCachedContents != null) {
1312
- if (Array.isArray(fromCachedContents)) {
1313
- setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1314
- return cachedContentFromVertex(apiClient, item);
1078
+ if (fromFunctionCallingConfig != null) {
1079
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex$1(apiClient, fromFunctionCallingConfig));
1080
+ }
1081
+ return toObject;
1082
+ }
1083
+ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
1084
+ const toObject = {};
1085
+ const fromTtl = getValueByPath(fromObject, ['ttl']);
1086
+ if (parentObject !== undefined && fromTtl != null) {
1087
+ setValueByPath(parentObject, ['ttl'], fromTtl);
1088
+ }
1089
+ const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
1090
+ if (parentObject !== undefined && fromExpireTime != null) {
1091
+ setValueByPath(parentObject, ['expireTime'], fromExpireTime);
1092
+ }
1093
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
1094
+ if (parentObject !== undefined && fromDisplayName != null) {
1095
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
1096
+ }
1097
+ const fromContents = getValueByPath(fromObject, ['contents']);
1098
+ if (parentObject !== undefined && fromContents != null) {
1099
+ if (Array.isArray(fromContents)) {
1100
+ setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
1101
+ return contentToVertex$1(apiClient, item);
1102
+ })));
1103
+ }
1104
+ else {
1105
+ setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
1106
+ }
1107
+ }
1108
+ const fromSystemInstruction = getValueByPath(fromObject, [
1109
+ 'systemInstruction',
1110
+ ]);
1111
+ if (parentObject !== undefined && fromSystemInstruction != null) {
1112
+ setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
1113
+ }
1114
+ const fromTools = getValueByPath(fromObject, ['tools']);
1115
+ if (parentObject !== undefined && fromTools != null) {
1116
+ if (Array.isArray(fromTools)) {
1117
+ setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
1118
+ return toolToVertex$1(apiClient, item);
1315
1119
  }));
1316
1120
  }
1317
1121
  else {
1318
- setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1122
+ setValueByPath(parentObject, ['tools'], fromTools);
1319
1123
  }
1320
1124
  }
1321
- return toObject;
1125
+ const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
1126
+ if (parentObject !== undefined && fromToolConfig != null) {
1127
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToVertex$1(apiClient, fromToolConfig));
1128
+ }
1129
+ return toObject;
1130
+ }
1131
+ function createCachedContentParametersToVertex(apiClient, fromObject) {
1132
+ const toObject = {};
1133
+ const fromModel = getValueByPath(fromObject, ['model']);
1134
+ if (fromModel != null) {
1135
+ setValueByPath(toObject, ['model'], tCachesModel(apiClient, fromModel));
1136
+ }
1137
+ const fromConfig = getValueByPath(fromObject, ['config']);
1138
+ if (fromConfig != null) {
1139
+ setValueByPath(toObject, ['config'], createCachedContentConfigToVertex(apiClient, fromConfig, toObject));
1140
+ }
1141
+ return toObject;
1142
+ }
1143
+ function getCachedContentParametersToVertex(apiClient, fromObject) {
1144
+ const toObject = {};
1145
+ const fromName = getValueByPath(fromObject, ['name']);
1146
+ if (fromName != null) {
1147
+ setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
1148
+ }
1149
+ const fromConfig = getValueByPath(fromObject, ['config']);
1150
+ if (fromConfig != null) {
1151
+ setValueByPath(toObject, ['config'], fromConfig);
1152
+ }
1153
+ return toObject;
1154
+ }
1155
+ function deleteCachedContentParametersToVertex(apiClient, fromObject) {
1156
+ const toObject = {};
1157
+ const fromName = getValueByPath(fromObject, ['name']);
1158
+ if (fromName != null) {
1159
+ setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
1160
+ }
1161
+ const fromConfig = getValueByPath(fromObject, ['config']);
1162
+ if (fromConfig != null) {
1163
+ setValueByPath(toObject, ['config'], fromConfig);
1164
+ }
1165
+ return toObject;
1166
+ }
1167
+ function updateCachedContentConfigToVertex(apiClient, fromObject, parentObject) {
1168
+ const toObject = {};
1169
+ const fromTtl = getValueByPath(fromObject, ['ttl']);
1170
+ if (parentObject !== undefined && fromTtl != null) {
1171
+ setValueByPath(parentObject, ['ttl'], fromTtl);
1172
+ }
1173
+ const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
1174
+ if (parentObject !== undefined && fromExpireTime != null) {
1175
+ setValueByPath(parentObject, ['expireTime'], fromExpireTime);
1176
+ }
1177
+ return toObject;
1178
+ }
1179
+ function updateCachedContentParametersToVertex(apiClient, fromObject) {
1180
+ const toObject = {};
1181
+ const fromName = getValueByPath(fromObject, ['name']);
1182
+ if (fromName != null) {
1183
+ setValueByPath(toObject, ['_url', 'name'], tCachedContentName(apiClient, fromName));
1184
+ }
1185
+ const fromConfig = getValueByPath(fromObject, ['config']);
1186
+ if (fromConfig != null) {
1187
+ setValueByPath(toObject, ['config'], updateCachedContentConfigToVertex(apiClient, fromConfig, toObject));
1188
+ }
1189
+ return toObject;
1190
+ }
1191
+ function listCachedContentsConfigToVertex(apiClient, fromObject, parentObject) {
1192
+ const toObject = {};
1193
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
1194
+ if (parentObject !== undefined && fromPageSize != null) {
1195
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
1196
+ }
1197
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
1198
+ if (parentObject !== undefined && fromPageToken != null) {
1199
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
1200
+ }
1201
+ return toObject;
1202
+ }
1203
+ function listCachedContentsParametersToVertex(apiClient, fromObject) {
1204
+ const toObject = {};
1205
+ const fromConfig = getValueByPath(fromObject, ['config']);
1206
+ if (fromConfig != null) {
1207
+ setValueByPath(toObject, ['config'], listCachedContentsConfigToVertex(apiClient, fromConfig, toObject));
1208
+ }
1209
+ return toObject;
1210
+ }
1211
+ function cachedContentFromMldev(apiClient, fromObject) {
1212
+ const toObject = {};
1213
+ const fromName = getValueByPath(fromObject, ['name']);
1214
+ if (fromName != null) {
1215
+ setValueByPath(toObject, ['name'], fromName);
1216
+ }
1217
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
1218
+ if (fromDisplayName != null) {
1219
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
1220
+ }
1221
+ const fromModel = getValueByPath(fromObject, ['model']);
1222
+ if (fromModel != null) {
1223
+ setValueByPath(toObject, ['model'], fromModel);
1224
+ }
1225
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
1226
+ if (fromCreateTime != null) {
1227
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
1228
+ }
1229
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
1230
+ if (fromUpdateTime != null) {
1231
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
1232
+ }
1233
+ const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
1234
+ if (fromExpireTime != null) {
1235
+ setValueByPath(toObject, ['expireTime'], fromExpireTime);
1236
+ }
1237
+ const fromUsageMetadata = getValueByPath(fromObject, [
1238
+ 'usageMetadata',
1239
+ ]);
1240
+ if (fromUsageMetadata != null) {
1241
+ setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
1242
+ }
1243
+ return toObject;
1244
+ }
1245
+ function deleteCachedContentResponseFromMldev() {
1246
+ const toObject = {};
1247
+ return toObject;
1248
+ }
1249
+ function listCachedContentsResponseFromMldev(apiClient, fromObject) {
1250
+ const toObject = {};
1251
+ const fromNextPageToken = getValueByPath(fromObject, [
1252
+ 'nextPageToken',
1253
+ ]);
1254
+ if (fromNextPageToken != null) {
1255
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
1256
+ }
1257
+ const fromCachedContents = getValueByPath(fromObject, [
1258
+ 'cachedContents',
1259
+ ]);
1260
+ if (fromCachedContents != null) {
1261
+ if (Array.isArray(fromCachedContents)) {
1262
+ setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1263
+ return cachedContentFromMldev(apiClient, item);
1264
+ }));
1265
+ }
1266
+ else {
1267
+ setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1268
+ }
1269
+ }
1270
+ return toObject;
1271
+ }
1272
+ function cachedContentFromVertex(apiClient, fromObject) {
1273
+ const toObject = {};
1274
+ const fromName = getValueByPath(fromObject, ['name']);
1275
+ if (fromName != null) {
1276
+ setValueByPath(toObject, ['name'], fromName);
1277
+ }
1278
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
1279
+ if (fromDisplayName != null) {
1280
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
1281
+ }
1282
+ const fromModel = getValueByPath(fromObject, ['model']);
1283
+ if (fromModel != null) {
1284
+ setValueByPath(toObject, ['model'], fromModel);
1285
+ }
1286
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
1287
+ if (fromCreateTime != null) {
1288
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
1289
+ }
1290
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
1291
+ if (fromUpdateTime != null) {
1292
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
1293
+ }
1294
+ const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
1295
+ if (fromExpireTime != null) {
1296
+ setValueByPath(toObject, ['expireTime'], fromExpireTime);
1297
+ }
1298
+ const fromUsageMetadata = getValueByPath(fromObject, [
1299
+ 'usageMetadata',
1300
+ ]);
1301
+ if (fromUsageMetadata != null) {
1302
+ setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
1303
+ }
1304
+ return toObject;
1305
+ }
1306
+ function deleteCachedContentResponseFromVertex() {
1307
+ const toObject = {};
1308
+ return toObject;
1309
+ }
1310
+ function listCachedContentsResponseFromVertex(apiClient, fromObject) {
1311
+ const toObject = {};
1312
+ const fromNextPageToken = getValueByPath(fromObject, [
1313
+ 'nextPageToken',
1314
+ ]);
1315
+ if (fromNextPageToken != null) {
1316
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
1317
+ }
1318
+ const fromCachedContents = getValueByPath(fromObject, [
1319
+ 'cachedContents',
1320
+ ]);
1321
+ if (fromCachedContents != null) {
1322
+ if (Array.isArray(fromCachedContents)) {
1323
+ setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1324
+ return cachedContentFromVertex(apiClient, item);
1325
+ }));
1326
+ }
1327
+ else {
1328
+ setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1329
+ }
1330
+ }
1331
+ return toObject;
1322
1332
  }
1323
1333
 
1324
1334
  /**
@@ -2054,6 +2064,9 @@ class HttpResponse {
2054
2064
  /** Response for the create file method. */
2055
2065
  class CreateFileResponse {
2056
2066
  }
2067
+ /** Response for the delete file method. */
2068
+ class DeleteFileResponse {
2069
+ }
2057
2070
  /** Represents a single response in a replay. */
2058
2071
  class ReplayResponse {
2059
2072
  }
@@ -2796,7 +2809,7 @@ class Chat {
2796
2809
  const CONTENT_TYPE_HEADER = 'Content-Type';
2797
2810
  const USER_AGENT_HEADER = 'User-Agent';
2798
2811
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
2799
- const SDK_VERSION = '0.6.0'; // x-release-please-version
2812
+ const SDK_VERSION = '0.6.1'; // x-release-please-version
2800
2813
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
2801
2814
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
2802
2815
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -3438,6 +3451,18 @@ function getFileParametersToMldev(apiClient, fromObject) {
3438
3451
  }
3439
3452
  return toObject;
3440
3453
  }
3454
+ function deleteFileParametersToMldev(apiClient, fromObject) {
3455
+ const toObject = {};
3456
+ const fromName = getValueByPath(fromObject, ['name']);
3457
+ if (fromName != null) {
3458
+ setValueByPath(toObject, ['_url', 'file'], tFileName(apiClient, fromName));
3459
+ }
3460
+ const fromConfig = getValueByPath(fromObject, ['config']);
3461
+ if (fromConfig != null) {
3462
+ setValueByPath(toObject, ['config'], fromConfig);
3463
+ }
3464
+ return toObject;
3465
+ }
3441
3466
  function fileStatusFromMldev(apiClient, fromObject) {
3442
3467
  const toObject = {};
3443
3468
  const fromDetails = getValueByPath(fromObject, ['details']);
@@ -3547,6 +3572,10 @@ function createFileResponseFromMldev(apiClient, fromObject) {
3547
3572
  }
3548
3573
  return toObject;
3549
3574
  }
3575
+ function deleteFileResponseFromMldev() {
3576
+ const toObject = {};
3577
+ return toObject;
3578
+ }
3550
3579
 
3551
3580
  /**
3552
3581
  * @license
@@ -3746,55 +3775,703 @@ class Files extends BaseModule {
3746
3775
  });
3747
3776
  }
3748
3777
  }
3749
- }
3750
-
3751
- /**
3752
- * @license
3753
- * Copyright 2025 Google LLC
3754
- * SPDX-License-Identifier: Apache-2.0
3755
- */
3756
- function partToMldev(apiClient, fromObject) {
3757
- const toObject = {};
3758
- if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
3759
- throw new Error('videoMetadata parameter is not supported in Gemini API.');
3778
+ /**
3779
+ * Deletes a remotely stored file.
3780
+ *
3781
+ * @param params - The parameters for the delete request.
3782
+ * @return The DeleteFileResponse, the response for the delete method.
3783
+ *
3784
+ * @example
3785
+ * The following code deletes an example file named "files/mehozpxf877d".
3786
+ *
3787
+ * ```ts
3788
+ * await ai.files.delete({name: file.name});
3789
+ * ```
3790
+ */
3791
+ async delete(params) {
3792
+ var _a;
3793
+ let response;
3794
+ let path = '';
3795
+ let queryParams = {};
3796
+ if (this.apiClient.isVertexAI()) {
3797
+ throw new Error('This method is only supported by the Gemini Developer API.');
3798
+ }
3799
+ else {
3800
+ const body = deleteFileParametersToMldev(this.apiClient, params);
3801
+ path = formatMap('files/{file}', body['_url']);
3802
+ queryParams = body['_query'];
3803
+ delete body['config'];
3804
+ delete body['_url'];
3805
+ delete body['_query'];
3806
+ response = this.apiClient
3807
+ .request({
3808
+ path: path,
3809
+ queryParams: queryParams,
3810
+ body: JSON.stringify(body),
3811
+ httpMethod: 'DELETE',
3812
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
3813
+ })
3814
+ .then((httpResponse) => {
3815
+ return httpResponse.json();
3816
+ });
3817
+ return response.then(() => {
3818
+ const resp = deleteFileResponseFromMldev();
3819
+ const typedResp = new DeleteFileResponse();
3820
+ Object.assign(typedResp, resp);
3821
+ return typedResp;
3822
+ });
3823
+ }
3824
+ }
3825
+ }
3826
+
3827
+ /**
3828
+ * @license
3829
+ * Copyright 2025 Google LLC
3830
+ * SPDX-License-Identifier: Apache-2.0
3831
+ */
3832
+ function partToMldev(apiClient, fromObject) {
3833
+ const toObject = {};
3834
+ if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
3835
+ throw new Error('videoMetadata parameter is not supported in Gemini API.');
3836
+ }
3837
+ const fromThought = getValueByPath(fromObject, ['thought']);
3838
+ if (fromThought != null) {
3839
+ setValueByPath(toObject, ['thought'], fromThought);
3840
+ }
3841
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
3842
+ 'codeExecutionResult',
3843
+ ]);
3844
+ if (fromCodeExecutionResult != null) {
3845
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
3846
+ }
3847
+ const fromExecutableCode = getValueByPath(fromObject, [
3848
+ 'executableCode',
3849
+ ]);
3850
+ if (fromExecutableCode != null) {
3851
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
3852
+ }
3853
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
3854
+ if (fromFileData != null) {
3855
+ setValueByPath(toObject, ['fileData'], fromFileData);
3856
+ }
3857
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
3858
+ if (fromFunctionCall != null) {
3859
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
3860
+ }
3861
+ const fromFunctionResponse = getValueByPath(fromObject, [
3862
+ 'functionResponse',
3863
+ ]);
3864
+ if (fromFunctionResponse != null) {
3865
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
3866
+ }
3867
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
3868
+ if (fromInlineData != null) {
3869
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
3870
+ }
3871
+ const fromText = getValueByPath(fromObject, ['text']);
3872
+ if (fromText != null) {
3873
+ setValueByPath(toObject, ['text'], fromText);
3874
+ }
3875
+ return toObject;
3876
+ }
3877
+ function contentToMldev(apiClient, fromObject) {
3878
+ const toObject = {};
3879
+ const fromParts = getValueByPath(fromObject, ['parts']);
3880
+ if (fromParts != null) {
3881
+ if (Array.isArray(fromParts)) {
3882
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3883
+ return partToMldev(apiClient, item);
3884
+ }));
3885
+ }
3886
+ else {
3887
+ setValueByPath(toObject, ['parts'], fromParts);
3888
+ }
3889
+ }
3890
+ const fromRole = getValueByPath(fromObject, ['role']);
3891
+ if (fromRole != null) {
3892
+ setValueByPath(toObject, ['role'], fromRole);
3893
+ }
3894
+ return toObject;
3895
+ }
3896
+ function schemaToMldev(apiClient, fromObject) {
3897
+ const toObject = {};
3898
+ if (getValueByPath(fromObject, ['example']) !== undefined) {
3899
+ throw new Error('example parameter is not supported in Gemini API.');
3900
+ }
3901
+ if (getValueByPath(fromObject, ['pattern']) !== undefined) {
3902
+ throw new Error('pattern parameter is not supported in Gemini API.');
3903
+ }
3904
+ if (getValueByPath(fromObject, ['default']) !== undefined) {
3905
+ throw new Error('default parameter is not supported in Gemini API.');
3906
+ }
3907
+ if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
3908
+ throw new Error('maxLength parameter is not supported in Gemini API.');
3909
+ }
3910
+ if (getValueByPath(fromObject, ['minLength']) !== undefined) {
3911
+ throw new Error('minLength parameter is not supported in Gemini API.');
3912
+ }
3913
+ if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
3914
+ throw new Error('minProperties parameter is not supported in Gemini API.');
3915
+ }
3916
+ if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
3917
+ throw new Error('maxProperties parameter is not supported in Gemini API.');
3918
+ }
3919
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
3920
+ if (fromAnyOf != null) {
3921
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
3922
+ }
3923
+ const fromDescription = getValueByPath(fromObject, ['description']);
3924
+ if (fromDescription != null) {
3925
+ setValueByPath(toObject, ['description'], fromDescription);
3926
+ }
3927
+ const fromEnum = getValueByPath(fromObject, ['enum']);
3928
+ if (fromEnum != null) {
3929
+ setValueByPath(toObject, ['enum'], fromEnum);
3930
+ }
3931
+ const fromFormat = getValueByPath(fromObject, ['format']);
3932
+ if (fromFormat != null) {
3933
+ setValueByPath(toObject, ['format'], fromFormat);
3934
+ }
3935
+ const fromItems = getValueByPath(fromObject, ['items']);
3936
+ if (fromItems != null) {
3937
+ setValueByPath(toObject, ['items'], fromItems);
3938
+ }
3939
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
3940
+ if (fromMaxItems != null) {
3941
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
3942
+ }
3943
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
3944
+ if (fromMaximum != null) {
3945
+ setValueByPath(toObject, ['maximum'], fromMaximum);
3946
+ }
3947
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
3948
+ if (fromMinItems != null) {
3949
+ setValueByPath(toObject, ['minItems'], fromMinItems);
3950
+ }
3951
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
3952
+ if (fromMinimum != null) {
3953
+ setValueByPath(toObject, ['minimum'], fromMinimum);
3954
+ }
3955
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
3956
+ if (fromNullable != null) {
3957
+ setValueByPath(toObject, ['nullable'], fromNullable);
3958
+ }
3959
+ const fromProperties = getValueByPath(fromObject, ['properties']);
3960
+ if (fromProperties != null) {
3961
+ setValueByPath(toObject, ['properties'], fromProperties);
3962
+ }
3963
+ const fromPropertyOrdering = getValueByPath(fromObject, [
3964
+ 'propertyOrdering',
3965
+ ]);
3966
+ if (fromPropertyOrdering != null) {
3967
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
3968
+ }
3969
+ const fromRequired = getValueByPath(fromObject, ['required']);
3970
+ if (fromRequired != null) {
3971
+ setValueByPath(toObject, ['required'], fromRequired);
3972
+ }
3973
+ const fromTitle = getValueByPath(fromObject, ['title']);
3974
+ if (fromTitle != null) {
3975
+ setValueByPath(toObject, ['title'], fromTitle);
3976
+ }
3977
+ const fromType = getValueByPath(fromObject, ['type']);
3978
+ if (fromType != null) {
3979
+ setValueByPath(toObject, ['type'], fromType);
3980
+ }
3981
+ return toObject;
3982
+ }
3983
+ function safetySettingToMldev(apiClient, fromObject) {
3984
+ const toObject = {};
3985
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
3986
+ throw new Error('method parameter is not supported in Gemini API.');
3987
+ }
3988
+ const fromCategory = getValueByPath(fromObject, ['category']);
3989
+ if (fromCategory != null) {
3990
+ setValueByPath(toObject, ['category'], fromCategory);
3991
+ }
3992
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
3993
+ if (fromThreshold != null) {
3994
+ setValueByPath(toObject, ['threshold'], fromThreshold);
3995
+ }
3996
+ return toObject;
3997
+ }
3998
+ function functionDeclarationToMldev(apiClient, fromObject) {
3999
+ const toObject = {};
4000
+ if (getValueByPath(fromObject, ['response']) !== undefined) {
4001
+ throw new Error('response parameter is not supported in Gemini API.');
4002
+ }
4003
+ const fromDescription = getValueByPath(fromObject, ['description']);
4004
+ if (fromDescription != null) {
4005
+ setValueByPath(toObject, ['description'], fromDescription);
4006
+ }
4007
+ const fromName = getValueByPath(fromObject, ['name']);
4008
+ if (fromName != null) {
4009
+ setValueByPath(toObject, ['name'], fromName);
4010
+ }
4011
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
4012
+ if (fromParameters != null) {
4013
+ setValueByPath(toObject, ['parameters'], fromParameters);
4014
+ }
4015
+ return toObject;
4016
+ }
4017
+ function googleSearchToMldev() {
4018
+ const toObject = {};
4019
+ return toObject;
4020
+ }
4021
+ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
4022
+ const toObject = {};
4023
+ const fromMode = getValueByPath(fromObject, ['mode']);
4024
+ if (fromMode != null) {
4025
+ setValueByPath(toObject, ['mode'], fromMode);
4026
+ }
4027
+ const fromDynamicThreshold = getValueByPath(fromObject, [
4028
+ 'dynamicThreshold',
4029
+ ]);
4030
+ if (fromDynamicThreshold != null) {
4031
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
4032
+ }
4033
+ return toObject;
4034
+ }
4035
+ function googleSearchRetrievalToMldev(apiClient, fromObject) {
4036
+ const toObject = {};
4037
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
4038
+ 'dynamicRetrievalConfig',
4039
+ ]);
4040
+ if (fromDynamicRetrievalConfig != null) {
4041
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
4042
+ }
4043
+ return toObject;
4044
+ }
4045
+ function toolToMldev(apiClient, fromObject) {
4046
+ const toObject = {};
4047
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
4048
+ 'functionDeclarations',
4049
+ ]);
4050
+ if (fromFunctionDeclarations != null) {
4051
+ if (Array.isArray(fromFunctionDeclarations)) {
4052
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4053
+ return functionDeclarationToMldev(apiClient, item);
4054
+ }));
4055
+ }
4056
+ else {
4057
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4058
+ }
4059
+ }
4060
+ if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4061
+ throw new Error('retrieval parameter is not supported in Gemini API.');
4062
+ }
4063
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4064
+ if (fromGoogleSearch != null) {
4065
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev());
4066
+ }
4067
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4068
+ 'googleSearchRetrieval',
4069
+ ]);
4070
+ if (fromGoogleSearchRetrieval != null) {
4071
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
4072
+ }
4073
+ const fromCodeExecution = getValueByPath(fromObject, [
4074
+ 'codeExecution',
4075
+ ]);
4076
+ if (fromCodeExecution != null) {
4077
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4078
+ }
4079
+ return toObject;
4080
+ }
4081
+ function functionCallingConfigToMldev(apiClient, fromObject) {
4082
+ const toObject = {};
4083
+ const fromMode = getValueByPath(fromObject, ['mode']);
4084
+ if (fromMode != null) {
4085
+ setValueByPath(toObject, ['mode'], fromMode);
4086
+ }
4087
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
4088
+ 'allowedFunctionNames',
4089
+ ]);
4090
+ if (fromAllowedFunctionNames != null) {
4091
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
4092
+ }
4093
+ return toObject;
4094
+ }
4095
+ function toolConfigToMldev(apiClient, fromObject) {
4096
+ const toObject = {};
4097
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4098
+ 'functionCallingConfig',
4099
+ ]);
4100
+ if (fromFunctionCallingConfig != null) {
4101
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(apiClient, fromFunctionCallingConfig));
4102
+ }
4103
+ return toObject;
4104
+ }
4105
+ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
4106
+ const toObject = {};
4107
+ const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
4108
+ if (fromVoiceName != null) {
4109
+ setValueByPath(toObject, ['voiceName'], fromVoiceName);
4110
+ }
4111
+ return toObject;
4112
+ }
4113
+ function voiceConfigToMldev(apiClient, fromObject) {
4114
+ const toObject = {};
4115
+ const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
4116
+ 'prebuiltVoiceConfig',
4117
+ ]);
4118
+ if (fromPrebuiltVoiceConfig != null) {
4119
+ setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
4120
+ }
4121
+ return toObject;
4122
+ }
4123
+ function speechConfigToMldev(apiClient, fromObject) {
4124
+ const toObject = {};
4125
+ const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
4126
+ if (fromVoiceConfig != null) {
4127
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
4128
+ }
4129
+ return toObject;
4130
+ }
4131
+ function thinkingConfigToMldev(apiClient, fromObject) {
4132
+ const toObject = {};
4133
+ const fromIncludeThoughts = getValueByPath(fromObject, [
4134
+ 'includeThoughts',
4135
+ ]);
4136
+ if (fromIncludeThoughts != null) {
4137
+ setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
4138
+ }
4139
+ return toObject;
4140
+ }
4141
+ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
4142
+ const toObject = {};
4143
+ const fromSystemInstruction = getValueByPath(fromObject, [
4144
+ 'systemInstruction',
4145
+ ]);
4146
+ if (parentObject !== undefined && fromSystemInstruction != null) {
4147
+ setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
4148
+ }
4149
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
4150
+ if (fromTemperature != null) {
4151
+ setValueByPath(toObject, ['temperature'], fromTemperature);
4152
+ }
4153
+ const fromTopP = getValueByPath(fromObject, ['topP']);
4154
+ if (fromTopP != null) {
4155
+ setValueByPath(toObject, ['topP'], fromTopP);
4156
+ }
4157
+ const fromTopK = getValueByPath(fromObject, ['topK']);
4158
+ if (fromTopK != null) {
4159
+ setValueByPath(toObject, ['topK'], fromTopK);
4160
+ }
4161
+ const fromCandidateCount = getValueByPath(fromObject, [
4162
+ 'candidateCount',
4163
+ ]);
4164
+ if (fromCandidateCount != null) {
4165
+ setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
4166
+ }
4167
+ const fromMaxOutputTokens = getValueByPath(fromObject, [
4168
+ 'maxOutputTokens',
4169
+ ]);
4170
+ if (fromMaxOutputTokens != null) {
4171
+ setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
4172
+ }
4173
+ const fromStopSequences = getValueByPath(fromObject, [
4174
+ 'stopSequences',
4175
+ ]);
4176
+ if (fromStopSequences != null) {
4177
+ setValueByPath(toObject, ['stopSequences'], fromStopSequences);
4178
+ }
4179
+ const fromResponseLogprobs = getValueByPath(fromObject, [
4180
+ 'responseLogprobs',
4181
+ ]);
4182
+ if (fromResponseLogprobs != null) {
4183
+ setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
4184
+ }
4185
+ const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
4186
+ if (fromLogprobs != null) {
4187
+ setValueByPath(toObject, ['logprobs'], fromLogprobs);
4188
+ }
4189
+ const fromPresencePenalty = getValueByPath(fromObject, [
4190
+ 'presencePenalty',
4191
+ ]);
4192
+ if (fromPresencePenalty != null) {
4193
+ setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
4194
+ }
4195
+ const fromFrequencyPenalty = getValueByPath(fromObject, [
4196
+ 'frequencyPenalty',
4197
+ ]);
4198
+ if (fromFrequencyPenalty != null) {
4199
+ setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
4200
+ }
4201
+ const fromSeed = getValueByPath(fromObject, ['seed']);
4202
+ if (fromSeed != null) {
4203
+ setValueByPath(toObject, ['seed'], fromSeed);
4204
+ }
4205
+ const fromResponseMimeType = getValueByPath(fromObject, [
4206
+ 'responseMimeType',
4207
+ ]);
4208
+ if (fromResponseMimeType != null) {
4209
+ setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
4210
+ }
4211
+ const fromResponseSchema = getValueByPath(fromObject, [
4212
+ 'responseSchema',
4213
+ ]);
4214
+ if (fromResponseSchema != null) {
4215
+ setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
4216
+ }
4217
+ if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
4218
+ throw new Error('routingConfig parameter is not supported in Gemini API.');
4219
+ }
4220
+ const fromSafetySettings = getValueByPath(fromObject, [
4221
+ 'safetySettings',
4222
+ ]);
4223
+ if (parentObject !== undefined && fromSafetySettings != null) {
4224
+ if (Array.isArray(fromSafetySettings)) {
4225
+ setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
4226
+ return safetySettingToMldev(apiClient, item);
4227
+ }));
4228
+ }
4229
+ else {
4230
+ setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
4231
+ }
4232
+ }
4233
+ const fromTools = getValueByPath(fromObject, ['tools']);
4234
+ if (parentObject !== undefined && fromTools != null) {
4235
+ if (Array.isArray(fromTools)) {
4236
+ setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4237
+ return toolToMldev(apiClient, tTool(apiClient, item));
4238
+ })));
4239
+ }
4240
+ else {
4241
+ setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
4242
+ }
4243
+ }
4244
+ const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
4245
+ if (parentObject !== undefined && fromToolConfig != null) {
4246
+ setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(apiClient, fromToolConfig));
4247
+ }
4248
+ if (getValueByPath(fromObject, ['labels']) !== undefined) {
4249
+ throw new Error('labels parameter is not supported in Gemini API.');
4250
+ }
4251
+ const fromCachedContent = getValueByPath(fromObject, [
4252
+ 'cachedContent',
4253
+ ]);
4254
+ if (parentObject !== undefined && fromCachedContent != null) {
4255
+ setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
4256
+ }
4257
+ const fromResponseModalities = getValueByPath(fromObject, [
4258
+ 'responseModalities',
4259
+ ]);
4260
+ if (fromResponseModalities != null) {
4261
+ setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
4262
+ }
4263
+ const fromMediaResolution = getValueByPath(fromObject, [
4264
+ 'mediaResolution',
4265
+ ]);
4266
+ if (fromMediaResolution != null) {
4267
+ setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4268
+ }
4269
+ const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
4270
+ if (fromSpeechConfig != null) {
4271
+ setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
4272
+ }
4273
+ if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
4274
+ throw new Error('audioTimestamp parameter is not supported in Gemini API.');
4275
+ }
4276
+ const fromThinkingConfig = getValueByPath(fromObject, [
4277
+ 'thinkingConfig',
4278
+ ]);
4279
+ if (fromThinkingConfig != null) {
4280
+ setValueByPath(toObject, ['thinkingConfig'], thinkingConfigToMldev(apiClient, fromThinkingConfig));
4281
+ }
4282
+ return toObject;
4283
+ }
4284
+ function generateContentParametersToMldev(apiClient, fromObject) {
4285
+ const toObject = {};
4286
+ const fromModel = getValueByPath(fromObject, ['model']);
4287
+ if (fromModel != null) {
4288
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
4289
+ }
4290
+ const fromContents = getValueByPath(fromObject, ['contents']);
4291
+ if (fromContents != null) {
4292
+ if (Array.isArray(fromContents)) {
4293
+ setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
4294
+ return contentToMldev(apiClient, item);
4295
+ })));
4296
+ }
4297
+ else {
4298
+ setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
4299
+ }
4300
+ }
4301
+ const fromConfig = getValueByPath(fromObject, ['config']);
4302
+ if (fromConfig != null) {
4303
+ setValueByPath(toObject, ['generationConfig'], generateContentConfigToMldev(apiClient, fromConfig, toObject));
4304
+ }
4305
+ return toObject;
4306
+ }
4307
+ function embedContentConfigToMldev(apiClient, fromObject, parentObject) {
4308
+ const toObject = {};
4309
+ const fromTaskType = getValueByPath(fromObject, ['taskType']);
4310
+ if (parentObject !== undefined && fromTaskType != null) {
4311
+ setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
4312
+ }
4313
+ const fromTitle = getValueByPath(fromObject, ['title']);
4314
+ if (parentObject !== undefined && fromTitle != null) {
4315
+ setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
4316
+ }
4317
+ const fromOutputDimensionality = getValueByPath(fromObject, [
4318
+ 'outputDimensionality',
4319
+ ]);
4320
+ if (parentObject !== undefined && fromOutputDimensionality != null) {
4321
+ setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
4322
+ }
4323
+ if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
4324
+ throw new Error('mimeType parameter is not supported in Gemini API.');
4325
+ }
4326
+ if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
4327
+ throw new Error('autoTruncate parameter is not supported in Gemini API.');
4328
+ }
4329
+ return toObject;
4330
+ }
4331
+ function embedContentParametersToMldev(apiClient, fromObject) {
4332
+ const toObject = {};
4333
+ const fromModel = getValueByPath(fromObject, ['model']);
4334
+ if (fromModel != null) {
4335
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
4336
+ }
4337
+ const fromContents = getValueByPath(fromObject, ['contents']);
4338
+ if (fromContents != null) {
4339
+ setValueByPath(toObject, ['requests[]', 'content'], tContentsForEmbed(apiClient, fromContents));
4340
+ }
4341
+ const fromConfig = getValueByPath(fromObject, ['config']);
4342
+ if (fromConfig != null) {
4343
+ setValueByPath(toObject, ['config'], embedContentConfigToMldev(apiClient, fromConfig, toObject));
4344
+ }
4345
+ const fromModelForEmbedContent = getValueByPath(fromObject, ['model']);
4346
+ if (fromModelForEmbedContent !== undefined) {
4347
+ setValueByPath(toObject, ['requests[]', 'model'], tModel(apiClient, fromModelForEmbedContent));
4348
+ }
4349
+ return toObject;
4350
+ }
4351
+ function generateImagesConfigToMldev(apiClient, fromObject, parentObject) {
4352
+ const toObject = {};
4353
+ if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
4354
+ throw new Error('outputGcsUri parameter is not supported in Gemini API.');
4355
+ }
4356
+ if (getValueByPath(fromObject, ['negativePrompt']) !== undefined) {
4357
+ throw new Error('negativePrompt parameter is not supported in Gemini API.');
4358
+ }
4359
+ const fromNumberOfImages = getValueByPath(fromObject, [
4360
+ 'numberOfImages',
4361
+ ]);
4362
+ if (parentObject !== undefined && fromNumberOfImages != null) {
4363
+ setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
4364
+ }
4365
+ const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
4366
+ if (parentObject !== undefined && fromAspectRatio != null) {
4367
+ setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
4368
+ }
4369
+ const fromGuidanceScale = getValueByPath(fromObject, [
4370
+ 'guidanceScale',
4371
+ ]);
4372
+ if (parentObject !== undefined && fromGuidanceScale != null) {
4373
+ setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
3760
4374
  }
3761
- const fromThought = getValueByPath(fromObject, ['thought']);
3762
- if (fromThought != null) {
3763
- setValueByPath(toObject, ['thought'], fromThought);
4375
+ if (getValueByPath(fromObject, ['seed']) !== undefined) {
4376
+ throw new Error('seed parameter is not supported in Gemini API.');
3764
4377
  }
3765
- const fromCodeExecutionResult = getValueByPath(fromObject, [
3766
- 'codeExecutionResult',
4378
+ const fromSafetyFilterLevel = getValueByPath(fromObject, [
4379
+ 'safetyFilterLevel',
3767
4380
  ]);
3768
- if (fromCodeExecutionResult != null) {
3769
- setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
4381
+ if (parentObject !== undefined && fromSafetyFilterLevel != null) {
4382
+ setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
3770
4383
  }
3771
- const fromExecutableCode = getValueByPath(fromObject, [
3772
- 'executableCode',
4384
+ const fromPersonGeneration = getValueByPath(fromObject, [
4385
+ 'personGeneration',
3773
4386
  ]);
3774
- if (fromExecutableCode != null) {
3775
- setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4387
+ if (parentObject !== undefined && fromPersonGeneration != null) {
4388
+ setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
3776
4389
  }
3777
- const fromFileData = getValueByPath(fromObject, ['fileData']);
3778
- if (fromFileData != null) {
3779
- setValueByPath(toObject, ['fileData'], fromFileData);
4390
+ const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
4391
+ 'includeSafetyAttributes',
4392
+ ]);
4393
+ if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
4394
+ setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
3780
4395
  }
3781
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
3782
- if (fromFunctionCall != null) {
3783
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4396
+ const fromIncludeRaiReason = getValueByPath(fromObject, [
4397
+ 'includeRaiReason',
4398
+ ]);
4399
+ if (parentObject !== undefined && fromIncludeRaiReason != null) {
4400
+ setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
3784
4401
  }
3785
- const fromFunctionResponse = getValueByPath(fromObject, [
3786
- 'functionResponse',
4402
+ const fromLanguage = getValueByPath(fromObject, ['language']);
4403
+ if (parentObject !== undefined && fromLanguage != null) {
4404
+ setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
4405
+ }
4406
+ const fromOutputMimeType = getValueByPath(fromObject, [
4407
+ 'outputMimeType',
3787
4408
  ]);
3788
- if (fromFunctionResponse != null) {
3789
- setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4409
+ if (parentObject !== undefined && fromOutputMimeType != null) {
4410
+ setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
3790
4411
  }
3791
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
3792
- if (fromInlineData != null) {
3793
- setValueByPath(toObject, ['inlineData'], fromInlineData);
4412
+ const fromOutputCompressionQuality = getValueByPath(fromObject, [
4413
+ 'outputCompressionQuality',
4414
+ ]);
4415
+ if (parentObject !== undefined && fromOutputCompressionQuality != null) {
4416
+ setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
3794
4417
  }
3795
- const fromText = getValueByPath(fromObject, ['text']);
3796
- if (fromText != null) {
3797
- setValueByPath(toObject, ['text'], fromText);
4418
+ if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
4419
+ throw new Error('addWatermark parameter is not supported in Gemini API.');
4420
+ }
4421
+ if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
4422
+ throw new Error('enhancePrompt parameter is not supported in Gemini API.');
4423
+ }
4424
+ return toObject;
4425
+ }
4426
+ function generateImagesParametersToMldev(apiClient, fromObject) {
4427
+ const toObject = {};
4428
+ const fromModel = getValueByPath(fromObject, ['model']);
4429
+ if (fromModel != null) {
4430
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
4431
+ }
4432
+ const fromPrompt = getValueByPath(fromObject, ['prompt']);
4433
+ if (fromPrompt != null) {
4434
+ setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
4435
+ }
4436
+ const fromConfig = getValueByPath(fromObject, ['config']);
4437
+ if (fromConfig != null) {
4438
+ setValueByPath(toObject, ['config'], generateImagesConfigToMldev(apiClient, fromConfig, toObject));
4439
+ }
4440
+ return toObject;
4441
+ }
4442
+ function countTokensConfigToMldev(apiClient, fromObject) {
4443
+ const toObject = {};
4444
+ if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
4445
+ throw new Error('systemInstruction parameter is not supported in Gemini API.');
4446
+ }
4447
+ if (getValueByPath(fromObject, ['tools']) !== undefined) {
4448
+ throw new Error('tools parameter is not supported in Gemini API.');
4449
+ }
4450
+ if (getValueByPath(fromObject, ['generationConfig']) !== undefined) {
4451
+ throw new Error('generationConfig parameter is not supported in Gemini API.');
4452
+ }
4453
+ return toObject;
4454
+ }
4455
+ function countTokensParametersToMldev(apiClient, fromObject) {
4456
+ const toObject = {};
4457
+ const fromModel = getValueByPath(fromObject, ['model']);
4458
+ if (fromModel != null) {
4459
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
4460
+ }
4461
+ const fromContents = getValueByPath(fromObject, ['contents']);
4462
+ if (fromContents != null) {
4463
+ if (Array.isArray(fromContents)) {
4464
+ setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
4465
+ return contentToMldev(apiClient, item);
4466
+ })));
4467
+ }
4468
+ else {
4469
+ setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
4470
+ }
4471
+ }
4472
+ const fromConfig = getValueByPath(fromObject, ['config']);
4473
+ if (fromConfig != null) {
4474
+ setValueByPath(toObject, ['config'], countTokensConfigToMldev(apiClient, fromConfig));
3798
4475
  }
3799
4476
  return toObject;
3800
4477
  }
@@ -3831,142 +4508,37 @@ function partToVertex(apiClient, fromObject) {
3831
4508
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
3832
4509
  }
3833
4510
  const fromFunctionResponse = getValueByPath(fromObject, [
3834
- 'functionResponse',
3835
- ]);
3836
- if (fromFunctionResponse != null) {
3837
- setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
3838
- }
3839
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
3840
- if (fromInlineData != null) {
3841
- setValueByPath(toObject, ['inlineData'], fromInlineData);
3842
- }
3843
- const fromText = getValueByPath(fromObject, ['text']);
3844
- if (fromText != null) {
3845
- setValueByPath(toObject, ['text'], fromText);
3846
- }
3847
- return toObject;
3848
- }
3849
- function contentToMldev(apiClient, fromObject) {
3850
- const toObject = {};
3851
- const fromParts = getValueByPath(fromObject, ['parts']);
3852
- if (fromParts != null) {
3853
- if (Array.isArray(fromParts)) {
3854
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3855
- return partToMldev(apiClient, item);
3856
- }));
3857
- }
3858
- else {
3859
- setValueByPath(toObject, ['parts'], fromParts);
3860
- }
3861
- }
3862
- const fromRole = getValueByPath(fromObject, ['role']);
3863
- if (fromRole != null) {
3864
- setValueByPath(toObject, ['role'], fromRole);
3865
- }
3866
- return toObject;
3867
- }
3868
- function contentToVertex(apiClient, fromObject) {
3869
- const toObject = {};
3870
- const fromParts = getValueByPath(fromObject, ['parts']);
3871
- if (fromParts != null) {
3872
- if (Array.isArray(fromParts)) {
3873
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3874
- return partToVertex(apiClient, item);
3875
- }));
3876
- }
3877
- else {
3878
- setValueByPath(toObject, ['parts'], fromParts);
3879
- }
3880
- }
3881
- const fromRole = getValueByPath(fromObject, ['role']);
3882
- if (fromRole != null) {
3883
- setValueByPath(toObject, ['role'], fromRole);
3884
- }
3885
- return toObject;
3886
- }
3887
- function schemaToMldev(apiClient, fromObject) {
3888
- const toObject = {};
3889
- if (getValueByPath(fromObject, ['example']) !== undefined) {
3890
- throw new Error('example parameter is not supported in Gemini API.');
3891
- }
3892
- if (getValueByPath(fromObject, ['pattern']) !== undefined) {
3893
- throw new Error('pattern parameter is not supported in Gemini API.');
3894
- }
3895
- if (getValueByPath(fromObject, ['default']) !== undefined) {
3896
- throw new Error('default parameter is not supported in Gemini API.');
3897
- }
3898
- if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
3899
- throw new Error('maxLength parameter is not supported in Gemini API.');
3900
- }
3901
- if (getValueByPath(fromObject, ['title']) !== undefined) {
3902
- throw new Error('title parameter is not supported in Gemini API.');
3903
- }
3904
- if (getValueByPath(fromObject, ['minLength']) !== undefined) {
3905
- throw new Error('minLength parameter is not supported in Gemini API.');
3906
- }
3907
- if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
3908
- throw new Error('minProperties parameter is not supported in Gemini API.');
3909
- }
3910
- if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
3911
- throw new Error('maxProperties parameter is not supported in Gemini API.');
3912
- }
3913
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
3914
- if (fromAnyOf != null) {
3915
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
3916
- }
3917
- const fromDescription = getValueByPath(fromObject, ['description']);
3918
- if (fromDescription != null) {
3919
- setValueByPath(toObject, ['description'], fromDescription);
3920
- }
3921
- const fromEnum = getValueByPath(fromObject, ['enum']);
3922
- if (fromEnum != null) {
3923
- setValueByPath(toObject, ['enum'], fromEnum);
3924
- }
3925
- const fromFormat = getValueByPath(fromObject, ['format']);
3926
- if (fromFormat != null) {
3927
- setValueByPath(toObject, ['format'], fromFormat);
3928
- }
3929
- const fromItems = getValueByPath(fromObject, ['items']);
3930
- if (fromItems != null) {
3931
- setValueByPath(toObject, ['items'], fromItems);
3932
- }
3933
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
3934
- if (fromMaxItems != null) {
3935
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
3936
- }
3937
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
3938
- if (fromMaximum != null) {
3939
- setValueByPath(toObject, ['maximum'], fromMaximum);
3940
- }
3941
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
3942
- if (fromMinItems != null) {
3943
- setValueByPath(toObject, ['minItems'], fromMinItems);
3944
- }
3945
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
3946
- if (fromMinimum != null) {
3947
- setValueByPath(toObject, ['minimum'], fromMinimum);
3948
- }
3949
- const fromNullable = getValueByPath(fromObject, ['nullable']);
3950
- if (fromNullable != null) {
3951
- setValueByPath(toObject, ['nullable'], fromNullable);
3952
- }
3953
- const fromProperties = getValueByPath(fromObject, ['properties']);
3954
- if (fromProperties != null) {
3955
- setValueByPath(toObject, ['properties'], fromProperties);
3956
- }
3957
- const fromPropertyOrdering = getValueByPath(fromObject, [
3958
- 'propertyOrdering',
4511
+ 'functionResponse',
3959
4512
  ]);
3960
- if (fromPropertyOrdering != null) {
3961
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
4513
+ if (fromFunctionResponse != null) {
4514
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
3962
4515
  }
3963
- const fromRequired = getValueByPath(fromObject, ['required']);
3964
- if (fromRequired != null) {
3965
- setValueByPath(toObject, ['required'], fromRequired);
4516
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4517
+ if (fromInlineData != null) {
4518
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
3966
4519
  }
3967
- const fromType = getValueByPath(fromObject, ['type']);
3968
- if (fromType != null) {
3969
- setValueByPath(toObject, ['type'], fromType);
4520
+ const fromText = getValueByPath(fromObject, ['text']);
4521
+ if (fromText != null) {
4522
+ setValueByPath(toObject, ['text'], fromText);
4523
+ }
4524
+ return toObject;
4525
+ }
4526
+ function contentToVertex(apiClient, fromObject) {
4527
+ const toObject = {};
4528
+ const fromParts = getValueByPath(fromObject, ['parts']);
4529
+ if (fromParts != null) {
4530
+ if (Array.isArray(fromParts)) {
4531
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4532
+ return partToVertex(apiClient, item);
4533
+ }));
4534
+ }
4535
+ else {
4536
+ setValueByPath(toObject, ['parts'], fromParts);
4537
+ }
4538
+ }
4539
+ const fromRole = getValueByPath(fromObject, ['role']);
4540
+ if (fromRole != null) {
4541
+ setValueByPath(toObject, ['role'], fromRole);
3970
4542
  }
3971
4543
  return toObject;
3972
4544
  }
@@ -3988,10 +4560,6 @@ function schemaToVertex(apiClient, fromObject) {
3988
4560
  if (fromMaxLength != null) {
3989
4561
  setValueByPath(toObject, ['maxLength'], fromMaxLength);
3990
4562
  }
3991
- const fromTitle = getValueByPath(fromObject, ['title']);
3992
- if (fromTitle != null) {
3993
- setValueByPath(toObject, ['title'], fromTitle);
3994
- }
3995
4563
  const fromMinLength = getValueByPath(fromObject, ['minLength']);
3996
4564
  if (fromMinLength != null) {
3997
4565
  setValueByPath(toObject, ['minLength'], fromMinLength);
@@ -4042,491 +4610,194 @@ function schemaToVertex(apiClient, fromObject) {
4042
4610
  }
4043
4611
  const fromMinimum = getValueByPath(fromObject, ['minimum']);
4044
4612
  if (fromMinimum != null) {
4045
- setValueByPath(toObject, ['minimum'], fromMinimum);
4046
- }
4047
- const fromNullable = getValueByPath(fromObject, ['nullable']);
4048
- if (fromNullable != null) {
4049
- setValueByPath(toObject, ['nullable'], fromNullable);
4050
- }
4051
- const fromProperties = getValueByPath(fromObject, ['properties']);
4052
- if (fromProperties != null) {
4053
- setValueByPath(toObject, ['properties'], fromProperties);
4054
- }
4055
- const fromPropertyOrdering = getValueByPath(fromObject, [
4056
- 'propertyOrdering',
4057
- ]);
4058
- if (fromPropertyOrdering != null) {
4059
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
4060
- }
4061
- const fromRequired = getValueByPath(fromObject, ['required']);
4062
- if (fromRequired != null) {
4063
- setValueByPath(toObject, ['required'], fromRequired);
4064
- }
4065
- const fromType = getValueByPath(fromObject, ['type']);
4066
- if (fromType != null) {
4067
- setValueByPath(toObject, ['type'], fromType);
4068
- }
4069
- return toObject;
4070
- }
4071
- function safetySettingToMldev(apiClient, fromObject) {
4072
- const toObject = {};
4073
- if (getValueByPath(fromObject, ['method']) !== undefined) {
4074
- throw new Error('method parameter is not supported in Gemini API.');
4075
- }
4076
- const fromCategory = getValueByPath(fromObject, ['category']);
4077
- if (fromCategory != null) {
4078
- setValueByPath(toObject, ['category'], fromCategory);
4079
- }
4080
- const fromThreshold = getValueByPath(fromObject, ['threshold']);
4081
- if (fromThreshold != null) {
4082
- setValueByPath(toObject, ['threshold'], fromThreshold);
4083
- }
4084
- return toObject;
4085
- }
4086
- function safetySettingToVertex(apiClient, fromObject) {
4087
- const toObject = {};
4088
- const fromMethod = getValueByPath(fromObject, ['method']);
4089
- if (fromMethod != null) {
4090
- setValueByPath(toObject, ['method'], fromMethod);
4091
- }
4092
- const fromCategory = getValueByPath(fromObject, ['category']);
4093
- if (fromCategory != null) {
4094
- setValueByPath(toObject, ['category'], fromCategory);
4095
- }
4096
- const fromThreshold = getValueByPath(fromObject, ['threshold']);
4097
- if (fromThreshold != null) {
4098
- setValueByPath(toObject, ['threshold'], fromThreshold);
4099
- }
4100
- return toObject;
4101
- }
4102
- function functionDeclarationToMldev(apiClient, fromObject) {
4103
- const toObject = {};
4104
- if (getValueByPath(fromObject, ['response']) !== undefined) {
4105
- throw new Error('response parameter is not supported in Gemini API.');
4106
- }
4107
- const fromDescription = getValueByPath(fromObject, ['description']);
4108
- if (fromDescription != null) {
4109
- setValueByPath(toObject, ['description'], fromDescription);
4110
- }
4111
- const fromName = getValueByPath(fromObject, ['name']);
4112
- if (fromName != null) {
4113
- setValueByPath(toObject, ['name'], fromName);
4114
- }
4115
- const fromParameters = getValueByPath(fromObject, ['parameters']);
4116
- if (fromParameters != null) {
4117
- setValueByPath(toObject, ['parameters'], fromParameters);
4118
- }
4119
- return toObject;
4120
- }
4121
- function functionDeclarationToVertex(apiClient, fromObject) {
4122
- const toObject = {};
4123
- const fromResponse = getValueByPath(fromObject, ['response']);
4124
- if (fromResponse != null) {
4125
- setValueByPath(toObject, ['response'], schemaToVertex(apiClient, fromResponse));
4126
- }
4127
- const fromDescription = getValueByPath(fromObject, ['description']);
4128
- if (fromDescription != null) {
4129
- setValueByPath(toObject, ['description'], fromDescription);
4130
- }
4131
- const fromName = getValueByPath(fromObject, ['name']);
4132
- if (fromName != null) {
4133
- setValueByPath(toObject, ['name'], fromName);
4134
- }
4135
- const fromParameters = getValueByPath(fromObject, ['parameters']);
4136
- if (fromParameters != null) {
4137
- setValueByPath(toObject, ['parameters'], fromParameters);
4138
- }
4139
- return toObject;
4140
- }
4141
- function googleSearchToMldev() {
4142
- const toObject = {};
4143
- return toObject;
4144
- }
4145
- function googleSearchToVertex() {
4146
- const toObject = {};
4147
- return toObject;
4148
- }
4149
- function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
4150
- const toObject = {};
4151
- const fromMode = getValueByPath(fromObject, ['mode']);
4152
- if (fromMode != null) {
4153
- setValueByPath(toObject, ['mode'], fromMode);
4154
- }
4155
- const fromDynamicThreshold = getValueByPath(fromObject, [
4156
- 'dynamicThreshold',
4157
- ]);
4158
- if (fromDynamicThreshold != null) {
4159
- setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
4160
- }
4161
- return toObject;
4162
- }
4163
- function dynamicRetrievalConfigToVertex(apiClient, fromObject) {
4164
- const toObject = {};
4165
- const fromMode = getValueByPath(fromObject, ['mode']);
4166
- if (fromMode != null) {
4167
- setValueByPath(toObject, ['mode'], fromMode);
4168
- }
4169
- const fromDynamicThreshold = getValueByPath(fromObject, [
4170
- 'dynamicThreshold',
4171
- ]);
4172
- if (fromDynamicThreshold != null) {
4173
- setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
4174
- }
4175
- return toObject;
4176
- }
4177
- function googleSearchRetrievalToMldev(apiClient, fromObject) {
4178
- const toObject = {};
4179
- const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
4180
- 'dynamicRetrievalConfig',
4181
- ]);
4182
- if (fromDynamicRetrievalConfig != null) {
4183
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
4184
- }
4185
- return toObject;
4186
- }
4187
- function googleSearchRetrievalToVertex(apiClient, fromObject) {
4188
- const toObject = {};
4189
- const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
4190
- 'dynamicRetrievalConfig',
4191
- ]);
4192
- if (fromDynamicRetrievalConfig != null) {
4193
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex(apiClient, fromDynamicRetrievalConfig));
4194
- }
4195
- return toObject;
4196
- }
4197
- function toolToMldev(apiClient, fromObject) {
4198
- const toObject = {};
4199
- const fromFunctionDeclarations = getValueByPath(fromObject, [
4200
- 'functionDeclarations',
4201
- ]);
4202
- if (fromFunctionDeclarations != null) {
4203
- if (Array.isArray(fromFunctionDeclarations)) {
4204
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4205
- return functionDeclarationToMldev(apiClient, item);
4206
- }));
4207
- }
4208
- else {
4209
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4210
- }
4211
- }
4212
- if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4213
- throw new Error('retrieval parameter is not supported in Gemini API.');
4214
- }
4215
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4216
- if (fromGoogleSearch != null) {
4217
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev());
4218
- }
4219
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4220
- 'googleSearchRetrieval',
4221
- ]);
4222
- if (fromGoogleSearchRetrieval != null) {
4223
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
4224
- }
4225
- const fromCodeExecution = getValueByPath(fromObject, [
4226
- 'codeExecution',
4227
- ]);
4228
- if (fromCodeExecution != null) {
4229
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4230
- }
4231
- return toObject;
4232
- }
4233
- function toolToVertex(apiClient, fromObject) {
4234
- const toObject = {};
4235
- const fromFunctionDeclarations = getValueByPath(fromObject, [
4236
- 'functionDeclarations',
4237
- ]);
4238
- if (fromFunctionDeclarations != null) {
4239
- if (Array.isArray(fromFunctionDeclarations)) {
4240
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4241
- return functionDeclarationToVertex(apiClient, item);
4242
- }));
4243
- }
4244
- else {
4245
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4246
- }
4247
- }
4248
- const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
4249
- if (fromRetrieval != null) {
4250
- setValueByPath(toObject, ['retrieval'], fromRetrieval);
4251
- }
4252
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4253
- if (fromGoogleSearch != null) {
4254
- setValueByPath(toObject, ['googleSearch'], googleSearchToVertex());
4255
- }
4256
- const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4257
- 'googleSearchRetrieval',
4258
- ]);
4259
- if (fromGoogleSearchRetrieval != null) {
4260
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex(apiClient, fromGoogleSearchRetrieval));
4613
+ setValueByPath(toObject, ['minimum'], fromMinimum);
4261
4614
  }
4262
- const fromCodeExecution = getValueByPath(fromObject, [
4263
- 'codeExecution',
4264
- ]);
4265
- if (fromCodeExecution != null) {
4266
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4615
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
4616
+ if (fromNullable != null) {
4617
+ setValueByPath(toObject, ['nullable'], fromNullable);
4267
4618
  }
4268
- return toObject;
4269
- }
4270
- function functionCallingConfigToMldev(apiClient, fromObject) {
4271
- const toObject = {};
4272
- const fromMode = getValueByPath(fromObject, ['mode']);
4273
- if (fromMode != null) {
4274
- setValueByPath(toObject, ['mode'], fromMode);
4619
+ const fromProperties = getValueByPath(fromObject, ['properties']);
4620
+ if (fromProperties != null) {
4621
+ setValueByPath(toObject, ['properties'], fromProperties);
4275
4622
  }
4276
- const fromAllowedFunctionNames = getValueByPath(fromObject, [
4277
- 'allowedFunctionNames',
4623
+ const fromPropertyOrdering = getValueByPath(fromObject, [
4624
+ 'propertyOrdering',
4278
4625
  ]);
4279
- if (fromAllowedFunctionNames != null) {
4280
- setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
4626
+ if (fromPropertyOrdering != null) {
4627
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
4281
4628
  }
4282
- return toObject;
4283
- }
4284
- function functionCallingConfigToVertex(apiClient, fromObject) {
4285
- const toObject = {};
4286
- const fromMode = getValueByPath(fromObject, ['mode']);
4287
- if (fromMode != null) {
4288
- setValueByPath(toObject, ['mode'], fromMode);
4629
+ const fromRequired = getValueByPath(fromObject, ['required']);
4630
+ if (fromRequired != null) {
4631
+ setValueByPath(toObject, ['required'], fromRequired);
4289
4632
  }
4290
- const fromAllowedFunctionNames = getValueByPath(fromObject, [
4291
- 'allowedFunctionNames',
4292
- ]);
4293
- if (fromAllowedFunctionNames != null) {
4294
- setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
4633
+ const fromTitle = getValueByPath(fromObject, ['title']);
4634
+ if (fromTitle != null) {
4635
+ setValueByPath(toObject, ['title'], fromTitle);
4295
4636
  }
4296
- return toObject;
4297
- }
4298
- function toolConfigToMldev(apiClient, fromObject) {
4299
- const toObject = {};
4300
- const fromFunctionCallingConfig = getValueByPath(fromObject, [
4301
- 'functionCallingConfig',
4302
- ]);
4303
- if (fromFunctionCallingConfig != null) {
4304
- setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(apiClient, fromFunctionCallingConfig));
4637
+ const fromType = getValueByPath(fromObject, ['type']);
4638
+ if (fromType != null) {
4639
+ setValueByPath(toObject, ['type'], fromType);
4305
4640
  }
4306
4641
  return toObject;
4307
4642
  }
4308
- function toolConfigToVertex(apiClient, fromObject) {
4643
+ function safetySettingToVertex(apiClient, fromObject) {
4309
4644
  const toObject = {};
4310
- const fromFunctionCallingConfig = getValueByPath(fromObject, [
4311
- 'functionCallingConfig',
4312
- ]);
4313
- if (fromFunctionCallingConfig != null) {
4314
- setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex(apiClient, fromFunctionCallingConfig));
4645
+ const fromMethod = getValueByPath(fromObject, ['method']);
4646
+ if (fromMethod != null) {
4647
+ setValueByPath(toObject, ['method'], fromMethod);
4315
4648
  }
4316
- return toObject;
4317
- }
4318
- function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
4319
- const toObject = {};
4320
- const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
4321
- if (fromVoiceName != null) {
4322
- setValueByPath(toObject, ['voiceName'], fromVoiceName);
4649
+ const fromCategory = getValueByPath(fromObject, ['category']);
4650
+ if (fromCategory != null) {
4651
+ setValueByPath(toObject, ['category'], fromCategory);
4323
4652
  }
4324
- return toObject;
4325
- }
4326
- function prebuiltVoiceConfigToVertex(apiClient, fromObject) {
4327
- const toObject = {};
4328
- const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
4329
- if (fromVoiceName != null) {
4330
- setValueByPath(toObject, ['voiceName'], fromVoiceName);
4653
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
4654
+ if (fromThreshold != null) {
4655
+ setValueByPath(toObject, ['threshold'], fromThreshold);
4331
4656
  }
4332
4657
  return toObject;
4333
4658
  }
4334
- function voiceConfigToMldev(apiClient, fromObject) {
4659
+ function functionDeclarationToVertex(apiClient, fromObject) {
4335
4660
  const toObject = {};
4336
- const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
4337
- 'prebuiltVoiceConfig',
4338
- ]);
4339
- if (fromPrebuiltVoiceConfig != null) {
4340
- setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
4661
+ const fromResponse = getValueByPath(fromObject, ['response']);
4662
+ if (fromResponse != null) {
4663
+ setValueByPath(toObject, ['response'], schemaToVertex(apiClient, fromResponse));
4341
4664
  }
4342
- return toObject;
4343
- }
4344
- function voiceConfigToVertex(apiClient, fromObject) {
4345
- const toObject = {};
4346
- const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
4347
- 'prebuiltVoiceConfig',
4348
- ]);
4349
- if (fromPrebuiltVoiceConfig != null) {
4350
- setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToVertex(apiClient, fromPrebuiltVoiceConfig));
4665
+ const fromDescription = getValueByPath(fromObject, ['description']);
4666
+ if (fromDescription != null) {
4667
+ setValueByPath(toObject, ['description'], fromDescription);
4351
4668
  }
4352
- return toObject;
4353
- }
4354
- function speechConfigToMldev(apiClient, fromObject) {
4355
- const toObject = {};
4356
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
4357
- if (fromVoiceConfig != null) {
4358
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
4669
+ const fromName = getValueByPath(fromObject, ['name']);
4670
+ if (fromName != null) {
4671
+ setValueByPath(toObject, ['name'], fromName);
4672
+ }
4673
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
4674
+ if (fromParameters != null) {
4675
+ setValueByPath(toObject, ['parameters'], fromParameters);
4359
4676
  }
4360
4677
  return toObject;
4361
4678
  }
4362
- function speechConfigToVertex(apiClient, fromObject) {
4679
+ function googleSearchToVertex() {
4363
4680
  const toObject = {};
4364
- const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
4365
- if (fromVoiceConfig != null) {
4366
- setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
4367
- }
4368
4681
  return toObject;
4369
4682
  }
4370
- function thinkingConfigToMldev(apiClient, fromObject) {
4683
+ function dynamicRetrievalConfigToVertex(apiClient, fromObject) {
4371
4684
  const toObject = {};
4372
- const fromIncludeThoughts = getValueByPath(fromObject, [
4373
- 'includeThoughts',
4685
+ const fromMode = getValueByPath(fromObject, ['mode']);
4686
+ if (fromMode != null) {
4687
+ setValueByPath(toObject, ['mode'], fromMode);
4688
+ }
4689
+ const fromDynamicThreshold = getValueByPath(fromObject, [
4690
+ 'dynamicThreshold',
4374
4691
  ]);
4375
- if (fromIncludeThoughts != null) {
4376
- setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
4692
+ if (fromDynamicThreshold != null) {
4693
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
4377
4694
  }
4378
4695
  return toObject;
4379
4696
  }
4380
- function thinkingConfigToVertex(apiClient, fromObject) {
4697
+ function googleSearchRetrievalToVertex(apiClient, fromObject) {
4381
4698
  const toObject = {};
4382
- const fromIncludeThoughts = getValueByPath(fromObject, [
4383
- 'includeThoughts',
4699
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
4700
+ 'dynamicRetrievalConfig',
4384
4701
  ]);
4385
- if (fromIncludeThoughts != null) {
4386
- setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
4702
+ if (fromDynamicRetrievalConfig != null) {
4703
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex(apiClient, fromDynamicRetrievalConfig));
4387
4704
  }
4388
4705
  return toObject;
4389
4706
  }
4390
- function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
4707
+ function toolToVertex(apiClient, fromObject) {
4391
4708
  const toObject = {};
4392
- const fromSystemInstruction = getValueByPath(fromObject, [
4393
- 'systemInstruction',
4394
- ]);
4395
- if (parentObject !== undefined && fromSystemInstruction != null) {
4396
- setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
4397
- }
4398
- const fromTemperature = getValueByPath(fromObject, ['temperature']);
4399
- if (fromTemperature != null) {
4400
- setValueByPath(toObject, ['temperature'], fromTemperature);
4401
- }
4402
- const fromTopP = getValueByPath(fromObject, ['topP']);
4403
- if (fromTopP != null) {
4404
- setValueByPath(toObject, ['topP'], fromTopP);
4405
- }
4406
- const fromTopK = getValueByPath(fromObject, ['topK']);
4407
- if (fromTopK != null) {
4408
- setValueByPath(toObject, ['topK'], fromTopK);
4409
- }
4410
- const fromCandidateCount = getValueByPath(fromObject, [
4411
- 'candidateCount',
4412
- ]);
4413
- if (fromCandidateCount != null) {
4414
- setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
4415
- }
4416
- const fromMaxOutputTokens = getValueByPath(fromObject, [
4417
- 'maxOutputTokens',
4418
- ]);
4419
- if (fromMaxOutputTokens != null) {
4420
- setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
4421
- }
4422
- const fromStopSequences = getValueByPath(fromObject, [
4423
- 'stopSequences',
4424
- ]);
4425
- if (fromStopSequences != null) {
4426
- setValueByPath(toObject, ['stopSequences'], fromStopSequences);
4427
- }
4428
- const fromResponseLogprobs = getValueByPath(fromObject, [
4429
- 'responseLogprobs',
4430
- ]);
4431
- if (fromResponseLogprobs != null) {
4432
- setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
4433
- }
4434
- const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
4435
- if (fromLogprobs != null) {
4436
- setValueByPath(toObject, ['logprobs'], fromLogprobs);
4437
- }
4438
- const fromPresencePenalty = getValueByPath(fromObject, [
4439
- 'presencePenalty',
4440
- ]);
4441
- if (fromPresencePenalty != null) {
4442
- setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
4443
- }
4444
- const fromFrequencyPenalty = getValueByPath(fromObject, [
4445
- 'frequencyPenalty',
4446
- ]);
4447
- if (fromFrequencyPenalty != null) {
4448
- setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
4449
- }
4450
- const fromSeed = getValueByPath(fromObject, ['seed']);
4451
- if (fromSeed != null) {
4452
- setValueByPath(toObject, ['seed'], fromSeed);
4453
- }
4454
- const fromResponseMimeType = getValueByPath(fromObject, [
4455
- 'responseMimeType',
4456
- ]);
4457
- if (fromResponseMimeType != null) {
4458
- setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
4459
- }
4460
- const fromResponseSchema = getValueByPath(fromObject, [
4461
- 'responseSchema',
4462
- ]);
4463
- if (fromResponseSchema != null) {
4464
- setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
4465
- }
4466
- if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
4467
- throw new Error('routingConfig parameter is not supported in Gemini API.');
4468
- }
4469
- const fromSafetySettings = getValueByPath(fromObject, [
4470
- 'safetySettings',
4709
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
4710
+ 'functionDeclarations',
4471
4711
  ]);
4472
- if (parentObject !== undefined && fromSafetySettings != null) {
4473
- if (Array.isArray(fromSafetySettings)) {
4474
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
4475
- return safetySettingToMldev(apiClient, item);
4712
+ if (fromFunctionDeclarations != null) {
4713
+ if (Array.isArray(fromFunctionDeclarations)) {
4714
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4715
+ return functionDeclarationToVertex(apiClient, item);
4476
4716
  }));
4477
4717
  }
4478
4718
  else {
4479
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
4480
- }
4481
- }
4482
- const fromTools = getValueByPath(fromObject, ['tools']);
4483
- if (parentObject !== undefined && fromTools != null) {
4484
- if (Array.isArray(fromTools)) {
4485
- setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4486
- return toolToMldev(apiClient, tTool(apiClient, item));
4487
- })));
4488
- }
4489
- else {
4490
- setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
4719
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4491
4720
  }
4492
4721
  }
4493
- const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
4494
- if (parentObject !== undefined && fromToolConfig != null) {
4495
- setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(apiClient, fromToolConfig));
4722
+ const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
4723
+ if (fromRetrieval != null) {
4724
+ setValueByPath(toObject, ['retrieval'], fromRetrieval);
4496
4725
  }
4497
- if (getValueByPath(fromObject, ['labels']) !== undefined) {
4498
- throw new Error('labels parameter is not supported in Gemini API.');
4726
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4727
+ if (fromGoogleSearch != null) {
4728
+ setValueByPath(toObject, ['googleSearch'], googleSearchToVertex());
4499
4729
  }
4500
- const fromCachedContent = getValueByPath(fromObject, [
4501
- 'cachedContent',
4730
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4731
+ 'googleSearchRetrieval',
4502
4732
  ]);
4503
- if (parentObject !== undefined && fromCachedContent != null) {
4504
- setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
4733
+ if (fromGoogleSearchRetrieval != null) {
4734
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex(apiClient, fromGoogleSearchRetrieval));
4505
4735
  }
4506
- const fromResponseModalities = getValueByPath(fromObject, [
4507
- 'responseModalities',
4736
+ const fromCodeExecution = getValueByPath(fromObject, [
4737
+ 'codeExecution',
4508
4738
  ]);
4509
- if (fromResponseModalities != null) {
4510
- setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
4739
+ if (fromCodeExecution != null) {
4740
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4511
4741
  }
4512
- const fromMediaResolution = getValueByPath(fromObject, [
4513
- 'mediaResolution',
4742
+ return toObject;
4743
+ }
4744
+ function functionCallingConfigToVertex(apiClient, fromObject) {
4745
+ const toObject = {};
4746
+ const fromMode = getValueByPath(fromObject, ['mode']);
4747
+ if (fromMode != null) {
4748
+ setValueByPath(toObject, ['mode'], fromMode);
4749
+ }
4750
+ const fromAllowedFunctionNames = getValueByPath(fromObject, [
4751
+ 'allowedFunctionNames',
4514
4752
  ]);
4515
- if (fromMediaResolution != null) {
4516
- setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
4753
+ if (fromAllowedFunctionNames != null) {
4754
+ setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
4517
4755
  }
4518
- const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
4519
- if (fromSpeechConfig != null) {
4520
- setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
4756
+ return toObject;
4757
+ }
4758
+ function toolConfigToVertex(apiClient, fromObject) {
4759
+ const toObject = {};
4760
+ const fromFunctionCallingConfig = getValueByPath(fromObject, [
4761
+ 'functionCallingConfig',
4762
+ ]);
4763
+ if (fromFunctionCallingConfig != null) {
4764
+ setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToVertex(apiClient, fromFunctionCallingConfig));
4521
4765
  }
4522
- if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
4523
- throw new Error('audioTimestamp parameter is not supported in Gemini API.');
4766
+ return toObject;
4767
+ }
4768
+ function prebuiltVoiceConfigToVertex(apiClient, fromObject) {
4769
+ const toObject = {};
4770
+ const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
4771
+ if (fromVoiceName != null) {
4772
+ setValueByPath(toObject, ['voiceName'], fromVoiceName);
4524
4773
  }
4525
- const fromThinkingConfig = getValueByPath(fromObject, [
4526
- 'thinkingConfig',
4774
+ return toObject;
4775
+ }
4776
+ function voiceConfigToVertex(apiClient, fromObject) {
4777
+ const toObject = {};
4778
+ const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
4779
+ 'prebuiltVoiceConfig',
4527
4780
  ]);
4528
- if (fromThinkingConfig != null) {
4529
- setValueByPath(toObject, ['thinkingConfig'], thinkingConfigToMldev(apiClient, fromThinkingConfig));
4781
+ if (fromPrebuiltVoiceConfig != null) {
4782
+ setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToVertex(apiClient, fromPrebuiltVoiceConfig));
4783
+ }
4784
+ return toObject;
4785
+ }
4786
+ function speechConfigToVertex(apiClient, fromObject) {
4787
+ const toObject = {};
4788
+ const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
4789
+ if (fromVoiceConfig != null) {
4790
+ setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
4791
+ }
4792
+ return toObject;
4793
+ }
4794
+ function thinkingConfigToVertex(apiClient, fromObject) {
4795
+ const toObject = {};
4796
+ const fromIncludeThoughts = getValueByPath(fromObject, [
4797
+ 'includeThoughts',
4798
+ ]);
4799
+ if (fromIncludeThoughts != null) {
4800
+ setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
4530
4801
  }
4531
4802
  return toObject;
4532
4803
  }
@@ -4680,29 +4951,6 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
4680
4951
  }
4681
4952
  return toObject;
4682
4953
  }
4683
- function generateContentParametersToMldev(apiClient, fromObject) {
4684
- const toObject = {};
4685
- const fromModel = getValueByPath(fromObject, ['model']);
4686
- if (fromModel != null) {
4687
- setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
4688
- }
4689
- const fromContents = getValueByPath(fromObject, ['contents']);
4690
- if (fromContents != null) {
4691
- if (Array.isArray(fromContents)) {
4692
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
4693
- return contentToMldev(apiClient, item);
4694
- })));
4695
- }
4696
- else {
4697
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
4698
- }
4699
- }
4700
- const fromConfig = getValueByPath(fromObject, ['config']);
4701
- if (fromConfig != null) {
4702
- setValueByPath(toObject, ['generationConfig'], generateContentConfigToMldev(apiClient, fromConfig, toObject));
4703
- }
4704
- return toObject;
4705
- }
4706
4954
  function generateContentParametersToVertex(apiClient, fromObject) {
4707
4955
  const toObject = {};
4708
4956
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4726,30 +4974,6 @@ function generateContentParametersToVertex(apiClient, fromObject) {
4726
4974
  }
4727
4975
  return toObject;
4728
4976
  }
4729
- function embedContentConfigToMldev(apiClient, fromObject, parentObject) {
4730
- const toObject = {};
4731
- const fromTaskType = getValueByPath(fromObject, ['taskType']);
4732
- if (parentObject !== undefined && fromTaskType != null) {
4733
- setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
4734
- }
4735
- const fromTitle = getValueByPath(fromObject, ['title']);
4736
- if (parentObject !== undefined && fromTitle != null) {
4737
- setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
4738
- }
4739
- const fromOutputDimensionality = getValueByPath(fromObject, [
4740
- 'outputDimensionality',
4741
- ]);
4742
- if (parentObject !== undefined && fromOutputDimensionality != null) {
4743
- setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
4744
- }
4745
- if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
4746
- throw new Error('mimeType parameter is not supported in Gemini API.');
4747
- }
4748
- if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
4749
- throw new Error('autoTruncate parameter is not supported in Gemini API.');
4750
- }
4751
- return toObject;
4752
- }
4753
4977
  function embedContentConfigToVertex(apiClient, fromObject, parentObject) {
4754
4978
  const toObject = {};
4755
4979
  const fromTaskType = getValueByPath(fromObject, ['taskType']);
@@ -4776,26 +5000,6 @@ function embedContentConfigToVertex(apiClient, fromObject, parentObject) {
4776
5000
  }
4777
5001
  return toObject;
4778
5002
  }
4779
- function embedContentParametersToMldev(apiClient, fromObject) {
4780
- const toObject = {};
4781
- const fromModel = getValueByPath(fromObject, ['model']);
4782
- if (fromModel != null) {
4783
- setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
4784
- }
4785
- const fromContents = getValueByPath(fromObject, ['contents']);
4786
- if (fromContents != null) {
4787
- setValueByPath(toObject, ['requests[]', 'content'], tContentsForEmbed(apiClient, fromContents));
4788
- }
4789
- const fromConfig = getValueByPath(fromObject, ['config']);
4790
- if (fromConfig != null) {
4791
- setValueByPath(toObject, ['config'], embedContentConfigToMldev(apiClient, fromConfig, toObject));
4792
- }
4793
- const fromModelForEmbedContent = getValueByPath(fromObject, ['model']);
4794
- if (fromModelForEmbedContent !== undefined) {
4795
- setValueByPath(toObject, ['requests[]', 'model'], tModel(apiClient, fromModelForEmbedContent));
4796
- }
4797
- return toObject;
4798
- }
4799
5003
  function embedContentParametersToVertex(apiClient, fromObject) {
4800
5004
  const toObject = {};
4801
5005
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -4812,81 +5016,6 @@ function embedContentParametersToVertex(apiClient, fromObject) {
4812
5016
  }
4813
5017
  return toObject;
4814
5018
  }
4815
- function generateImagesConfigToMldev(apiClient, fromObject, parentObject) {
4816
- const toObject = {};
4817
- if (getValueByPath(fromObject, ['outputGcsUri']) !== undefined) {
4818
- throw new Error('outputGcsUri parameter is not supported in Gemini API.');
4819
- }
4820
- if (getValueByPath(fromObject, ['negativePrompt']) !== undefined) {
4821
- throw new Error('negativePrompt parameter is not supported in Gemini API.');
4822
- }
4823
- const fromNumberOfImages = getValueByPath(fromObject, [
4824
- 'numberOfImages',
4825
- ]);
4826
- if (parentObject !== undefined && fromNumberOfImages != null) {
4827
- setValueByPath(parentObject, ['parameters', 'sampleCount'], fromNumberOfImages);
4828
- }
4829
- const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
4830
- if (parentObject !== undefined && fromAspectRatio != null) {
4831
- setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
4832
- }
4833
- const fromGuidanceScale = getValueByPath(fromObject, [
4834
- 'guidanceScale',
4835
- ]);
4836
- if (parentObject !== undefined && fromGuidanceScale != null) {
4837
- setValueByPath(parentObject, ['parameters', 'guidanceScale'], fromGuidanceScale);
4838
- }
4839
- if (getValueByPath(fromObject, ['seed']) !== undefined) {
4840
- throw new Error('seed parameter is not supported in Gemini API.');
4841
- }
4842
- const fromSafetyFilterLevel = getValueByPath(fromObject, [
4843
- 'safetyFilterLevel',
4844
- ]);
4845
- if (parentObject !== undefined && fromSafetyFilterLevel != null) {
4846
- setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
4847
- }
4848
- const fromPersonGeneration = getValueByPath(fromObject, [
4849
- 'personGeneration',
4850
- ]);
4851
- if (parentObject !== undefined && fromPersonGeneration != null) {
4852
- setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
4853
- }
4854
- const fromIncludeSafetyAttributes = getValueByPath(fromObject, [
4855
- 'includeSafetyAttributes',
4856
- ]);
4857
- if (parentObject !== undefined && fromIncludeSafetyAttributes != null) {
4858
- setValueByPath(parentObject, ['parameters', 'includeSafetyAttributes'], fromIncludeSafetyAttributes);
4859
- }
4860
- const fromIncludeRaiReason = getValueByPath(fromObject, [
4861
- 'includeRaiReason',
4862
- ]);
4863
- if (parentObject !== undefined && fromIncludeRaiReason != null) {
4864
- setValueByPath(parentObject, ['parameters', 'includeRaiReason'], fromIncludeRaiReason);
4865
- }
4866
- const fromLanguage = getValueByPath(fromObject, ['language']);
4867
- if (parentObject !== undefined && fromLanguage != null) {
4868
- setValueByPath(parentObject, ['parameters', 'language'], fromLanguage);
4869
- }
4870
- const fromOutputMimeType = getValueByPath(fromObject, [
4871
- 'outputMimeType',
4872
- ]);
4873
- if (parentObject !== undefined && fromOutputMimeType != null) {
4874
- setValueByPath(parentObject, ['parameters', 'outputOptions', 'mimeType'], fromOutputMimeType);
4875
- }
4876
- const fromOutputCompressionQuality = getValueByPath(fromObject, [
4877
- 'outputCompressionQuality',
4878
- ]);
4879
- if (parentObject !== undefined && fromOutputCompressionQuality != null) {
4880
- setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
4881
- }
4882
- if (getValueByPath(fromObject, ['addWatermark']) !== undefined) {
4883
- throw new Error('addWatermark parameter is not supported in Gemini API.');
4884
- }
4885
- if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
4886
- throw new Error('enhancePrompt parameter is not supported in Gemini API.');
4887
- }
4888
- return toObject;
4889
- }
4890
5019
  function generateImagesConfigToVertex(apiClient, fromObject, parentObject) {
4891
5020
  const toObject = {};
4892
5021
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
@@ -4965,25 +5094,9 @@ function generateImagesConfigToVertex(apiClient, fromObject, parentObject) {
4965
5094
  }
4966
5095
  const fromEnhancePrompt = getValueByPath(fromObject, [
4967
5096
  'enhancePrompt',
4968
- ]);
4969
- if (parentObject !== undefined && fromEnhancePrompt != null) {
4970
- setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
4971
- }
4972
- return toObject;
4973
- }
4974
- function generateImagesParametersToMldev(apiClient, fromObject) {
4975
- const toObject = {};
4976
- const fromModel = getValueByPath(fromObject, ['model']);
4977
- if (fromModel != null) {
4978
- setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
4979
- }
4980
- const fromPrompt = getValueByPath(fromObject, ['prompt']);
4981
- if (fromPrompt != null) {
4982
- setValueByPath(toObject, ['instances[0]', 'prompt'], fromPrompt);
4983
- }
4984
- const fromConfig = getValueByPath(fromObject, ['config']);
4985
- if (fromConfig != null) {
4986
- setValueByPath(toObject, ['config'], generateImagesConfigToMldev(apiClient, fromConfig, toObject));
5097
+ ]);
5098
+ if (parentObject !== undefined && fromEnhancePrompt != null) {
5099
+ setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
4987
5100
  }
4988
5101
  return toObject;
4989
5102
  }
@@ -5003,19 +5116,6 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
5003
5116
  }
5004
5117
  return toObject;
5005
5118
  }
5006
- function countTokensConfigToMldev(apiClient, fromObject) {
5007
- const toObject = {};
5008
- if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
5009
- throw new Error('systemInstruction parameter is not supported in Gemini API.');
5010
- }
5011
- if (getValueByPath(fromObject, ['tools']) !== undefined) {
5012
- throw new Error('tools parameter is not supported in Gemini API.');
5013
- }
5014
- if (getValueByPath(fromObject, ['generationConfig']) !== undefined) {
5015
- throw new Error('generationConfig parameter is not supported in Gemini API.');
5016
- }
5017
- return toObject;
5018
- }
5019
5119
  function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
5020
5120
  const toObject = {};
5021
5121
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -5043,29 +5143,6 @@ function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
5043
5143
  }
5044
5144
  return toObject;
5045
5145
  }
5046
- function countTokensParametersToMldev(apiClient, fromObject) {
5047
- const toObject = {};
5048
- const fromModel = getValueByPath(fromObject, ['model']);
5049
- if (fromModel != null) {
5050
- setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
5051
- }
5052
- const fromContents = getValueByPath(fromObject, ['contents']);
5053
- if (fromContents != null) {
5054
- if (Array.isArray(fromContents)) {
5055
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
5056
- return contentToMldev(apiClient, item);
5057
- })));
5058
- }
5059
- else {
5060
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
5061
- }
5062
- }
5063
- const fromConfig = getValueByPath(fromObject, ['config']);
5064
- if (fromConfig != null) {
5065
- setValueByPath(toObject, ['config'], countTokensConfigToMldev(apiClient, fromConfig));
5066
- }
5067
- return toObject;
5068
- }
5069
5146
  function countTokensParametersToVertex(apiClient, fromObject) {
5070
5147
  const toObject = {};
5071
5148
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -5138,19 +5215,247 @@ function partFromMldev(apiClient, fromObject) {
5138
5215
  if (fromFunctionCall != null) {
5139
5216
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5140
5217
  }
5141
- const fromFunctionResponse = getValueByPath(fromObject, [
5142
- 'functionResponse',
5218
+ const fromFunctionResponse = getValueByPath(fromObject, [
5219
+ 'functionResponse',
5220
+ ]);
5221
+ if (fromFunctionResponse != null) {
5222
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
5223
+ }
5224
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5225
+ if (fromInlineData != null) {
5226
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
5227
+ }
5228
+ const fromText = getValueByPath(fromObject, ['text']);
5229
+ if (fromText != null) {
5230
+ setValueByPath(toObject, ['text'], fromText);
5231
+ }
5232
+ return toObject;
5233
+ }
5234
+ function contentFromMldev(apiClient, fromObject) {
5235
+ const toObject = {};
5236
+ const fromParts = getValueByPath(fromObject, ['parts']);
5237
+ if (fromParts != null) {
5238
+ if (Array.isArray(fromParts)) {
5239
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
5240
+ return partFromMldev(apiClient, item);
5241
+ }));
5242
+ }
5243
+ else {
5244
+ setValueByPath(toObject, ['parts'], fromParts);
5245
+ }
5246
+ }
5247
+ const fromRole = getValueByPath(fromObject, ['role']);
5248
+ if (fromRole != null) {
5249
+ setValueByPath(toObject, ['role'], fromRole);
5250
+ }
5251
+ return toObject;
5252
+ }
5253
+ function citationMetadataFromMldev(apiClient, fromObject) {
5254
+ const toObject = {};
5255
+ const fromCitations = getValueByPath(fromObject, ['citationSources']);
5256
+ if (fromCitations != null) {
5257
+ setValueByPath(toObject, ['citations'], fromCitations);
5258
+ }
5259
+ return toObject;
5260
+ }
5261
+ function candidateFromMldev(apiClient, fromObject) {
5262
+ const toObject = {};
5263
+ const fromContent = getValueByPath(fromObject, ['content']);
5264
+ if (fromContent != null) {
5265
+ setValueByPath(toObject, ['content'], contentFromMldev(apiClient, fromContent));
5266
+ }
5267
+ const fromCitationMetadata = getValueByPath(fromObject, [
5268
+ 'citationMetadata',
5269
+ ]);
5270
+ if (fromCitationMetadata != null) {
5271
+ setValueByPath(toObject, ['citationMetadata'], citationMetadataFromMldev(apiClient, fromCitationMetadata));
5272
+ }
5273
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
5274
+ if (fromTokenCount != null) {
5275
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
5276
+ }
5277
+ const fromFinishReason = getValueByPath(fromObject, ['finishReason']);
5278
+ if (fromFinishReason != null) {
5279
+ setValueByPath(toObject, ['finishReason'], fromFinishReason);
5280
+ }
5281
+ const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
5282
+ if (fromAvgLogprobs != null) {
5283
+ setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
5284
+ }
5285
+ const fromGroundingMetadata = getValueByPath(fromObject, [
5286
+ 'groundingMetadata',
5287
+ ]);
5288
+ if (fromGroundingMetadata != null) {
5289
+ setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
5290
+ }
5291
+ const fromIndex = getValueByPath(fromObject, ['index']);
5292
+ if (fromIndex != null) {
5293
+ setValueByPath(toObject, ['index'], fromIndex);
5294
+ }
5295
+ const fromLogprobsResult = getValueByPath(fromObject, [
5296
+ 'logprobsResult',
5297
+ ]);
5298
+ if (fromLogprobsResult != null) {
5299
+ setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
5300
+ }
5301
+ const fromSafetyRatings = getValueByPath(fromObject, [
5302
+ 'safetyRatings',
5303
+ ]);
5304
+ if (fromSafetyRatings != null) {
5305
+ setValueByPath(toObject, ['safetyRatings'], fromSafetyRatings);
5306
+ }
5307
+ return toObject;
5308
+ }
5309
+ function generateContentResponseFromMldev(apiClient, fromObject) {
5310
+ const toObject = {};
5311
+ const fromCandidates = getValueByPath(fromObject, ['candidates']);
5312
+ if (fromCandidates != null) {
5313
+ if (Array.isArray(fromCandidates)) {
5314
+ setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
5315
+ return candidateFromMldev(apiClient, item);
5316
+ }));
5317
+ }
5318
+ else {
5319
+ setValueByPath(toObject, ['candidates'], fromCandidates);
5320
+ }
5321
+ }
5322
+ const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
5323
+ if (fromModelVersion != null) {
5324
+ setValueByPath(toObject, ['modelVersion'], fromModelVersion);
5325
+ }
5326
+ const fromPromptFeedback = getValueByPath(fromObject, [
5327
+ 'promptFeedback',
5328
+ ]);
5329
+ if (fromPromptFeedback != null) {
5330
+ setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
5331
+ }
5332
+ const fromUsageMetadata = getValueByPath(fromObject, [
5333
+ 'usageMetadata',
5334
+ ]);
5335
+ if (fromUsageMetadata != null) {
5336
+ setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
5337
+ }
5338
+ return toObject;
5339
+ }
5340
+ function contentEmbeddingFromMldev(apiClient, fromObject) {
5341
+ const toObject = {};
5342
+ const fromValues = getValueByPath(fromObject, ['values']);
5343
+ if (fromValues != null) {
5344
+ setValueByPath(toObject, ['values'], fromValues);
5345
+ }
5346
+ return toObject;
5347
+ }
5348
+ function embedContentMetadataFromMldev() {
5349
+ const toObject = {};
5350
+ return toObject;
5351
+ }
5352
+ function embedContentResponseFromMldev(apiClient, fromObject) {
5353
+ const toObject = {};
5354
+ const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
5355
+ if (fromEmbeddings != null) {
5356
+ if (Array.isArray(fromEmbeddings)) {
5357
+ setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
5358
+ return contentEmbeddingFromMldev(apiClient, item);
5359
+ }));
5360
+ }
5361
+ else {
5362
+ setValueByPath(toObject, ['embeddings'], fromEmbeddings);
5363
+ }
5364
+ }
5365
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
5366
+ if (fromMetadata != null) {
5367
+ setValueByPath(toObject, ['metadata'], embedContentMetadataFromMldev());
5368
+ }
5369
+ return toObject;
5370
+ }
5371
+ function imageFromMldev(apiClient, fromObject) {
5372
+ const toObject = {};
5373
+ const fromImageBytes = getValueByPath(fromObject, [
5374
+ 'bytesBase64Encoded',
5375
+ ]);
5376
+ if (fromImageBytes != null) {
5377
+ setValueByPath(toObject, ['imageBytes'], tBytes(apiClient, fromImageBytes));
5378
+ }
5379
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5380
+ if (fromMimeType != null) {
5381
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
5382
+ }
5383
+ return toObject;
5384
+ }
5385
+ function safetyAttributesFromMldev(apiClient, fromObject) {
5386
+ const toObject = {};
5387
+ const fromCategories = getValueByPath(fromObject, [
5388
+ 'safetyAttributes',
5389
+ 'categories',
5390
+ ]);
5391
+ if (fromCategories != null) {
5392
+ setValueByPath(toObject, ['categories'], fromCategories);
5393
+ }
5394
+ const fromScores = getValueByPath(fromObject, [
5395
+ 'safetyAttributes',
5396
+ 'scores',
5397
+ ]);
5398
+ if (fromScores != null) {
5399
+ setValueByPath(toObject, ['scores'], fromScores);
5400
+ }
5401
+ const fromContentType = getValueByPath(fromObject, ['contentType']);
5402
+ if (fromContentType != null) {
5403
+ setValueByPath(toObject, ['contentType'], fromContentType);
5404
+ }
5405
+ return toObject;
5406
+ }
5407
+ function generatedImageFromMldev(apiClient, fromObject) {
5408
+ const toObject = {};
5409
+ const fromImage = getValueByPath(fromObject, ['_self']);
5410
+ if (fromImage != null) {
5411
+ setValueByPath(toObject, ['image'], imageFromMldev(apiClient, fromImage));
5412
+ }
5413
+ const fromRaiFilteredReason = getValueByPath(fromObject, [
5414
+ 'raiFilteredReason',
5415
+ ]);
5416
+ if (fromRaiFilteredReason != null) {
5417
+ setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
5418
+ }
5419
+ const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
5420
+ if (fromSafetyAttributes != null) {
5421
+ setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromMldev(apiClient, fromSafetyAttributes));
5422
+ }
5423
+ return toObject;
5424
+ }
5425
+ function generateImagesResponseFromMldev(apiClient, fromObject) {
5426
+ const toObject = {};
5427
+ const fromGeneratedImages = getValueByPath(fromObject, [
5428
+ 'predictions',
5429
+ ]);
5430
+ if (fromGeneratedImages != null) {
5431
+ if (Array.isArray(fromGeneratedImages)) {
5432
+ setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
5433
+ return generatedImageFromMldev(apiClient, item);
5434
+ }));
5435
+ }
5436
+ else {
5437
+ setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
5438
+ }
5439
+ }
5440
+ const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
5441
+ 'positivePromptSafetyAttributes',
5143
5442
  ]);
5144
- if (fromFunctionResponse != null) {
5145
- setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
5443
+ if (fromPositivePromptSafetyAttributes != null) {
5444
+ setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromMldev(apiClient, fromPositivePromptSafetyAttributes));
5146
5445
  }
5147
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5148
- if (fromInlineData != null) {
5149
- setValueByPath(toObject, ['inlineData'], fromInlineData);
5446
+ return toObject;
5447
+ }
5448
+ function countTokensResponseFromMldev(apiClient, fromObject) {
5449
+ const toObject = {};
5450
+ const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
5451
+ if (fromTotalTokens != null) {
5452
+ setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
5150
5453
  }
5151
- const fromText = getValueByPath(fromObject, ['text']);
5152
- if (fromText != null) {
5153
- setValueByPath(toObject, ['text'], fromText);
5454
+ const fromCachedContentTokenCount = getValueByPath(fromObject, [
5455
+ 'cachedContentTokenCount',
5456
+ ]);
5457
+ if (fromCachedContentTokenCount != null) {
5458
+ setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
5154
5459
  }
5155
5460
  return toObject;
5156
5461
  }
@@ -5202,25 +5507,6 @@ function partFromVertex(apiClient, fromObject) {
5202
5507
  }
5203
5508
  return toObject;
5204
5509
  }
5205
- function contentFromMldev(apiClient, fromObject) {
5206
- const toObject = {};
5207
- const fromParts = getValueByPath(fromObject, ['parts']);
5208
- if (fromParts != null) {
5209
- if (Array.isArray(fromParts)) {
5210
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
5211
- return partFromMldev(apiClient, item);
5212
- }));
5213
- }
5214
- else {
5215
- setValueByPath(toObject, ['parts'], fromParts);
5216
- }
5217
- }
5218
- const fromRole = getValueByPath(fromObject, ['role']);
5219
- if (fromRole != null) {
5220
- setValueByPath(toObject, ['role'], fromRole);
5221
- }
5222
- return toObject;
5223
- }
5224
5510
  function contentFromVertex(apiClient, fromObject) {
5225
5511
  const toObject = {};
5226
5512
  const fromParts = getValueByPath(fromObject, ['parts']);
@@ -5240,14 +5526,6 @@ function contentFromVertex(apiClient, fromObject) {
5240
5526
  }
5241
5527
  return toObject;
5242
5528
  }
5243
- function citationMetadataFromMldev(apiClient, fromObject) {
5244
- const toObject = {};
5245
- const fromCitations = getValueByPath(fromObject, ['citationSources']);
5246
- if (fromCitations != null) {
5247
- setValueByPath(toObject, ['citations'], fromCitations);
5248
- }
5249
- return toObject;
5250
- }
5251
5529
  function citationMetadataFromVertex(apiClient, fromObject) {
5252
5530
  const toObject = {};
5253
5531
  const fromCitations = getValueByPath(fromObject, ['citations']);
@@ -5256,54 +5534,6 @@ function citationMetadataFromVertex(apiClient, fromObject) {
5256
5534
  }
5257
5535
  return toObject;
5258
5536
  }
5259
- function candidateFromMldev(apiClient, fromObject) {
5260
- const toObject = {};
5261
- const fromContent = getValueByPath(fromObject, ['content']);
5262
- if (fromContent != null) {
5263
- setValueByPath(toObject, ['content'], contentFromMldev(apiClient, fromContent));
5264
- }
5265
- const fromCitationMetadata = getValueByPath(fromObject, [
5266
- 'citationMetadata',
5267
- ]);
5268
- if (fromCitationMetadata != null) {
5269
- setValueByPath(toObject, ['citationMetadata'], citationMetadataFromMldev(apiClient, fromCitationMetadata));
5270
- }
5271
- const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
5272
- if (fromTokenCount != null) {
5273
- setValueByPath(toObject, ['tokenCount'], fromTokenCount);
5274
- }
5275
- const fromFinishReason = getValueByPath(fromObject, ['finishReason']);
5276
- if (fromFinishReason != null) {
5277
- setValueByPath(toObject, ['finishReason'], fromFinishReason);
5278
- }
5279
- const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
5280
- if (fromAvgLogprobs != null) {
5281
- setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
5282
- }
5283
- const fromGroundingMetadata = getValueByPath(fromObject, [
5284
- 'groundingMetadata',
5285
- ]);
5286
- if (fromGroundingMetadata != null) {
5287
- setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
5288
- }
5289
- const fromIndex = getValueByPath(fromObject, ['index']);
5290
- if (fromIndex != null) {
5291
- setValueByPath(toObject, ['index'], fromIndex);
5292
- }
5293
- const fromLogprobsResult = getValueByPath(fromObject, [
5294
- 'logprobsResult',
5295
- ]);
5296
- if (fromLogprobsResult != null) {
5297
- setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
5298
- }
5299
- const fromSafetyRatings = getValueByPath(fromObject, [
5300
- 'safetyRatings',
5301
- ]);
5302
- if (fromSafetyRatings != null) {
5303
- setValueByPath(toObject, ['safetyRatings'], fromSafetyRatings);
5304
- }
5305
- return toObject;
5306
- }
5307
5537
  function candidateFromVertex(apiClient, fromObject) {
5308
5538
  const toObject = {};
5309
5539
  const fromContent = getValueByPath(fromObject, ['content']);
@@ -5354,37 +5584,6 @@ function candidateFromVertex(apiClient, fromObject) {
5354
5584
  }
5355
5585
  return toObject;
5356
5586
  }
5357
- function generateContentResponseFromMldev(apiClient, fromObject) {
5358
- const toObject = {};
5359
- const fromCandidates = getValueByPath(fromObject, ['candidates']);
5360
- if (fromCandidates != null) {
5361
- if (Array.isArray(fromCandidates)) {
5362
- setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
5363
- return candidateFromMldev(apiClient, item);
5364
- }));
5365
- }
5366
- else {
5367
- setValueByPath(toObject, ['candidates'], fromCandidates);
5368
- }
5369
- }
5370
- const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
5371
- if (fromModelVersion != null) {
5372
- setValueByPath(toObject, ['modelVersion'], fromModelVersion);
5373
- }
5374
- const fromPromptFeedback = getValueByPath(fromObject, [
5375
- 'promptFeedback',
5376
- ]);
5377
- if (fromPromptFeedback != null) {
5378
- setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
5379
- }
5380
- const fromUsageMetadata = getValueByPath(fromObject, [
5381
- 'usageMetadata',
5382
- ]);
5383
- if (fromUsageMetadata != null) {
5384
- setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
5385
- }
5386
- return toObject;
5387
- }
5388
5587
  function generateContentResponseFromVertex(apiClient, fromObject) {
5389
5588
  const toObject = {};
5390
5589
  const fromCandidates = getValueByPath(fromObject, ['candidates']);
@@ -5436,14 +5635,6 @@ function contentEmbeddingStatisticsFromVertex(apiClient, fromObject) {
5436
5635
  }
5437
5636
  return toObject;
5438
5637
  }
5439
- function contentEmbeddingFromMldev(apiClient, fromObject) {
5440
- const toObject = {};
5441
- const fromValues = getValueByPath(fromObject, ['values']);
5442
- if (fromValues != null) {
5443
- setValueByPath(toObject, ['values'], fromValues);
5444
- }
5445
- return toObject;
5446
- }
5447
5638
  function contentEmbeddingFromVertex(apiClient, fromObject) {
5448
5639
  const toObject = {};
5449
5640
  const fromValues = getValueByPath(fromObject, ['values']);
@@ -5456,10 +5647,6 @@ function contentEmbeddingFromVertex(apiClient, fromObject) {
5456
5647
  }
5457
5648
  return toObject;
5458
5649
  }
5459
- function embedContentMetadataFromMldev() {
5460
- const toObject = {};
5461
- return toObject;
5462
- }
5463
5650
  function embedContentMetadataFromVertex(apiClient, fromObject) {
5464
5651
  const toObject = {};
5465
5652
  const fromBillableCharacterCount = getValueByPath(fromObject, [
@@ -5470,25 +5657,6 @@ function embedContentMetadataFromVertex(apiClient, fromObject) {
5470
5657
  }
5471
5658
  return toObject;
5472
5659
  }
5473
- function embedContentResponseFromMldev(apiClient, fromObject) {
5474
- const toObject = {};
5475
- const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
5476
- if (fromEmbeddings != null) {
5477
- if (Array.isArray(fromEmbeddings)) {
5478
- setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
5479
- return contentEmbeddingFromMldev(apiClient, item);
5480
- }));
5481
- }
5482
- else {
5483
- setValueByPath(toObject, ['embeddings'], fromEmbeddings);
5484
- }
5485
- }
5486
- const fromMetadata = getValueByPath(fromObject, ['metadata']);
5487
- if (fromMetadata != null) {
5488
- setValueByPath(toObject, ['metadata'], embedContentMetadataFromMldev());
5489
- }
5490
- return toObject;
5491
- }
5492
5660
  function embedContentResponseFromVertex(apiClient, fromObject) {
5493
5661
  const toObject = {};
5494
5662
  const fromEmbeddings = getValueByPath(fromObject, [
@@ -5511,20 +5679,6 @@ function embedContentResponseFromVertex(apiClient, fromObject) {
5511
5679
  }
5512
5680
  return toObject;
5513
5681
  }
5514
- function imageFromMldev(apiClient, fromObject) {
5515
- const toObject = {};
5516
- const fromImageBytes = getValueByPath(fromObject, [
5517
- 'bytesBase64Encoded',
5518
- ]);
5519
- if (fromImageBytes != null) {
5520
- setValueByPath(toObject, ['imageBytes'], tBytes(apiClient, fromImageBytes));
5521
- }
5522
- const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5523
- if (fromMimeType != null) {
5524
- setValueByPath(toObject, ['mimeType'], fromMimeType);
5525
- }
5526
- return toObject;
5527
- }
5528
5682
  function imageFromVertex(apiClient, fromObject) {
5529
5683
  const toObject = {};
5530
5684
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
@@ -5543,24 +5697,6 @@ function imageFromVertex(apiClient, fromObject) {
5543
5697
  }
5544
5698
  return toObject;
5545
5699
  }
5546
- function safetyAttributesFromMldev(apiClient, fromObject) {
5547
- const toObject = {};
5548
- const fromCategories = getValueByPath(fromObject, [
5549
- 'safetyAttributes',
5550
- 'categories',
5551
- ]);
5552
- if (fromCategories != null) {
5553
- setValueByPath(toObject, ['categories'], fromCategories);
5554
- }
5555
- const fromScores = getValueByPath(fromObject, [
5556
- 'safetyAttributes',
5557
- 'scores',
5558
- ]);
5559
- if (fromScores != null) {
5560
- setValueByPath(toObject, ['scores'], fromScores);
5561
- }
5562
- return toObject;
5563
- }
5564
5700
  function safetyAttributesFromVertex(apiClient, fromObject) {
5565
5701
  const toObject = {};
5566
5702
  const fromCategories = getValueByPath(fromObject, [
@@ -5577,23 +5713,9 @@ function safetyAttributesFromVertex(apiClient, fromObject) {
5577
5713
  if (fromScores != null) {
5578
5714
  setValueByPath(toObject, ['scores'], fromScores);
5579
5715
  }
5580
- return toObject;
5581
- }
5582
- function generatedImageFromMldev(apiClient, fromObject) {
5583
- const toObject = {};
5584
- const fromImage = getValueByPath(fromObject, ['_self']);
5585
- if (fromImage != null) {
5586
- setValueByPath(toObject, ['image'], imageFromMldev(apiClient, fromImage));
5587
- }
5588
- const fromRaiFilteredReason = getValueByPath(fromObject, [
5589
- 'raiFilteredReason',
5590
- ]);
5591
- if (fromRaiFilteredReason != null) {
5592
- setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
5593
- }
5594
- const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
5595
- if (fromSafetyAttributes != null) {
5596
- setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromMldev(apiClient, fromSafetyAttributes));
5716
+ const fromContentType = getValueByPath(fromObject, ['contentType']);
5717
+ if (fromContentType != null) {
5718
+ setValueByPath(toObject, ['contentType'], fromContentType);
5597
5719
  }
5598
5720
  return toObject;
5599
5721
  }
@@ -5619,23 +5741,6 @@ function generatedImageFromVertex(apiClient, fromObject) {
5619
5741
  }
5620
5742
  return toObject;
5621
5743
  }
5622
- function generateImagesResponseFromMldev(apiClient, fromObject) {
5623
- const toObject = {};
5624
- const fromGeneratedImages = getValueByPath(fromObject, [
5625
- 'predictions',
5626
- ]);
5627
- if (fromGeneratedImages != null) {
5628
- if (Array.isArray(fromGeneratedImages)) {
5629
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
5630
- return generatedImageFromMldev(apiClient, item);
5631
- }));
5632
- }
5633
- else {
5634
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
5635
- }
5636
- }
5637
- return toObject;
5638
- }
5639
5744
  function generateImagesResponseFromVertex(apiClient, fromObject) {
5640
5745
  const toObject = {};
5641
5746
  const fromGeneratedImages = getValueByPath(fromObject, [
@@ -5651,19 +5756,11 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
5651
5756
  setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
5652
5757
  }
5653
5758
  }
5654
- return toObject;
5655
- }
5656
- function countTokensResponseFromMldev(apiClient, fromObject) {
5657
- const toObject = {};
5658
- const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
5659
- if (fromTotalTokens != null) {
5660
- setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
5661
- }
5662
- const fromCachedContentTokenCount = getValueByPath(fromObject, [
5663
- 'cachedContentTokenCount',
5759
+ const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
5760
+ 'positivePromptSafetyAttributes',
5664
5761
  ]);
5665
- if (fromCachedContentTokenCount != null) {
5666
- setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
5762
+ if (fromPositivePromptSafetyAttributes != null) {
5763
+ setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromVertex(apiClient, fromPositivePromptSafetyAttributes));
5667
5764
  }
5668
5765
  return toObject;
5669
5766
  }
@@ -6408,6 +6505,59 @@ class Models extends BaseModule {
6408
6505
  this.generateContentStream = async (params) => {
6409
6506
  return await this.generateContentStreamInternal(params);
6410
6507
  };
6508
+ /**
6509
+ * Generates an image based on a text description and configuration.
6510
+ *
6511
+ * @param model - The model to use.
6512
+ * @param prompt - A text description of the image to generate.
6513
+ * @param [config] - The config for image generation.
6514
+ * @return The response from the API.
6515
+ *
6516
+ * @example
6517
+ * ```ts
6518
+ * const response = await client.models.generateImages({
6519
+ * model: 'imagen-3.0-generate-002',
6520
+ * prompt: 'Robot holding a red skateboard',
6521
+ * config: {
6522
+ * numberOfImages: 1,
6523
+ * includeRaiReason: true,
6524
+ * },
6525
+ * });
6526
+ * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
6527
+ * ```
6528
+ */
6529
+ this.generateImages = async (params) => {
6530
+ return await this.generateImagesInternal(params).then((apiResponse) => {
6531
+ var _a;
6532
+ let positivePromptSafetyAttributes;
6533
+ const generatedImages = [];
6534
+ if (apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.generatedImages) {
6535
+ for (const generatedImage of apiResponse.generatedImages) {
6536
+ if (generatedImage &&
6537
+ (generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes) &&
6538
+ ((_a = generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes) === null || _a === void 0 ? void 0 : _a.contentType) === 'Positive Prompt') {
6539
+ positivePromptSafetyAttributes = generatedImage === null || generatedImage === void 0 ? void 0 : generatedImage.safetyAttributes;
6540
+ }
6541
+ else {
6542
+ generatedImages.push(generatedImage);
6543
+ }
6544
+ }
6545
+ }
6546
+ let response;
6547
+ if (positivePromptSafetyAttributes) {
6548
+ response = {
6549
+ generatedImages: generatedImages,
6550
+ positivePromptSafetyAttributes: positivePromptSafetyAttributes,
6551
+ };
6552
+ }
6553
+ else {
6554
+ response = {
6555
+ generatedImages: generatedImages,
6556
+ };
6557
+ }
6558
+ return response;
6559
+ });
6560
+ };
6411
6561
  }
6412
6562
  async generateContentInternal(params) {
6413
6563
  var _a, _b;
@@ -6645,7 +6795,7 @@ class Models extends BaseModule {
6645
6795
  * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
6646
6796
  * ```
6647
6797
  */
6648
- async generateImages(params) {
6798
+ async generateImagesInternal(params) {
6649
6799
  var _a, _b;
6650
6800
  let response;
6651
6801
  let path = '';
@@ -6917,6 +7067,7 @@ exports.ComputeTokensResponse = ComputeTokensResponse;
6917
7067
  exports.CountTokensResponse = CountTokensResponse;
6918
7068
  exports.CreateFileResponse = CreateFileResponse;
6919
7069
  exports.DeleteCachedContentResponse = DeleteCachedContentResponse;
7070
+ exports.DeleteFileResponse = DeleteFileResponse;
6920
7071
  exports.EmbedContentResponse = EmbedContentResponse;
6921
7072
  exports.FunctionResponse = FunctionResponse;
6922
7073
  exports.GenerateContentResponse = GenerateContentResponse;