From 04686f497f120096435da72c6546306eb292846a Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 23 Apr 2024 00:50:25 +0200 Subject: Add delete all cli --- rag/drop.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 rag/drop.py (limited to 'rag/drop.py') diff --git a/rag/drop.py b/rag/drop.py new file mode 100644 index 0000000..89ae755 --- /dev/null +++ b/rag/drop.py @@ -0,0 +1,24 @@ +import click +from dotenv import load_dotenv +from loguru import logger as log + +from rag.retriever.retriever import Retriever + + +def drop(): + log.debug("Dropping documents") + retriever = Retriever() + doc_db = retriever.doc_db + doc_db.delete_all() + vec_db = retriever.vec_db + vec_db.delete_collection() + + +@click.confirmation_option(prompt="Are you sure you want to drop the db?") +def main(): + drop() + + +if __name__ == "__main__": + load_dotenv() + main() -- cgit v1.2.3-70-g09d2