AI DataChat: An Assistant That Speaks Your Language

Alina Gribanova, Andrey Litvin21 Jan 2025

Problem

Managers, product owners and business analysts at Sber need data to decide, but most do not know SQL. They ask a data analyst, who may have no free time, may lack context for the question, or may lack access to the data. Even a simple question then waits in a queue. The team built a tool that answers questions in natural language from the user's own file.

Example from the article: a manager has an Excel export of companies registered in Moscow in 2024 and wants to ask how many there are and get the answer directly.

Solution in brief

A bot in the internal messenger takes an uploaded Excel, CSV or Parquet file, loads it into an in-memory DuckDB database and asks an LLM (GigaChat-Pro) to write SQL. The query is run, failed queries are repaired by a dedicated prompt, and empty results are checked against a per-column vector index of the real values. Follow-ups are merged with the previous question.

Questions this case answers
  • How to give non-technical staff self-service answers from tabular files when analyst capacity is the bottleneck
  • How to detect and repair a generated query that runs but returns nothing because a filter value does not match the stored values
  • How to let managers and product owners who do not know SQL get answers from their own tables without waiting for an analyst?
  • How to make text-to-SQL answers reliable when a filter value in the question does not match the stored value?

Tools and methods

  • GigaChat-Pro (30b-8k) — generates SQL, descriptions, answers and chart code
  • GigaChain — framework for calling the model
  • GigaChat Embeddings — embeddings of the unique column values
  • DuckDB — in-memory database that runs the generated SQL quickly
  • Vector index per column — finds the stored value closest to a filter value
  • Few-shot prompting — successful and failed queries for the same table go into the prompt
Continue reading — it's free

Google or a one-time email code. No password.