Zouhour Bellamine

Hello

English 🇬🇧

✿
Loading
← All work

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.

assistant.sqlLive workflow
How many employees are in the company?
natural language→GPT-OSS 120B→SQLite
SELECT COUNT(*) FROM EMPLOYEE;
RESULT10employees
Role AI / Software EngineerType LLM + Data ApplicationStatus LiveStack Python · Streamlit · LangChain · Groq · SQLite

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.

01

User question

How many employees are in the company?

02

Schema context

The known EMPLOYEE database schema is supplied to the model.

03

LLM generation

Groq-hosted GPT-OSS 120B produces a SQLite query.

04

SQL execution

The generated query runs against the local SQLite database.

05

Result

The application shows the SQL and returned data together.

A verified example

Natural language

“How many employees are in the company?”

Generated SQL
SELECT COUNT(*) FROM EMPLOYEE;
Result10

Technical architecture

A deliberately focused AI and data path.

Streamlit UIThe browser interface↓LangChainPrompt and model composition↓Groq / GPT-OSS 120BHosted LLM inference↓Generated SQLA SQLite query↓SQLite / company.dbStructured employee data↓Query resultsReturned rows in the UI

Technical implementation

Focused decisions, visible behavior.

01

Natural-language SQL generation

English questions are converted into SQLite queries through the LLM.

02

Schema-aware prompting

The EMPLOYEE schema gives the model the context it needs to address available data.

03

Query execution

Generated SQL is run against the included SQLite database.

04

Result presentation

The interface displays both the generated SQL and the returned database rows.

05

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.

Platform Streamlit Community Cloud

Status Live

Runtime Python

Open Live Application ↗

Explore the implementation

See the application, LLM integration, database workflow, configuration, and deployment setup.

View source on GitHub ↗
Next project: Industrial Vision Inspection