Class: RCrewAI::Knowledge::PdfSource

Inherits:
Source
  • Object
show all
Defined in:
lib/rcrewai/knowledge/sources.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PdfSource

Returns a new instance of PdfSource.



36
37
38
39
# File 'lib/rcrewai/knowledge/sources.rb', line 36

def initialize(path)
  super()
  @path = path
end

Instance Method Details

#readObject



41
42
43
44
45
# File 'lib/rcrewai/knowledge/sources.rb', line 41

def read
  require 'pdf-reader'
  reader = PDF::Reader.new(@path)
  reader.pages.map(&:text).join("\n")
end