Class JudgeResponse

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

@Experimental public final class JudgeResponse extends Object
The response of a Judge to a JudgeRequest: one JudgeVerdict per criterion, in the order of the criteria, and the tokens the judge model used. Returned by Judge.evaluate(JudgeRequest). Implementations of Judge create it with from(List) or builder().
  • Method Details

    • from

      public static JudgeResponse from(List<JudgeVerdict> verdicts)
      Creates a response with the given verdicts and without token usage, for example in a Judge implementation.
      Parameters:
      verdicts - one verdict per criterion, in the order of the criteria
    • builder

      public static JudgeResponse.Builder builder()
      Returns a builder for a response, for example in a Judge implementation.
    • verdicts

      public List<JudgeVerdict> verdicts()
      One verdict per criterion of the request, in the order of the criteria.
    • tokenUsage

      public TokenUsage tokenUsage()
      The tokens the judge model used for this evaluation, added up over all requests the judge sent. A count that a response did not report is left out of the sum, as TokenUsage.add(TokenUsage) does. null if the judge model did not report token usage for any request.
    • 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