Class LocalFileSourceLoader

java.lang.Object
com.tnsai.intelligence.rag.binding.LocalFileSourceLoader
All Implemented Interfaces:
SourceLoader

public final class LocalFileSourceLoader extends Object
Declarative FILE-source adapter over the canonical FileIngestionService.
Since:
0.5.4 (issue #172, Phase 1)
  • Constructor Details

    • LocalFileSourceLoader

      public LocalFileSourceLoader()
  • Method Details

    • handles

      public com.tnsai.annotations.Knowledge.Type handles()
      Description copied from interface: SourceLoader
      The Knowledge.Type this loader handles. RoleRagBinding routes each declared source to the loader whose handles() matches.
      Specified by:
      handles in interface SourceLoader
      Returns:
      the supported type
    • load

      public List<SourceLoader.LoadedDocument> load(com.tnsai.rag.KnowledgeSourceConfig source)
      Description copied from interface: SourceLoader
      Loads documents from the given source declaration.

      Each returned SourceLoader.LoadedDocument carries an id (used as the entry id in the vector store), the textual content, and an optional source label for retrieval-time attribution (e.g. the file path, URL, or DB row id).

      The return type is a list because a loader decides the unit of retrieval: it may split one source into as many documents as it likes, and everything downstream — topK, minScore, dedupeThreshold, contextWindow — is defined over whatever it returns. The bundled LocalFileSourceLoader keeps small files intact and emits stable, format-aware chunks for larger files (TAN-5327).

      Successfully loaded empty sources return an empty list. The bundled FILE and HTTP loaders throw RetrievalException with reason SOURCE_LOADING when a source cannot be read; they never publish a partial corpus as an empty success. Invalid source configuration and content surface as CONFIGURATION at the binding boundary.

      The returned list defines ingest order. Ordered consumers observe documents in exactly this order, so implementations must return a deterministic list for a stable source snapshot.

      Specified by:
      load in interface SourceLoader
      Parameters:
      source - the normalized knowledge-source declaration
      Returns:
      loaded documents in deterministic ingest order, or empty when the source was successfully read but contained no documents
    • loadSource

      public com.tnsai.intelligence.rag.binding.ChunkingSourceLoader.LoadedSource loadSource(com.tnsai.rag.KnowledgeSourceConfig source)
    • loadChunks

      public List<com.tnsai.intelligence.rag.binding.ChunkingSourceLoader.LoadedChunk> loadChunks(com.tnsai.rag.KnowledgeSourceConfig source)