Thanks to visit codestin.com
Credit goes to github.com

Skip to content

prady00/Vanna-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Chat with Your Data using Vanna.AI + Flask

This is a lightweight, open-source demo that lets you ask natural language questions and get SQL queries in return — powered by Vanna.AI, OpenAI GPT, and a simple Flask UI.

Ask questions like:

  • "Show all categories of sales"
  • "List top-selling categories by revenue"
  • "Get total orders per region"

🚀 Features

✅ Natural language → SQL conversion
✅ Connects to a real SQLite database
✅ Powered by OpenAI GPT-4 + ChromaDB
✅ Flask-based interactive web interface
✅ Environment-based API key loading with .env
✅ Easily extensible to Postgres, MySQL, BigQuery, etc.


📁 Project Structure

Vanna-Demo/
├── .env                # Your OpenAI API key (secure, ignored by Git)
├── db.py               # DB config for SQLite
├── demo_sales.db       # Sample SQLite database
├── main.py             # CLI + Flask app entry point
├── vanna_setup.py      # Vanna LLM setup and training
├── requirements.txt    # Python dependencies
└── readme.md           # This file

🔧 Setup Instructions

1. Clone the Repo

git clone https://github.com/your-username/Vanna-Demo.git
cd Vanna-Demo

2. Install Dependencies

pip install -r requirements.txt

3. Create a .env File

Create a .env file in the root directory with your OpenAI API key:

OPENAI_API_KEY=sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXX

⚠️ This file is ignored by Git. Keep your API key private.


▶️ Run the App

To run the app and open the Flask UI:

python main.py

Visit your browser at: http://127.0.0.1:5000


💡 Sample Questions to Try

  • "Show all customers who ordered more than once"
  • "List total sales by region"
  • "Find the average order value"

🛠 Built With


🧠 How It Works

  1. Loads table definitions from SQLite using introspection.
  2. Trains the Vanna model with DDL, sample SQL, and documentation.
  3. Accepts natural language questions via CLI or Flask UI.
  4. Converts questions into SQL using OpenAI and your schema context.

🧩 Ideas for Improvement

  • Add support for more databases (Postgres, MySQL, Snowflake, etc.)
  • Enhance Flask UI with chat history or result charts
  • Deploy to Docker or cloud

🙏 Credits

Created by [Pradeep Kumar]
Powered by Vanna.AI


📄 License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages