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.
-
#chunk_type ⇒ Object
Returns the value of attribute chunk_type.
-
#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).
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/kreuzberg/result.rb', line 46 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :chunk_type, :embedding ) 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, chunk_type: chunk_type, embedding: } end end |
#byte_start ⇒ Integer (readonly)
Returns Starting byte offset (UTF-8).
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/kreuzberg/result.rb', line 46 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :chunk_type, :embedding ) 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, chunk_type: chunk_type, embedding: } end end |
#chunk_index ⇒ Object
Returns the value of attribute chunk_index
46 47 48 |
# File 'lib/kreuzberg/result.rb', line 46 def chunk_index @chunk_index end |
#chunk_type ⇒ Object
Returns the value of attribute chunk_type
46 47 48 |
# File 'lib/kreuzberg/result.rb', line 46 def chunk_type @chunk_type end |
#content ⇒ String (readonly)
Returns Chunk content.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/kreuzberg/result.rb', line 46 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :chunk_type, :embedding ) 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, chunk_type: chunk_type, embedding: } end end |
#embedding ⇒ Object
Returns the value of attribute embedding
46 47 48 |
# File 'lib/kreuzberg/result.rb', line 46 def @embedding end |
#first_page ⇒ Integer? (readonly)
Returns First page number (1-indexed).
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/kreuzberg/result.rb', line 46 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :chunk_type, :embedding ) 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, chunk_type: chunk_type, embedding: } end end |
#last_page ⇒ Integer? (readonly)
Returns Last page number (1-indexed).
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/kreuzberg/result.rb', line 46 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :chunk_type, :embedding ) 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, chunk_type: chunk_type, embedding: } end end |
#token_count ⇒ Integer? (readonly)
Returns Approximate token count (may be nil).
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/kreuzberg/result.rb', line 46 Chunk = Struct.new( :content, :byte_start, :byte_end, :token_count, :chunk_index, :total_chunks, :first_page, :last_page, :chunk_type, :embedding ) 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, chunk_type: chunk_type, embedding: } end end |
#total_chunks ⇒ Object
Returns the value of attribute total_chunks
46 47 48 |
# File 'lib/kreuzberg/result.rb', line 46 def total_chunks @total_chunks end |
Instance Method Details
#to_h ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/kreuzberg/result.rb', line 58 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, chunk_type: chunk_type, embedding: } end |