nemo_rl.data.chat_templates#

Module Contents#

Classes#

Functions#

find_rendered_message_content_span

Locate the same canonical nonempty content key on every model surface.

API#

class nemo_rl.data.chat_templates.COMMON_CHAT_TEMPLATES#
simple_role_header = <Multiline-String>#
passthrough_prompt_response#

“{% for message in messages %}{{ message[‘content’] }}{% endfor %}”

nemo_rl.data.chat_templates.find_rendered_message_content_span(
text: str,
content: str,
cursor: int = 0,
) → tuple[int, int, str] | None#

Locate the same canonical nonempty content key on every model surface.

Trimming the logical source before searching ensures templates preserving and trimming boundary whitespace share one coordinate origin. Callers must anchor cursor and the search surface to the corresponding logical turn. Interior whitespace is never changed.