Spaces:
Runtime error
Runtime error
Commit History
-
Replace FAISS index with portable numpy embeddings in pkl
FAISS C++ objects are not safely picklable across OS/build environments (Windows pkl cannot be loaded on HF Space Linux). Fix: store raw L2-normalised numpy embeddings in the pkl and perform retrieval via a plain dot product. No FAISS dependency at runtime on the Space. - build_index.py: build_embeddings() replaces build_faiss_index(); saves embeddings ndarray instead of faiss.IndexFlatIP object - retrieval.py: pure numpy dot product, zero FAISS calls at runtime - app.py: variable renamed _rag_index -> _rag_embeddings - data/sanyu_knowledge_base.pkl: rebuilt with new format (167 chunks) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>543fbbd -
Add RAG pipeline: build_index.py, retrieval.py, and FAISS knowledge base
- build_index.py: extracts, cleans, chunks and embeds YAPS documents into a FAISS index (167 chunks from 2 PDFs) - retrieval.py: load_index() and retrieve() for use by app.py at runtime - data/sanyu_knowledge_base.pkl: pre-built FAISS index (422KB) - app.py: wires retrieval in as a separate context Content block per query; loads index and embedding model once at startup - requirements.txt: adds sentence-transformers, faiss-cpu, pdfplumber - .gitignore: excludes venv, docs/, build artefacts Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>0b92277