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

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

On this page