From 02e337fc8c9e32b6fbfccf3053104ddc8e21bc48 Mon Sep 17 00:00:00 2001 From: James Braza Date: Fri, 18 Oct 2024 11:50:30 -0700 Subject: [PATCH] Added __eq__ to NumpyVectorStore for convenience --- paperqa/llms.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/paperqa/llms.py b/paperqa/llms.py index ba468241..cd557bab 100644 --- a/paperqa/llms.py +++ b/paperqa/llms.py @@ -845,6 +845,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 = []