Turn sentence vectors into a comparable signal with cosine similarity, including the zero-vector boundary.
Required APIdef cosine_similarity(left, right):
return similarityBehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
cosine_similarity([1, 0], [1, 0])identical meaning vectors align perfectly
cosine_similarity([1, 0], [0, 1])unrelated axes have no cosine overlap
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.