This system provides an AI-powered career assessment quiz that generates personalized career suggestions based on user responses. Here's how your team can implement and use it:
base_url = http://localhost:5000/api
Note: You have to add GEMINI_API_KEY to your .env file, and you get api key by following below instructions.
Note: You need to add GEMINI_API_KEY to your .env file to use Gemini models.
.env file:GEMINI_API_KEY=your_api_key_here
Endpoint: POST /ai-quiz/start
Frontend Action:
Expected Response:
{
"success": true,
"message": "Quiz started successfully",
"data": {
"id": 1,
"question": "Which activities energize you most?",
"options": [
{"text": "Solving complex problems", "value": "opt1"},
{"text": "Creating artistic works", "value": "opt2"},
{"text": "Helping others directly", "value": "opt3"},
{"text": "Analyzing data/patterns", "value": "opt4"}
]
},
"metadata": {
"currentQuestion": 1,
"totalQuestions": 10,
"completionPercentage": 0,
"threadId": "thread_user123_1712345678901"
}
}
Frontend Display:
threadId for future requestsEndpoint: POST /ai-quiz/submit
Frontend Action: For each question:
Sample Request:
{
"threadId": "thread_user123_1712345678901",
"answer": "opt2"
}
Intermediate Response (questions 2-9):
{
"success": true,
"message": "Answer submitted successfully",
"data": {
"id": 2,
"question": "What work environment do you prefer?",
"options": [
{"text": "Structured and predictable", "value": "opt1"},
{"text": "Flexible and creative", "value": "opt2"},
{"text": "Fast-paced and dynamic", "value": "opt3"}
]
},
"metadata": {
"currentQuestion": 2,
"totalQuestions": 10,
"completionPercentage": 10
}
}
Final Response (after 10th answer):
{
"success": true,
"message": "Quiz completed successfully!",
"data": {
"careerSuggestions": [
{
"title": "UX/UI Designer",
"description": "Design intuitive digital experiences...",
"pros": ["High creativity", "Growing demand", "Impact user satisfaction"],
"cons": ["Subjective feedback", "Balancing needs", "Evolving standards"],
"salaryRange": "$75,000 - $120,000",
"educationPath": "Bachelor's in design + portfolio",
"jobMarket": "high",
"fitScore": 82
},
{
"title": "Data Scientist",
"description": "Extract insights from complex datasets...",
"pros": ["High earning", "Diverse applications", "Challenging work"],
"cons": ["Technical skills", "Data cleaning", "Constant learning"],
"salaryRange": "$95,000 - $150,000",
"educationPath": "Advanced degree in statistics",
"jobMarket": "high",
"fitScore": 78
}
]
},
"metadata": {
"currentQuestion": 10,
"totalQuestions": 10,
"completionPercentage": 100
}
}
Endpoint: GET /ai-quiz/suggestion/:threadId/:index
Frontend Action:
Sample Response:
{
"success": true,
"data": {
"title": "UX/UI Designer",
"description": "Design intuitive digital experiences...",
"pros": ["High creativity", "Growing demand", "Impact user satisfaction"],
"cons": ["Subjective feedback", "Balancing needs", "Evolving standards"],
"salaryRange": "$75,000 - $120,000",
"educationPath": "Bachelor's in design + portfolio",
"jobMarket": "high",
"fitScore": 82
}
}
Endpoint: GET /ai-quiz/progress/:threadId
Frontend Action:
Sample Response:
{
"success": true,
"data": {
"userId": "user123",
"threadId": "thread_user123_1712345678901",
"currentQuestion": 3,
"completed": false,
"questions": [
{/* question 1 */},
{/* question 2 */}
]
},
"metadata": {
"currentQuestion": 3,
"totalQuestions": 10,
"completionPercentage": 20,
"isCompleted": false
}
}