Skip to content

lang_tools.llm.greeting

GreetingGeneratorChain: open a conversational tutor session.

Classes:

Functions:

GreetingInput

Bases: BaseModelKwargs

Inputs to GreetingGeneratorChain.

Attributes:

  • topic (str) –

    Topic the conversation will revolve around.

  • language (str) –

    ISO 639-1 target language code.

  • difficulty_level (str) –

    "beginner" / "intermediate" / "advanced".

GreetingOutput

Bases: BaseModel

Outputs from GreetingGeneratorChain.

Attributes:

  • greeting (str) –

    Greeting text in the target language.

  • translation (str) –

    Translation in the user's language.

build_greeting_chain

build_greeting_chain(
    chat_config: ChatConfig,
    *,
    base_prompt_fol: Path | None = None,
    version: str = "auto",
) -> StructuredLLMChain[GreetingInput, GreetingOutput]

Build a greeting generator chain wired to chat_config.

Source code in src/lang_tools/llm/greeting.py
def build_greeting_chain(
    chat_config: ChatConfig,
    *,
    base_prompt_fol: Path | None = None,
    version: str = "auto",
) -> StructuredLLMChain[GreetingInput, GreetingOutput]:
    """Build a greeting generator chain wired to `chat_config`."""
    return StructuredLLMChain(
        chat_config=chat_config,
        prompt_str=load_prompt(
            "greeting_generator",
            base_prompt_fol=base_prompt_fol,
            version=version,
        ),
        input_model=GreetingInput,
        output_model=GreetingOutput,
    )