An air quality assistant that cites its sources
ResearchSince 2025FastAPI · pgvector · Qwen3 · Ollama · TimescaleDB · MQTT
Problem
The answer to an indoor air quality question usually exists somewhere: in a standard like ASHRAE or WELL, in a sensor history, or in a specialist's head. Finding it means knowing which of the three to ask. An unsourced answer from a language model is worse than no answer at all when the decision affects the air people are breathing in an occupied room.
Approach
A retrieval layer over standards-grounded knowledge cards, planned by an LLM router rather than hand-written rules, and wrapped in an agentic Sense → Fuse → Reason → Act loop so the system can pull live sensor context into an answer instead of reasoning in the abstract.
What I built
- FastAPI service with pgvector retrieval and Qwen3 served through Ollama.
- Server-sent-event streaming so citations arrive with the tokens they support, not after them.
- Intent routing rebuilt from regex matching to an LLM planner, then extended into the Sense → Fuse → Reason → Act agent loop.
- A TimescaleDB pipeline and an MQTT broker migration underneath, feeding campus IoT sensors into the same store the copilot reads from.
Results
- Answers grounded in ASHRAE, WELL, EPA, WHO and RESET Air, with citations attached at the claim level.
- Quasi-experimental user study: NASA-TLX workload effect size d = 0.79, time-on-task d = 0.42.