lang_tools.llm.tutor
¶
TutorResponseChain: produce a correction + conversation continuation.
Classes:
-
ConversationBlock–Tutor's conversation continuation.
-
CorrectionBlock–Tutor's correction block.
-
ErrorDetail–Structured grammar / vocabulary error.
-
TutorInput–Inputs to
TutorResponseChain. -
TutorOutput–Outputs from
TutorResponseChain.
Functions:
-
build_tutor_chain–Build a tutor response chain wired to
chat_config.
ConversationBlock
¶
CorrectionBlock
¶
Bases: BaseModel
Tutor's correction block.
Attributes:
-
content(str) –Correction text in the target language.
-
translation(str) –Translation of the correction text.
-
errors(list[ErrorDetail]) –Structured list of individual errors.
ErrorDetail
¶
TutorInput
¶
Bases: BaseModelKwargs
Inputs to TutorResponseChain.
Attributes:
-
topic(str) –Conversation topic.
-
language(str) –ISO 639-1 target language code.
-
user_message(str) –Latest user message.
-
history(list[TutorMessage]) –Prior
TutorMessages. -
difficulty_level(str) –"beginner"/"intermediate"/"advanced".
TutorOutput
¶
Bases: BaseModel
Outputs from TutorResponseChain.
Attributes:
-
correction(CorrectionBlock) –Correction block (may be empty when no errors).
-
conversation(ConversationBlock) –Conversation continuation block.
build_tutor_chain
¶
build_tutor_chain(
chat_config: ChatConfig,
*,
base_prompt_fol: Path | None = None,
version: str = "auto",
) -> StructuredLLMChain[TutorInput, TutorOutput]
Build a tutor response chain wired to chat_config.