The system has three core models:
- Chatbot – Interacts with the user, interprets queries, and provides answers.
- Embedding Model – Converts documents into vector embeddings for semantic search.
- Summariser – Generates structured metadata and concise descriptions for new documents.
We use ChromaDB to store all document embeddings along with their metadata.
ChromaDB enables fast similarity search and supports filtering by metadata (e.g., category, date, author).
- A new document is uploaded to the intranet.
- Summariser generates structured metadata:
- Document name
- Date of creation
- Date of last modification
- Category (e.g., Faculty Data, Student Data, Hostels, Academics, Messes)
- A brief description of the content
- Embedding Model processes the document:
- Tokenises and chunks the text into manageable sizes.
- Generates vector embeddings for each chunk.
- The embeddings and their metadata are stored in ChromaDB.
- The user submits a question via the website.
- Chatbot:
- Converts the query into an embedding.
- Uses ChromaDB to retrieve the most relevant chunks, filtered if needed by metadata.
- Reads the retrieved content and composes a natural-language answer.
- The interface displays:
- Chatbot’s answer.
- Highlighted Matches – exact sentence/phrase from the matched chunk.
- References to relevant documents.
- Responsive UI for desktop and mobile.
- User authentication and session management.
- Chat interface for queries and responses.
- Metadata-based filtering (category, date range, author, “recently added”).
- Quick Filters & Facets for faster narrowing of results.
- Keyboard Shortcuts – direct typing focuses chatbox.
- Document preview thumbnails (PDF, text, image icons).
- Clickable links to intranet documents.
- Acts as a bridge between frontend, ChromaDB, and AI models.
- Endpoints for:
- Document upload
- Metadata retrieval
- Search queries
- Embedding creation
- Summarisation
- Chatbot queries
- Returns JSON for integration with Next.js.
- Handles filtering and sorting before passing to chatbot.
- Next.js frontend ↔ FastAPI backend via REST.
- FastAPI interacts with ChromaDB and AI models.
- Authentication via Institute CAS for secure access.
Accessible only via CAS authentication.
Features:
- Document upload form with metadata fields.
- Upload Progress & Status – from upload → summarising → embedding → ready.
- List of uploaded documents with:
- Status
- Last update time
- Quick re-upload option
ChromaDB is metadata-driven. We maintain two main collections:
| Field Name | Type | Description |
|---|---|---|
| doc_id | UUID | Unique ID for the document |
| name | String | Document name |
| category | Enum | One of: faculty, student, hostel, academics, mess |
| description | String | Summary from Summariser |
| created_at | DateTime | Document creation date |
| updated_at | DateTime | Last modification date |
| file_url | String | Link to intranet file |
| author | String | Optional uploader’s name |
| Field Name | Type | Description |
|---|---|---|
| chunk_id | UUID | Unique ID for the chunk |
| doc_id | UUID | FK to documents.doc_id |
| chunk_text | Text | Actual chunk text |
| embedding | Vector[float] | Vector representation from Embedding Model |
| position | Int | Chunk order in document |
| category | Enum | Same as document category |
embeddingis stored in the vector index for similarity search.- Metadata fields like
categoryanddoc_idare indexed for filtering.
We are using:
- Qwen 3-0.6B via Hugging Face Text Generation Inference for chat and summarization
- Qwen/Qwen3-Embedding-0.6B via sentence-transformers for embeddings
- pdfplumber for PDF text extraction (replacing PyPDF2)
- Uses pdfplumber for robust PDF text extraction
- Handles complex PDF layouts better than PyPDF2
- Preserves text formatting and structure
- sentence-transformers with Qwen-based embedding model
- Generates high-quality vector representations for semantic search
- Embeddings are normalized for better similarity calculations
- Hugging Face TGI with Qwen 3-0.6B model for natural language tasks
- Handles document summarization during upload
- Provides contextual responses using retrieved document chunks
Copy .env.example to .env and configure:
- HF TGI server URL and model settings
- Embedding model preferences
- ChromaDB storage location
- File upload limits and allowed types
- All data must be machine-readable for LLMs.
- Images require alt-text or descriptive metadata.
- Handwritten text must be OCR-processed before upload.
- Only supported formats (PDF, plain text, etc.) are allowed.