mirror of
https://github.com/hwchase17/langchain.git
synced 2025-10-25 21:03:11 +00:00
**Description:** Added an explicit validation step in `langchain_core.vectorstores.utils._cosine_similarity` to raise a `ValueError` if the input query or any embedding contains `NaN` values. This prevents silent failures or unstable behavior during similarity calculations, especially when using maximal_marginal_relevance. **Issue**: Fixes #31806 **Dependencies:** None --------- Co-authored-by: Azhagammal S C <azhagammal@kofluence.com> Co-authored-by: Mason Daugherty <mason@langchain.dev>