AI Lesson Generator
The AI Lesson Generator uses Google's Gemini API to produce tailored lesson plans based on your learner's profile, teaching persona, available inventory, and recent achievements. You configure the generation, submit it, and the lesson is generated in the background.
Configuration
Go to AI Generator in the sidebar. The configuration page has three mode tabs and an auto-schedule tab.
Targeted Goal
Generate a lesson aimed at a specific learning objective. Fields:
| Field | Required | Purpose |
|---|---|---|
| Learner | Yes | Who the lesson is for |
| Goal | Yes | What you want to teach (e.g. "Introduction to fractions") |
| Teaching Persona | No | Which persona to use (defaults to the learner's default persona) |
| Output Template | No | Formatting instructions for the generated output (see Output Templates) |
| Tags | No | Subject tags to focus the generation and filter relevant achievements |
| Inventory | No | Physical materials to include in the context |
Suggestions
Generate a follow-up lesson based on recent achievements. All tags are pre-selected so the AI can see the full picture across subjects. Useful when you want the AI to decide what to teach next.
Extension
Build on an existing generated lesson. Select a lesson from the Lesson Bank and the AI will produce a continuation that addresses gaps or next steps, incorporating any achievements logged against the original lesson.
Auto Schedule
Configure automatic daily or weekly lesson generation per learner. Each auto-schedule can optionally use a specific persona and output template. When enabled, a background task generates a new lesson at 7 AM (daily) or 7 AM Monday (weekly).
Generation Process
- Fill in the configuration and click Generate Lesson.
- A lesson record is created immediately and you're redirected to its detail page.
- The page shows a spinner while the lesson generates in the background.
- Once complete, the lesson content appears automatically (the page polls for updates).
- If generation fails (e.g. API rate limit), an error message and Retry button are shown. Transient errors are retried automatically up to 3 times with exponential backoff before marking the lesson as failed.
What Feeds Into the Prompt
The generator builds a prompt from multiple data sources. See the Prompt Reference for the exact template.
| Data | Source | Default if missing |
|---|---|---|
| Persona name and instructions | Selected TeacherPersona |
"an expert homeschool teacher" |
| Teacher profile (bio, style, strengths, weaknesses) | Teacher model fields |
"Not specified" |
| Learner profile (name, age, learning style, strengths, weaknesses) | Learner model fields |
"Not specified" |
| Lesson focus | Mode-dependent: goal text, parent lesson, or "suggest next" | -- |
| Tags | Selected Tag names |
"None specified" |
| Inventory | Selected active InventoryItem names |
"None" |
| Recent achievements | Last 7 days, up to 30 records (filtered by selected tags if any) | "No recent achievements" |
| Format instructions | Selected OutputTemplate |
Built-in default (see Output Templates) |
AI Interaction Logs
Every generation is saved as an AI Interaction Log, recording the prompt sent, the response received, and the token count. These are visible from the learner's data export and are linked to the generated lesson.
Gemini Model
The default model is gemini-2.5-flash. This can be overridden with the GEMINI_MODEL environment variable.