Documentation

Everything you need to know to use QueryAI and Kaveri.

Getting Started

Kaveri is a natural language to SQL interface built on top of QueryAI.

Upload a data file (CSV, Excel, JSON, or SQL), then ask questions in plain English.


Quick start:

1. Open [Kaveri](/kaveri)

2. Click the upload icon or drag & drop a file

3. Once uploaded, type your question in the chat input

4. View the generated SQL, explanation, and chart


No SQL knowledge is required. Kaveri handles everything.

Uploading Data

Supported formats:

  • `.csv` — Comma-separated values (with or without headers)
  • `.xlsx` / `.xls` — Microsoft Excel workbooks (first sheet is used)
  • `.json` — JSON array of objects or `{ key: [...rows] }` shape
  • `.sql` — SQL files with CREATE TABLE statements

  • Limits:

  • Maximum file size: 50 MB
  • Rows: up to 100,000 rows recommended for performance

  • After upload, Kaveri automatically:

  • Detects column names and types (integer, float, boolean, date, text)
  • Stores data in a per-session PostgreSQL table
  • Generates a semantic embedding for schema-aware queries
  • Asking Questions

    Type any question about your data in the chat input. Examples:


  • *"Show me the top 10 customers by revenue"*
  • *"What is the average order value per month?"*
  • *"Which products have never been ordered?"*
  • *"Count distinct users by country"*

  • Kaveri uses a tool-use agent loop:

    1. `get_schema` — reads column names and types

    2. `sample_data` — inspects a few rows to understand values

    3. `execute_sql` — runs the generated SELECT query


    This multi-step process produces more accurate SQL than single-shot generation.

    Model Selection

    Use the model dropdown in the sidebar to choose which AI model generates your SQL.


    Available models:

    |---|---|---|


    Models are accessed via [OpenRouter](https://openrouter.ai) — one key, all models.

    Guardrails & Safety

    Kaveri includes two layers of safety:


    **Input guardrails** — blocks off-topic questions:

  • Greetings and chitchat
  • Code generation unrelated to data
  • PII or personal data requests

  • **SQL safety checks** — blocks destructive operations:

  • `DROP TABLE`, `DELETE`, `UPDATE`, `INSERT`
  • `ALTER`, `CREATE TABLE`, `TRUNCATE`
  • Any query that doesn't start with `SELECT` or `WITH`

  • Only read-only SELECT queries are ever executed on your data.

    Self-Hosting

    Prerequisites:

  • Node.js 18+
  • Python 3.11+
  • PostgreSQL (optional — degrades gracefully without it)
  • ChromaDB (optional — embeddings skip if unavailable)

  • Backend setup:

    cd backend

    python -m venv .venv

    .venv/Scripts/activate # Windows

    pip install -r requirements.txt

    cp .env.example .env # add your OPENROUTER_API_KEY

    uvicorn main:app --reload


    Frontend setup:

    cd frontend

    npm install

    cp .env.example .env.local # set DATABASE_URL if using PostgreSQL

    npm run dev


    Open `http://localhost:3000` to start using QueryAI.