Skip to content

Project

Natural language data querying

Role
AI Engineer
Context
Global Hitss
Stack
  • llm
  • text-to-sql
  • postgresql
  • bigquery
  • gcp
  • guardrails

o200k_base · 162 tokens · what the model reads

A chatbot that writes the SQL: whoever has the question stops depending on whoever can query.

The problem

The data that answered management questions lived in the database, and the only language that reached it was SQL. The people with the questions did not write the queries, and the people writing the queries were not the ones asking.

Turning a question into SQL is easy to describe and hard to guarantee: a wrong query does not fail, it returns a plausible number. And the user who cannot read SQL also has no way to check the SQL that was generated for them.

The solution

A chatbot that takes the question in natural language, generates the query against the client schema, runs it on the database and returns the result as written prose, with charts and filters requested in the conversation itself.

How a query moves through the system

  1. 01

    Question

    in natural language, with no table names and no syntax.

  2. 02

    Schema

    the ER diagram and the knowledge base enter as model context.

  3. 03

    SQL

    the question becomes a query over tables that actually exist.

  4. 04

    Execution

    the query runs on the database and returns rows, not text.

  5. 05

    Answer

    the result goes back to the model and comes out as prose, or as a chart when asked.

Back to projects