Class: Pikuri::VectorDb::Backend::Result

Inherits:
Data
  • Object
show all
Defined in:
lib/pikuri/vector_db/backend/result.rb

Overview

A single query hit: the matched Chunk + its score, returned in descending-score order from a backend's #query.

  • chunk — the stored Chunk.
  • score — cosine similarity Float [-1.0, 1.0] (in practice [0.0, 1.0] for the normalized vectors most embedders produce; 1.0 = exact match, 0.0 = orthogonal). But this is cosine only as returned by the backendTools::Search substitutes the reranker's relevance score (via Data#with) when a reranker reorders, so a surfaced score is cosine only in vector-only mode (see Tools::Search's "Which score is shown").

Tools::Search cites hits as chunk.source + chunk.text + score; id is never surfaced, metadata carries optional deep-link extras.

Instance Attribute Summary collapse

Instance Attribute Details

#chunkObject (readonly)

Returns the value of attribute chunk

Returns:

  • (Object)

    the current value of chunk



20
21
22
# File 'lib/pikuri/vector_db/backend/result.rb', line 20

def chunk
  @chunk
end

#scoreObject (readonly)

Returns the value of attribute score

Returns:

  • (Object)

    the current value of score



20
21
22
# File 'lib/pikuri/vector_db/backend/result.rb', line 20

def score
  @score
end