Skip to main content
Version: 0.9.0

mellea.formatters

Formatters for converting components into model-ready prompts.

Formatters translate Component objects into the prompt strings or chat message lists that inference backends consume. This package exports the abstract Formatter interface and three concrete implementations: ChatFormatter, which converts components into role-labelled chat messages; TemplateFormatter, which renders them through Jinja2 templates; and LLMONFormatter, which sends them to LLMON-trained models in the message fields their chat template turns into LLMON. Pass a formatter when constructing a FormatterBackend for your chosen model, or let the backend choose one with default_formatter.