Quick Start
Generate a quiz and render it with React.
Generate questions with edu-sdk, then pass them to <Quiz />.
Generate
import { createQuiz } from "edu-sdk";
const quiz = await createQuiz({
model: "google/gemini-3.6-flash",
content,
count: 10,
difficulty: "medium",
});createQuiz returns Promise<Artifact<QuizQuestion[]>>. Each question in quiz.content looks like:
{
id: string; // required (SDK-stamped on generate)
question: string;
options: string[];
correctAnswer: number; // zero-indexed
topics?: string[]; // 1–4 tags when generated; optional for hand-authored
}Configure your AI SDK provider so the model value resolves. See Models & providers.
Render
import { Quiz } from "@edu-sdk/react";
import "@edu-sdk/react/styles.css";
<Quiz
questions={quiz.content}
onComplete={(result) => {
console.log(result.score, result.percentage);
}}
/>Import styles.css once in your app, not on every page. onComplete is optional — it receives the GradeQuizResult after the learner finishes (including optional byTopic when questions have topics).
Next steps
- Concepts — shared
Artifactshape and React prop rules - Personalization —
learnerContext, past work, and topic-aware grading - Core — all generators, workflows, and assessment
- React — components and styling