langchain_chroma.vectorstores.cosine_similarity¶

langchain_chroma.vectorstores.cosine_similarity(X: Union[List[List[float]], List[ndarray], ndarray], Y: Union[List[List[float]], List[ndarray], ndarray]) ndarray[source]¶

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

Raises

ValueError – If the number of columns in X and Y are not the same.

Parameters
  • X (Union[List[List[float]], List[ndarray], ndarray]) –

  • Y (Union[List[List[float]], List[ndarray], ndarray]) –

Return type

ndarray

Examples using cosine_similarity¶