blob: d5651c159cc1b1827155010e9f094fbb1e122498 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
from pathlib import Path
try:
from rag.rag import RAG
except ModuleNotFoundError:
from rag import RAG
if __name__ == "__main__":
rag = RAG()
while True:
print("Retrieval Augmented Generation")
choice = input("1. add pdf from path\n2. Enter a query\n")
match choice:
case "1":
path = input("Enter the path to the pdf: ")
path = Path(path)
rag.add_pdf_from_path(path)
case "2":
query = input("Enter your query: ")
if query:
result = rag.retrive(query)
print("Answer: \n")
print(result.answer + "\n")
case _:
print("Invalid option!")
|