From e7ccaf6e78ee8d5adf617b953578efdd01998bbd Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 06:39:54 +0000 Subject: [PATCH] Fix: milvus error because the limit set to None by default The pymilvus library expects -1 for unlimited queries, but the code was passing None, which caused a TypeError. This commit changes the default value of the limit parameter in the query method from None to -1. It also updates the call site in the get method to pass -1 instead of None and updates the type hint and a comment to reflect this change. --- backend/open_webui/retrieval/vector/dbs/milvus.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/retrieval/vector/dbs/milvus.py b/backend/open_webui/retrieval/vector/dbs/milvus.py index 059ea43cc0..53bb3bb72f 100644 --- a/backend/open_webui/retrieval/vector/dbs/milvus.py +++ b/backend/open_webui/retrieval/vector/dbs/milvus.py @@ -189,7 +189,7 @@ class MilvusClient(VectorDBBase): ) return self._result_to_search_result(result) - def query(self, collection_name: str, filter: dict, limit: Optional[int] = None): + def query(self, collection_name: str, filter: dict, limit: int = -1): connections.connect(uri=MILVUS_URI, token=MILVUS_TOKEN, db_name=MILVUS_DB) # Construct the filter string for querying @@ -222,7 +222,7 @@ class MilvusClient(VectorDBBase): "data", "metadata", ], - limit=limit, # Pass the limit directly; None means no limit. + limit=limit, # Pass the limit directly; -1 means no limit. ) while True: @@ -249,7 +249,7 @@ class MilvusClient(VectorDBBase): ) # Using query with a trivial filter to get all items. # This will use the paginated query logic. - return self.query(collection_name=collection_name, filter={}, limit=None) + return self.query(collection_name=collection_name, filter={}, limit=-1) def insert(self, collection_name: str, items: list[VectorItem]): # Insert the items into the collection, if the collection does not exist, it will be created.