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
- Variables
- func Guide(ctx context.Context, eng engine.Engine, course, material string) (string, error)
- func QA(ctx context.Context, eng engine.Engine, course, material string, opts QAOpts) (string, error)
- func Solve(ctx context.Context, eng engine.Engine, course, material string, ...) (string, error)
- type Exercise
- type QAOpts
Constants ¶
const DefaultQACount = 10
DefaultQACount is applied when the learner does not specify a count (FR-054).
Variables ¶
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.
var ErrUnknownExercise = errors.New("unknown exercise")
ErrUnknownExercise signals a requested label that the set does not contain (ERR-102).
Functions ¶
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
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
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).