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/retriever/document.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'rag/retriever/document.py') diff --git a/rag/retriever/document.py b/rag/retriever/document.py index 8a50f01..132ec4b 100644 --- a/rag/retriever/document.py +++ b/rag/retriever/document.py @@ -34,6 +34,16 @@ class DocumentDB: log.debug("Hashing document...") return hashlib.sha256(blob.as_bytes()).hexdigest() + def delete_all(self): + with self.conn.cursor() as cur: + cur.execute( + """ + TRUNCATE TABLE + document + """ + ) + self.conn.commit() + def add(self, blob: Blob) -> bool: with self.conn.cursor() as cur: hash = self.__hash(blob) -- cgit v1.2.3-70-g09d2