demo · v148

Comment Stream

The motivating "summarise this comment" use case from the Writing Assistance APIs explainer. A stream of long-ish comments arrives; each one gets a TL;DR badge generated by the on-device Summarizer with performance: "fast". Toggle to "quality" and watch the latency change.

Heads up Origin trial. With the Summarizer API unavailable, the demo synthesises a deterministic TL;DR with a delay calibrated to match what fast vs quality would feel like in practice.

the code

// For "summarise this comment" — fast is the right pick.
const summariser = await Summarizer.create({
  type: "tldr",
  format: "plain-text",
  length: "short",
  performance: "fast",   // NEW in 148
});

const tldr = await summariser.summarize(commentBody);
attachBadge(comment, tldr);

// Switch to "quality" only for high-value, longer-form input.

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗