Overview
SkillRise uses Groq for AI-powered features. Groq provides ultra-fast LLM inference with models like LLaMA, optimized for real-time applications.AI Features
SkillRise leverages Groq AI for four key features:- AI Chatbot: Personalized learning assistant with course context
- Quiz Generation: Auto-generate chapter quizzes from course content
- Study Recommendations: AI-powered feedback based on quiz performance
- Learning Roadmaps: Personalized and custom learning paths
Environment Variables
Add this to yourserver/.env file:
server/.env
Get your API key from the Groq Console. Sign up for free to access the API.
Setup Instructions
Create Groq Account
- Go to Groq Console
- Sign up for a free account
- Free tier includes generous rate limits for development
Generate API Key
- Navigate to API Keys in the Groq Console
- Click Create API Key
- Name your key (e.g., “SkillRise Development”)
- Copy the key (starts with
gsk_) - Add it to
server/.env:
Core Service
SkillRise uses a centralized AI service for all Groq interactions:server/services/chatbot/aiChatbotService.js
Model Selection
SkillRise usesopenai/gpt-oss-120b (GPT-OSS 120B) for all AI features. Other available models:
| Model | Best For | Speed |
|---|---|---|
openai/gpt-oss-120b | General purpose, high quality | Fast |
meta-llama/llama-3.3-70b-versatile | Balanced quality & speed | Very Fast |
meta-llama/llama-3.1-8b-instant | Low latency, simple tasks | Ultra Fast |
Feature 1: AI Chatbot
The AI chatbot is a personalized learning assistant that helps students with course content and study guidance.Context Building
The chatbot builds personalized context for each student:server/controllers/chatbotController.js
System Prompt
server/controllers/chatbotController.js
Chat Endpoint
server/controllers/chatbotController.js
Feature 2: Quiz Generation
Automatically generate chapter quizzes from course content:server/controllers/quizController.js
Feature 3: Study Recommendations
Generate personalized study recommendations based on quiz performance:server/controllers/quizController.js
Feature 4: Learning Roadmaps
Generate personalized learning roadmaps based on enrolled courses:server/controllers/roadmapController.js
Rate Limiting
Protect AI endpoints from abuse:server/server.js
Error Handling
Handle AI errors gracefully:Best Practices
Use System Prompts
Always provide clear system prompts to guide AI behavior and output format.
Validate Responses
Use Zod or similar validation to ensure AI responses match expected schema.
Rate Limiting
Apply strict rate limits to prevent API cost abuse and ensure fair usage.
Handle Failures
Implement fallbacks for AI failures (cached responses, error messages).
Common Issues
API key invalid or rate limit exceeded
API key invalid or rate limit exceeded
- Verify
GROQ_CHATBOT_API_KEYis correct (starts withgsk_) - Check your Groq Console for rate limit status
- Implement exponential backoff for rate limit errors
AI returns invalid JSON
AI returns invalid JSON
- Add explicit instructions: “Return ONLY valid JSON, no markdown”
- Strip markdown code blocks:
raw.replace(/```json|```/g, '') - Use multiple parsing strategies (see
parseJSONhelper) - Validate with Zod before using the response
Responses are too generic
Responses are too generic
- Include more specific context in system prompts
- Pass user progress data in the prompt
- Lower temperature (0.5-0.7) for more focused responses
Chatbot forgets conversation history
Chatbot forgets conversation history
- Ensure you’re passing previous messages in the
messagesarray - Limit history to last 20 messages to avoid token limits
- Store sessions in database with
sessionId