Similarity searchintermediate
Cosine similarity measures the angle between two embeddings; sorting your chunks by it is the entire retrieval half of RAG.
Cosine similarity, top-k, and a score floor — the retrieval half of RAG, written out by hand so you know what the vector database is doing for you.
Identical vectors score 1, orthogonal score 0, a zero vector scores 0 rather than NaN.
Published in full, before you start — every point is one of these and there is nothing else. Each one runs your code; it is not a search for keywords.
Cosine similarity measures the angle between two embeddings; sorting your chunks by it is the entire retrieval half of RAG.