Record Class Classification

Object
Record
akka.javasdk.agent.Classification
Record Components:
score - a numeric score, if the classifier produces one
label - a categorical label, if the classifier produces one (may be derived from the score)
confidence - the classifier's confidence in its own result, if available
attributes - any extra key-value detail the classifier wants to attach

public record Classification(Optional<Double> score, Optional<String> label, Optional<Double> confidence, Map<String,String> attributes) extends Record
The result of a Classifier: a score and/or label, with optional confidence and attributes.
  • Constructor Details

  • Method Details

    • score

      public static Classification score(double score)
      Creates a Classification with only a score.
    • label

      public static Classification label(String label)
      Creates a Classification with only a label.
    • of

      public static Classification of(double score, String label)
      Creates a Classification with both a score and a label.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • score

      public Optional<Double> score()
      Returns the value of the score record component.
      Returns:
      the value of the score record component
    • label

      public Optional<String> label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • confidence

      public Optional<Double> confidence()
      Returns the value of the confidence record component.
      Returns:
      the value of the confidence record component
    • attributes

      public Map<String,String> attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component