| # rag/loader.py | |
| from langchain_community.vectorstores import FAISS | |
| from langchain_community.embeddings import HuggingFaceEmbeddings | |
| def load_rag_index(index_path="faiss_index_fast"): | |
| embeddings = HuggingFaceEmbeddings( | |
| model_name="sentence-transformers/all-MiniLM-L6-v2" | |
| ) | |
| vectorstore = FAISS.load_local( | |
| index_path, | |
| embeddings, | |
| allow_dangerous_deserialization=True | |
| ) | |
| return vectorstore | |