AI201 Lab 4 Starter Repository
RepairSafe is a home repair Q&A tool with a safety classification layer. Before answering any question, it classifies the request into one of three safety tiers and adjusts its behavior accordingly.
-
Fork this repo and clone your fork locally
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # Mac/Linux # or: .venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt -
Copy
.env.exampleto.envand add your Groq API key -
Run the app:
python app.py
| Milestone | File | Function | Description |
|---|---|---|---|
| 1 | safety.py |
classify_safety_tier() |
Classify question into safe / caution / refuse |
| 2 | responder.py |
generate_safe_response() |
Generate tier-appropriate response |
| 3 | auditor.py |
log_interaction() |
Append interaction record to audit log |
Complete each spec in specs/ before implementing the corresponding function.
ai201-lab4-repairsafe-starter/
├── app.py ← Gradio UI and pipeline orchestration (pre-built)
├── safety.py ← Milestone 1: safety tier classifier
├── responder.py ← Milestone 2: tier-aware response generator
├── auditor.py ← Milestone 3: audit logger
├── config.py ← constants (API key, model, log path, valid tiers)
├── logs/ ← audit.jsonl written here after Milestone 3
└── specs/
├── system-design.md ← read this first
├── classifier-spec.md ← Milestone 1 spec
├── responder-spec.md ← Milestone 2 spec
└── auditor-spec.md ← Milestone 3 spec