A lightweight retrieval-augmented generation (RAG) app built with LangChain, FAISS, and HuggingFace (can be used fully offline and free for experimental tasks if don't want to use paid openAI credits).
This project demonstrates how to build a retrieval-based knowledge assistant using your own documents without relying on paid APIs.
- β
Offline / Free β Uses
sentence-transformersandflan-t5-smalllocally (no OpenAI key needed) - π Document Search β Indexes and retrieves contextually relevant information using FAISS
- π¬ Conversational Interface β Ask natural language questions about your files
- π§© Modular Architecture β Swap in OpenAI or HuggingFace models easily
- π Streamlit UI β Simple, interactive web interface
Clone the repository and install dependencies:
git clone https://github.com/rmehmood786/genai-knowledge-assistant.git
cd genai-knowledge-assistant
python -m venv .venv
.venv\Scripts\Activate.ps1 # (on Windows PowerShell)
pip install -r requirements.txtgenai-knowledge-assistant/
β
βββ app.py # Streamlit interface (main app)
βββ ingest.py # Indexes local documents into FAISS
βββ config.py # Configuration (API key, paths)
βββ data/
β βββ docs/ # Place your .txt/.md/.pdf documents here
β βββ vectorstore/ # FAISS index will be stored here
βββ .env.example # Example environment file
βββ README.md
Put any .txt, .md, or .pdf files in data/docs/.
python ingest.pyYouβll see a message like:
Saved FAISS index to data/vectorstore with 4 chunks.
streamlit run app.pyThen open your browser at:
π http://localhost:8501
Example prompts:
- βWhat does SmartCo Consulting do?β
- βWhich technologies are mentioned in my documents?β
- βSummarise the document about AI ethics.β
- Embeddings:
sentence-transformers/all-MiniLM-L6-v2 - LLM (offline):
google/flan-t5-small - (Optional) You can still switch to OpenAI models by unchecking βUse free local LLMβ in the sidebar.
- Add document upload support directly in the UI
- Include context preview under each answer
- Support PDF β text conversion
- Deploy via Streamlit Cloud or HuggingFace Spaces
Rashid Mehmood
π§ rashidmehmood5914@gmail.com
π LinkedIn | GitHub
From inside your project folder:
cd "C:\Users\Rashid Mehmood\Downloads\genai-knowledge-assistant\genai-knowledge-assistant"
.venv\Scripts\Activate.ps1
git add .
git commit -m "update: fully offline version using HuggingFace + Flan-T5 with badges"
git branch -M main
git remote set-url origin https://github.com/rmehmood786/genai-knowledge-assistant.git
git push -u origin mainβ Note: Ensure
.envis in your.gitignoreso your local API keys remain private.