Structured Output in the browser with Transformers.js 4.3
Transformers.js 4.3 adds structured output that constrains generation to a JSON schema or regex in the browser.
“it makes sure that every new token actually follows the structure that we want”
Hugging Face released Transformers.js 4.3 with a new NPM structured-output package that hooks into token generation to guarantee outputs conform to a JSON schema or regex. It brings constrained decoding to in-browser JS inference, a long-requested community feature, though it is an incremental developer-tooling update rather than a major industry signal.