Natural language → SQL → Insight. Ask questions about your sales data. Get back tables, charts, and AI-written summaries — streamed in real time.
Text2Insight converts plain English questions into SQL, executes them against a DuckDB sales database, and returns:
- Data table — structured query results
- Chart — auto-rendered visualization
- AI summary — business-friendly insight narrative
- All streamed live via Server-Sent Events (SSE)
User Query
│
▼
┌──────────────┐ JWT Auth
│ FastAPI │ ◄──────────────── User Login
│ Backend │
└──────┬───────┘
│
┌────┴────┐
▼ ▼
SQL Memory
Generator Manager
(LLM) (Multi-turn)
│
▼
DuckDB Execution
│
├── Table Results
├── Chart Data
└── AI Summary (streamed via SSE)
│
▼
Export: PDF / Word / PowerPoint
- NL-to-SQL — Converts natural language to DuckDB-compatible SQL
- SSE Streaming — Results stream token by token in real time
- Multi-turn Memory — Maintains conversation context across questions
- JWT Authentication — Secure user sessions with token quota management
- SQL Confidence Scoring — Flags low-confidence queries before execution
- Export — Download results as PDF, Word, or PowerPoint
- Test Suite — Full pytest suite with
tests/directory
| Layer | Technology |
|---|---|
| Backend | FastAPI, Python |
| Database | DuckDB |
| Auth | JWT (JSON Web Tokens) |
| Streaming | Server-Sent Events (SSE) |
| Frontend | Vanilla JavaScript, HTML5, CSS3 |
| Testing | pytest |
| Export | PDF, DOCX, PPTX generation |
git clone https://github.com/iampriyabrat14/Text2Insight.git
cd Text2Insight
pip install -r requirements.txt
cp .env.example .env # Add your LLM API key
uvicorn backend.main:app --reloadOpen http://localhost:8000 — log in and start querying your data.
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/login |
JWT login |
| POST | /query/stream |
NL query → SSE stream |
| GET | /query/history |
Conversation history |
| POST | /export/pdf |
Export results as PDF |
Text2Insight/
├── backend/ # FastAPI app
├── frontend/ # Vanilla JS single-page UI
├── tests/ # pytest test suite
├── CLAUDE.md # Dev notes
├── requirements.txt
└── .env.example
MIT © 2026 Priyabrat Dalbehera