Edu SDKEdu SDK

Concepts

Shared types and patterns across edu-sdk and @edu-sdk/react.

Every generator in edu-sdk shares the same options shape and return envelope. React components consume that data with a few consistent rules.

Shared options

Every create* helper accepts:

OptionTypeRequiredDefault
modelstring | LanguageModelYes
contentstring | FileContentYes
difficulty"easy" | "medium" | "hard"No"medium"
learnerContextLearnerContextNo

model is an AI SDK model ID or a LanguageModel instance. See Models & providers.

content is either a non-empty string or a FileContent object (PDF / text / markdown bytes). See Working with files.

learnerContext is optional personalization. Generation stays grounded in content; context only biases what to emphasize. The SDK is stateless — your app owns persistence of history and context. See Personalization.

Generated quizzes, flashcards, practice problems, and study-guide key concepts may include optional topics?: string[] (1–4 tags when produced by the model). Notes do not carry topic tags.

Some helpers add extra options (count, length, durationMinutes, include, and so on). Those are documented on each API page.

Artifact

Every generator returns Promise<Artifact<T>>:

{
  id: string;
  title: string;
  description?: string;
  metadata: {
    createdAt: string; // ISO timestamp
    model: string;     // resolved model label
    difficulty: "easy" | "medium" | "hard";
  };
  content: T;
}

T depends on the helper:

Helpercontent type
createFlashcardsFlashcard[]
createNoteMarkdown string
createQuizQuizQuestion[]
createStudyGuideStudyGuideContent
createPracticeProblemsPracticeProblem[]
createLearningSetNested artifacts (LearningSetContent)
createStudySessionAgenda + nested materials (StudySessionContent)
analyzePastWorkDiagnostic analysis (PastWorkAnalysis)

extractContent is not a generator — it returns extracted text, not an Artifact. buildLearnerContext is a pure helper (no LLM) and returns LearnerContext, not an artifact.

Choosing a generator

GoalUse
One material typeA single create* helper
Several materials from the same contentcreateLearningSet()
Timed agenda plus materialscreateStudySession()

React prop shapes

Most components take the inner artifact.content array:

<Quiz questions={quiz.content} />
<Flashcards flashcards={flashcards.content} />
<PracticeProblems problems={problems.content} />

<StudyGuide /> is the exception — it takes the full artifact so it can render title and sections:

<StudyGuide studyGuide={studyGuide} />

There is no React component for notes or learning sets alone — render notes Markdown yourself, or compose material components from nested artifacts. For study sessions, use <StudySession /> or build a custom runner — see Study session flow.

Nested artifacts

createLearningSet() and createStudySession() nest full artifacts under content:

const set = await createLearningSet({ /* ... */ });

// Outer envelope
set.title;
set.content.quiz; // Artifact<QuizQuestion[]> | undefined

// Pass into React
<Quiz questions={set.content.quiz!.content} />

Errors

Invalid options throw InvalidInputError. File problems throw UnsupportedContentError or ContentExtractionError. All extend EduSDKError. Model and network failures come from the AI SDK and are not wrapped. See Error handling.

Next: Personalization for the closed loop, Core for the full API, or Quick Start for a minimal example.

On this page