Edu SDKEdu SDK

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

OptionTypeRequiredDefault
modelstring | LanguageModelYes—
contentstring | FileContentYes—
countnumber (positive int)Yes—
difficulty"easy" | "medium" | "hard"No"medium"
numOfOptionsnumber (min 2)No4
learnerContextLearnerContextNo—

content may be a string or FileContent (PDF / text / markdown bytes).

learnerContext is optional personalization input. See Personalization.

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 is a QuizQuestion:

{
  id: string;
  question: string;
  options: string[];
  correctAnswer: number;
  topics?: string[];
}

correctAnswer is zero-indexed. Artifact id / leaf ids and metadata are SDK-generated; title and optional description come from the model.

Generation always produces 1–4 topics tags per question. On the public QuizQuestion type, topics is optional so hand-authored quizzes (and grading) can omit them. id is always required.

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 />.

On this page