This project is the Challenge Provided by the Anarix to create a AI-powered E-Commerce data assistant that:
- Understands the Natural Language Questions
- Converets them to the any Database Query (I have selected the PostgreSQL) using the LLM (gemini-2.5-flash)
- Returns the tabulated response in the terminal using the tabulate library
- Visualizes the results as charts, bars when applicable
Anarix_Task/
|__ .env => (Stores API_KEY and DB_URL for secure environment config)
|__ data/
| |__ Product-Level Ad Sales and Metrics.csv
| |__ Product-Level Eligibility Table.csv
| |__ Product-Level Total Sales and Metrics.csv
|
|__ db/
| |__ connection.py => (Sets up DB connection and extracts table schemas)
| |__ queries.py => (Executes SQL queries and generates visualizations by matplotlib)
|
|__ llm/
| |__ agent.py => (Uses Gemini API to convert user Natural Language Question's into SQL queries)
|
|__ init_db.py => (Loads CSV files into the database as tables)
|__ requirements.py => (Script to define dependencies of the Project)
|__ TASK DESCRIPTION_GenAI Intern VIT.pdf
|__ README.md => (Project documentation)
FastAPI, Uvicorn (Web Server)
SQLAlchemy (Database Access)
pandas (Data Handling)
Matplotlib (library for Chart/Visuvalization)
tabulate (Terminal Table)
python-dotenv (Environment variable loader)
google-generatveai (Gemini SDK)
API_KEY = your_gemini_api_key
You can Collect you API_KEY from here: https://aistudio.google.com/apikey
DB_URL = postgresql://<username>:<your-db-password>@localhost:5432/<your_db># Create virtual environment
python -m venv <your-venv-name>.\<your-venv-name>\Scripts\activatesource <your-venv-name>/Scripts/activatepip install -r requirements.txtpython init_db.py or python -m init_dbpython main.py or python -m main
The output runs in the following server: http://127.0.0.1:8000/docs or http://localhost:8000/docs




