demo · v137 · origin trial
Data to Prose
From the explainer use-case list: “generate textual explanations of structured data” and “expand pro/con lists into comprehensive evaluations”. Paste a JSON object (e.g. a product spec, a pros/cons table, a calendar event) and the on-device Writer turns it into a paragraph in your chosen tone.
Heads up · origin trial / flagEnable
chrome://flags/#writer-api-for-gemini-nano plus the on-device model component. If the API isn't available, the demo falls back to a labelled message.probing…
structured input
—
generated prose
no output yet
the code
const data = {
product: "Brompton T-Line", price_gbp: 4490, weight_kg: 7.9,
pros: ["titanium frame", "ultra-light", "same fold as original"],
cons: ["very expensive", "single-speed", "no rear rack option"],
};
const writer = await Writer.create({
tone: "neutral",
format: "plain-text",
length: "medium",
sharedContext:
"You receive structured product data as JSON. " +
"Write an evenhanded review paragraph covering price, weight, " +
"and the pros/cons. Do NOT echo raw field names.",
});
const stream = await writer.writeStreaming(
"Data:\n" + JSON.stringify(data, null, 2)
);
for await (const c of stream) out.textContent += c;
see also
- Writer API — feature index
- Writer brief-to-prose demo
- Spec
- ChromeStatus entry