A 100% local knowledge base that lets you upload CSV or PDF files and ask questions in natural language. Your documents are processed into searchable text chunks, stored in PostgreSQL, and indexed by MindsDB for semantic search. All AI models run locally—no API keys, no cloud, just fast, private answers on your machine.
quest19_demo.mp4
git clone https://github.com/Adii0906/DocMind_KB.git
cd DocMind_KBDownload and install Docker from: https://www.docker.com/products/docker-desktop/
# Pull MindsDB image
docker pull mindsdb/mindsdb
# Run MindsDB container
docker run -p 47334:47334 -p 5436:5432 mindsdb/mindsdbMindsDB GUI will be available at: http://127.0.0.1:47334/
Download and install PostgreSQL from: https://www.postgresql.org/download/
- Ensure it's running on port 5432
- Remember your username/password for setup
- Go to MindsDB GUI (
http://127.0.0.1:47334/) - On the right side → Learning Hub → Search "postgres"
- Run this SQL command:
CREATE DATABASE postgresql_conn
WITH ENGINE = 'postgres',
PARAMETERS = {
"host": "host.docker.internal", -- Use this for Docker
"port": 5432,
"database": "your_database", -- Your database name created on postgres
"user": "postgres",
"schema": "public",
"password": "password_you_setuped_during_installation" -- Your password
};python -m venv .venv
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activatepip install -r requirements.txtstreamlit run main.pySimple Explanation:
- Upload Documents → Your files (CSV/PDF) get converted to text chunks
- Store in Database → Text chunks saved in PostgreSQL (your local database)
- Create AI Index → MindsDB reads your data and creates "smart embeddings" (mathematical understanding of meaning)
- Ask Questions → When you ask something, the system finds relevant chunks based on meaning (not just keywords)
- Generate Answers → Local AI model combines relevant information to create natural language answers
Why This Works:
- PostgreSQL = Your filing cabinet (stores the actual documents)
- MindsDB = Your smart librarian (understands what documents mean and finds relevant ones)
- Local AI = Your assistant (reads relevant documents and answers your questions)
┌─────────────┐ ┌──────────────┐ ┌─────────────────┐
│ Your │───▶│ PostgreSQL │◄──▶│ MindsDB │
│ Documents │ │ (Raw Data) │ │ (AI Layer) │
└─────────────┘ └──────────────┘ └─────────────────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────────┐
│ Local │ │ Semantic │
│ Models │◄──────────────────────▶│ Search & │
│ (Embeddings) │ │ Answers │
└─────────────┘ └─────────────────┘
Data Flow:
- Upload → Files processed into text chunks
- Store → Text saved in PostgreSQL
- Index → MindsDB creates embeddings for semantic search
- Query → Ask questions, get intelligent answers
- Embeddings:
multi-qa-MiniLM-L6-cos-v1(QA-optimized, 80MB) – Finds relevant information for your questions - Question Answering:
distilbert-base-cased-distilled-squad(260MB) – Extracts precise answers from your documents - Lightweight & Fast – Runs on CPU, no GPU required
- Initialize Models → Click "🔧 Initialize Lightweight Models"
- Upload File → Drop CSV or PDF file
- Auto-Create KB → Click "🚀 Auto-Create Knowledge Base"
- Ask Questions → Type natural language questions
- Get Answers → Receive contextual responses with sources
Update database settings in main.py:
DB_CONFIG = {
"database": "database_name", # Your database name
"user": "postgres",
"password": "your_pass", # Your password
"host": "127.0.0.1",
"port": 5432
}| Issue | Solution |
|---|---|
| MindsDB not connecting | Check docker is running: docker ps |
| PostgreSQL connection failed | Verify PostgreSQL is running on port 5432 |
| Models not loading | Check internet for first download (~360MB) |
| GUI not accessible | Ensure port 47334 is available |
- 🔒 100% Local - No external APIs
- 📁 Multi-format - CSV & PDF support
- 🧠 Smart Search - Semantic understanding
- 🚀 Auto-setup - One-click knowledge base creation
- 💬 Natural Q&A - Ask questions in plain English
Tech Stack: Streamlit • PostgreSQL • MindsDB • Transformers • Docker • Python