Package com.tnsai.rag

Record Class RetrievalResult

java.lang.Object
java.lang.Record
com.tnsai.rag.RetrievalResult
Record Components:
evidence - ranked retrieved evidence
diagnostics - retrieval diagnostics

public record RetrievalResult(List<RetrievalEvidence> evidence, RetrievalDiagnostics diagnostics) extends Record
Immutable outcome returned by a RetrievalEngine.

An empty result is a successful retrieval outcome, not an error. Configuration, timeout, provider, and execution failures use RetrievalException; cooperative cancellation uses CancellationException.

Since:
0.13.0
  • Constructor Details

  • Method Details

    • empty

      public static RetrievalResult empty()
      Returns a successful empty retrieval outcome.
      Returns:
      empty result
    • hasEvidence

      public boolean hasEvidence()
      Returns whether this result contains evidence.
      Returns:
      true when at least one evidence entry exists
    • 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.
    • evidence

      public List<RetrievalEvidence> evidence()
      Returns the value of the evidence record component.
      Returns:
      the value of the evidence record component
    • diagnostics

      public RetrievalDiagnostics diagnostics()
      Returns the value of the diagnostics record component.
      Returns:
      the value of the diagnostics record component