This repository contains a full-stack RAG-powered Knowledge Base built to serve internal teams (Ops, Sales, CS).
By training the AI exclusively on Blostem's internal documents (product specs, partner contracts, RBI/SEBI circulars, and live website data), it allows users to ask natural-language questions and receive highly accurate, cited answers with zero hallucination.
Everything runs locally on your machine—ensuring zero data leakage to third-party APIs.
- 🔒 100% Local & Private: Powered by Ollama using
llama3.2for generation andnomic-embed-textfor embeddings. - 📚 Automated Ingestion Pipeline: Extracts text from
.pdfand.docxfiles, chunks them recursively, and permanently stores the vectors in ChromaDB. - 🎯 Anti-Hallucination Guardrails: Strict system prompts prevent the AI from answering off-topic questions (e.g., "What is the capital of France?" gets politely rejected).
- 📊 Confidence Scoring & Citations: Every AI answer includes a semantic-similarity confidence badge (🟢 High / 🟡 Medium / 🔴 Low) and expandable citations pointing directly to the exact document and page.
- 🖥️ Streamlit Web Dashboard: A beautiful, dark-themed UI for internal teams to upload documents, view database stats, and chat.
| Component | Technology Used |
|---|---|
| LLM Engine | Ollama (llama3.2, nomic-embed-text) |
| Vector Database | ChromaDB |
| Frontend Dashboard | Streamlit |
| Document Parsing | PyMuPDF (fitz), python-docx |
📦 blostem-rag-knowledge-base
┣ 📂 sample_docs/ # Directory for storing source PDFs and DOCX files
┣ 📂 chroma_db/ # Local vector database storage (auto-generated)
┣ 📜 app.py # The Streamlit web dashboard UI
┣ 📜 rag.py # Core RAG engine (embedding, searching, prompt building)
┣ 📜 ingest.py # Data ingestion pipeline
┣ 📜 create_sample_docs.py # Script to generate dummy internal documents for testing
┗ 📜 create_full_blostem_doc.py # Script that scraped and ingested the Blostem website data- Python 3.10 or higher.
- Ollama installed and running on your machine.
Open your terminal and pull the required open-source models:
ollama pull llama3.2
ollama pull nomic-embed-textpip install streamlit langchain chromadb pymupdf python-docxUse this interface for internal team access, managing documents, and testing the database.
streamlit run app.py(Access the dashboard at http://localhost:8501)
- Ingestion:
ingest.pyreads the raw text from files, splits it into 500-character chunks (with 50 characters of overlap), and usesnomic-embed-textto map them as vectors in ChromaDB. - Retrieval: When a user asks a question,
rag.pyconverts the question into a vector and performs a Cosine Similarity search to find the Top 5 most relevant chunks. - Generation: The chunks are injected into a strict prompt template.
llama3.2synthesizes a comprehensive, bulleted answer using only the provided context.
Built as a secure, private AI Knowledge Base prototype.