createQuiz
Generate a multiple-choice quiz from educational content.
Generates a multiple-choice quiz from educational content.
Usage
import { createQuiz } from "edu-sdk";
const quiz = await createQuiz({
model: "google/gemini-3.6-flash",
content,
count: 10,
difficulty: "hard",
numOfOptions: 4
});Options
| Option | Type | Required | Default |
|---|---|---|---|
model | string | LanguageModel | Yes | — |
content | string | FileContent | Yes | — |
count | number (positive int) | Yes | — |
difficulty | "easy" | "medium" | "hard" | No | "medium" |
numOfOptions | number (min 2) | No | 4 |
content may be a string or FileContent (PDF / text / markdown bytes).
Returns
Promise<Artifact<QuizQuestion[]>>
{
id: string;
title: string;
description?: string;
metadata: {
createdAt: string;
model: string;
difficulty: "easy" | "medium" | "hard";
};
content: QuizQuestion[];
}Each question in content contains:
{
id: string;
question: string;
options: string[];
correctAnswer: number;
}correctAnswer is zero-indexed. Artifact id / leaf ids and metadata are SDK-generated; title and optional description come from the model.
Example
import { createQuiz } from "edu-sdk";
const quiz = await createQuiz({
model: "google/gemini-3.6-flash",
content: notes,
count: 10,
difficulty: "medium"
});
// Pass questions into the React component:
// <Quiz questions={quiz.content} />Render with <Quiz />.