@@ -1040,44 +1040,40 @@ ObjectNode functionCallingConfigToMldev(JsonNode fromObject, ObjectNode parentOb
10401040 ObjectNode generateContentConfigToMldev (
10411041 ApiClient apiClient , JsonNode fromObject , ObjectNode parentObject ) {
10421042 ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
1043+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"modelSelectionConfig" }))) {
1044+ throw new IllegalArgumentException (
1045+ "modelSelectionConfig parameter is not supported in Gemini API." );
1046+ }
10431047
1044- if (Common .getValueByPath (fromObject , new String [] {"systemInstruction" }) != null ) {
1045- Common .setValueByPath (
1046- parentObject ,
1047- new String [] {"systemInstruction" },
1048- contentToMldev (
1049- JsonSerializable .toJsonNode (
1050- Transformers .tContent (
1051- Common .getValueByPath (fromObject , new String [] {"systemInstruction" }))),
1052- toObject ));
1048+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"audioTimestamp" }))) {
1049+ throw new IllegalArgumentException (
1050+ "audioTimestamp parameter is not supported in Gemini API." );
10531051 }
10541052
1055- if (Common .getValueByPath (fromObject , new String [] {"temperature " }) != null ) {
1053+ if (Common .getValueByPath (fromObject , new String [] {"candidateCount " }) != null ) {
10561054 Common .setValueByPath (
10571055 toObject ,
1058- new String [] {"temperature " },
1059- Common .getValueByPath (fromObject , new String [] {"temperature " }));
1056+ new String [] {"candidateCount " },
1057+ Common .getValueByPath (fromObject , new String [] {"candidateCount " }));
10601058 }
10611059
1062- if (Common .getValueByPath (fromObject , new String [] {"topP" }) != null ) {
1063- Common .setValueByPath (
1064- toObject ,
1065- new String [] {"topP" },
1066- Common .getValueByPath (fromObject , new String [] {"topP" }));
1060+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"enableAffectiveDialog" }))) {
1061+ throw new IllegalArgumentException (
1062+ "enableAffectiveDialog parameter is not supported in Gemini API." );
10671063 }
10681064
1069- if (Common .getValueByPath (fromObject , new String [] {"topK " }) != null ) {
1065+ if (Common .getValueByPath (fromObject , new String [] {"frequencyPenalty " }) != null ) {
10701066 Common .setValueByPath (
10711067 toObject ,
1072- new String [] {"topK " },
1073- Common .getValueByPath (fromObject , new String [] {"topK " }));
1068+ new String [] {"frequencyPenalty " },
1069+ Common .getValueByPath (fromObject , new String [] {"frequencyPenalty " }));
10741070 }
10751071
1076- if (Common .getValueByPath (fromObject , new String [] {"candidateCount " }) != null ) {
1072+ if (Common .getValueByPath (fromObject , new String [] {"logprobs " }) != null ) {
10771073 Common .setValueByPath (
10781074 toObject ,
1079- new String [] {"candidateCount " },
1080- Common .getValueByPath (fromObject , new String [] {"candidateCount " }));
1075+ new String [] {"logprobs " },
1076+ Common .getValueByPath (fromObject , new String [] {"logprobs " }));
10811077 }
10821078
10831079 if (Common .getValueByPath (fromObject , new String [] {"maxOutputTokens" }) != null ) {
@@ -1087,11 +1083,25 @@ ObjectNode generateContentConfigToMldev(
10871083 Common .getValueByPath (fromObject , new String [] {"maxOutputTokens" }));
10881084 }
10891085
1090- if (Common .getValueByPath (fromObject , new String [] {"stopSequences " }) != null ) {
1086+ if (Common .getValueByPath (fromObject , new String [] {"mediaResolution " }) != null ) {
10911087 Common .setValueByPath (
10921088 toObject ,
1093- new String [] {"stopSequences" },
1094- Common .getValueByPath (fromObject , new String [] {"stopSequences" }));
1089+ new String [] {"mediaResolution" },
1090+ Common .getValueByPath (fromObject , new String [] {"mediaResolution" }));
1091+ }
1092+
1093+ if (Common .getValueByPath (fromObject , new String [] {"presencePenalty" }) != null ) {
1094+ Common .setValueByPath (
1095+ toObject ,
1096+ new String [] {"presencePenalty" },
1097+ Common .getValueByPath (fromObject , new String [] {"presencePenalty" }));
1098+ }
1099+
1100+ if (Common .getValueByPath (fromObject , new String [] {"responseJsonSchema" }) != null ) {
1101+ Common .setValueByPath (
1102+ toObject ,
1103+ new String [] {"responseJsonSchema" },
1104+ Common .getValueByPath (fromObject , new String [] {"responseJsonSchema" }));
10951105 }
10961106
10971107 if (Common .getValueByPath (fromObject , new String [] {"responseLogprobs" }) != null ) {
@@ -1101,25 +1111,29 @@ ObjectNode generateContentConfigToMldev(
11011111 Common .getValueByPath (fromObject , new String [] {"responseLogprobs" }));
11021112 }
11031113
1104- if (Common .getValueByPath (fromObject , new String [] {"logprobs " }) != null ) {
1114+ if (Common .getValueByPath (fromObject , new String [] {"responseMimeType " }) != null ) {
11051115 Common .setValueByPath (
11061116 toObject ,
1107- new String [] {"logprobs " },
1108- Common .getValueByPath (fromObject , new String [] {"logprobs " }));
1117+ new String [] {"responseMimeType " },
1118+ Common .getValueByPath (fromObject , new String [] {"responseMimeType " }));
11091119 }
11101120
1111- if (Common .getValueByPath (fromObject , new String [] {"presencePenalty " }) != null ) {
1121+ if (Common .getValueByPath (fromObject , new String [] {"responseModalities " }) != null ) {
11121122 Common .setValueByPath (
11131123 toObject ,
1114- new String [] {"presencePenalty " },
1115- Common .getValueByPath (fromObject , new String [] {"presencePenalty " }));
1124+ new String [] {"responseModalities " },
1125+ Common .getValueByPath (fromObject , new String [] {"responseModalities " }));
11161126 }
11171127
1118- if (Common .getValueByPath (fromObject , new String [] {"frequencyPenalty " }) != null ) {
1128+ if (Common .getValueByPath (fromObject , new String [] {"responseSchema " }) != null ) {
11191129 Common .setValueByPath (
11201130 toObject ,
1121- new String [] {"frequencyPenalty" },
1122- Common .getValueByPath (fromObject , new String [] {"frequencyPenalty" }));
1131+ new String [] {"responseSchema" },
1132+ Transformers .tSchema (Common .getValueByPath (fromObject , new String [] {"responseSchema" })));
1133+ }
1134+
1135+ if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"routingConfig" }))) {
1136+ throw new IllegalArgumentException ("routingConfig parameter is not supported in Gemini API." );
11231137 }
11241138
11251139 if (Common .getValueByPath (fromObject , new String [] {"seed" }) != null ) {
@@ -1129,34 +1143,65 @@ ObjectNode generateContentConfigToMldev(
11291143 Common .getValueByPath (fromObject , new String [] {"seed" }));
11301144 }
11311145
1132- if (Common .getValueByPath (fromObject , new String [] {"responseMimeType " }) != null ) {
1146+ if (Common .getValueByPath (fromObject , new String [] {"speechConfig " }) != null ) {
11331147 Common .setValueByPath (
11341148 toObject ,
1135- new String [] {"responseMimeType" },
1136- Common .getValueByPath (fromObject , new String [] {"responseMimeType" }));
1149+ new String [] {"speechConfig" },
1150+ Transformers .tSpeechConfig (
1151+ Common .getValueByPath (fromObject , new String [] {"speechConfig" })));
11371152 }
11381153
1139- if (Common .getValueByPath (fromObject , new String [] {"responseSchema " }) != null ) {
1154+ if (Common .getValueByPath (fromObject , new String [] {"stopSequences " }) != null ) {
11401155 Common .setValueByPath (
11411156 toObject ,
1142- new String [] {"responseSchema " },
1143- Transformers . tSchema ( Common .getValueByPath (fromObject , new String [] {"responseSchema" }) ));
1157+ new String [] {"stopSequences " },
1158+ Common .getValueByPath (fromObject , new String [] {"stopSequences" } ));
11441159 }
11451160
1146- if (Common .getValueByPath (fromObject , new String [] {"responseJsonSchema " }) != null ) {
1161+ if (Common .getValueByPath (fromObject , new String [] {"temperature " }) != null ) {
11471162 Common .setValueByPath (
11481163 toObject ,
1149- new String [] {"responseJsonSchema " },
1150- Common .getValueByPath (fromObject , new String [] {"responseJsonSchema " }));
1164+ new String [] {"temperature " },
1165+ Common .getValueByPath (fromObject , new String [] {"temperature " }));
11511166 }
11521167
1153- if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"routingConfig" }))) {
1154- throw new IllegalArgumentException ("routingConfig parameter is not supported in Gemini API." );
1168+ if (Common .getValueByPath (fromObject , new String [] {"thinkingConfig" }) != null ) {
1169+ Common .setValueByPath (
1170+ toObject ,
1171+ new String [] {"thinkingConfig" },
1172+ Common .getValueByPath (fromObject , new String [] {"thinkingConfig" }));
11551173 }
11561174
1157- if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"modelSelectionConfig" }))) {
1158- throw new IllegalArgumentException (
1159- "modelSelectionConfig parameter is not supported in Gemini API." );
1175+ if (Common .getValueByPath (fromObject , new String [] {"topK" }) != null ) {
1176+ Common .setValueByPath (
1177+ toObject ,
1178+ new String [] {"topK" },
1179+ Common .getValueByPath (fromObject , new String [] {"topK" }));
1180+ }
1181+
1182+ if (Common .getValueByPath (fromObject , new String [] {"topP" }) != null ) {
1183+ Common .setValueByPath (
1184+ toObject ,
1185+ new String [] {"topP" },
1186+ Common .getValueByPath (fromObject , new String [] {"topP" }));
1187+ }
1188+
1189+ if (Common .getValueByPath (fromObject , new String [] {"enableEnhancedCivicAnswers" }) != null ) {
1190+ Common .setValueByPath (
1191+ toObject ,
1192+ new String [] {"enableEnhancedCivicAnswers" },
1193+ Common .getValueByPath (fromObject , new String [] {"enableEnhancedCivicAnswers" }));
1194+ }
1195+
1196+ if (Common .getValueByPath (fromObject , new String [] {"systemInstruction" }) != null ) {
1197+ Common .setValueByPath (
1198+ parentObject ,
1199+ new String [] {"systemInstruction" },
1200+ contentToMldev (
1201+ JsonSerializable .toJsonNode (
1202+ Transformers .tContent (
1203+ Common .getValueByPath (fromObject , new String [] {"systemInstruction" }))),
1204+ toObject ));
11601205 }
11611206
11621207 if (Common .getValueByPath (fromObject , new String [] {"safetySettings" }) != null ) {
@@ -1206,40 +1251,6 @@ ObjectNode generateContentConfigToMldev(
12061251 this .apiClient , Common .getValueByPath (fromObject , new String [] {"cachedContent" })));
12071252 }
12081253
1209- if (Common .getValueByPath (fromObject , new String [] {"responseModalities" }) != null ) {
1210- Common .setValueByPath (
1211- toObject ,
1212- new String [] {"responseModalities" },
1213- Common .getValueByPath (fromObject , new String [] {"responseModalities" }));
1214- }
1215-
1216- if (Common .getValueByPath (fromObject , new String [] {"mediaResolution" }) != null ) {
1217- Common .setValueByPath (
1218- toObject ,
1219- new String [] {"mediaResolution" },
1220- Common .getValueByPath (fromObject , new String [] {"mediaResolution" }));
1221- }
1222-
1223- if (Common .getValueByPath (fromObject , new String [] {"speechConfig" }) != null ) {
1224- Common .setValueByPath (
1225- toObject ,
1226- new String [] {"speechConfig" },
1227- Transformers .tSpeechConfig (
1228- Common .getValueByPath (fromObject , new String [] {"speechConfig" })));
1229- }
1230-
1231- if (!Common .isZero (Common .getValueByPath (fromObject , new String [] {"audioTimestamp" }))) {
1232- throw new IllegalArgumentException (
1233- "audioTimestamp parameter is not supported in Gemini API." );
1234- }
1235-
1236- if (Common .getValueByPath (fromObject , new String [] {"thinkingConfig" }) != null ) {
1237- Common .setValueByPath (
1238- toObject ,
1239- new String [] {"thinkingConfig" },
1240- Common .getValueByPath (fromObject , new String [] {"thinkingConfig" }));
1241- }
1242-
12431254 if (Common .getValueByPath (fromObject , new String [] {"imageConfig" }) != null ) {
12441255 Common .setValueByPath (
12451256 toObject ,
@@ -1250,13 +1261,6 @@ ObjectNode generateContentConfigToMldev(
12501261 toObject ));
12511262 }
12521263
1253- if (Common .getValueByPath (fromObject , new String [] {"enableEnhancedCivicAnswers" }) != null ) {
1254- Common .setValueByPath (
1255- toObject ,
1256- new String [] {"enableEnhancedCivicAnswers" },
1257- Common .getValueByPath (fromObject , new String [] {"enableEnhancedCivicAnswers" }));
1258- }
1259-
12601264 return toObject ;
12611265 }
12621266
0 commit comments