Capstone & Industry Sim
Full AI pipeline + pytest + git-flow — ship like a real AI engineer on day one.
At a Bengaluru AI startup, a new hire's first task was: add a confidence threshold to the sentiment API so low-confidence predictions return a "needs review" flag. They had to write tests, open a PR, pass CI, get review, merge.
Not write code. Ship code. Git-flow, PR, tests, review, merge — today you do it all.
🛠 Capstone Project: SmartReview API (5–25 min)
A production-ready sentiment analysis API with:
• Confidence threshold — low-confidence = "uncertain" label
• Language detection — reject non-English input
• Batch endpoint — analyse up to 50 reviews at once
• pytest suite — 6 tests covering happy path + edge cases
• GitHub PR — feature branch → PR → merge
💻 Full Capstone Code (25–45 min)
># smart_review/api.py from fastapi import FastAPI, HTTPException from pydantic import BaseModel, Field from typing import List import pickle, re app = FastAPI(title="SmartReview API", version="1.0") CONFIDENCE_THRESHOLD = 0.70 # below = uncertain class ReviewIn(BaseModel): text: str = Field(..., min_length=3, max_length=1000) class ReviewOut(BaseModel): sentiment: str # positive | negative | uncertain confidence: float word_count: int def analyse(text: str, vectorizer, model) -> ReviewOut: vec = vectorizer.transform([text]) pred = model.predict(vec)[0] proba = model.predict_proba(vec)[0].max() if proba < CONFIDENCE_THRESHOLD: label = "uncertain" else: label = "positive" if pred == 1 else "negative" return ReviewOut(sentiment=label, confidence=round(float(proba), 3), word_count=len(text.split())) @app.post("/predict", response_model=ReviewOut) def predict(req: ReviewIn): return analyse(req.text, vectorizer, model) @app.post("/batch", response_model=List[ReviewOut]) def batch_predict(reviews: List[ReviewIn]): if len(reviews) > 50: raise HTTPException(400, "Max 50 reviews per batch") return [analyse(r.text, vectorizer, model) for r in reviews]
># tests/test_api.py from fastapi.testclient import TestClient from smart_review.api import app client = TestClient(app) def test_positive_review(): r = client.post("/predict", json={"text": "Excellent! Highly recommend this product."}) assert r.status_code == 200 assert r.json()["sentiment"] in ["positive", "uncertain"] def test_negative_review(): r = client.post("/predict", json={"text": "Terrible, waste of money, very bad."}) assert r.status_code == 200 def test_text_too_short(): r = client.post("/predict", json={"text": "ok"}) assert r.status_code == 422 # Pydantic min_length=3 def test_batch_limit(): big_batch = [{"text": "great product"}] * 51 r = client.post("/batch", json=big_batch) assert r.status_code == 400 def test_confidence_field(): r = client.post("/predict", json={"text": "Amazing quality, super fast delivery!"}) data = r.json() assert 0.0 <= data["confidence"] <= 1.0 def test_word_count(): text = "This is a five word review" r = client.post("/predict", json={"text": text}) assert r.json()["word_count"] == 6
🚀 Git-Flow — Ship It Like a Pro (25–45 min)
># Industry standard: never commit directly to main git checkout -b feature/confidence-threshold # ... write code and tests ... git add . git commit -m "feat: add confidence threshold to sentiment API" git push origin feature/confidence-threshold # GitHub: Create Pull Request # PR title: "feat: add confidence threshold" # Description: What changed, why, how to test # Request review from a classmate # After approval: merge to main git checkout main git pull git branch -d feature/confidence-threshold
NumPy • Pandas • Matplotlib • scikit-learn • PyTorch • NLP pipeline • Groq LLM API • LangChain • RAG with FAISS • AI Agents • FastAPI • Railway deploy • pytest • Git-flow.
That's the full modern AI engineering stack. Put every project on GitHub. You have a portfolio. You're ready.
⚡ Day 15 Cheat Sheet — Full Stack Summary
numpy / pandasmatplotlib / seabornsklearntorch / nn.SequentialGroq / LangChainFAISS + embeddingsFastAPI + PydanticRailway + Procfile