Kuldeep-AI / README.md
Kuldeepmishra3's picture
feat: Kuldeep AI v1.0
f2eba97
|
Raw
History Blame Contribute Delete
8.67 kB
metadata
title: Kuldeep AI
emoji: ๐Ÿš€
colorFrom: red
colorTo: green
sdk: docker
pinned: false
license: mit

Kuldeep AI โ€” Personal AI Assistant

A humanized, multi-agent AI chatbot powered by an advanced RAG knowledge base
Built by Kuldeep Kumar Mishra ยท AI Engineer ยท IIIT Lucknow


๐Ÿ‘‹ What is Kuldeep AI?

Kuldeep AI is my personal AI assistant that anyone can talk to and learn about me โ€” my background, projects, skills, achievements, and more. Instead of a static portfolio, this is a living, conversational AI that knows everything about me from a carefully curated knowledge base.

It's not just a chatbot. It's a multi-agent system with five specialized agents working under the hood, an advanced RAG pipeline that retrieves and reasons over my personal knowledge base, and a clean, beautiful UI that feels premium and modern.

"The goal isn't to build models. The goal is to build intelligence that matters." โ€” Kuldeep Kumar Mishra


โœจ Key Features

๐Ÿง  Advanced RAG System

  • Hybrid Retrieval โ€” BM25 keyword search + semantic vector search combined
  • Reciprocal Rank Fusion (RRF) โ€” intelligently merges results from both retrieval methods
  • Cross-Encoder Re-ranking โ€” uses ms-marco-MiniLM-L-6-v2 for precise relevance scoring
  • Anti-Hallucination โ€” answers only from the knowledge base; declines gracefully if info is unavailable
  • Persistent ChromaDB โ€” vector store survives server restarts; auto-indexed on startup

๐Ÿค– Multi-Agent Architecture (LangGraph)

The system intelligently routes every message to the right specialist:

Agent Handles
๐Ÿ”€ Router Agent Classifies the query and routes it to the right agent
๐Ÿ“š RAG Agent Answers from Kuldeep's personal knowledge base
๐Ÿงฎ Math Agent Solves calculations and equations
๐Ÿง  Memory Agent Recalls earlier parts of the conversation
๐ŸŒ Search Agent Fetches real-time information from the web
๐Ÿ’ฌ General Agent Handles greetings and general knowledge

๐Ÿ” Admin Panel (Private)

  • Upload PDFs and TXT files to expand the knowledge base
  • View, edit, and delete documents directly in the browser
  • Force re-index all documents with one click
  • Protected by a secret key โ€” hidden from public users

๐ŸŽจ Beautiful UI

  • Light mode default โ€” clean white/blue design inspired by modern AI interfaces
  • Dark mode toggle โ€” switches to a sleek dark theme
  • Word-by-word streaming responses
  • Responsive design for mobile and desktop

๐Ÿ—๏ธ Project Architecture

kuldeep-ai/
โ”‚
โ”œโ”€โ”€ app.py                   # App entry point
โ”œโ”€โ”€ config.py                # Centralized configuration
โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”œโ”€โ”€ run.bat                  # One-click local startup (Windows)
โ”‚
โ”œโ”€โ”€ agents/                  # All AI agents
โ”‚   โ”œโ”€โ”€ router_agent.py      # Routes queries to the right agent
โ”‚   โ”œโ”€โ”€ rag_agent.py         # Knowledge base Q&A (anti-hallucination)
โ”‚   โ”œโ”€โ”€ math_agent.py        # Math & calculations
โ”‚   โ”œโ”€โ”€ memory_agent.py      # Conversation memory recall
โ”‚   โ”œโ”€โ”€ search_agent.py      # Real-time web search
โ”‚   โ””โ”€โ”€ general_agent.py     # General chat & greetings
โ”‚
โ”œโ”€โ”€ rag/                     # RAG pipeline
โ”‚   โ”œโ”€โ”€ document_loader.py   # PDF & TXT chunking
โ”‚   โ”œโ”€โ”€ vector_store.py      # ChromaDB wrapper (CRUD)
โ”‚   โ”œโ”€โ”€ retriever.py         # Hybrid BM25 + semantic + RRF
โ”‚   โ””โ”€โ”€ reranker.py          # Cross-encoder re-ranking
โ”‚
โ”œโ”€โ”€ orchestrator/
โ”‚   โ””โ”€โ”€ graph.py             # LangGraph state machine
โ”‚
โ”œโ”€โ”€ api/
โ”‚   โ””โ”€โ”€ index.py             # Flask routes (chat, admin, docs)
โ”‚
โ”œโ”€โ”€ memory/
โ”‚   โ””โ”€โ”€ sqlite_memory.py     # Conversation history (SQLite)
โ”‚
โ”œโ”€โ”€ templates/               # HTML pages
โ”‚   โ”œโ”€โ”€ index.html           # Public chat UI
โ”‚   โ”œโ”€โ”€ admin.html           # Admin dashboard
โ”‚   โ””โ”€โ”€ admin_denied.html    # 403 access denied
โ”‚
โ”œโ”€โ”€ static/                  # Frontend assets
โ”‚   โ”œโ”€โ”€ style.css            # All styles (light + dark theme)
โ”‚   โ”œโ”€โ”€ script.js            # Chat logic, streaming, theme
โ”‚   โ””โ”€โ”€ ai-avatar.png        # Bot avatar image
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ knowledge/           # ๐Ÿ“ Private: .txt/.pdf knowledge files
โ”‚   โ”œโ”€โ”€ uploads/             # ๐Ÿ“ Private: admin-uploaded files
โ”‚   โ””โ”€โ”€ chroma_db/           # ๐Ÿ“ Auto-generated: vector embeddings
โ”‚
โ””โ”€โ”€ utils/
    โ””โ”€โ”€ logger.py            # Structured logging

๐Ÿš€ Getting Started

Prerequisites

1. Clone and Setup

git clone <your-repo-url>
cd kuldeep-ai

2. Create Virtual Environment

python -m venv .venv

# Windows
.venv\Scripts\activate

# Mac/Linux
source .venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment

Copy .env.example to .env and fill in your values:

cp .env.example .env

Edit .env:

GROQ_API_KEY=your_groq_api_key_here
ADMIN_SECRET_KEY=your-secret-admin-key

5. Add Your Knowledge Base

Place your .txt or .pdf files in data/knowledge/. These are auto-indexed on every server start.

data/knowledge/
โ”œโ”€โ”€ about.txt
โ”œโ”€โ”€ projects.txt
โ”œโ”€โ”€ skills.txt
โ”œโ”€โ”€ work_experience.txt
โ”œโ”€โ”€ achievements.txt
โ”œโ”€โ”€ social_links.txt
โ””โ”€โ”€ faq.txt

6. Run the App

# Windows (double-click or run):
run.bat

# Or manually:
python app.py

Open your browser at: http://127.0.0.1:10000


๐Ÿ” Admin Panel

Access the admin dashboard at:

http://127.0.0.1:10000/admin?key=YOUR_ADMIN_SECRET_KEY

From the admin panel you can:

  • ๐Ÿ“ค Upload new PDF or TXT files
  • ๐Ÿ‘๏ธ View any document's content
  • โœ๏ธ Edit TXT files directly in the browser
  • ๐Ÿ—‘๏ธ Delete documents (also removes from vector store)
  • ๐Ÿ”„ Force re-index all files

โš™๏ธ Configuration Reference

All settings live in .env:

Variable Default Description
GROQ_API_KEY โ€” Your Groq API key
GROQ_MODEL_NAME llama-3.1-8b-instant LLM model to use
EMBEDDING_MODEL all-MiniLM-L6-v2 Local embedding model
ADMIN_SECRET_KEY โ€” Password for admin panel
CHUNK_SIZE 600 Characters per document chunk
CHUNK_OVERLAP 80 Overlap between chunks
TOP_K_RETRIEVAL 5 Final chunks sent to LLM
TOP_K_CANDIDATES 8 Candidates before re-ranking
ENABLE_RERANKING true Cross-encoder re-ranking
ENABLE_QUERY_EXPANSION false Query expansion (slower)

๐Ÿ› ๏ธ Tech Stack

Layer Technology
LLM Groq (Llama 3.1 8B Instant)
Embeddings sentence-transformers/all-MiniLM-L6-v2
Re-ranker cross-encoder/ms-marco-MiniLM-L-6-v2
Vector Store ChromaDB (persistent)
Retrieval BM25 + Semantic + RRF + Cross-Encoder
Orchestration LangGraph (state machine)
Backend Flask 3.x
Memory SQLite (conversation history)
Frontend Vanilla HTML/CSS/JS
Fonts Google Fonts (Inter + Outfit)

๐Ÿ‘จโ€๐Ÿ’ป About the Author

Kuldeep Kumar Mishra is an AI Engineer specializing in Generative AI, LLMs, RAG systems, Agentic AI, and Machine Learning. Currently pursuing M.Sc. Data Science at IIIT Lucknow (secured AIR 1180 in IIT JAM Mathematics 2024).


๐Ÿ“„ License

This is a personal project. All rights reserved ยฉ 2025 Kuldeep Kumar Mishra.