curl --request POST \
--url https://api.example.com/api/generate-quiz \
--header 'Content-Type: application/json' \
--data '
{
"topic": "<string>",
"content": "<string>",
"numQuestions": 123
}
'{
"questions": [
{
"question": "<string>",
"options": [
{}
],
"correctAnswer": 123,
"explanation": "<string>"
}
],
"topic": "<string>",
"error": "<string>"
}Generate multiple-choice quiz questions based on a topic and optional content
curl --request POST \
--url https://api.example.com/api/generate-quiz \
--header 'Content-Type: application/json' \
--data '
{
"topic": "<string>",
"content": "<string>",
"numQuestions": 123
}
'{
"questions": [
{
"question": "<string>",
"options": [
{}
],
"correctAnswer": 123,
"explanation": "<string>"
}
],
"topic": "<string>",
"error": "<string>"
}POST /api/generate-quiz
curl -X POST https://yourdomain.com/api/generate-quiz \
-H "Content-Type: application/json" \
-d '{
"topic": "World War II",
"content": "World War II was a global conflict that lasted from 1939 to 1945...",
"numQuestions": 5
}'
{
"questions": [
{
"question": "When did World War II begin?",
"options": ["1939", "1941", "1937", "1945"],
"correctAnswer": 0,
"explanation": "World War II began in 1939 when Germany invaded Poland."
},
{
"question": "Which countries were part of the Allied Powers?",
"options": [
"Germany, Italy, Japan",
"United States, United Kingdom, Soviet Union",
"France, Germany, Italy",
"Japan, China, Thailand"
],
"correctAnswer": 1,
"explanation": "The main Allied Powers were the United States, United Kingdom, and Soviet Union."
}
],
"topic": "World War II"
}
{
"error": "Topic is required"
}
topic field is missing or empty.
{
"error": "Failed to generate quiz"
}
{
"error": "Failed to parse quiz"
}
{
"error": "Failed to generate questions"
}
mixtral-8x7b-32768 model