Skip to content

Commit

Permalink
Added __eq__ to NumpyVectorStore for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbraza committed Oct 18, 2024
1 parent 2e65ca6 commit a684dc7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions paperqa/llms.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,16 @@ class NumpyVectorStore(VectorStore):
texts: list[Embeddable] = []
_embeddings_matrix: np.ndarray | None = None

def __eq__(self, other) -> bool:
if isinstance(other, type(self)):
raise NotImplementedError
return (
self.texts == other.texts
and self.texts_hashes == other.texts_hashes
and self.mmr_lambda == other.mmr_lambda
and self._embeddings_matrix == other._embeddings_matrix
)

def clear(self) -> None:
super().clear()
self.texts = []
Expand Down

0 comments on commit a684dc7

Please sign in to comment.