03 / LLM / Data application
Text-to-SQL
Data Assistant
An AI-powered data assistant that transforms natural-language questions into SQL queries and executes them against a structured employee database.
SELECT COUNT(*) FROM EMPLOYEE;Watch the demo
See the workflow in action.
A short walkthrough of the deployed Text-to-SQL application.
The problem
Answers should not require speaking SQL.
People often know the information they need from structured data, but not the SQL needed to retrieve it. This application explores how an LLM can bridge that gap: ask a question in natural language, then inspect the generated query and its result.
How it works
From a question to a result, with the query kept visible.
User question
How many employees are in the company?
Schema context
The known EMPLOYEE database schema is supplied to the model.
LLM generation
Groq-hosted GPT-OSS 120B produces a SQLite query.
SQL execution
The generated query runs against the local SQLite database.
Result
The application shows the SQL and returned data together.
A verified example
“How many employees are in the company?”
SELECT COUNT(*) FROM EMPLOYEE;Technical architecture
A deliberately focused AI and data path.
Technical implementation
Focused decisions, visible behavior.
Natural-language SQL generation
English questions are converted into SQLite queries through the LLM.
Schema-aware prompting
The EMPLOYEE schema gives the model the context it needs to address available data.
Query execution
Generated SQL is run against the included SQLite database.
Result presentation
The interface displays both the generated SQL and the returned database rows.
Configuration
Credentials use environment variables locally and Streamlit secrets in deployment.
Engineering decisions
SQLiteA lightweight relational database is enough to demonstrate the workflow without external infrastructure.
StreamlitAn efficient way to expose the AI and data workflow through an interactive browser interface.
LangChainThe application layer for composing prompts and integrating the chat model.
GroqHosted inference access to the selected LLM through a straightforward application integration.
Deployment
Not only a local experiment.
Explore the implementation