summaryrefslogtreecommitdiff
path: root/rag/retriever/document.py
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2024-04-23 00:50:25 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2024-04-23 00:50:25 +0200
commit04686f497f120096435da72c6546306eb292846a (patch)
tree8203df9747e2cb729a8317045e5bdc4512241ac4 /rag/retriever/document.py
parentf5adcbb62b10110dc7417c5a07ef6461782f5a10 (diff)
Add delete all cli
Diffstat (limited to 'rag/retriever/document.py')
-rw-r--r--rag/retriever/document.py10
1 files changed, 10 insertions, 0 deletions
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)