Skip to main content

Module render

Module render 

Source
Expand description

The text the model reads for a question, before tokenizing.

Only the compat family is here for now. It reproduces what Laya 0.3.7 feeds its tokenizer (build_sequence, render_options, render_criterion and serialize_state in laya/common.py, and Agent._to_internal), because a single differing space changes the ids. The native family renders differently (spec/06-input.md) and arrives with the native models.

Structs§

CompatText
The three pieces of text for one compat question. Every piece has had the tokenizer’s mask literal replaced by a space, so user text cannot forge a marker.

Constants§

NOUL_FALSE
The default noul descriptions Laya uses when a side is missing or empty.
NOUL_TRUE
See NOUL_FALSE.

Functions§

compat_options
Laya’s render_options, without the leading space and mask replacement.
compat_question
Renders a question the way Laya does. mask is the tokenizer’s mask literal, [MASK] for ModernBERT and <mask> for mmBERT.
compat_state
Laya’s serialize_state followed by the mask replacement.
criterion
Laya’s render_criterion: strings as they are, anything else as JSON with raw Unicode.