Browse Source

refactor: Removed more swallows

Signed-off-by: Anush008 <anushshetty90@gmail.com>
Anush008 3 months ago
parent
commit
c8a49d373a
1 changed files with 18 additions and 30 deletions
  1. 18 30
      backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py

+ 18 - 30
backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py

@@ -225,16 +225,12 @@ class QdrantClient(VectorDBBase):
         elif filter:
         elif filter:
             must_conditions += [_metadata_filter(k, v) for k, v in filter.items()]
             must_conditions += [_metadata_filter(k, v) for k, v in filter.items()]
 
 
-        try:
-            return self.client.delete(
-                collection_name=mt_collection,
-                points_selector=models.FilterSelector(
-                    filter=models.Filter(must=must_conditions, should=should_conditions)
-                ),
-            )
-        except Exception as e:
-            log.warning(f"Error deleting from collection {mt_collection}: {e}")
-            return None
+        return self.client.delete(
+            collection_name=mt_collection,
+            points_selector=models.FilterSelector(
+                filter=models.Filter(must=must_conditions, should=should_conditions)
+            ),
+        )
 
 
     def search(
     def search(
         self, collection_name: str, vectors: List[List[float | int]], limit: int
         self, collection_name: str, vectors: List[List[float | int]], limit: int
@@ -281,16 +277,12 @@ class QdrantClient(VectorDBBase):
         tenant_filter = _tenant_filter(tenant_id)
         tenant_filter = _tenant_filter(tenant_id)
         field_conditions = [_metadata_filter(k, v) for k, v in filter.items()]
         field_conditions = [_metadata_filter(k, v) for k, v in filter.items()]
         combined_filter = models.Filter(must=[tenant_filter, *field_conditions])
         combined_filter = models.Filter(must=[tenant_filter, *field_conditions])
-        try:
-            points = self.client.query_points(
-                collection_name=mt_collection,
-                query_filter=combined_filter,
-                limit=limit,
-            )
-            return self._result_to_get_result(points.points)
-        except Exception as e:
-            log.exception(f"Error querying collection '{collection_name}': {e}")
-            return None
+        points = self.client.query_points(
+            collection_name=mt_collection,
+            query_filter=combined_filter,
+            limit=limit,
+        )
+        return self._result_to_get_result(points.points)
 
 
     def get(self, collection_name: str) -> Optional[GetResult]:
     def get(self, collection_name: str) -> Optional[GetResult]:
         """
         """
@@ -303,16 +295,12 @@ class QdrantClient(VectorDBBase):
             log.debug(f"Collection {mt_collection} doesn't exist, get returns None")
             log.debug(f"Collection {mt_collection} doesn't exist, get returns None")
             return None
             return None
         tenant_filter = _tenant_filter(tenant_id)
         tenant_filter = _tenant_filter(tenant_id)
-        try:
-            points = self.client.query_points(
-                collection_name=mt_collection,
-                query_filter=models.Filter(must=[tenant_filter]),
-                limit=NO_LIMIT,
-            )
-            return self._result_to_get_result(points.points)
-        except Exception as e:
-            log.exception(f"Error getting collection '{collection_name}': {e}")
-            return None
+        points = self.client.query_points(
+            collection_name=mt_collection,
+            query_filter=models.Filter(must=[tenant_filter]),
+            limit=NO_LIMIT,
+        )
+        return self._result_to_get_result(points.points)
 
 
     def upsert(self, collection_name: str, items: List[VectorItem]):
     def upsert(self, collection_name: str, items: List[VectorItem]):
         """
         """