Toggle Menu
Prev Up Next

# `langchain_astradb.utils.mmr`.cosine_similarity

langchain_astradb.utils.mmr.cosine_similarity(X: Union[List[List[float]], List[ndarray], ndarray], Y: Union[List[List[float]], List[ndarray], ndarray]) → ndarray

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

  Parameters

    - X (Union[List[List[float]], List[ndarray], ndarray]) –

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

  Return type

    ndarray

# Examples using cosine_similarity

- Dynamically route logic based on input {#dynamically-route-logic-based-on-input}