Inspiration I noticed educational institutions hesitate to adopt GenAI because standard LLMs act as general-purpose cheat tools. I wanted to engineer a strict, syllabus-bound backend system—a "Controlled AI" architecture that mathematically enforces academic integrity by restricting responses entirely to professor-uploaded documents and specific subject constraints.
What it does JomoAI RAG is an enterprise-grade backend for a highly restrictive virtual teaching assistant. Upon initialization, the API locks the session to a specific "Subject Name" and user-uploaded PDFs. Using strict semantic guardrails at the routing layer, the backend evaluates every incoming query. If a student attempts prompt injection or asks out-of-syllabus questions, the system's internal router drops the request. Valid queries are deterministically grounded only in the uploaded vectors, ensuring zero hallucinations and preventing generic AI misuse.
How I built it I architected the core backend using FastAPI and LangGraph to manage complex, stateful multi-agent workflows. For the ingestion pipeline, I utilized PyMuPDF4LLM and implemented advanced Parent-Child chunking to preserve deep document context, storing embeddings in PGVector (Supabase).
To handle conversational memory, I integrated asynchronous Postgres checkpointers to persist LangGraph state threads. I also engineered a Bring-Your-Own-Model (BYOM) layer, securely encrypting user API keys in the database. The system's core security relies on my custom DecisionNode—a highly strict semantic router that acts as an API firewall between the user prompt and the retrieval pipeline.
Challenges I ran into My biggest infrastructural challenge was managing idle database connections with Supabase. I faced frequent psycopg2.DatabaseError (Connection timed out/EOF) crashes during retrieval operations. I diagnosed the issue deep within the SQLStore and PGVector initializations, ultimately resolving it by engineering custom asynchronous SQLAlchemy engines with strict connection pooling (pool_pre_ping=True, pool_recycle=1800). Additionally, fine-tuning the semantic router to perfectly differentiate between valid syllabus queries and clever prompt injections required rigorous testing and iteration.
Accomplishments that I'm proud of I am incredibly proud of engineering a highly resilient, "Zero-Hallucination" retrieval pipeline. Building a dynamic semantic router that strictly bounds the LLM to a specific domain without breaking the asynchronous streaming flow was a major milestone. Furthermore, implementing complex JWT authentication, tenant-specific DB filters, daily token quota tracking, and deploying the entire containerized architecture via Docker proved my ability to build secure, production-ready SaaS backends from scratch.
What I learned I gained profound backend engineering experience building this. I learned that production RAG is far more complex than simple vector similarity search—it requires robust state management, secure multi-tenant data isolation, and deep database connection lifecycle management. Mastering LangGraph’s state checkpointers and SQLAlchemy's async engine behaviors fundamentally leveled up my system architecture skills.
What's next for JomoAI RAG I plan to develop robust webhooks and REST APIs to allow seamless integration into Learning Management Systems (LMS) like Canvas and Moodle. On the backend infrastructure side, I aim to implement background asynchronous workers (Cron Jobs/Celery) for vector cleanup, and build advanced telemetry pipelines so professors can monitor query analytics and identify exactly which topics students struggle with the most.
Built With
- ai-guardrails
- anthropic-claude
- asyncio
- cryptography
- docker
- docker-compose
- fastapi
- gemini-api
- huggingface
- jwt-authentication
- langchain
- langgraph
- large-language-models
- oracle-cloud
- pgvector
- postgresql
- pymupdf
- python
- rag
- semantic-routing
- sqlalchemy
- supabase
- uvicorn
- vertex-ai
Log in or sign up for Devpost to join the conversation.