44import com .launchdarkly .sdk .server .ai .datamodel .LDAIConfigTypes .Message ;
55import com .launchdarkly .sdk .server .ai .datamodel .LDAITrackingTypes .JudgeResult ;
66
7+ import java .util .Arrays ;
8+ import java .util .Collections ;
9+ import java .util .HashMap ;
710import java .util .List ;
811import java .util .Map ;
912import java .util .Objects ;
@@ -26,12 +29,25 @@ public final class Judge {
2629 * JSON-Schema fragment sent to the runner as the {@code outputType}, requesting structured
2730 * {@code {score, reasoning}} output.
2831 */
29- private static final Map <String , Object > EVALUATION_SCHEMA = Map .of (
30- "type" , "object" ,
31- "properties" , Map .of (
32- "score" , Map .of ("type" , "number" ),
33- "reasoning" , Map .of ("type" , "string" )),
34- "required" , List .of ("score" , "reasoning" ));
32+ private static final Map <String , Object > EVALUATION_SCHEMA ;
33+ static {
34+ Map <String , Object > scoreSchema = new HashMap <>();
35+ scoreSchema .put ("type" , "number" );
36+
37+ Map <String , Object > reasoningSchema = new HashMap <>();
38+ reasoningSchema .put ("type" , "string" );
39+
40+ Map <String , Object > properties = new HashMap <>();
41+ properties .put ("score" , Collections .unmodifiableMap (scoreSchema ));
42+ properties .put ("reasoning" , Collections .unmodifiableMap (reasoningSchema ));
43+
44+ Map <String , Object > schema = new HashMap <>();
45+ schema .put ("type" , "object" );
46+ schema .put ("properties" , Collections .unmodifiableMap (properties ));
47+ schema .put ("required" , Arrays .asList ("score" , "reasoning" ));
48+
49+ EVALUATION_SCHEMA = Collections .unmodifiableMap (schema );
50+ }
3551
3652 private final AIJudgeConfig config ;
3753 private final Runner runner ;
0 commit comments