Skip to main content

Module render

Module render 

Source
Expand description

Local chat-template rendering.

The serving runtime’s own template is the preferred source (/apply-template on llama.cpp), but runtimes such as vLLM expose no such endpoint. This module renders the same Jinja template locally with minijinja.

llama.cpp renders with the C++ minijinja plus Python-style string methods, which the Rust crate does not implement. Those methods are supplied through Environment::set_unknown_method_callback so a template written for transformers still renders here. python_string_methods mirrors CPython semantics, including treating the argument of strip/lstrip/rstrip as a set of characters rather than a prefix.

Structs§

LocalRenderer
A chat template rendered in-process.