Skip to main content

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:
  1. AI Chatbot: Personalized learning assistant with course context
  2. Quiz Generation: Auto-generate chapter quizzes from course content
  3. Study Recommendations: AI-powered feedback based on quiz performance
  4. Learning Roadmaps: Personalized and custom learning paths

Environment Variables

Add this to your server/.env file:
server/.env
Get your API key from the Groq Console. Sign up for free to access the API.

Setup Instructions

1

Create Groq Account

  1. Go to Groq Console
  2. Sign up for a free account
  3. Free tier includes generous rate limits for development
2

Generate API Key

  1. Navigate to API Keys in the Groq Console
  2. Click Create API Key
  3. Name your key (e.g., “SkillRise Development”)
  4. Copy the key (starts with gsk_)
  5. Add it to server/.env:
3

Install Dependencies

4

Test Connection

Create a test script to verify your setup:
test-groq.js
Run: node test-groq.js

Core Service

SkillRise uses a centralized AI service for all Groq interactions:
server/services/chatbot/aiChatbotService.js

Model Selection

SkillRise uses openai/gpt-oss-120b (GPT-OSS 120B) for all AI features. Other available models:

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
API Endpoint:

Feature 2: Quiz Generation

Automatically generate chapter quizzes from course content:
server/controllers/quizController.js
API Endpoint:

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

  • Verify GROQ_CHATBOT_API_KEY is correct (starts with gsk_)
  • Check your Groq Console for rate limit status
  • Implement exponential backoff for rate limit errors
  • Add explicit instructions: “Return ONLY valid JSON, no markdown”
  • Strip markdown code blocks: raw.replace(/```json|```/g, '')
  • Use multiple parsing strategies (see parseJSON helper)
  • Validate with Zod before using the response
  • Include more specific context in system prompts
  • Pass user progress data in the prompt
  • Lower temperature (0.5-0.7) for more focused responses
  • Ensure you’re passing previous messages in the messages array
  • Limit history to last 20 messages to avoid token limits
  • Store sessions in database with sessionId

Resources

Groq Docs

Official Groq documentation

API Reference

Groq API reference

Models

Available models and pricing

Rate Limits

Rate limits and quotas