Files
leleka/crates/tokenizer/examples
Pavlo RatushnyiandClaude Sonnet 5.5 d661812b09 feat: add the gpt-oss tokenizer and the Harmony prompt renderer and parser (STRA-213)
leleka-tokenizer gains gguf_bpe: a byte-level BPE tokenizer built from the vocabulary in the GGUF file
(gpt2 model, gpt-4o pre-tokenizer), with special-token parsing that is off by default so user text cannot
forge markers, and a UTF-8-safe streaming decoder. Checked against llama.cpp's /tokenize on 67 strings: same
ids except the two documented differences (llama.cpp forges some Harmony markers from text; it splits
words at combining marks, which the o200k expression keeps together).

New leleka-harmony crate: render() reproduces the gpt-oss chat template (including its whitespace) and is
byte-identical to llama.cpp's /apply-template on ten conversations with many tool-schema shapes;
HarmonyParser turns generated tokens into reasoning, answer and tool-call events.

The oracle fixtures are test strings, token ids and rendered prompts only. The tokenizer oracle test needs
LELEKA_GPTOSS_GGUF and reports "skipped" without it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 19:08:24 +02:00
..