A lightweight AI-powered documentation chatbot built using Flask, LangChain, Google Gemini, and FAISS.
The system uses Retrieval-Augmented Generation (RAG) to answer questions based on your own documents. Instead of hallucinating answers, it retrieves relevant document chunks and sends them to Gemini for grounded responses.
Currently the chatbot indexes DevOps documentation such as:
- Docker
- CI/CD
But it can be extended to any domain knowledge base.
• Retrieval-Augmented Generation (RAG) architecture
• Google Gemini LLM for responses
• Gemini embedding model for semantic search
• FAISS vector database for fast retrieval
• Session-based conversation memory
• Flask API backend
• Simple web UI (index.html)
• Source document references returned with answers
• Rate-limit safe embedding pipeline for free-tier Gemini API
User Question
│
▼
Flask API (/chat)
│
▼
History-aware Retriever
│
▼
FAISS Vector Store
│
Retrieve Top-K Relevant Chunks
│
▼
Gemini LLM (RAG Prompt)
│
▼
Answer + Sources
This prevents hallucinations by forcing the model to use retrieved context from your docs.
project/
│
├── docs/ # Knowledge base documents
│ ├── docker.txt
│ └── cicid.txt
│
├── vector_store/ # Generated FAISS index
│
├── embed_docs.py # Creates embeddings from d
├── main.py # Flask RAG chatbot API
├── index.html # Frontend chat UI
├── requirements.txt # Python dependencies
│
└── README.md
git clone <repo-url>
cd <project-folder>python3 -m venv venv
source venv/bin/activateWindows:
venv\Scripts\activatepip install -r requirements.txtGet an API key from:
Then export it as an environment variable.
ENV:
GEMINI_API_KEY="your_api_key_here"Place .txt files inside the docs/ folder.
Example:
docs/
docker.txt
cicid.txt
You can add any domain documents such as:
- Kubernetes
- Terraform
- Jenkins
- DevOps Interview Notes
- Internal Company Docs
Run the embedding script:
python embed_docs.pyWhat this script does:
- Loads documents from
docs/ - Splits them into chunks
- Generates embeddings using Gemini Embedding Model
- Stores vectors in FAISS
- Saves index in
vector_store/
Example output:
Loading docs …
Loaded 2 file(s)
Split into 34 chunks
Embedding with gemini-embedding-001 …
Vector store saved to 'vector_store/'
Total vectors indexed: 34
Start the Flask server:
python main.pyServer runs at:
http://localhost:5000
