# cosine_similarity

> **Function** in `langchain_redis`

📖 [View in docs](https://reference.langchain.com/python/langchain-redis/vectorstores/cosine_similarity)

Row-wise cosine similarity between two equal-width matrices.

## Signature

```python
cosine_similarity(
    X: Matrix,
    Y: Matrix,
) -> np.ndarray
```

---

[View source on GitHub](https://github.com/langchain-ai/langchain-redis/blob/110f379bde5cde4d783b69eb9c6d313fa71b028f/libs/redis/langchain_redis/vectorstores.py#L29)