Prerequisites Before setting up the project, ensure you have the following installed:
Python 3.8 or higher pip (Python package manager)
Setup Instructions
-
Download and Extract the Project Files Obtain the project files (e.g., via a provided zip file or direct download) and extract them to a directory on your local machine. Navigate to the project directory: cd path/to/insightpulse
-
Create a Virtual Environment Set up a virtual environment to manage dependencies: python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies Install the required Python packages listed in requirements.txt: pip install -r requirements.txt
The requirements.txt file includes:
llama-index pandas google-generativeai python-dotenv
- Set Up Environment Variables Create a .env file in the project root directory and add your Google API key for Gemini models: GOOGLE_API_KEY=
To obtain a Google API key, visit the Google Cloud Console, create a project, enable the Gemini API, and generate an API key. 5. Generate Dummy Sales Data Run the Dummy_Sales_Data.py script to create a synthetic dataset (sales_data.csv) for the demo: python Dummy_Sales_Data.py
This script generates sales records with fields like OrderID, Date, Region, Product, Category, Quantity, UnitPrice, and TotalSale. 6. Run the Application Execute the main script sales_analysis_agent.py to start the InsightPulse command-line interface: python sales_analysis_agent.py
The application will start, and you can interact with it by entering natural language queries (e.g., "What is the total sales for Laptops in South in 2024?"). Usage
Querying: Enter natural language queries to analyze sales data (e.g., "What is the average unit price of Monitors in 2023?"). View History: Type history to see the last 5 queries and their responses. Exit: Type exit to quit the application.
Project Structure
sales_analysis_agent.py: Main script for indexing, agent creation, and query handling. Dummy_Sales_Data.py: Script to generate synthetic sales data. sales_data.csv: Generated dataset used for analysis. requirements.txt: Lists project dependencies. .env: Stores environment variables (e.g., Google API key). index_storage/: Directory for persisting the VectorStoreIndex.
Troubleshooting
Missing API Key: Ensure the GOOGLE_API_KEY is correctly set in the .env file. Dependency Issues: Verify that all dependencies are installed by running pip install -r requirements.txt. File Not Found: Ensure sales_data.csv is generated by running Dummy_Sales_Data.py before starting the application.
Additional Resources
For detailed documentation, refer to the InsightPulse Documentation included in the project. To enhance the user experience, consider implementing the suggested web-based UI using React and Tailwind CSS, as outlined in the documentation.