diff options
-rw-r--r-- | rag/db/document.py | 2 | ||||
-rw-r--r-- | rag/rag.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/rag/db/document.py b/rag/db/document.py index 8e4d208..c449158 100644 --- a/rag/db/document.py +++ b/rag/db/document.py @@ -56,4 +56,4 @@ class DocumentDB: (hash,), ) self.conn.commit() - return exist is not None + return exist is None @@ -27,6 +27,8 @@ class RAG: log.debug(f"Adding pdf with filepath: {filepath} to vector db") points = self.encoder.encode_document(chunks) self.vector_db.add(points) + else: + log.debug("Document already exists!") def __context(self, query_emb: List[StrictFloat], limit: int) -> str: hits = self.vector_db.search(query_emb, limit) |