Class ModelBasedJudge
- All Implemented Interfaces:
Judge
Judge that asks a model through JudgeAgent. The verdict is one model call, not
deterministic, and consumes tokens.
The system message is DEFAULT_SYSTEM_MESSAGE, or the one passed to withSystemMessage(java.lang.String). The judge appends REPLY_FORMAT to either, so the model always
replies with a JSON object with a score between 0 and 1 and a reason.
The user message is the criterion and the Interaction rendered as text by defaultUserMessage(java.lang.String, akka.javasdk.testkit.eval.Interaction). withUserMessage(java.util.function.BiFunction<java.lang.String, akka.javasdk.testkit.eval.Interaction, java.lang.String>) replaces that rendering, for example to write the
sections in another language.
The model is the one configured in akka.javasdk.agent.model-provider. withModel(java.lang.String) names another configuration path. A provider registered for JudgeAgent in the
TestKit settings takes precedence over both.
Each verdict is decided in a new session.
-
Nested Class Summary
Nested classes/interfaces inherited from interface akka.javasdk.testkit.eval.Judge
Judge.Verdict -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe system message a judge sends unlesswithSystemMessage(java.lang.String)replaces it, beforeREPLY_FORMAT.static final StringAppended to every system message: the reply format the verdict is read from. -
Method Summary
Modifier and TypeMethodDescriptiondecide(String criterion, Interaction interaction) static StringdefaultUserMessage(String criterion, Interaction interaction) The criterion and the interaction as text, in labeled sections.The configuration path of the model this judge asks; empty for the default model.The system message this judge sends, withREPLY_FORMATappended.The same judge asking the model configured at this path, for example"eval.judge-model", in the same form asakka.javasdk.agent.model-provider.withSystemMessage(String systemMessage) The same judge with another system message.withUserMessage(BiFunction<String, Interaction, String> userMessage) The same judge with another rendering of the criterion and the interaction into the user message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface akka.javasdk.testkit.eval.Judge
shouldSatisfy, shouldScoreAtLeast
-
Field Details
-
DEFAULT_SYSTEM_MESSAGE
The system message a judge sends unlesswithSystemMessage(java.lang.String)replaces it, beforeREPLY_FORMAT.- See Also:
-
REPLY_FORMAT
Appended to every system message: the reply format the verdict is read from.- See Also:
-
-
Method Details
-
withSystemMessage
The same judge with another system message.REPLY_FORMATis appended to it. -
withUserMessage
The same judge with another rendering of the criterion and the interaction into the user message. The rendering must carry what the system message asks the model to judge. -
withModel
The same judge asking the model configured at this path, for example"eval.judge-model", in the same form asakka.javasdk.agent.model-provider. -
systemMessage
The system message this judge sends, withREPLY_FORMATappended. -
modelConfigPath
The configuration path of the model this judge asks; empty for the default model. -
decide
-
defaultUserMessage
The criterion and the interaction as text, in labeled sections. What the agent was asked isInteraction.asked(): the user message the model saw when the trace carried it, otherwise the case's command.
-