From 388911eb2570e9b377afd20555f90776d9c7d2b0 Mon Sep 17 00:00:00 2001 From: Corentin Meyer Date: Thu, 7 Mar 2024 09:16:48 +0100 Subject: [PATCH] fix(qdrant): fix tests --- .../document_stores/qdrant/document_store.py | 4 ++-- integrations/qdrant/tests/test_dict_converters.py | 6 ++++++ integrations/qdrant/tests/test_retriever.py | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py b/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py index b4d756e57..b5f64b229 100644 --- a/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py +++ b/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py @@ -135,7 +135,7 @@ def __init__( self.payload_field_to_index = payload_field_to_index # Make sure the collection is properly set up - self._set_up_collection(index, embedding_dim, on_disk, recreate_index, similarity, payload_field_to_index) + self._set_up_collection(index, embedding_dim, recreate_index, similarity, on_disk, payload_field_to_index) self.embedding_dim = embedding_dim self.on_disk = on_disk @@ -355,9 +355,9 @@ def _set_up_collection( self, collection_name: str, embedding_dim: int, - on_disk: bool, # noqa: FBT001 recreate_collection: bool, # noqa: FBT001 similarity: str, + on_disk: bool = False, # noqa: FBT001 payload_field_to_index: Optional[List[dict]] = None, ): distance = self._get_distance(similarity) diff --git a/integrations/qdrant/tests/test_dict_converters.py b/integrations/qdrant/tests/test_dict_converters.py index 18940fbbf..745890d74 100644 --- a/integrations/qdrant/tests/test_dict_converters.py +++ b/integrations/qdrant/tests/test_dict_converters.py @@ -21,6 +21,7 @@ def test_to_dict(): "path": None, "index": "test", "embedding_dim": 768, + "on_disk": False, "content_field": "content", "name_field": "name", "embedding_field": "embedding", @@ -42,6 +43,7 @@ def test_to_dict(): "metadata": {}, "write_batch_size": 100, "scroll_size": 10000, + "payload_field_to_index": None, }, } @@ -57,6 +59,7 @@ def test_from_dict(): "location": ":memory:", "index": "test", "embedding_dim": 768, + "on_disk": False, "content_field": "content", "name_field": "name", "embedding_field": "embedding", @@ -72,6 +75,7 @@ def test_from_dict(): "metadata": {}, "write_batch_size": 1000, "scroll_size": 10000, + "payload_field_to_index": None, }, } ) @@ -82,6 +86,7 @@ def test_from_dict(): document_store.content_field == "content", document_store.name_field == "name", document_store.embedding_field == "embedding", + document_store.on_disk is False, document_store.similarity == "cosine", document_store.return_embedding is False, document_store.progress_bar, @@ -101,5 +106,6 @@ def test_from_dict(): document_store.write_batch_size == 1000, document_store.scroll_size == 10000, document_store.api_key == Secret.from_env_var("ENV_VAR", strict=False), + document_store.payload_field_to_index is None, ] ) diff --git a/integrations/qdrant/tests/test_retriever.py b/integrations/qdrant/tests/test_retriever.py index 7521642ff..6e338341f 100644 --- a/integrations/qdrant/tests/test_retriever.py +++ b/integrations/qdrant/tests/test_retriever.py @@ -41,6 +41,7 @@ def test_to_dict(self): "path": None, "index": "test", "embedding_dim": 768, + "on_disk": False, "content_field": "content", "name_field": "name", "embedding_field": "embedding", @@ -62,6 +63,7 @@ def test_to_dict(self): "metadata": {}, "write_batch_size": 100, "scroll_size": 10000, + "payload_field_to_index": None, }, }, "filters": None,