Class: RagRuby::Chunk
- Inherits:
-
Object
- Object
- RagRuby::Chunk
- Defined in:
- lib/rag_ruby/chunk.rb
Instance Attribute Summary collapse
-
#document_source ⇒ Object
Returns the value of attribute document_source.
-
#embedding ⇒ Object
Returns the value of attribute embedding.
-
#index ⇒ Object
Returns the value of attribute index.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #bytesize ⇒ Object
- #embedded? ⇒ Boolean
-
#initialize(text:, metadata: {}, document_source: nil, index: 0) ⇒ Chunk
constructor
A new instance of Chunk.
- #to_s ⇒ Object
Constructor Details
#initialize(text:, metadata: {}, document_source: nil, index: 0) ⇒ Chunk
Returns a new instance of Chunk.
7 8 9 10 11 12 13 |
# File 'lib/rag_ruby/chunk.rb', line 7 def initialize(text:, metadata: {}, document_source: nil, index: 0) @text = text = @document_source = document_source @index = index = nil end |
Instance Attribute Details
#document_source ⇒ Object
Returns the value of attribute document_source.
5 6 7 |
# File 'lib/rag_ruby/chunk.rb', line 5 def document_source @document_source end |
#embedding ⇒ Object
Returns the value of attribute embedding.
5 6 7 |
# File 'lib/rag_ruby/chunk.rb', line 5 def end |
#index ⇒ Object
Returns the value of attribute index.
5 6 7 |
# File 'lib/rag_ruby/chunk.rb', line 5 def index @index end |
#metadata ⇒ Object
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/rag_ruby/chunk.rb', line 5 def end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/rag_ruby/chunk.rb', line 5 def text @text end |
Instance Method Details
#bytesize ⇒ Object
23 24 25 |
# File 'lib/rag_ruby/chunk.rb', line 23 def bytesize text.bytesize end |
#embedded? ⇒ Boolean
15 16 17 |
# File 'lib/rag_ruby/chunk.rb', line 15 def !.nil? end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/rag_ruby/chunk.rb', line 19 def to_s text end |