Package com.tnsai.rag

Record Class ChatKnowledgeContext.Turn

java.lang.Object
java.lang.Record
com.tnsai.rag.ChatKnowledgeContext.Turn
Record Components:
beforeSearch - blocks declared before the first SEARCH entry, or every block when no entry is SEARCH
afterSearch - blocks declared after the first SEARCH entry
usage - one row per chat source, in declaration order: what each DIRECT source gave, and a zero row for each SEARCH source that the turn's search fills in
Enclosing interface:
ChatKnowledgeContext

public static record ChatKnowledgeContext.Turn(List<String> beforeSearch, List<String> afterSearch, List<KnowledgeUsage> usage) extends Record
One turn's blocks, split at the first SEARCH entry.
  • Field Details

  • Constructor Details

    • Turn

      public Turn(List<String> beforeSearch, List<String> afterSearch, List<KnowledgeUsage> usage)
      Creates an instance of a Turn record class.
      Parameters:
      beforeSearch - the value for the beforeSearch record component
      afterSearch - the value for the afterSearch record component
      usage - the value for the usage record component
    • Turn

      public Turn(List<String> beforeSearch, List<String> afterSearch)
      A turn with no usage rows.
      Parameters:
      beforeSearch - blocks declared before the first SEARCH entry
      afterSearch - blocks declared after the first SEARCH entry
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns:
      whether the turn gives no block at all
    • 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.
    • beforeSearch

      public List<String> beforeSearch()
      Returns the value of the beforeSearch record component.
      Returns:
      the value of the beforeSearch record component
    • afterSearch

      public List<String> afterSearch()
      Returns the value of the afterSearch record component.
      Returns:
      the value of the afterSearch record component
    • usage

      public List<KnowledgeUsage> usage()
      Returns the value of the usage record component.
      Returns:
      the value of the usage record component