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