Class: RubyLLM::Voyage::ContextualizedChunk

Inherits:
Struct
  • Object
show all
Defined in:
lib/ruby_llm/voyage/results.rb

Overview

One contextualized chunk and its vector.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#embeddingObject

Returns the value of attribute embedding

Returns:

  • (Object)

    the current value of embedding



33
34
35
# File 'lib/ruby_llm/voyage/results.rb', line 33

def embedding
  @embedding
end

#indexObject

Returns the value of attribute index

Returns:

  • (Object)

    the current value of index



33
34
35
# File 'lib/ruby_llm/voyage/results.rb', line 33

def index
  @index
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



33
34
35
# File 'lib/ruby_llm/voyage/results.rb', line 33

def text
  @text
end

Instance Method Details

#inspectString

Summarizes the vector so console output stays readable.

Returns:

  • (String)


36
37
38
39
40
# File 'lib/ruby_llm/voyage/results.rb', line 36

def inspect
  dimensions = embedding.respond_to?(:length) ? "[#{embedding.length} values]" : embedding.inspect
  "#<RubyLLM::Voyage::ContextualizedChunk index=#{index} embedding=#{dimensions} " \
    "text=#{text&.slice(0, 60).inspect}>"
end