THE CHALLENGE: We set out to build an AI-powered chat interface that could turn natural language queries (NLQ) into precise SQL queries—enabling users to search projects, people, and companies effortlessly. But unlike big tech, we didn’t have access to massive datasets of labeled NLQ-to-SQL pairs. What we did have was a solid understanding of how the media production industry is structured—and a small, validated subset of data.
Company:
Wercflow
My Role:
Head of Product
Year:
2024
Techstack
Python | GPT-4o | Azure Function App | Azure SQL | Custom Validation Scripts | Parameterized Data Generation
THE SOLUTION
Synthetic Data + Smart Deployment
I designed a system to generate the data we needed—at scale and with variety.

🔹 1. Building the Foundation: Templates & Parameters
I started by crafting 88 core NLQ-to-SQL templates, each based on real-world user queries.
🔹 2. Scaling with Automation
Each template had 1 - 5 parameters. We had a total of 562 unique values for those paramteres and we generated 5+ natural language variations to mimic how users actually phrase queries.
This wasn’t manual — I built custom Python scripts to automate the entire process:
Natural Language Template | Parameter Values | Natural Language Variations |
|---|---|---|
Who can {action_1}, {action_2}, and {action_3} {content_domain} spots? | direct, edit, shoot, fashion | Which director also edits and shoots fashion campaigns? |
What {company_type}s have expertise in {content_domain}? | production companies, music videos | I need some prod co that product music vids! |
🔹 3. Training & Deployment
With 1M high-quality NLQ-SQL pairs generated, I fine-tuned GPT-4o to handle complex, domain-specific search queries. But training was just the start—I designed the deployment for real-world use, not just a sandbox.
Deployed the fine-tuned model via Azure Foundry for scalable, low-latency cloud inference.
Integrated Azure Functions for post-processing—handling SQL correction, syntax validation, and schema alignment in real-time.
Implemented Redis caching to optimize recurring queries and reduce load.
This architecture ensured that AI-driven query handling was not only smart—but also fast, reliable, and production-ready.

🔹 4. Ensuring Reliability with Validation
AI without guardrails breaks things. To ensure trustworthy outputs:
Built a robust validation pipeline to automatically detect and fix:
SQL syntax errors
Schema mismatches
Missing conditions or incorrect joins
Set up monitoring to track query success rates, error frequencies, and system performance.
Established a feedback loop where failed or flagged queries were logged for continuous dataset improvement and future fine-tuning cycles.
Leveraged Redis to cache validated queries, further enhancing response times for repeat patterns.
This system wasn’t static—it learned and improved with every execution.
📊 THE IMPACT
Results by the Numbers
In just weeks, I transformed limited data and resources into a fully deployed, AI-powered search solution—fast, reliable, and scalable without the need for a large team or big-tech infrastructure.
Reduction in Search Time | -50% |
Platfrom Engagement | 2x |
Project Teams Built | 22,000 |
Records Indexed | 500k |


