harshkumar27/data-analysis-agent
0
TDS Data Analyst Agent
An intelligent, AI-powered data analyst agent that can answer questions about datasets, perform analysis, and generate visualizations. This agent is built with FastAPI and LangChain, leveraging the power of Google's Gemini models.
๐ Features
- Interactive Web Interface: A user-friendly, responsive web UI for uploading files and viewing results.
- Multiple Data Sources: Supports various data file formats, including CSV, Excel, Parquet, and JSON.
- Web Scraping: Can fetch and analyze data directly from URLs.
- AI-Powered Analysis: Uses LangChain and Google Gemini to understand questions and generate Python code for analysis.
- Code Execution Sandbox: Safely executes generated code in a sandboxed environment.
- Data Visualization: Generates and displays plots and charts based on the analysis.
- Robust LLM Fallback: Implements a fallback mechanism for Gemini API keys to ensure reliability.
- Easy Deployment: Ready for deployment on platforms like Railway with included configuration files.
๐ ๏ธ Installation
To run this project locally, follow these steps:
- Clone the repository:
git clone [https://github.com/your-username/your-repo.git](https://github.com/your-username/your-repo.git)
cd your-repo- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`- Install the dependencies:
pip install -r requirements.txt- Create a `.env` file in the root directory and add your Google Gemini API keys. You can add up to 10 keys for load balancing. If you only have one, you can repeat it.
gemini_api_1=your_api_key_here
gemini_api_2=your_api_key_here
# ... up to gemini_api_10
LLM_TIMEOUT_SECONDS=240Usage
To start the application, run the following command:
uvicorn app:app --host 0.0.0.0 --port 8000
