Problem
About 95% of surveyed Woowa Brothers employees use data at work, but many cannot write SQL. In the company survey, over half wanted to use SQL and lacked time to learn it or struggled to encode business logic and extraction conditions. They also doubted the data's reliability. A plain GPT-4 produces queries that look fine but are unusable, because it knows nothing of internal domains and data policies, the default retriever pulls unnecessary data, and hallucinations make quality inconsistent.
Example from the article: a Slack bot, QueryAnswerBird (QAB), returns a question with a generated and syntax-validated query plus an explanation, within 30 seconds to 1 minute.
Solution in brief
QAB augments GPT with company knowledge through RAG. It enriches table metadata, builds a business glossary and a few-shot question-query set, retrieves different context at each stage, and uses a ReAct-style prompt. An internal evaluation set, metrics and leaderboard (500+ A/B tests) decide which chain variant ships.
Questions this case answers
- How to make a general-purpose LLM write correct queries over a company's own tables when it does not know the business terms, data policies or column semantics
- How to measure and improve an LLM query generator on internal domain questions when public benchmarks do not reflect the company's metrics
- How to build a text-to-SQL assistant that knows company business terms and table documentation?
- How to reduce hallucinated or unusable SQL from a general-purpose LLM on internal data?
Tools and methods
- LangChain, LangServe — document loading, vector store, RAG chains, prompt playground
- Azure OpenAI GPT — query generation (GPT-3.5 in the hackathon version)
- Vector database with per-area indexes — similarity search over metadata, glossary and examples
- Few-shot SQL examples — analyst-written query and question pairs
- ReAct-style prompt with chain-of-thought — step-by-step reasoning combined with dynamic retrieval
- Slack — user interface and satisfied/unsatisfied feedback
Google or a one-time email code. No password.