Skip to content

Ask questions about your business data in plain English, Get automatic SQL queries and visualizations, Receive AI-powered insights and recommendations, No SQL knowledge required

License

Notifications You must be signed in to change notification settings

tnickster/ai-analyst-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Business Insights Agent

An intelligent business analytics platform powered by LLMs that translates natural language questions into SQL queries, creates visualizations, and provides actionable insights.

📸 Screenshots

1. Asking a question

Agent input prompt

2. Employees per department

Bar Graph

3. Overall gender distribution & Follow-up

Overall gender pie

Features

  • 💬 Natural Language Interface: Ask questions in plain English about your business data
  • 📊 Automatic Visualizations: Generates appropriate charts based on query results
  • 🔍 Root Cause Analysis: Identifies underlying factors contributing to business trends
  • 📈 Actionable Recommendations: Suggests next steps based on data insights
  • 🔄 Follow-up Questions: Recommends additional queries to deepen your analysis

Tech Stack

  • Backend: Python, MySQL, LangChain
  • LLM Integration: OpenAI GPT-4
  • Data Processing: Pandas
  • Visualization: Plotly
  • Frontend: Streamlit

How It Works

  1. User asks a business question in natural language
  2. LLM agent interprets the question and generates appropriate SQL queries
  3. Queries are executed against the MySQL database
  4. Results are processed and visualized
  5. LLM provides insights, analyses, and recommendations based on the data

Getting Started

Prerequisites

  • Python 3.8+
  • MySQL database with your business data
  • OpenAI API key

Installation

  1. Clone this repository

    git clone https://github.com/tnickster/ai-analyst-agent.git
    cd ai-analyst-agent
  2. Install dependencies

    pip install -r requirements.txt
  3. Create a .env file with your configuration

    OPENAI_API_KEY=your_openai_api_key 
    DB_HOST=your_db_host
    DB_PORT=your_db_host
    DB_USER=your_db_user
    DB_PASSWORD=your_db_password
    DB_NAME=your_db_name
    

Running the Application

Streamlit Web Interface

streamlit run app.py

Command Line Interface

python main.py

Project Structure

├── app.py              # Streamlit web interface
├── main.py             # Command line interface
├── tools.py            # Core functionality, SQL processing, visualization
├── prompt.txt          # System prompt for the LLM agent
├── requirements.txt    # Python dependencies
└── README.md           # This file

Demo

Soon to be implemented

Future Improvements

  • Support for additional databases (PostgreSQL, SQLite, etc.)
  • Custom visualization options
  • Data export functionality
  • User authentication and access controls
  • Multi-tenant support for multiple databases

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Nicholas Tarazi - Nicholas.Tarazi7@gmail.com

LinkedIn: https://www.linkedin.com/in/nicholas-tarazi/

Project Link: https://github.com/tnickster/ai-analyst-agent

About

Ask questions about your business data in plain English, Get automatic SQL queries and visualizations, Receive AI-powered insights and recommendations, No SQL knowledge required

Topics

Resources

License

Stars

Watchers

Forks

Languages