From 78157a94e7e2d0cd3ae8ac42508e9a248b96852b Mon Sep 17 00:00:00 2001 From: lohit8846 Date: Thu, 6 Jun 2024 00:17:50 -0700 Subject: [PATCH] feat: Add force_disable_check_same_thread init param for Qdrant local client (#779) * fix: added missing init param which is use by qdrant local client * fix: Corrected linting --- .../document_stores/qdrant/document_store.py | 3 +++ integrations/qdrant/tests/test_dict_converters.py | 3 +++ integrations/qdrant/tests/test_retriever.py | 3 +++ 3 files changed, 9 insertions(+) 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 0cbad74a1..b3be56f40 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 @@ -68,6 +68,7 @@ def __init__( timeout: Optional[int] = None, host: Optional[str] = None, path: Optional[str] = None, + force_disable_check_same_thread: bool = False, index: str = "Document", embedding_dim: int = 768, on_disk: bool = False, @@ -109,6 +110,7 @@ def __init__( self.timeout = timeout self.host = host self.path = path + self.force_disable_check_same_thread = force_disable_check_same_thread self.metadata = metadata or {} self.api_key = api_key @@ -155,6 +157,7 @@ def client(self): host=self.host, path=self.path, metadata=self.metadata, + force_disable_check_same_thread=self.force_disable_check_same_thread, ) # Make sure the collection is properly set up self._set_up_collection( diff --git a/integrations/qdrant/tests/test_dict_converters.py b/integrations/qdrant/tests/test_dict_converters.py index 6c8e46710..dd54df4c4 100644 --- a/integrations/qdrant/tests/test_dict_converters.py +++ b/integrations/qdrant/tests/test_dict_converters.py @@ -25,6 +25,7 @@ def test_to_dict(): "content_field": "content", "name_field": "name", "embedding_field": "embedding", + "force_disable_check_same_thread": False, "use_sparse_embeddings": False, "similarity": "cosine", "return_embedding": False, @@ -64,6 +65,7 @@ def test_from_dict(): "content_field": "content", "name_field": "name", "embedding_field": "embedding", + "force_disable_check_same_thread": False, "use_sparse_embeddings": True, "similarity": "cosine", "return_embedding": False, @@ -88,6 +90,7 @@ def test_from_dict(): document_store.content_field == "content", document_store.name_field == "name", document_store.embedding_field == "embedding", + document_store.force_disable_check_same_thread is False, document_store.use_sparse_embeddings is True, document_store.on_disk is False, document_store.similarity == "cosine", diff --git a/integrations/qdrant/tests/test_retriever.py b/integrations/qdrant/tests/test_retriever.py index 47fec5968..2eb0f6a34 100644 --- a/integrations/qdrant/tests/test_retriever.py +++ b/integrations/qdrant/tests/test_retriever.py @@ -49,6 +49,7 @@ def test_to_dict(self): "on_disk": False, "content_field": "content", "name_field": "name", + "force_disable_check_same_thread": False, "embedding_field": "embedding", "use_sparse_embeddings": False, "similarity": "cosine", @@ -172,6 +173,7 @@ def test_to_dict(self): "content_field": "content", "name_field": "name", "embedding_field": "embedding", + "force_disable_check_same_thread": False, "use_sparse_embeddings": False, "similarity": "cosine", "return_embedding": False, @@ -281,6 +283,7 @@ def test_to_dict(self): "content_field": "content", "name_field": "name", "embedding_field": "embedding", + "force_disable_check_same_thread": False, "use_sparse_embeddings": False, "similarity": "cosine", "return_embedding": False,