Transformers.js v4.3: Structured Output in the browser
Transformers.js v4.3 introduces structured output, allowing developers to force LLMs to generate output that strictly adheres to a JSON Schema or regex. This solves the problem of unreliable LLM output formats and is achieved by hooking into the logits processor.
Read article