@@ -414,18 +414,18 @@ ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) {
414414 @ ExcludeFromGeneratedCoverageReport
415415 ObjectNode functionCallingConfigToMldev (JsonNode fromObject , ObjectNode parentObject ) {
416416 ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
417- if (Common .getValueByPath (fromObject , new String [] {"mode " }) != null ) {
417+ if (Common .getValueByPath (fromObject , new String [] {"allowedFunctionNames " }) != null ) {
418418 Common .setValueByPath (
419419 toObject ,
420- new String [] {"mode " },
421- Common .getValueByPath (fromObject , new String [] {"mode " }));
420+ new String [] {"allowedFunctionNames " },
421+ Common .getValueByPath (fromObject , new String [] {"allowedFunctionNames " }));
422422 }
423423
424- if (Common .getValueByPath (fromObject , new String [] {"allowedFunctionNames " }) != null ) {
424+ if (Common .getValueByPath (fromObject , new String [] {"mode " }) != null ) {
425425 Common .setValueByPath (
426426 toObject ,
427- new String [] {"allowedFunctionNames " },
428- Common .getValueByPath (fromObject , new String [] {"allowedFunctionNames " }));
427+ new String [] {"mode " },
428+ Common .getValueByPath (fromObject , new String [] {"mode " }));
429429 }
430430
431431 if (!Common .isZero (
@@ -440,10 +440,6 @@ ObjectNode functionCallingConfigToMldev(JsonNode fromObject, ObjectNode parentOb
440440 @ ExcludeFromGeneratedCoverageReport
441441 ObjectNode functionDeclarationToVertex (JsonNode fromObject , ObjectNode parentObject ) {
442442 ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
443- if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"behavior" }))) {
444- throw new IllegalArgumentException ("behavior parameter is not supported in Vertex AI." );
445- }
446-
447443 if (Common .getValueByPath (fromObject , new String [] {"description" }) != null ) {
448444 Common .setValueByPath (
449445 toObject ,
@@ -486,6 +482,10 @@ ObjectNode functionDeclarationToVertex(JsonNode fromObject, ObjectNode parentObj
486482 Common .getValueByPath (fromObject , new String [] {"responseJsonSchema" }));
487483 }
488484
485+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"behavior" }))) {
486+ throw new IllegalArgumentException ("behavior parameter is not supported in Vertex AI." );
487+ }
488+
489489 return toObject ;
490490 }
491491
@@ -778,6 +778,13 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) {
778778 @ ExcludeFromGeneratedCoverageReport
779779 ObjectNode toolConfigToMldev (JsonNode fromObject , ObjectNode parentObject ) {
780780 ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
781+ if (Common .getValueByPath (fromObject , new String [] {"retrievalConfig" }) != null ) {
782+ Common .setValueByPath (
783+ toObject ,
784+ new String [] {"retrievalConfig" },
785+ Common .getValueByPath (fromObject , new String [] {"retrievalConfig" }));
786+ }
787+
781788 if (Common .getValueByPath (fromObject , new String [] {"functionCallingConfig" }) != null ) {
782789 Common .setValueByPath (
783790 toObject ,
@@ -788,37 +795,16 @@ ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) {
788795 toObject ));
789796 }
790797
791- if (Common .getValueByPath (fromObject , new String [] {"retrievalConfig" }) != null ) {
792- Common .setValueByPath (
793- toObject ,
794- new String [] {"retrievalConfig" },
795- Common .getValueByPath (fromObject , new String [] {"retrievalConfig" }));
796- }
797-
798798 return toObject ;
799799 }
800800
801801 @ ExcludeFromGeneratedCoverageReport
802802 ObjectNode toolToMldev (JsonNode fromObject , ObjectNode parentObject ) {
803803 ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
804- if (Common .getValueByPath (fromObject , new String [] {"functionDeclarations" }) != null ) {
805- Common .setValueByPath (
806- toObject ,
807- new String [] {"functionDeclarations" },
808- Common .getValueByPath (fromObject , new String [] {"functionDeclarations" }));
809- }
810-
811804 if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"retrieval" }))) {
812805 throw new IllegalArgumentException ("retrieval parameter is not supported in Gemini API." );
813806 }
814807
815- if (Common .getValueByPath (fromObject , new String [] {"googleSearchRetrieval" }) != null ) {
816- Common .setValueByPath (
817- toObject ,
818- new String [] {"googleSearchRetrieval" },
819- Common .getValueByPath (fromObject , new String [] {"googleSearchRetrieval" }));
820- }
821-
822808 if (Common .getValueByPath (fromObject , new String [] {"computerUse" }) != null ) {
823809 Common .setValueByPath (
824810 toObject ,
@@ -845,6 +831,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
845831 "enterpriseWebSearch parameter is not supported in Gemini API." );
846832 }
847833
834+ if (Common .getValueByPath (fromObject , new String [] {"functionDeclarations" }) != null ) {
835+ Common .setValueByPath (
836+ toObject ,
837+ new String [] {"functionDeclarations" },
838+ Common .getValueByPath (fromObject , new String [] {"functionDeclarations" }));
839+ }
840+
848841 if (Common .getValueByPath (fromObject , new String [] {"googleMaps" }) != null ) {
849842 Common .setValueByPath (
850843 toObject ,
@@ -865,6 +858,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
865858 toObject ));
866859 }
867860
861+ if (Common .getValueByPath (fromObject , new String [] {"googleSearchRetrieval" }) != null ) {
862+ Common .setValueByPath (
863+ toObject ,
864+ new String [] {"googleSearchRetrieval" },
865+ Common .getValueByPath (fromObject , new String [] {"googleSearchRetrieval" }));
866+ }
867+
868868 if (Common .getValueByPath (fromObject , new String [] {"urlContext" }) != null ) {
869869 Common .setValueByPath (
870870 toObject ,
@@ -878,32 +878,13 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
878878 @ ExcludeFromGeneratedCoverageReport
879879 ObjectNode toolToVertex (JsonNode fromObject , ObjectNode parentObject ) {
880880 ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
881- if (Common .getValueByPath (fromObject , new String [] {"functionDeclarations" }) != null ) {
882- ArrayNode keyArray =
883- (ArrayNode ) Common .getValueByPath (fromObject , new String [] {"functionDeclarations" });
884- ObjectMapper objectMapper = new ObjectMapper ();
885- ArrayNode result = objectMapper .createArrayNode ();
886-
887- for (JsonNode item : keyArray ) {
888- result .add (functionDeclarationToVertex (JsonSerializable .toJsonNode (item ), toObject ));
889- }
890- Common .setValueByPath (toObject , new String [] {"functionDeclarations" }, result );
891- }
892-
893881 if (Common .getValueByPath (fromObject , new String [] {"retrieval" }) != null ) {
894882 Common .setValueByPath (
895883 toObject ,
896884 new String [] {"retrieval" },
897885 Common .getValueByPath (fromObject , new String [] {"retrieval" }));
898886 }
899887
900- if (Common .getValueByPath (fromObject , new String [] {"googleSearchRetrieval" }) != null ) {
901- Common .setValueByPath (
902- toObject ,
903- new String [] {"googleSearchRetrieval" },
904- Common .getValueByPath (fromObject , new String [] {"googleSearchRetrieval" }));
905- }
906-
907888 if (Common .getValueByPath (fromObject , new String [] {"computerUse" }) != null ) {
908889 Common .setValueByPath (
909890 toObject ,
@@ -929,6 +910,18 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) {
929910 Common .getValueByPath (fromObject , new String [] {"enterpriseWebSearch" }));
930911 }
931912
913+ if (Common .getValueByPath (fromObject , new String [] {"functionDeclarations" }) != null ) {
914+ ArrayNode keyArray =
915+ (ArrayNode ) Common .getValueByPath (fromObject , new String [] {"functionDeclarations" });
916+ ObjectMapper objectMapper = new ObjectMapper ();
917+ ArrayNode result = objectMapper .createArrayNode ();
918+
919+ for (JsonNode item : keyArray ) {
920+ result .add (functionDeclarationToVertex (JsonSerializable .toJsonNode (item ), toObject ));
921+ }
922+ Common .setValueByPath (toObject , new String [] {"functionDeclarations" }, result );
923+ }
924+
932925 if (Common .getValueByPath (fromObject , new String [] {"googleMaps" }) != null ) {
933926 Common .setValueByPath (
934927 toObject ,
@@ -943,6 +936,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) {
943936 Common .getValueByPath (fromObject , new String [] {"googleSearch" }));
944937 }
945938
939+ if (Common .getValueByPath (fromObject , new String [] {"googleSearchRetrieval" }) != null ) {
940+ Common .setValueByPath (
941+ toObject ,
942+ new String [] {"googleSearchRetrieval" },
943+ Common .getValueByPath (fromObject , new String [] {"googleSearchRetrieval" }));
944+ }
945+
946946 if (Common .getValueByPath (fromObject , new String [] {"urlContext" }) != null ) {
947947 Common .setValueByPath (
948948 toObject ,
0 commit comments