Query Formula Generator
A hackathon prototype that turned plain-English questions into query formulas by constraining an LLM with query-engine context.
Overview
Some report and monitor work depends on writing query formulas over product data. The hard parts are joins, field discovery, and formula shapes that fail only after you try to run them. People who need a formula usually ask a teammate, dig through examples, or ask for the data over Slack.
For the August 2025 hackathon, I built a prototype that takes a plain-English description and generates an inspectable query formula. Ask something like "employees hired in the last 90 days with admin access" and the demo returns a formula you can inspect.
What I built
The useful engineering work was constraining the LLM with query-language grammar, common joins, field constraints, and sharp edges of the query engine. That gave the model fewer places to invent fields or produce formulas that could not run.
This fit a hackathon window because I already knew the query engine's common failure modes. The prompt encoded those constraints directly: which joins were common, which fields were easy to invent, and which formula shapes tended not to run.
Outcome
- The demo worked end to end from plain-English input to inspectable query output with query-engine constraints.
- The prototype suggested that useful query authoring depended on encoded grammar, joins, fields, and failure modes.
The prototype was useful because it reduced the model's room to be wrong: enough query-language failure modes were encoded into the generator that obvious invalid outputs became harder to produce.