From a22da4315b4645ba3b8b371f24f7b0e634432829 Mon Sep 17 00:00:00 2001 From: Christophe Bornet Date: Wed, 17 Apr 2024 23:13:13 +0200 Subject: [PATCH] community[patch]: Replace function in CassandraVectorStore with simpler lambda (#20323) --- .../langchain_community/vectorstores/cassandra.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libs/community/langchain_community/vectorstores/cassandra.py b/libs/community/langchain_community/vectorstores/cassandra.py index 799ea79b487..ac70c21d1ce 100644 --- a/libs/community/langchain_community/vectorstores/cassandra.py +++ b/libs/community/langchain_community/vectorstores/cassandra.py @@ -112,18 +112,13 @@ class Cassandra(VectorStore): def embeddings(self) -> Embeddings: return self.embedding - @staticmethod - def _dont_flip_the_cos_score(distance: float) -> float: - # the identity - return distance - def _select_relevance_score_fn(self) -> Callable[[float], float]: """ The underlying VectorTable already returns a "score proper", i.e. one in [0, 1] where higher means more *similar*, so here the final score transformation is not reversing the interval: """ - return self._dont_flip_the_cos_score + return lambda score: score def delete_collection(self) -> None: """