The problem
Analysts ask questions like “where do coffee shop visits peak in Dallas on weekends?” The data to answer that exists, but reaching it normally means SQL, a GIS tool and a wait. Chat interfaces on top of large datasets tend to fail in one of two ways: they are slow, or they are confidently wrong.
What I built
A map with a chat panel. You ask in plain English and the answer appears on the map.
Speed came from refusing to send everything to a large model.
- The browser handles map moves itself. Panning, zooming and “show me Texas” never reach a server. The target was under 300 milliseconds. The measured median is 39.
- A small model routes the question. Known shapes of question go to pre-written SQL templates, which are fast and predictable.
- A larger model writes SQL only for new shapes. That is the slow lane, and the interface says so.
- The data sits next to the code. DuckDB reads Parquet files in the same process as the agent. For the fast lane this beat a separate database on both speed and cost.
Guardrails screen what goes in and what comes out, and a fixed set of test questions with known answers runs against every change.
The result
Most questions return in about two seconds. Heavier ones, which reach into billions of hourly rows, take longer and are labelled as such. The product is live by invitation.
What carries over
The pattern is general. Use the model for what only a model can do, keep everything else deterministic, and measure each lane separately so you know which one a complaint is about.