This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The create() static method of the Summarizer interface creates a new Summarizer instance from which to generate summaries.
Note: The create() method requires transient activation, that is, it must be invoked in response to a user action such as a mouse click or button press.
Summarizer.create() Summarizer.create(options)
options OptionalAn object specifying configuration options for the Summarizer. Possible values include:
expectedInputLanguagesAn array of strings specifying the expected languages of the input text, which should be valid BCP 47 language tags (as specified in RFC 5646). Defaults to ["en"].
expectedContextLanguagesAn array of strings specifying the expected languages of any provided context strings (either the sharedContext passed to the Summarizer, or a context specified during a summarize() or summarizeStreaming() call), which should be valid BCP 47 language tags. Defaults to ["en"].
formatAn enumerated value specifying the text format you want summaries returned in. Defaults to markdown.
lengthAn enumerated value specifying the relative length for the generated summaries. Defaults to short.
monitorA callback function with a CreateMonitor argument that enables monitoring download progress of the AI model.
outputLanguageA string specifying the expected language of summaries generated by the Summarizer, which should be a valid BCP 47 language tag. Defaults to en.
A sharedContext string describing the context the pieces of text to summarize are being used in, which helps the Summarizer generate more suitable summaries.
signalAn AbortSignal object instance, which allows the create() operation to be aborted via the associated AbortController.
typeAn enumerated value specifying the type of summary you want this Summarizer to generate. Defaults to key-points.
A Promise that fulfills with a Summarizer object instance.
NotAllowedError DOMException
Thrown if usage of the Summarizer API is blocked by a summarizer Permissions-Policy.
NotSupportedError DOMException
Thrown if any of the language tags specified in expectedContextLanguages, expectedInputLanguages, or outputLanguage are invalid, or not supported.
OperationError DOMException
General-purpose exception thrown if Summarizer creation failed for any other reason.
Summarizer creationconst summarizer = await Summarizer.create({
sharedContext:
"A general summary to help a user decide if the text is worth reading",
type: "tldr",
length: "short",
format: "markdown",
expectedInputLanguages: ["en-US"],
outputLanguage: "en-US",
});
| Specification |
|---|
| Writing Assistance APIs> # dom-summarizer-create> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
create_static |
138Availability may be subject to geographical restrictions. |
138 | No | 122Availability may be subject to geographical restrictions. |
No | No | No | No | No | No | No | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/create_static