From d13478791cb6852b122e492ad40cd21e032a9971 Mon Sep 17 00:00:00 2001 From: Merlin Kallenborn Date: Tue, 21 May 2024 16:00:43 +0200 Subject: [PATCH] chore: Replace deprecated `recreate_collection`-method. TASK: IL-511 --- .../connectors/retrievers/qdrant_in_memory_retriever.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/intelligence_layer/connectors/retrievers/qdrant_in_memory_retriever.py b/src/intelligence_layer/connectors/retrievers/qdrant_in_memory_retriever.py index 007ed8331..05ee8459d 100644 --- a/src/intelligence_layer/connectors/retrievers/qdrant_in_memory_retriever.py +++ b/src/intelligence_layer/connectors/retrievers/qdrant_in_memory_retriever.py @@ -75,10 +75,16 @@ def __init__( self._query_representation, self._document_representation = retriever_type.value self._distance_metric = distance_metric - self._search_client.recreate_collection( + if self._search_client.collection_exists(collection_name=self._collection_name): + self._search_client.delete_collection( + collection_name=self._collection_name, + ) + + self._search_client.create_collection( collection_name=self._collection_name, vectors_config=VectorParams(size=128, distance=self._distance_metric), ) + self._add_texts_to_memory(documents) def get_relevant_documents_with_scores(