DataMentor AI is an end-to-end, full-stack chatbot application designed to act as an expert technical assistant for data science and machine learning. Built with a lightweight Node.js/Express backend and a responsive Vanilla JavaScript frontend, the application integrates Google's Gemini 2.5 Flash API to deliver real-time, context-aware responses.
- Stateful Conversation Memory: The frontend maintains an array-based conversation history, passing the full context to the backend on each request to ensure continuous, multi-turn dialogue.
- Engineered AI Persona: Utilizes Gemini's
systemInstructionparameters to enforce a strict domain focus (Data Science/ML) and specific coding standards. - Asynchronous Data Handling: Implements robust asynchronous
fetchrequests and error handling to manage API latency and provide immediate visual feedback (e.g., "thinking..." states) to the user. - RESTful Backend Architecture: A cleanly separated Express.js server handles API routing, CORS, environment variable security, and communication with the Google GenAI SDK.
- Frontend: HTML5, CSS3, Vanilla JavaScript (DOM Manipulation, Fetch API)
- Backend: Node.js, Express.js
- AI Integration: Google GenAI SDK (
@google/genai), Gemini 2.5 Flash Model - Security & Config:
dotenv,cors
- Client Layer: The user inputs a prompt via the web interface. The frontend captures the input, updates the UI, and appends the message to the session's history array.
- API Layer: A
POSTrequest containing the full conversation payload is sent to the/api/chatExpress endpoint. - AI Layer: The Node.js server transforms the payload into the required schema and passes it to the Gemini API, injecting the custom system instructions and temperature configurations.
- Resolution: The AI's generated text is returned to the client and dynamically rendered in the chat interface.
-
Clone the repository:
git clone https://github.com/yourusername/datamentor-ai-bot.git cd datamentor-ai-bot -
Install dependencies:
npm install
-
Environment Configuration: Create a
.envfile in the project root and add the following lines:GEMINI_API_KEY=your_api_key_here PORT=3000
-
Start the server:
npm start
-
Access the application: Open your browser and navigate to
http://localhost:3000.