Class JudgeVerdict

java.lang.Object
dev.langchain4j.test.judge.JudgeVerdict

@Experimental public final class JudgeVerdict extends Object
The verdict of a Judge on one JudgeCriterion. Returned by Judge.evaluate(JudgeRequest). Implementations of Judge create verdicts with from(JudgeCriterion, boolean, String).
  • Method Details

    • from

      public static JudgeVerdict from(JudgeCriterion criterion, boolean satisfied, String explanation)
      Creates a verdict without a probability, for example in a Judge implementation.
      Parameters:
      criterion - the criterion the verdict is about
      satisfied - whether the criterion is satisfied
      explanation - a human-readable explanation of the verdict
    • from

      public static JudgeVerdict from(JudgeCriterion criterion, boolean satisfied, String explanation, double probability)
      Creates a verdict with the probability, from 0 to 1, that the criterion is satisfied, for example in a Judge implementation.
      Parameters:
      criterion - the criterion the verdict is about
      satisfied - whether the criterion is satisfied
      explanation - a human-readable explanation of the verdict
      probability - the probability that the criterion is satisfied, from 0 to 1
    • criterion

      public JudgeCriterion criterion()
      The criterion this verdict is about.
    • isSatisfied

      public boolean isSatisfied()
      Whether the judge considers the criterion satisfied. A criterion the judge was not sure about is not satisfied.
    • explanation

      public String explanation()
      A human-readable explanation of the verdict: the judge's reasoning for a ChatModelJudge, the probability and threshold for a DecisionModelJudge.
    • probability

      public Double probability()
      The probability, from 0 to 1, that the criterion is satisfied, as answered by a DecisionModelJudge, or null if the judge does not provide one, for example a ChatModelJudge.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object