Skip to main content

Module chat

Module chat 

Source
Expand description

Chat-template engine for RLX runners.

Replaces LlamaModel::apply_chat_template (llama-cpp-4) end-to-end. Two sources: an inline Jinja2 string, or tokenizer.chat_template (and tokenizer.ggml.chat_template) read directly from a GGUF file’s metadata. Rendering uses minijinja.

BOS/EOS strings are looked up via tokenizer.ggml.bos_token_id / eos_token_id against the tokenizer.ggml.tokens array (the GGUF convention).

Structs§

ChatMessage
One chat turn. role is conventionally one of system, user, assistant, tool — but templates can accept anything.
ChatTemplate
Compiled Jinja chat template + BOS/EOS strings.

Enums§

ChatTemplateSource
Where a ChatTemplate was loaded from. Useful for diagnostics and for letting a caller round-trip the source string into config.

Functions§

auto_chat_template
Convenience for the M3 auto-dispatch family: load the chat template