Class: Ask::RAG::Loader::Text

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

Overview

Loads a plain text file as a single document.

Instance Method Summary collapse

Methods inherited from Base

#lazy_load

Instance Method Details

#load(path) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/ask/rag/loader/text.rb', line 8

def load(path)
  content = File.read(path)
  [Ask::Document.new(
    content: content,
    metadata: { source: path }
  )]
end