From 59c77c93c39755526e3d7649660780584b1c090d Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sat, 6 Apr 2024 00:19:24 +0200 Subject: Wip rag --- rag/rag.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 rag/rag.py 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) -- cgit v1.2.3-70-g09d2