TutorGPT (a.k.a. Tutor++) is a Flask + React application designed to act like a Teaching Assistant (TA) in office hours. It provides helpful academic guidance for students taking CS109: Probability for Computer Scientists—without giving away direct solutions or code.
- Project Overview
- Features
- Architecture
- Sprint History
- Setup & Installation
- Running the App
- Usage Tips
- Project Structure
- Future Enhancements
TutorGPT is a specialized chatbot that:
- Answers conceptual questions about probability and course material.
- Provides hints and guidance on homework assignments—without simply handing out the full solutions.
- Uses a fine-tuned OpenAI GPT model under the hood, with extra policy checks to avoid academic dishonesty.
- Includes a rating system so students can rate the helpfulness of responses.
This helps TAs and professors cut down on repetitive questions and improves the learning experience by giving students immediate feedback—day or night.
Please see here for more materials around product specifications and go-to-market.
- Chat Interface: Clean, minimal React-based UI for easy conversation flow.
- Flask Backend: Python server that calls the fine-tuned OpenAI GPT model with additional guardrails.
- Policy Checks: Naive keyword filtering + optional post-processing to remove code blocks or direct solutions.
- Rating System: Thumbs-up/down rating per message, which logs to the backend for potential analytics.
- CORS-Enabled: The Flask server is configured to accept requests from
localhost:3000(the React dev server).
-
Frontend:
- React (Create React App)
- Handles chat UI, sends user messages to the backend via Axios, displays AI responses, and includes a rating component.
-
Backend:
- Flask (Python)
- Exposes
/api/chatendpoint to process user messages, apply policy checks, and call the fine-tuned OpenAI API. - Exposes
/api/rateto store or log message ratings. - Uses
flask-corsfor cross-origin requests.
-
OpenAI:
- The Flask app calls OpenAI's ChatCompletion API with your fine-tuned GPT model name.
- A system prompt instructs the model to act like a TA and avoid giving direct solutions.
- Kashyap Nathan & Neetish Sharma: Collaborated on setting up the initial project structure, basic Flask backend, and React frontend integration.
- Neetish Sharma:
- Implemented Redis integration for conversation history management
- Added IP-based rate limiting functionality
- Enhanced error handling and CORS configuration for better security
- Kashyap Nathan:
- Implemented the rating system backend endpoint
- Added policy checking and content filtering mechanisms
- Set up dynamic response formatting for better user experience
- Neetish Sharma:
- Implemented conversation context management
- Added configurable system prompt functionality
- Enhanced logging and monitoring systems
- Kashyap Nathan:
- Added fine-tuning preparation infrastructure
- Implemented advanced chat message formatting
- Set up comprehensive testing infrastructure
git clone https://github.com/kashyapnathan/tutorGPT.git
cd tutorGPT(Adjust paths if needed.)
- Create a
.envfile in thebackend/folder (do not commit it!):OPENAI_API_KEY=sk-YourRealKeyHere FLASK_DEBUG=1
- Note: The API key is used for development. You won't need it in production hosting if you use container secrets or another secure method.
- Ensure
.envis listed in your.gitignore.
cd backend
pip install -r requirements.txtcd ../frontend
npm install(or yarn install if you prefer Yarn.)
-
Start the Flask Backend:
cd backend python app.pyBy default, it runs on http://localhost:5001.
(Checkapp.run(host="0.0.0.0", port=5001)inapp.pyor update if you prefer a different port.) -
Start the React Frontend:
cd ../frontend npm startRuns on http://localhost:3000. Make sure the
baseURLinfrontend/src/api.jsmatches your Flask port. -
Open http://localhost:3000 to interact with the chatbot.
Important: In app.py, ensure you specify your fine-tuned model name (e.g. gpt-4-2025-01-23:tutor-gpt) where you call openai.ChatCompletion.create(..., model="your-finetuned-model").
- As a student: Type questions about probability, concepts, or clarifications for homework. The bot should provide hints without giving direct solutions.
- As a TA/Professor: Monitor messages for repeated questions, gather feedback from the rating logs, and tune the policy checks as needed.
- Guardrails: If a user tries to request direct solutions or code, the bot refuses or redacts the response.
tutor-plus-plus/
├── backend/
│ ├── app.py # Flask server
│ ├── requirements.txt # Python dependencies
│ ├── model_fine_tuning.py # Stub for future fine-tuning
│ └── .env # Contains OPENAI_API_KEY (ignored by Git)
└── frontend/
├── public/ # index.html, static assets
├── src/
│ ├── App.js
│ ├── Chat.js
│ ├── Message.js
│ ├── Rating.js
│ ├── api.js # Axios calls to the backend
│ └── ...
├── package.json
├── package-lock.json
└── .gitignore
- Database Integration: Store chat logs, user ratings, and usage analytics in a real database (e.g., Postgres, MongoDB).
- OpenAI Moderation: Integrate the official OpenAI Moderation endpoint for more robust content filtering.
- Fine-Tuning: We already have a custom fine-tuned GPT model, but you can refine further or update as more course data becomes available.
- Forum Integration: Connect with platforms like Piazza or Ed, allowing the bot to automatically respond to common questions.
- Audio/Video: Provide an interactive AV interface for real-time "office hours."
Happy Learning with TutorGPT!