summaryrefslogtreecommitdiff
path: root/rag
diff options
context:
space:
mode:
Diffstat (limited to 'rag')
-rw-r--r--rag/rag.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/rag/rag.py b/rag/rag.py
new file mode 100644
index 0000000..5b5f5ab
--- /dev/null
+++ b/rag/rag.py
@@ -0,0 +1,20 @@
+from pathlib import Path
+from typing import List, Optional
+
+from langchain_core.documents.base import Document
+from llm.encoder import Encoder
+from llm.generator import Generator
+from parser import pdf
+from db.documents import Documents
+from db.vectors import Vectors
+
+
+class RAG:
+ def __init__(self) -> None:
+ self.generator = Generator()
+ self.encoder = Encoder()
+ self.docs = Documents()
+ self.vectors = Vectors()
+
+ def add_pdf(self, filepath: Path) -> Optional[List[Document]]:
+ chunks = pdf.parser(filepath)