Class Evaluation

Object
akka.javasdk.evaluation.Evaluation

public final class Evaluation extends Object
The outcome of an evaluation, recorded by an Evaluator.

An Evaluation captures whether the evaluated interaction passed, an explanation for the verdict, and optional quantitative (score) and categorical (label) results. Arbitrary additional attributes can be attached for downstream analysis.

Create instances with the fluent factory methods and with* builders, for example:


 Evaluation.passed("Response was accurate and helpful")
     .withScore(0.92)
     .withLabel("excellent");
 
  • Method Details

    • passed

      public static Evaluation passed(String explanation)
      Create an evaluation that passed, with the given explanation.
    • failed

      public static Evaluation failed(String explanation)
      Create an evaluation that failed, with the given explanation.
    • of

      public static Evaluation of(boolean passed, String explanation)
      Create an evaluation with the given pass/fail verdict and explanation.
      Parameters:
      passed - whether the evaluated interaction passed
      explanation - the reason for the verdict
    • withScore

      public Evaluation withScore(double score)
      Return a copy of this evaluation with the given numeric score.
    • withLabel

      public Evaluation withLabel(String label)
      Return a copy of this evaluation with the given categorical label.
    • withAttribute

      public Evaluation withAttribute(String key, String value)
      Return a copy of this evaluation with the given attribute added.
    • withAttributes

      public Evaluation withAttributes(Map<String,String> attributes)
      Return a copy of this evaluation with all the given attributes added.
    • passed

      public boolean passed()
      Returns:
      whether the evaluated interaction passed
    • explanation

      public String explanation()
      Returns:
      the reason for the verdict
    • score

      public Optional<Double> score()
      Returns:
      the numeric score, if one was set
    • label

      public Optional<String> label()
      Returns:
      the categorical label, if one was set
    • attributes

      public Map<String,String> attributes()
      Returns:
      additional attributes attached to this evaluation
    • toString

      public String toString()
      Overrides:
      toString in class Object