Natural-Language BI Platform — Turning Plain English Into Live Business Intelligence
Context
Primastat runs VizKraft, a production BI platform. Non-technical users needed to query business data without writing SQL, across four different underlying database engines.
The problem
General-purpose LLMs asked to write SQL against real schemas hallucinate columns, joins, and syntax that doesn't match the actual database — unacceptable in a product where the query runs directly against live business data.
Approach
We fine-tuned a large language model specifically on this task rather than relying on a general-purpose model with prompting alone.
- Fine-tuned Kimi K2.5 on 5,000+ real query pairs across 12 database schemas, deliberately including multi-table joins, CTEs, and window functions.
- Built a schema-injection pipeline (FastAPI, LangChain, SQLAlchemy) that resolves a client's live database schema at query time and injects it directly into the model's context.
- Every generated query is syntax-highlighted, editable, and re-executable — technical users can audit and correct exactly what the AI decided to run.
- Streamed results through Kafka across a three-service architecture (React SPA, Node.js orchestration, Python FastAPI) so charts render incrementally as query results arrive, in real time.
Architecture
Outcome
The platform is live in production with zero major AI-related incidents to date, and every generated query remains fully visible and editable by the end user.
Stack
Metrics reported by client and Rakri AI engineering logs as of the current engagement period.
Have a similar nl-to-sql problem?
Book a free 15-minute call. No pitch deck — just an honest read on whether this is an AI problem.
Response within 24 hours. No commitment required.