Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Summarizer API

Summarizer API

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

TheSummarizer API summarizes a given body of text via a browser's internal AI model (which may differ between browsers).

Concepts and usage

Writing a summary of a larger body of text is a common writing task, and one that AI is well-suited to. Typical use cases include:

  • Providing a summary of a full article so the reader can judge whether to read the whole thing.
  • Summarizing a meeting transcript so those joining the meeting late can get up to speed with what they've missed.
  • Summarizing a set of product reviews to quickly communicate overall sentiment.

The Summarizer API provides an asynchronous (Promise-based) mechanism for a website to feed a body of text into the browser's own internal AI model and request that it returns a summary of the text based on specified options.

This is done using the functionality made available by theSummarizer interface, in a two-step process:

  1. Create aSummarizer object instance using theSummarizer.create() static method, specifying options for what kind of summary you want written. Options include length, type (for example, "tldr" or key points), format (plain text or markdown), and input and output languages.

    Note:If you want to check whether the browser AI model is able to support your preferences, you can do so with theSummarizer.availability() static method.

  2. Run theSummarizer.summarize() instance method to request the summary.

You can cancel a pendingcreate() orsummarize() operation using anAbortController.

After aSummarizer instance has been created, you can release its assigned resources and stop any further activity by calling itsSummarizer.destroy() method. You are encouraged to do this after you've finished with theSummarizer object as it can consume a lot of resources.

SeeUsing the Summarizer API for a walkthrough of how the API works.

Interfaces

SummarizerExperimental

Contains all the functionality for the Summarizer API, including checking AI model availability, creating a newSummarizer instance, using it to generate a new summary, and more.

HTTP headers

Permissions-Policy; thesummarizer directive

Controls access to the Summarizer API. Where a policy specifically disallows the use of the Summarizer API, any attempts to call the API's methods will fail with aNotAllowedErrorDOMException.

Security considerations

The specification requires that a user has recently interacted with the page when creatingSummarizer objects (transient user activation is required).

In addition, the specification controls access to the API viasummarizerPermissions-Policy directives.

Examples

For a full example, seeUsing the Summarizer API.

Specifications

Specification
Writing Assistance APIs
# summarizer-api

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp