Generation & teachers¶
steerkit.teacher.TeacherModel
¶
steerkit.teacher.APITeacher
¶
Bases: TeacherModel
steerkit.teacher.LocalHFTeacher
¶
Bases: TeacherModel
Teacher using a locally loaded HF causal-LM.
Loads the model lazily (only on first .complete() call) so that constructing the
object is cheap, and so a user can hand a LocalHFTeacher to code that may end up
not actually generating (e.g. tests that mock it).
steerkit.teacher.make_teacher(spec)
¶
Parse a teacher spec string and return a TeacherModel.
Supported forms
'anthropic:
steerkit.generate.generate_pairs_for_concept(concept, *, teacher, neutral_reference, seed_prompts=None, max_pairs=None, temperature=0.7, max_tokens=512, on_failure=None)
¶
Generate contrast pairs for a single concept against a shared neutral.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
concept
|
Concept
|
the Concept whose |
required |
teacher
|
TeacherModel
|
the TeacherModel to call. |
required |
neutral_reference
|
str
|
the group-level neutral instruction (e.g. "respond in a plain, neutral tone"). |
required |
seed_prompts
|
list[str] | None
|
list of user prompts to generate over. Defaults to DEFAULT_SEED_PROMPTS. |
None
|
max_pairs
|
int | None
|
stop after producing this many successful pairs. None = use all seed_prompts. |
None
|
temperature
|
float
|
sampling temperature passed through to teacher.complete. |
0.7
|
max_tokens
|
int
|
max output tokens passed through to teacher.complete. |
512
|
on_failure
|
Callable[[str, str], None] | None
|
optional callback invoked with (prompt, raw_text) on parse failure. |
None
|
Returns the list of pairs produced (length <= len(seed_prompts)) and a GenerationStats.
steerkit.generate.generate_pairs_for_group(group, *, teacher, seed_prompts=None, max_pairs_per_concept=None, temperature=0.7, max_tokens=512, on_failure=None)
¶
Generate contrast pairs for every concept in a group, attaching them in-place.
Returns a dict mapping concept.name -> GenerationStats.