summaryrefslogtreecommitdiff
path: root/rag/cli.py
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2024-04-08 00:23:52 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2024-04-08 00:23:52 +0200
commit8211705debf9d1335223c606275f46c43c78d8a2 (patch)
treef09f902c7d31b2035813c42cbb4a47e720fa363b /rag/cli.py
parent95f47c4900a96d91daaef93bf87094ed3d4da43c (diff)
Updates
Diffstat (limited to 'rag/cli.py')
-rw-r--r--rag/cli.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/rag/cli.py b/rag/cli.py
new file mode 100644
index 0000000..5ea1a47
--- /dev/null
+++ b/rag/cli.py
@@ -0,0 +1,28 @@
+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)
+ case _:
+ print("Invalid option!")
+