lang_tools.llm.conversation
¶
ConversationGeneratorChain: generate a multi-turn bilingual dialogue.
Classes:
-
ConversationInput–Inputs to
ConversationGeneratorChain. -
ConversationOutput–Outputs from
ConversationGeneratorChain. -
ConversationTurn–One turn in a generated conversation.
Functions:
-
build_conversation_chain–Build a conversation generator chain wired to
chat_config.
ConversationInput
¶
Bases: BaseModelKwargs
Inputs to ConversationGeneratorChain.
Attributes:
-
topic(str) –Topic prompt for the dialogue.
-
language(str) –ISO 639-1 code of the target language.
-
difficulty_level(str) –"beginner"/"intermediate"/"advanced". -
num_turns(int) –How many turns the dialogue should contain.
-
max_sentences_per_turn(int) –Per-turn sentence cap.
-
sample_conversation(str | None) –Optional few-shot example to calibrate level.
ConversationOutput
¶
Bases: BaseModel
Outputs from ConversationGeneratorChain.
Attributes:
-
turns(list[ConversationTurn]) –Generated dialogue turns.
ConversationTurn
¶
build_conversation_chain
¶
build_conversation_chain(
chat_config: ChatConfig,
*,
base_prompt_fol: Path | None = None,
version: str = "auto",
) -> StructuredLLMChain[
ConversationInput, ConversationOutput
]
Build a conversation generator chain wired to chat_config.