mstar.utils.utf8_stream#
Decode a model’s text chunks without splitting characters.
Models with a byte-level detokenizer (Whisper, Cosmos3) send each token’s raw
bytes as its own text chunk, so one character can span two chunks, and
decoding each chunk on its own turns both halves into U+FFFD. Stdlib only:
the Python SDK imports this too. The Rust frontend’s twin is
rust/server/src/utf8.rs.
Functions
|
A whole response's text chunks as one string: join, then decode once. |
Classes
One text stream's incremental decoder: |