Loading
Vector search ranks documents by cosine similarity between embeddings. Write `cosine(a, b)` for two equal-length lists of numbers: the dot product divided by the product of their lengths. Return 0.0 if either vector is all zeros.
dot = sum(x*y for x, y in zip(a, b)); length = math.sqrt(sum(x*x for x in a)).