added a script to add all documents (IWM articles) from a local folder. won't work on other machines
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Add all PDFs under a folder to the RAG vector store. Run from project root."""
|
||||
from pathlib import Path
|
||||
|
||||
from local_rag import LocalRAG
|
||||
|
||||
DATA_ROOT = Path("/Users/Philipp/Desktop/workspace/python/gpt_publikationen/data_vs")
|
||||
VECTORSTORE_PATH = "./vectorstore"
|
||||
|
||||
if __name__ == "__main__":
|
||||
pdfs = sorted(p for p in DATA_ROOT.rglob("*") if p.suffix.lower() == ".pdf")
|
||||
print(f"Found {len(pdfs)} PDF(s) under {DATA_ROOT}")
|
||||
if not pdfs:
|
||||
raise SystemExit("No PDFs found.")
|
||||
|
||||
rag = LocalRAG(vectorstore_path=VECTORSTORE_PATH)
|
||||
rag.add_documents([str(p) for p in pdfs])
|
||||
print("Done.")
|
||||
Reference in New Issue
Block a user