SIGN IN SIGN UP

fix[core]: added error message if the query vector or embedding contains NaN values (#31822)

**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>
A
Azhagammal committed
4d9c0b088397d556d9dee9766fcc118259fdae79
Parent: a8998a1
Committed by GitHub <noreply@github.com> on 7/9/2025, 10:30:26 PM