An AI-powered RAG (Retrieval-Augmented Generation) chatbot built with Streamlit and LangChain, designed to help users make informed, data-driven decisions for safer homes and resilient communities.
HabiMate uses a FAISS vector store to retrieve relevant context from local PDF documents and passes it to Google Gemini (gemini-2.5-flash-lite) to generate accurate, grounded answers. It features a clean chat UI built entirely in Streamlit.
| Layer | Technology |
|---|---|
| Frontend / UI | Streamlit |
| LLM | Google Gemini 2.5 Flash Lite (via LangChain) |
| Embeddings | sentence-transformers/all-MiniLM-L6-v2 (HuggingFace) |
| Vector Store | FAISS |
| RAG Framework | LangChain |
| Backend (API) | FastAPI |
| Data Source | PDF documents |
├── .devcontainer/ # Dev container config
├── backend/ # FastAPI backend
├── data/
│ └── pdfs/
│ └── family_database_ovg_vi_dec_2024.pdf
├── vectorstore/ # FAISS index (generated)
├── app.py # Main Streamlit app
├── requirements.txt
├── .gitignore
└── README.md
- PDF documents are loaded from
data/pdfs/and chunked into segments - Each chunk is embedded using
all-MiniLM-L6-v2and stored in a FAISS index - When a user asks a question, the top 5 most relevant chunks are retrieved
- The retrieved context + question are passed to Gemini via a LangChain RAG chain
- The answer is displayed in the chat UI
git clone https://github.com/your-username/habimate.git
cd habimatepip install -r requirements.txtCreate a .env file in the root directory:
GOOGLE_API_KEY=your_google_api_key_here
Make sure your PDFs are in data/pdfs/, then run your ingestion script to generate the FAISS index in vectorstore/faiss_index.
streamlit run app.pyA lightweight FastAPI backend is also available for programmatic access:
uvicorn backend.main:app --reloadEndpoint:
GET /search?query=your+question+here
Returns:
{
"result": "AI-generated answer based on retrieved context"
}| Variable | Description |
|---|---|
GOOGLE_API_KEY |
Your Google Gemini API key |
Key dependencies (see requirements.txt for full list):
streamlitlangchainlangchain-google-genailangchain-communityfaiss-cpusentence-transformerspython-dotenvfastapiuvicorn
