Class: Kreuzberg::Result::Chunk

Inherits:
Struct
  • Object
show all
Defined in:
lib/kreuzberg/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#byte_endInteger (readonly)

Returns Ending byte offset (UTF-8).

Returns:

  • (Integer)

    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: embedding
    }
  end
end

#byte_startInteger (readonly)

Returns Starting byte offset (UTF-8).

Returns:

  • (Integer)

    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: embedding
    }
  end
end

#chunk_indexObject

Returns the value of attribute chunk_index

Returns:

  • (Object)

    the current value of chunk_index



43
44
45
# File 'lib/kreuzberg/result.rb', line 43

def chunk_index
  @chunk_index
end

#contentString (readonly)

Returns Chunk content.

Returns:

  • (String)

    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: embedding
    }
  end
end

#embeddingObject

Returns the value of attribute embedding

Returns:

  • (Object)

    the current value of embedding



43
44
45
# File 'lib/kreuzberg/result.rb', line 43

def embedding
  @embedding
end

#first_pageInteger? (readonly)

Returns First page number (1-indexed).

Returns:

  • (Integer, nil)

    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: embedding
    }
  end
end

#last_pageInteger? (readonly)

Returns Last page number (1-indexed).

Returns:

  • (Integer, nil)

    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: embedding
    }
  end
end

#token_countInteger? (readonly)

Returns Approximate token count (may be nil).

Returns:

  • (Integer, nil)

    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: embedding
    }
  end
end

#total_chunksObject

Returns the value of attribute total_chunks

Returns:

  • (Object)

    the current value of total_chunks



43
44
45
# File 'lib/kreuzberg/result.rb', line 43

def total_chunks
  @total_chunks
end

Instance Method Details

#to_hObject



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: embedding
  }
end