A powerful Streamlit application that leverages Azure OpenAI Assistant API to provide interactive data analysis capabilities. This application allows users to upload datasets and ask natural language questions to analyze their data.
- Interactive Chat Interface: Engage with an AI assistant through a user-friendly chat interface
- File Upload: Support for multiple data formats (CSV, Excel, JSON, TXT)
- Natural Language Data Analysis: Ask questions about your data in plain English
- Data Visualization: Automatically generates relevant visualizations based on your queries
- Code Interpreter: Utilizes Azure OpenAI's code interpreter to run Python code for data analysis
- File Management: Download generated analysis files and visualizations
- Session Persistence: Maintains conversation and analysis history during your session
- Streamlit: Frontend web application framework
- Azure OpenAI: Provides the Assistant API with GPT-4o capabilities
- Python: Core programming language
- Pillow: Image processing library
- dotenv: Environment variable management
- Python 3.8+
- Azure OpenAI API access with Assistant API capabilities
- Azure OpenAI API key and endpoint
-
Clone this repository:
git clone https://github.com/yourusername/st-assistant.git cd st-assistant
-
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.env.local
file with your Azure OpenAI credentials:AZURE_OPENAI_API_KEY=your_api_key_here AZURE_OPENAI_ENDPOINT=your_endpoint_here AZURE_DEPLOYMENT_NAME=your_deployment_name # Optional, defaults to gpt-4o AZURE_ASSISTANT_ID=your_assistant_id # Optional, will create new assistant if not provided
-
Start the application:
streamlit run app.py
-
The application will open in your default web browser at
http://localhost:8501
-
Step 1: Upload your dataset(s) (CSV, Excel, JSON, or TXT files)
-
Step 2: Ask questions about your data in natural language
- Example: "What's the correlation between sales and marketing spend?"
- Example: "Create a visualization of monthly revenue trends"
- Example: "Find outliers in the customer satisfaction scores"
-
View the analysis results, including visualizations and insights
-
Download any generated files for further use
-
Start a new analysis session when needed
The application follows a simple architecture:
-
Frontend: Streamlit web interface for user interactions
-
Backend: Python application that handles:
- File uploads to Azure OpenAI
- Thread and message management
- Assistant API interactions
- Tool function handling for data analysis
- File downloads and management
-
Azure OpenAI Assistant: Provides the AI capabilities including:
- Natural language understanding
- Code interpreter for data analysis
- Function calling for custom analysis tools
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Streamlit for the amazing web app framework
- Azure OpenAI for the powerful AI capabilities
- OpenAI for developing the Assistant API