Package com.tnsai.rag

Record Class KnowledgeEntry

java.lang.Object
java.lang.Record
com.tnsai.rag.KnowledgeEntry
Record Components:
source - what to load and from where
use - how the loaded documents reach the model
maxTokens - explicit DIRECT budget; empty means the default budget
search - search settings this source contributes to its scope

public record KnowledgeEntry(KnowledgeSourceConfig source, Knowledge.Use use, OptionalInt maxTokens, Optional<SearchSettings> search) extends Record
One declared knowledge source together with how a scope uses it.

Produced by KnowledgeDeclarations from a Knowledge declaration, after an action's overlay has been applied: use is already resolved (an unset use is Knowledge.Use.SEARCH), and maxTokens and search are the values that apply.

Since:
0.18.0
  • Constructor Details

  • Method Details

    • search

      public static KnowledgeEntry search(KnowledgeSourceConfig source)
      A source searched with the scope's settings, as an AgentBuilder source is.
      Parameters:
      source - the source
      Returns:
      a SEARCH entry contributing no search settings of its own
    • name

      public String name()
      Returns:
      the declared knowledge name
    • 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.
    • source

      public KnowledgeSourceConfig source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component
    • use

      public Knowledge.Use use()
      Returns the value of the use record component.
      Returns:
      the value of the use record component
    • maxTokens

      public OptionalInt maxTokens()
      Returns the value of the maxTokens record component.
      Returns:
      the value of the maxTokens record component
    • search

      public Optional<SearchSettings> search()
      Returns the value of the search record component.
      Returns:
      the value of the search record component