Timothy Jaeryang Baek 4 months ago
parent
commit
b98d8aa8ec
1 changed files with 5 additions and 1 deletions
  1. 5 1
      backend/open_webui/retrieval/utils.py

+ 5 - 1
backend/open_webui/retrieval/utils.py

@@ -220,7 +220,11 @@ def query_doc_with_hybrid_search(
                 zip(distances, metadatas, documents), key=lambda x: x[0], reverse=True
             )
             sorted_items = sorted_items[:k]
-            distances, documents, metadatas = map(list, zip(*sorted_items))
+
+            if sorted_items:
+                distances, documents, metadatas = map(list, zip(*sorted_items))
+            else:
+                distances, documents, metadatas = [], [], []
 
         result = {
             "distances": [distances],