generate

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package generate assembles prompts and drives the Engine to produce study guides and revision Q&A grounded in course material (INV-04).

Index

Constants

View Source
const DefaultQACount = 10

DefaultQACount is applied when the learner does not specify a count (FR-054).

Variables

View Source
var ErrNoExercises = errors.New("no exercises found in set")

ErrNoExercises signals a set with no recognizable exercise headings (ERR-101); the caller may fall back to solving the whole set as one item.

View Source
var ErrUnknownExercise = errors.New("unknown exercise")

ErrUnknownExercise signals a requested label that the set does not contain (ERR-102).

Functions

func Guide

func Guide(ctx context.Context, eng engine.Engine, course, material string) (string, error)

Guide produces a study guide from the course material (FR-040..042).

func QA

func QA(ctx context.Context, eng engine.Engine, course, material string, opts QAOpts) (string, error)

QA produces revision Q&A from the course material in the learner's format (FR-050..056).

func Solve added in v0.2.0

func Solve(ctx context.Context, eng engine.Engine, course, material string, exs []Exercise) (string, error)

Solve produces worked solutions for the selected exercises, grounded only in the course material (FR-104/105). It refuses before calling the engine when the grounding is empty (INV-05) or nothing is selected.

Types

type Exercise added in v0.2.0

type Exercise struct {
	Label string     // human label, e.g. "Exercice 3" / "Problem 2"
	Num   string     // addressable identifier extracted from the label, e.g. "3"
	Text  string     // the full statement under the heading (incl. sub-parts)
	Parts []Exercise // parsed sub-questions, addressable via Num ("1", "a")
}

Exercise is one addressable problem within a set, with optional sub-questions (docs/06). Sub-parts are addressed as "<num>.<marker>", e.g. "3.1" or "3.a" (FR-103).

func Enumerate added in v0.2.0

func Enumerate(setMD string) ([]Exercise, error)

Enumerate parses a set's markdown into an ordered, addressable list of exercises with their sub-parts (FR-102). It returns ErrNoExercises when no heading is recognized (ERR-101).

func Select added in v0.2.0

func Select(exs []Exercise, tokens []string) ([]Exercise, error)

Select resolves selection tokens (e.g. "2", "3.1", "3.a") against the enumerated exercises, returning the chosen items in request order. A sub-part token yields a synthetic Exercise carrying just that part's statement. An unmatched token returns ErrUnknownExercise (ERR-102).

type QAOpts

type QAOpts struct {
	Count int    // target number of pairs; <=0 means DefaultQACount
	Scope string // optional free-text focus constraint
}

QAOpts parameterizes Q&A generation (FR-054/055).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL