v148 · AI · JavaScript
Format Selector
The Summarizer API accepts format (plain-text, markdown) and length (short, medium, long) parameters. Pick a format and length, paste any text, and compare how the same content is summarised differently. The output shows the actual API call parameters alongside the result.
Summarizer options
Format
Length
Type
Choose format, length, and type — then click Summarise. The three parameters combine to produce dramatically different outputs from the same source text.
// Chrome 148: Summarizer API with format, length, and type
const summarizer = await self.ai.summarizer.create({
format: 'plain-text', // 'plain-text' | 'markdown'
length: 'medium', // 'short' | 'medium' | 'long'
type: 'tl;dr', // 'tl;dr' | 'key-points' | 'teaser' | 'headline'
sharedContext: 'This is a technical article about web APIs.',
});
const result = await summarizer.summarize(text);
console.log(result);
// For streaming output:
const stream = summarizer.summarizeStreaming(text);
for await (const chunk of stream) {
outputEl.textContent = chunk; // cumulative, not delta
}
see also
- Fast vs Quality — performance preference comparison
- Comment Stream — streaming summary
- Article Summarizer — document summarization
- Quality vs Speed Benchmark — benchmarking
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗