Skip to content

Commit

Permalink
Merge branch 'main' into fix/get-embedding-for-near-vector
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm207 authored Mar 25, 2024
2 parents d0552ac + e2984f4 commit c8bbf02
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 66 deletions.
4 changes: 2 additions & 2 deletions langchain_weaviate/_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import List, Optional, Tuple, Union

import numpy as np
import simsimd as simd
import simsimd

logger = logging.getLogger(__name__)

Expand All @@ -26,7 +26,7 @@ def cosine_similarity(X: Matrix, Y: Matrix) -> np.ndarray:

X = np.array(X, dtype=np.float32)
Y = np.array(Y, dtype=np.float32)
Z = 1 - simd.cdist(X, Y, metric="cosine")
Z = 1 - np.array(simsimd.cdist(X, Y, metric="cosine"))
if isinstance(Z, float):
return np.array([Z])
return Z
Expand Down
Loading

0 comments on commit c8bbf02

Please sign in to comment.