Class: Ask::RAG::Loader::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ask/rag/loader/base.rb

Direct Known Subclasses

CSV, Directory, HTML, JSON, Markdown, PDF, Text

Instance Method Summary collapse

Instance Method Details

#lazy_load(path) ⇒ Enumerator<Ask::Document>

Load a file and return a lazy enumerator of documents. Override in subclasses that support streaming.

Parameters:

  • path (String)

    path to the file

Returns:

  • (Enumerator<Ask::Document>)


21
22
23
# File 'lib/ask/rag/loader/base.rb', line 21

def lazy_load(path)
  load(path).each
end

#load(path) ⇒ Array<Ask::Document>

Load a file and return an array of Ask::Document objects. Subclasses implement #load to produce documents from a specific format.

Parameters:

  • path (String)

    path to the file

Returns:

  • (Array<Ask::Document>)

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/ask/rag/loader/base.rb', line 12

def load(path)
  raise NotImplementedError, "#{self.class} must implement #load"
end