feat: add Runner, RunnerResult, Judge, and Evaluator#180
Open
mattrmc1 wants to merge 9 commits into
Open
Conversation
…b.com:launchdarkly/java-core into mmccarthy/AIC-2665/java-ai-sdk-v-1-0-aievals
…b.com:launchdarkly/java-core into mmccarthy/AIC-2665/java-ai-sdk-v-1-0-aievals
…b.com:launchdarkly/java-core into mmccarthy/AIC-2665/java-ai-sdk-v-1-0-aievals
…b.com:launchdarkly/java-core into mmccarthy/AIC-2665/java-ai-sdk-v-1-0-aievals
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit faa4981. Configure here.
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds the AIEVALS types —
Runner,RunnerResult,Judge, andEvaluator— and wiresEvaluator.noop()into all config types. Callers can now implement aRunnerto wrap any model provider, construct aJudgeto evaluate AI outputs against a judge prompt with structured{score, reasoning}output, and coordinate multiple judges through anEvaluator.New types
Wraps a model provider SDK.
outputTypecarries a JSON-Schema-like map when structured output is needed. Single-arg overload delegates withoutputType = null.Immutable result of a
Runnerinvocation.parsedis defensively copied and returned as unmodifiable.Evaluates AI output by invoking a runner with a formatted evaluation prompt and parsing the structured response. Sampling gate runs first — below the rate, returns
sampled=falseimmediately. Creates a fresh tracker per evaluation viaconfig.createTracker(). Parsesscore(Number, [0.0, 1.0]) andreasoning(String, optional). Runner exceptions are caught and returned asJudgeResult(success=false)— judge failures are results, not exceptions. Does not calltrackJudgeResult.Coordinates sequential execution of judges. Missing judges skipped with a warning.
Evaluator.noop()returns a singleton whoseevaluateimmediately returns an empty list. For v1.0, all configs receiveEvaluator.noop().Config type changes
AIConfigbase class gains anEvaluatorfield andgetEvaluator()accessor.AICompletionConfigandAIAgentConfigconstructors accept anEvaluator.AIJudgeConfigalways wiresEvaluator.noop()internally — judges do not evaluate themselves.Test plan
./gradlew :lib:sdk:server-ai:testpassesJudgeTest— successful evaluation, score boundary validation (0 and 1), reasoning optional, runner exception handling (caught not rethrown), null/missing parsed output, score out of range, sampling rates (0 always skips, 1 always runs), message formatting, getter accessorsEvaluatorTest— noop returns empty list, noop singleton identity, single/multiple judge execution, missing judge skipped, evaluator does not calltrackJudgeResult, returned future is already completeRunnerResultTest— builder field assignment, immutability, defensive copy of parsed mapNote
Medium Risk
Adds new public SDK types and extends
AIConfigconstruction, but v1.0 retrieval still usesEvaluator.noop(); main risk is future judge runs invoking customerRunnerimplementations and extra model calls when fully wired.Overview
Introduces AI evaluation plumbing in
server-ai: aRunnerabstraction for provider calls, immutableRunnerResult, aJudgethat scores model output via structured{score, reasoning}responses (with sampling, validation, and metrics viatrackMetricsOf), and anEvaluatorthat runs configured judges sequentially and returns a completedCompletableFuture.Config wiring:
AIConfignow carries anEvaluatorexposed throughgetEvaluator(). Completion and agent configs accept an evaluator at construction;LDAIClientImplcurrently passesEvaluator.noop()everywhere so retrieval behavior stays a no-op until later integration. Judge configs always useEvaluator.noop()internally.Unit tests cover judge success/failure paths, evaluator noop and multi-judge behavior, and
RunnerResultimmutability.Reviewed by Cursor Bugbot for commit f42de0b. Bugbot is set up for automated code reviews on this repo. Configure here.