From 69a20c3e7e76b67ba5d5a0609987ff58675ad1fa Mon Sep 17 00:00:00 2001 From: "283569391@qq.com" Date: Thu, 20 Feb 2025 11:54:03 +0800 Subject: [PATCH] fix issue2321:Provide an implementation of the truncate method --- dbgpt/storage/vector_store/milvus_store.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dbgpt/storage/vector_store/milvus_store.py b/dbgpt/storage/vector_store/milvus_store.py index 0032fa89a..49dbb3395 100644 --- a/dbgpt/storage/vector_store/milvus_store.py +++ b/dbgpt/storage/vector_store/milvus_store.py @@ -638,3 +638,15 @@ class MilvusStore(VectorStoreBase): else: metadata_filter_expr = metadata_filters[0] return metadata_filter_expr + + def truncate(self): + """Truncate milvus collection. + """ + logger.info(f"begin truncate milvus collection:{self.collection_name}") + from pymilvus import utility + if utility.has_collection(self.collection_name): + utility.drop_collection(self.collection_name) + + logger.info( + f"truncate milvus collection {self.collection_name} success" + ) \ No newline at end of file