2222import com .fasterxml .jackson .databind .ObjectMapper ;
2323import com .fasterxml .jackson .databind .node .ArrayNode ;
2424import com .fasterxml .jackson .databind .node .ObjectNode ;
25+ import com .google .common .collect .ImmutableSet ;
2526
2627/** Internal SDK converter functions. */
2728final class TokensConverters {
@@ -31,6 +32,15 @@ public TokensConverters(ApiClient apiClient) {
3132 this .apiClient = apiClient ;
3233 }
3334
35+ @ ExcludeFromGeneratedCoverageReport
36+ void thinkingLevelMldevEnumValidate (Object enumValue ) {
37+ ImmutableSet <String > invalidEnumValues = ImmutableSet .of ("MEDIUM" , "MINIMAL" );
38+ if (invalidEnumValues .contains (enumValue .toString ().replace ("\" " , "" ))) {
39+ throw new IllegalArgumentException (
40+ String .format ("%s enum value is not supported in Gemini API." , enumValue ));
41+ }
42+ }
43+
3444 @ ExcludeFromGeneratedCoverageReport
3545 ObjectNode blobToMldev (JsonNode fromObject , ObjectNode parentObject ) {
3646 ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
@@ -316,7 +326,10 @@ ObjectNode liveConnectConfigToMldev(JsonNode fromObject, ObjectNode parentObject
316326 Common .setValueByPath (
317327 parentObject ,
318328 new String [] {"setup" , "generationConfig" , "thinkingConfig" },
319- Common .getValueByPath (fromObject , new String [] {"thinkingConfig" }));
329+ thinkingConfigToMldev (
330+ JsonSerializable .toJsonNode (
331+ Common .getValueByPath (fromObject , new String [] {"thinkingConfig" })),
332+ toObject ));
320333 }
321334
322335 if (Common .getValueByPath (fromObject , new String [] {"enableAffectiveDialog" }) != null ) {
@@ -537,6 +550,35 @@ ObjectNode sessionResumptionConfigToMldev(JsonNode fromObject, ObjectNode parent
537550 return toObject ;
538551 }
539552
553+ @ ExcludeFromGeneratedCoverageReport
554+ ObjectNode thinkingConfigToMldev (JsonNode fromObject , ObjectNode parentObject ) {
555+ ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
556+ if (Common .getValueByPath (fromObject , new String [] {"includeThoughts" }) != null ) {
557+ Common .setValueByPath (
558+ toObject ,
559+ new String [] {"includeThoughts" },
560+ Common .getValueByPath (fromObject , new String [] {"includeThoughts" }));
561+ }
562+
563+ if (Common .getValueByPath (fromObject , new String [] {"thinkingBudget" }) != null ) {
564+ Common .setValueByPath (
565+ toObject ,
566+ new String [] {"thinkingBudget" },
567+ Common .getValueByPath (fromObject , new String [] {"thinkingBudget" }));
568+ }
569+
570+ if (Common .getValueByPath (fromObject , new String [] {"thinkingLevel" }) != null ) {
571+ thinkingLevelMldevEnumValidate (
572+ Common .getValueByPath (fromObject , new String [] {"thinkingLevel" }));
573+ Common .setValueByPath (
574+ toObject ,
575+ new String [] {"thinkingLevel" },
576+ Common .getValueByPath (fromObject , new String [] {"thinkingLevel" }));
577+ }
578+
579+ return toObject ;
580+ }
581+
540582 @ ExcludeFromGeneratedCoverageReport
541583 ObjectNode toolToMldev (JsonNode fromObject , ObjectNode parentObject ) {
542584 ObjectNode toObject = JsonSerializable .objectMapper ().createObjectNode ();
0 commit comments