DEV Community

Cover image for How I Built a Campus-Specific AI Chatbot for UET Taxila Using RAG
Ibrahim Salman
Ibrahim Salman

Posted on Edited on Originally published at Medium

How I Built a Campus-Specific AI Chatbot for UET Taxila Using RAG

Updated October 2026: rewritten to describe the current architecture. UETGPT is no longer open source, and it now lives at uetgpt.site.

Applicants to UET Taxila ask the same questions every year. How is merit calculated? What does the first semester cost? When does the admission window close? The answers exist, but they are spread across prospectus PDFs of more than a hundred pages, admission notices and department websites.

I built UETGPT to answer those questions in plain English, from the university's own documents, with a link to the source behind each answer. This article walks through how it works and what I learned building it.

The design rule: answers you can check

A general chatbot will happily give you a confident merit figure from the wrong year. For admissions, that is worse than no answer at all. So the rule from day one was simple: every answer should point to an official source, and when the sources don't cover a question, the assistant should say so.

The stack

  • Frontend: Next.js 16, React 19, TypeScript and Tailwind CSS, deployed on Vercel
  • Backend and data: Convex for serverless functions, real-time data and vector search
  • Authentication: Clerk
  • Language models: GPT-OSS 20B and 120B served by Groq, with Gemini 3.5 Flash-Lite as a fallback
  • Embeddings: Gemini Embedding 2 at 768 dimensions

How a question becomes an answer

1. Ingest official sources

The knowledge base is built from UET Taxila's official websites and prospectuses. Pages and PDFs are converted to clean text, and every document keeps its source URL so it can be cited later. Unchanged documents are skipped on later runs, so keeping the index current stays cheap.

2. Chunk with context

Each document is split twice: into large parent sections, and into smaller child chunks inside them. Before the chunks are embedded, each one gets a short header with its document's title and, for longer documents, a one-sentence summary of the whole document written by a small model. A fee row that only says "Rs. 38,000" is hard to find on its own. The same row carrying the title of the 2025 prospectus is far easier to match to a question about fees.

3. Search two ways, then fuse

Every question runs through vector search, which matches meaning, and full-text search, which matches exact terms such as program names and fee categories. The ranked lists are merged with Reciprocal Rank Fusion, which rewards passages that rank well in both, and the merged list is then reranked.

4. Grade relevance before answering

When the reranker is not confident about what it found, and for questions where a wrong answer would hurt, a grader judges whether the retrieved passages actually address the question before the model writes anything. This approach is known as Corrective RAG. Depending on the result, the assistant answers normally, qualifies its answer, or says it does not have enough information.

5. Stream the answer with citations

The answer streams to the browser as it is generated, with citations that link to the official page or prospectus each fact came from.

What I learned

Ingestion is most of the work

Picking a model is the easy part. Getting clean text out of the sources is where the effort goes. Prospectus tables break across pages, and amounts get separated from their labels during extraction. One recent fix was exactly that: hostel fee amounts that had come loose from their rows. The fix belonged in ingestion, not in the prompt.

The year matters as much as the number

Closing merit is published a year late: the 2025 prospectus carries the 2024 figures. An assistant that doesn't track which year a figure belongs to will give answers that are precise and wrong. Figures on the site are labelled with the year they belong to and the document they came from.

Hallucination control lives in the pipeline

Telling a model not to make things up helps a little. Good retrieval, a relevance check when retrieval looks unsure and a low temperature help far more. The assistant is also instructed to say when the official documents do not cover a question instead of filling the gap.

People want speed and a source

Most visitors want to type a question, get an answer quickly and see where it came from. Guests get five free questions a day without signing up, and answers start streaming as soon as generation begins.

Beyond the chat

Some questions are better served by a page than a conversation, so UETGPT also has a merit calculator, closing merit for every program from 2022 to 2024, fee estimates, degree outlines, the academic calendar, bus routes, a hostel guide and comparisons with 22 other universities.

Try it

UETGPT is free at uetgpt.site. It is independent and not affiliated with UET Taxila, so confirm anything important on uettaxila.edu.pk.

UETGPT is the first flagship project in my portfolio, and more are on the way. You can see the rest of my work at ibrahimsalman.vercel.app.

Top comments (1)

Collapse
 
devhms profile image
Ibrahim Salman • • Edited

Thanks for reading! A few extra details for anyone building something similar.

Why RAG instead of fine-tuning?
A fine-tuned model can absorb university facts, but it can't tell you where they came from, and it goes stale when the next prospectus comes out. RAG retrieves the actual documents and answers from them, so every claim links back to an official source that students can check.

Tech choices:

  • Convex has a built-in vector index, so there is no separate vector database to run.
  • Groq serves GPT-OSS for fast responses, with Gemini as the fallback.

If you have questions about the architecture, ask in the comments.

Live: uetgpt.site
More of my work: ibrahimsalman.vercel.app