Package dev.langchain4j.test.judge
package dev.langchain4j.test.judge
-
ClassDescriptionA
JudgeContextwith the conversation that the judged text answers, for example the messages of the last request an AI Service sent to the chat model: its system message, the messages from its chat memory, the user message and the tool calls and results.AJudgebacked by aDecisionModel.Checks whether a text, for example the response of an AI Service, satisfies criteria written in natural language, using a model as the judge:What the judged text responds to: either the user message (UserMessageContext) or the whole conversation (ConversationContext).A criterion for aJudge, written in natural language, for example "mentions the refund amount".Assertions on a text, checked by aJudge.Thrown when aJudgecould not judge a text, for example because the judge model returned a response that could not be understood.The response of aJudgeto aJudgeRequest: oneJudgeVerdictper criterion, in the order of the criteria, and the tokens the judge model used.Builder forJudgeResponse.The verdict of aJudgeon oneJudgeCriterion.AJudgeContextwith the text of the user message that the judged text responds to, for exampleuserMessage.singleText().