AI-powered Knowledge Assistant for DST β Centre for Interdisciplinary Mathematical Sciences (DST-CIMS), Banaras Hindu University
CIMS SAGE is a production-ready Retrieval-Augmented Generation (RAG) platform built for the DST Centre for Interdisciplinary Mathematical Sciences (DST-CIMS), Banaras Hindu University.
The system enables semantic search, intelligent document retrieval, and natural language interaction with institutional knowledge. CIMS SAGE combines FastAPI, ChromaDB, Sentence Transformers, and an Ollama LLM to deliver accurate, context-aware responses β using retrieval-based grounding to minimize hallucinations and keep answers anchored to the actual knowledge base.
Instead of manually searching through PDFs and institutional documents, users ask questions in natural language and get answers generated directly from indexed, verifiable source material.
AI Features
- Retrieval-Augmented Generation (RAG)
- Semantic Search
- Context-aware Question Answering
- Hallucination Mitigation via Retrieval Grounding
Knowledge Base
- PDF Upload & Ingestion
- URL Content Ingestion
- Automatic Chunking
- Vector Embeddings (ChromaDB)
- Knowledge Base Re-indexing
Backend
- FastAPI REST API
- Swagger / ReDoc API Documentation
- Health & Readiness Monitoring
- Admin APIs (Stats, Cache, Logs)
- Docker Support
Security
- Request ID Middleware
- Input Validation (Pydantic)
- Global Exception Handling
- Confirmation Guards on Destructive Operations
- CORS Support
User
β
βΌ
FastAPI API Layer
β
βΌ
Chat Controller
β
βΌ
RAG Pipeline
β
ββββββββββΊ Embedding Model
β
ββββββββββΊ ChromaDB
β
βΌ
Ollama LLM
β
βΌ
Final ResponseBackend
- FastAPI
- Python 3.11
- Pydantic
AI
- LangChain
- Ollama
- Sentence Transformers
Database
- ChromaDB
Document Processing
- PyPDF
- python-docx
Deployment
- Docker
- Docker Compose
- Vector Database: ChromaDB
- Embedding Model: all-MiniLM-L6-v2
- Vector Similarity: Cosine Similarity
- Top-K Retrieval: Configurable
- LLM: Ollama (Llama 3.1)
- Average Retrieval: < 1 second (hardware dependent)
backend/
βββ app.py
βββ config.py
β
βββ core/
βββ routes/
βββ storage/
βββ ingestion/
βββ utils/
βββ logs/
frontend/
βββ static/
βββ templates/
docs/
Dockerfile
docker-compose.yml
requirements.txt
README.mdClone the repository:
git clone https://github.com/That-ASHWIN/DST-AI.git
cd DST-AICreate and activate a virtual environment:
python -m venv .venv
source .venv/bin/activateOn Windows PowerShell, use:
.venv\Scripts\Activate.ps1
Install dependencies:
pip install -r requirements.txtInstall and start Ollama, then pull the required model:
ollama pull llama3.1:8b
ollama serveRun the server:
python3 -m uvicorn backend.app:app --reloadCreate a .env file in the project root. You can copy the example file:
cp .env.example .envThen configure the following values:
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama3.1:8b
EMBEDDING_MODEL=all-MiniLM-L6-v2
CHUNK_SIZE=500
CHUNK_OVERLAP=100
TOP_K_RESULTS=5
MAX_UPLOAD_SIZE=26214400Keep
.envprivate. Do not commit local environment files or credentials to GitHub.
Swagger UI
http://localhost:8000/docsReDoc
http://localhost:8000/redoc| Method | Endpoint | Description |
|---|---|---|
| POST | /chat |
Ask the AI assistant |
| POST | /upload/pdf |
Upload a PDF document |
| POST | /upload/url |
Ingest content from a URL |
| GET | / |
API root / status |
| GET | /health |
Lightweight overall health status |
| GET | /health/live |
Liveness probe |
| GET | /health/ready |
Readiness probe (checks DB) |
| GET | /health/system |
System info (Python, platform, uptime) |
| GET | /admin/stats |
Vector database stats |
| DELETE | /admin/clear |
Clear vector database (requires ?confirm=true) |
| GET | /admin/health |
Admin DB health check |
| POST | /admin/reindex |
Rebuild knowledge base (requires ?confirm=true) |
| GET | /admin/info |
Knowledge base info (PDFs, chunks, size) |
| GET | /admin/files |
List uploaded PDF files |
| GET | /admin/cache/stats |
Cache statistics |
| POST | /admin/cache/clear |
Clear cache (requires ?confirm=true) |
| GET | /admin/logs/ |
List log files |
| GET | /admin/logs/latest |
Get the most recent log file |
| DELETE | /admin/logs/clear |
Delete all log files (requires ?confirm=true) |
β οΈ All destructive admin operations (clear, reindex, cache clear, log clear) require an explicit?confirm=truequery parameter as a safety guard against accidental data loss.
- Request ID Middleware
- Global Exception Handling
- Input Validation (Pydantic)
- CORS Support
- Confirmation Guards on Destructive Admin Routes
- Health & Readiness Monitoring
- Production Logging
| Component | Status |
|---|---|
| Backend | β Production Ready |
| REST APIs | β Complete |
| Knowledge Base | β Complete |
| Docker | β Configured |
| Swagger | β Complete |
| Documentation | β Complete |
- User Authentication & RBAC
- Redis Distributed Cache
- PostgreSQL Metadata Store
- Streaming Responses
- Cloud Deployment
- Admin Analytics Dashboard
- Conversation History
- Multi-document Collections
Ashwin Dubey
Electronics & Communication Engineering
Chandigarh University
This project is released under the MIT License.