Class: Kreuzberg::Result::Chunk
- Inherits:
-
Struct
- Object
- Struct
- Kreuzberg::Result::Chunk
- Defined in:
- lib/kreuzberg/result.rb
Instance Attribute Summary collapse
-
#byte_end ⇒ Integer
readonly
Ending byte offset (UTF-8).
-
#byte_start ⇒ Integer
readonly
Starting byte offset (UTF-8).
-
#chunk_index ⇒ Object
Returns the value of attribute chunk_index.
-
#content ⇒ String
readonly
Chunk content.
-
#embedding ⇒ Object
Returns the value of attribute embedding.
-
#first_page ⇒ Integer?
readonly
First page number (1-indexed).
-
#last_page ⇒ Integer?
readonly
Last page number (1-indexed).
-
#token_count ⇒ Integer?
readonly
Approximate token count (may be nil).
-
#total_chunks ⇒ Object
Returns the value of attribute total_chunks.
Instance Method Summary collapse
Instance Attribute Details
#byte_end ⇒ Integer (readonly)
Returns Ending byte offset (UTF-8).
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kreuzberg/result.rb', line 43 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :embedding, keyword_init: true ) do def to_h { content: content, byte_start: byte_start, byte_end: byte_end, token_count: token_count, chunk_index: chunk_index, total_chunks: total_chunks, first_page: first_page, last_page: last_page, embedding: } end end |
#byte_start ⇒ Integer (readonly)
Returns Starting byte offset (UTF-8).
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kreuzberg/result.rb', line 43 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :embedding, keyword_init: true ) do def to_h { content: content, byte_start: byte_start, byte_end: byte_end, token_count: token_count, chunk_index: chunk_index, total_chunks: total_chunks, first_page: first_page, last_page: last_page, embedding: } end end |
#chunk_index ⇒ Object
Returns the value of attribute chunk_index
43 44 45 |
# File 'lib/kreuzberg/result.rb', line 43 def chunk_index @chunk_index end |
#content ⇒ String (readonly)
Returns Chunk content.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kreuzberg/result.rb', line 43 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :embedding, keyword_init: true ) do def to_h { content: content, byte_start: byte_start, byte_end: byte_end, token_count: token_count, chunk_index: chunk_index, total_chunks: total_chunks, first_page: first_page, last_page: last_page, embedding: } end end |
#embedding ⇒ Object
Returns the value of attribute embedding
43 44 45 |
# File 'lib/kreuzberg/result.rb', line 43 def @embedding end |
#first_page ⇒ Integer? (readonly)
Returns First page number (1-indexed).
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kreuzberg/result.rb', line 43 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :embedding, keyword_init: true ) do def to_h { content: content, byte_start: byte_start, byte_end: byte_end, token_count: token_count, chunk_index: chunk_index, total_chunks: total_chunks, first_page: first_page, last_page: last_page, embedding: } end end |
#last_page ⇒ Integer? (readonly)
Returns Last page number (1-indexed).
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kreuzberg/result.rb', line 43 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :embedding, keyword_init: true ) do def to_h { content: content, byte_start: byte_start, byte_end: byte_end, token_count: token_count, chunk_index: chunk_index, total_chunks: total_chunks, first_page: first_page, last_page: last_page, embedding: } end end |
#token_count ⇒ Integer? (readonly)
Returns Approximate token count (may be nil).
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kreuzberg/result.rb', line 43 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :embedding, keyword_init: true ) do def to_h { content: content, byte_start: byte_start, byte_end: byte_end, token_count: token_count, chunk_index: chunk_index, total_chunks: total_chunks, first_page: first_page, last_page: last_page, embedding: } end end |
#total_chunks ⇒ Object
Returns the value of attribute total_chunks
43 44 45 |
# File 'lib/kreuzberg/result.rb', line 43 def total_chunks @total_chunks end |
Instance Method Details
#to_h ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/kreuzberg/result.rb', line 55 def to_h { content: content, byte_start: byte_start, byte_end: byte_end, token_count: token_count, chunk_index: chunk_index, total_chunks: total_chunks, first_page: first_page, last_page: last_page, embedding: } end |