Package com.tnsai.rag

Enum Class KnowledgeUnit

java.lang.Object
java.lang.Enum<KnowledgeUnit>
com.tnsai.rag.KnowledgeUnit
All Implemented Interfaces:
Serializable, Comparable<KnowledgeUnit>, Constable

public enum KnowledgeUnit extends Enum<KnowledgeUnit>
How one ingested file becomes retrieval documents.

@Knowledge.format says what a file is. This enum says how many documents it becomes. It is an ingest-time decision, not consulted per query, and it does not change how SEARCH knowledge ranks results.

AUTO is the default and names the behaviour the framework already had: a file that fits one chunk stays one document, a larger file is split by NormalizedDocumentChunker. The other values are explicit opt-ins. There is no RECORD constant — JSONL and CSV already yield one document per row under their own extractors, and a dedicated value would be redundant for two formats and meaningless for the rest.

Since:
0.15.0
  • Enum Constant Details

    • AUTO

      public static final KnowledgeUnit AUTO
      Today's hybrid, unchanged. Small files behave like DOCUMENT; large files behave like CHUNK. It is the default and is omitted from the fingerprint payload, so leaving it alone is never itself a reason a source re-ingests.
    • DOCUMENT

      public static final KnowledgeUnit DOCUMENT
      The whole file is one document, chunking suppressed, and a file over the chunker limits fails at ingest rather than being split behind the declaration.
    • LINE

      public static final KnowledgeUnit LINE
      Each non-blank line is one document. Blank and whitespace-only lines are skipped, and a file containing no non-blank lines yields no units.
    • HEADING

      public static final KnowledgeUnit HEADING
      Markdown heading sections (#{1,6}).
    • CHUNK

      public static final KnowledgeUnit CHUNK
      NormalizedDocumentChunker applied unconditionally, including to files that would otherwise fit in one chunk.
  • Method Details

    • values

      public static KnowledgeUnit[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static KnowledgeUnit valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null