This project was created to experiment with linking a React frontend to a FastAPI backend for interactive, AI-driven code generation and execution.
- LLM-powered code generation based on user instructions
- Real-time code execution using Jupyter kernels
- Interactive plotting with Plotly
- WebSocket communication between frontend and backend
- Conversation memory using SQLite
- Virtual environment for package management
- Navigate to the
backend
directory - Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
- Install dependencies:
pip install fastapi uvicorn jupyter_client websockets plotly langchain_groq python-dotenv colorama
- Create a
.env
file and add necessary environment variables (e.g., API keys) - Run the FastAPI server:
python main.py
- Navigate to the
frontend
directory - Install dependencies:
npm install
- Start the React app:
npm start
- Open your browser and go to
http://localhost:3000
- Enter instructions in the text area (e.g., "create a survival plot for IO vs. Chemo and save it as survival.png")
- Click "Generate and Execute Code" to generate and run the code
- View the AI-generated code and its output in real-time below the input area
backend/
: FastAPI server and LLM-based code generation logicfrontend/
: React application for user interfacecoding_agent/
: Directory for storing generated Python scriptsconversations.db
: SQLite database for storing conversation history
This project is licensed under the Apache License 2.0. See the LICENSE file for details.