This is an advanced AI-powered research assistant system that utilizes multiple specialized agents to assist in tasks such as data analysis, visualization, and report generation. The system employs LangChain, OpenAI's GPT models, and LangGraph to handle complex research processes, integrating diverse AI architectures for optimal performance.
- Hypothesis generation and validation
- Data processing and analysis
- Visualization creation
- Web search and information retrieval
- Code generation and execution
- Report writing
- Quality review and revision
- Diverse Architectural Integration:
- Supervisor agents for overseeing the analysis process
- Chain-of-thought reasoning for complex problem-solving
- Critic agents for quality assurance and error checking
- Innovative Note Taker Agent:
- Continuously records the current state of the project
- Provides a more efficient alternative to transmitting complete historical information
- Enhances the system's ability to maintain context and continuity across different analysis stages
- Adaptive Workflow: Dynamically adjusts its analysis approach based on the data and task at hand
The integration of a dedicated Note Taker agent sets this system apart from traditional data analysis pipelines. By maintaining a concise yet comprehensive record of the project's state, the system can:
- Reduce computational overhead
- Improve context retention across different analysis phases
- Enable more coherent and consistent analysis outcomes
- Python 3.10 or higher
- Jupyter Notebook environment
- Clone the repository:
git clone https://github.com/starpig1129/ai-data-analysis-MulitAgent.git
- Create and activate a Conda virtual environment:
conda create -n data_assistant python=3.10
conda activate data_assistant
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
Rename
.env Example
to.env
and fill all the values
# Your data storage path(required)
DATA_STORAGE_PATH =./data_storage/
# Anaconda installation path(required)
CONDA_PATH = /home/user/anaconda3
# Conda environment name(required)
CONDA_ENV = envname
# ChromeDriver executable path(required)
CHROMEDRIVER_PATH =./chromedriver-linux64/chromedriver
# Firecrawl API key (optional)
# Note: If this key is missing, query capabilities may be reduced
FIRECRAWL_API_KEY = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# OpenAI API key (required)
# Warning: This key is essential; the program will not run without it
OPENAI_API_KEY = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# LangChain API key (optional)
# Used for monitoring the processing
LANGCHAIN_API_KEY = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
Start Jupyter Notebook:
-
Set YourDataName.csv in data_storage
-
Open the
main.ipynb
file. -
Run all cells to initialize the system and create the workflow.
-
In the last cell, you can customize the research task by modifying the
userInput
variable. -
Run the final few cells to execute the research process and view the results.
You can also run the system directly using main.py:
-
Place your data file (e.g., YourDataName.csv) in the data_storage directory
-
Run the script:
python main.py
- By default, it will process 'OnlineSalesData.csv'. To analyze a different dataset, modify the user_input variable in the main() function of main.py:
user_input = '''
datapath:YourDataName.csv
Use machine learning to perform data analysis and write complete graphical reports
'''
hypothesis_agent
: Generates research hypothesesprocess_agent
: Supervises the entire research processvisualization_agent
: Creates data visualizationscode_agent
: Writes data analysis codesearcher_agent
: Conducts literature and web searchesreport_agent
: Writes research reportsquality_review_agent
: Performs quality reviewsnote_agent
: Records the research process
The system uses LangGraph to create a state graph that manages the entire research process. The workflow includes the following steps:
- Hypothesis generation
- Human choice (continue or regenerate hypothesis)
- Processing (including data analysis, visualization, search, and report writing)
- Quality review
- Revision as needed
You can customize the system behavior by modifying the agent creation and workflow definition in main.ipynb
.
- Ensure you have sufficient OpenAI API credits, as the system will make multiple API calls.
- The system may take some time to complete the entire research process, depending on the complexity of the task.
- WARNING: The agent system may modify the data being analyzed. It is highly recommended to backup your data before using this system.
- OpenAI Internal Server Error (Error code: 500)
- NoteTaker Efficiency Improvement
- Overall Runtime Optimization
- Refiner needs to be better
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
Here are some of my other notable projects:
ShareLMAPI is a local language model sharing API that uses FastAPI to provide interfaces, allowing different programs or device to share the same local model, thereby reducing resource consumption. It supports streaming generation and various model configuration methods.
- GitHub: ShareLMAPI
A powerful Discord bot based on multi-modal Large Language Models (LLM), designed to interact with users through natural language. It combines advanced AI capabilities with practical features, offering a rich experience for Discord communities.
- GitHub: ai-discord-bot-PigPig