Record Class Confidence

java.lang.Object
java.lang.Record
ai.doctruth.Confidence
Record Components:
score - the confidence in [0.0, 1.0].
rationale - a free-form, possibly empty explanation of why the score was chosen.

public record Confidence(double score, String rationale) extends Record
A confidence score for a single extracted field, plus a free-form rationale. The score is typically LLM-self-reported (a prior production extraction system-style Field(ge=0.0, le=1.0)) — the library does NOT compute it from signals; it carries through what the model emits.

Invariants (enforced by the compact constructor):

  • score is a real number in [0.0, 1.0]NaN and infinities are rejected.
  • rationale is non-null. Empty string is allowed (some prompts skip rationale).
Since:
0.1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Confidence(double score, String rationale)
    Creates an instance of a Confidence record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the rationale record component.
    double
    Returns the value of the score record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Confidence

      public Confidence(double score, String rationale)
      Creates an instance of a Confidence record class.
      Parameters:
      score - the value for the score record component
      rationale - the value for the rationale record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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 double score()
      Returns the value of the score record component.
      Returns:
      the value of the score record component
    • rationale

      public String rationale()
      Returns the value of the rationale record component.
      Returns:
      the value of the rationale record component