AI Engineering — Building Apps with Large Language Models · Lesson 12 of 12 · Updated ·
Capstone — Build a Campus Help-Desk Assistant, Plus AI Engineering Interview Questions
Put every lesson together in one portfolio project that companies understand immediately.
1. The project: Campus Help-Desk Assistant
Users: students and parents. Goal: answer questions about rules, fees, exams and attendance correctly, from official documents, and look up a student's own data safely.
| Part | Lesson | What you build |
|---|---|---|
| Documents → chunks → index | 6, 7 | handbook sections with section numbers; hybrid search |
| Grounded answers with citations | 3, 7 | prompt template v1 in a file; "not in the handbook" path |
| Student data via tools | 8 | get_attendance(roll) — only for the logged-in student |
| Structured ticket creation | 4 | out-of-scope questions become tickets with a schema |
| Chat with history and streaming | 5 | last 6 turns + summary; streaming in the web UI |
| Guardrails | 11 | redaction, injection screening, no write tools without approval |
| Cost and limits | 10 | cached system prompt, per-user daily limit, usage logs |
| Evaluation | 9 | 50 real questions with expected sections/labels; run on every change |
Stack suggestion: Python (FastAPI) or Spring Boot backend, PostgreSQL + pgvector, a simple React or plain HTML front-end, the Claude API, and GitHub Actions running your eval script.
README must include: the problem, architecture diagram, how to run it (including with the free local stand-in API), evaluation results (e.g. "retrieval hit rate @ 3: 47/50"), known limits, and cost per 1,000 questions.
2. A tiny but complete core
The heart of the assistant — routing a question to the right path — fits in a few lines and is easy to test:
def route(question: str, logged_in_roll: int | None) -> str:
q = question.lower()
if any(w in q for w in ("my attendance", "my marks", "my result")):
return "tool:get_attendance" if logged_in_roll else "ask_login"
if any(w in q for w in ("fee", "attendance", "hall ticket", "exam", "re-evaluation")):
return "rag:handbook"
return "ticket:office"
cases = [
("What is my attendance in DSA?", 104),
("What is my attendance in DSA?", None),
("What is the late fee?", None),
("Can the canteen open on Sunday?", 104),
]
for question, roll in cases:
print(f"{question:32s} roll={roll!s:5s} -> {route(question, roll)}")
What is my attendance in DSA? roll=104 -> tool:get_attendance
What is my attendance in DSA? roll=None -> ask_login
What is the late fee? roll=None -> rag:handbook
Can the canteen open on Sunday? roll=104 -> ticket:office
A rule-based router like this is cheap and predictable; later you can replace it with a model call (classification with structured output) — and your eval set tells you whether that's actually better.
3. Interview questions — short answers
- What is an LLM? A neural network trained to predict the next token; instruction-tuned to follow requests.
- What is a token / context window? Word pieces; the maximum input+output the model can handle in one call.
- Why do LLMs hallucinate? How do you reduce it? They generate plausible text, not looked-up facts. Ground with RAG, use tools, allow "I don't know", cite sources, evaluate.
- Explain RAG. Chunk and index documents, retrieve relevant chunks for each question, put them in the prompt, answer with citations.
- Chunk size trade-off? Too big: unfocused and costly; too small: loses context. Use sections/paragraphs with slight overlap; measure.
- What are embeddings? Vectors representing meaning; similar texts are close (cosine similarity).
- Vector database? Stores vectors with metadata and does fast nearest-neighbour search (pgvector, Chroma…).
- Keyword vs semantic search? Exact words (good for codes/names) vs meaning (good for paraphrases); hybrid combines both.
- What is tool use / function calling? The model requests a function with arguments; your code runs it and returns the result.
- Agent vs workflow? The model chooses the steps vs your code fixes the steps; prefer workflows unless steps can't be known.
- How do you get reliable JSON? Structured outputs with a JSON schema / Pydantic, plus your own validation.
- How do you evaluate an LLM app? A versioned test set of real cases; exact/rule/reference scoring, LLM-as-judge validated against humans; compare versions.
- What is prompt injection? Defences? Untrusted text that contains instructions. Tag data, least privilege, output validation, human approval.
- How do you cut cost? Prompt caching, fewer input tokens, shorter outputs, right model per task, batching.
- How do you reduce latency? Streaming, shorter prompts, caching, parallel calls, lighter models for simple tasks.
- Fine-tuning vs RAG vs prompting? Prompting first; RAG for knowledge; fine-tuning (where available) for style or narrow formats — rarely the first step.
- What would you log? Prompt version, model, tokens, cost, latency, stop reason, sources, tool calls, feedback — minimal personal data.
- How do you handle personal data? Minimise and redact, follow the DPDP Act and provider policies, limit retention.
- Why keep humans in the loop? High-stakes or irreversible decisions; accountability; catching model errors.
- Describe your project. Problem → architecture → evals with numbers → a failure you found and fixed → cost and limits.
Common mistakes
- A demo with no evaluation numbers.
- Keys in the repo; no rate limits on a public demo.
- Claiming the model "understands" or "never makes mistakes".
Quick recap
- Capstone: RAG + tools + structured tickets + chat + guardrails + cost controls + evals.
- Start rule-based where you can; prove improvements with your eval set.
- Interviews reward numbers, trade-offs and honest limits.