Documentation
¶
Overview ¶
Package embedder handles batch embedding of chunks and sparse vector computation.
Index ¶
Constants ¶
View Source
const DefaultBatchSize = 96 // VoyageAI allows up to 128; 96 leaves headroom
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SparseVector ¶
SparseVector is the Qdrant sparse vector format (indices + values, both same length).
func BM25Sparse ¶
func BM25Sparse(text string) SparseVector
BM25Sparse computes a TF-based sparse vector for the text.
Algorithm:
- Tokenise: lowercase + split on non-letter/non-digit runes, drop tokens < 2 chars.
- Compute normalised term frequency (TF = count / total).
- Map each token to an index via FNV-32a % maxSparseIndex (no global vocab needed).
This approximates sparse retrieval without requiring a corpus-wide IDF table. When combined with dense vectors via Qdrant RRF, it significantly improves recall on exact keyword matches (column names, codes, dates, etc.).
Click to show internal directories.
Click to hide internal directories.