Cosine similarity
The dot product with length divided out, leaving only the angle between two vectors. It runs from -1 to 1 and ignores magnitude entirely, which is exactly what you want when comparing embeddings whose scale carries no meaning.
- The first vector, often a query embedding.
- The second vector, often a stored embedding.