← All models · Phi-3.5-mini

use case · practical

Practical: text → structured JSON

The most shippable LLM trick: extract clean, typed data from messy human text. Paste a note, email, or message and Phi-3.5-mini returns strict JSON matching a schema — using WebLLM's JSON mode so the output always parses, and a model strong enough to get the fields right. All on-device, so the source text (often sensitive) never leaves.

The JSON streams here, then is parsed and pretty-printed.

How JSON mode helps

Passing response_format: { type: "json_object" } constrains WebLLM's sampler to emit only tokens that keep the output valid JSON — so you never get a stray sentence wrapped around the object. Combined with a schema in the prompt and a capable model, extraction becomes reliable enough to drop straight into a form or an API call, entirely on-device.

← Basics · Phi-3.5-mini · Next: Wild →