DocMind
GRADUATION PROJECTDocuments in.
Grounded answers out.
Sole backend engineer on a 7-person graduation project. Built the entire FastAPI backend from scratch — 9 route groups, a full async SQLAlchemy stack with 14 ORM models, JWT auth with a token blocklist, role-based access control (RBAC) across three roles, and Alembic-managed migrations with a database seeder.
Architecture & implementation
The AI layer runs a production RAG pipeline with Factory and Strategy patterns: LLM provider (Gemini, OpenAI, Cohere, Ollama), embedding model, and vector store (pgvector or Qdrant) are all swappable at runtime via a single environment variable — no application code changes.
The optional AGENT_ENABLED=true JSON-Planner agentic layer decides per-turn whether retrieval is necessary — and can scope the search to named materials — cutting redundant retrieval calls by 60% and improving response coherence on follow-up questions.
Ingestion is structure-aware: tables stay intact as Markdown, headings become breadcrumbs, and every chunk is stamped with its source. MMR diversity filtering removes near-duplicate chunks to conserve the context window. An optional RERANK_ENABLED=true cross-encoder over-fetches for recall then truncates to the best chunks for precision, so the model gets cleaner, source-cited context — soft-degrading to vector order if it ever faults. MMR and cross-encoder reranking are each exposed as environment-variable toggles.
Platform serves three roles: students chat with uploaded documents or AI tutors scoped to their enrolled subjects; instructors upload and manage course materials and preview the bot before it goes live; admins monitor platform health, usage analytics, and response feedback across all subjects.