
Marat ("muh-RAH") is a data analysis and visualization tool that facilitates exploratory data analysis, from general AI-driven thematic insights to specific analysis or visualization requests by the user.
Current data analysis implementations leveraging conversational AI are primarily interrogative, with the user chatting with a personified version of the data. While this is quite useful, I believe it does not maximize AI's benefit in understanding data. We tend not to view insights and information as separate elements interacted with in a dialectic, but rather as a network of understanding, with insights linking together to form a complete understanding of data insights. This project represents a proof-of-concept attempt to better implement this view of analysis.
Marat uses a NextJS flowchart-style frontend to visualize and coordinate data analysis through Python-basedLanggraph agents. FastAPI is used to send information to the Python base, where analysis is then conducted and sent back to the NextJS frontend to be visualized and organized.
Go to the main dashboard page (localhost:3000/dashboard) and upload your CSV data file when prompted. When the question prompt appears, you can either ask a specific question (i.e. Generate a linear regression between size and cost) or a broad question (i.e. Tell me everything, What contributes to changes in price, etc.). To generate a report, select the nodes you wish to include and click "Generate Report from Selected Nodes". The report will then be generated as a PDF and can be downloaded through the /reports page.
All frontend NextJS code is located in the 'nextjs' folder. Presently, typescript is not set in script mode, but I am planning on updating this once all type configurations are fully added.
The Langgraph and agent configurations can be found in the backend folder, with the agent definitions and graph configuration found in backend->api->agents->agents.py and backend->api->agent_graph->graph.py respectively. FastAPI backend setup is in backend->api->test.py, with the coordination of the langgraph responses being found in langchain_base->langchain.py. Model configurations can be found in the backend->api->models directory. All prompts are located in backend->api->prompts->prompts.py
Much of the schema and implementation comes from this project, which also features some excellent learning material.
The easiest way to install and get started is through Docker. You can either pull the pre-built image or build the image locally.
Pull the Docker image from DockerHub
docker pull nbritt27/marat-agent-data-analysis:frontendv1.0
docker pull nbritt27/marat-agent-data-analysis:backendv1.0docker run -p 3000:3000 --name marat-frontend -d marat-agent-data-analysis:frontenddocker run -p 8000:8000 --name marat-agent-data-analysis-backend -d
-e OPENAI_API_KEY=your_api_key
marat-agent-data-analysis-backend:v1.0Build the image locally
git clone https://github.com/nbritt27/marat-agent-data-analysis.git
cd marat-agent-data-analysiscp .env.example .envdocker compose upAssuming you have Node installed (this project uses Node 20.12.0): The project uses a NextJS frontend, with NextJS installation instructions being found at https://nextjs.org/docs/getting-started/installation
Move into the nextjs directory
cd nextjsInstall all nextjs and node dependencies
npm install
# or
pnpm installInstall pip dependencies
pip install -r ../backend/requirements.txtTo run the project
npm run dev
NOTE: If you are using Windows, and want to generate reports, you will have to download the installer for wkhtmltopdf https://wkhtmltopdf.org/downloads.html, and specify the executable path in env file.
This project does execute generated Python code. Running the project inside of a virtual environment or container is recommended.
I would love assistance in working on this project. If you're interested in assisting with the project, or have any other questions or concerns, the best way to reach me is by email at [email protected]
This project is licensed under the MIT License - see the LICENSE file for details.
If you use this project or any subset of it, please let me know! I'd love to see what you're able to create :)