Skip to content

Editorial review: Document the Summarizer API #39263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
May 21, 2025

Conversation

chrisdavidmills
Copy link
Contributor

@chrisdavidmills chrisdavidmills commented Apr 24, 2025

Description

Chrome 138 onwards supports the Summarizer API; the relevant ChromeStatus entry says 139, but I've been told this is incorrect.

Note

During review, you may need to enable the chrome://flags/#summarization-api-for-gemini-nano flag to get the demos running in Chrome.

Specifically, this PR adds:

  • A Summarizer API landing page
  • A usage guide
  • A reference for the Summarizer interface.
  • A reference for the CreateMonitor interface.

Motivation

Additional details

Related issues and pull requests

@chrisdavidmills chrisdavidmills requested review from a team as code owners April 24, 2025 14:13
@chrisdavidmills chrisdavidmills requested review from sideshowbarker and pepelsbey and removed request for a team April 24, 2025 14:13
@chrisdavidmills chrisdavidmills marked this pull request as draft April 24, 2025 14:13
@github-actions github-actions bot added Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed labels Apr 24, 2025
Copy link
Contributor

github-actions bot commented Apr 24, 2025

Preview URLs (21 pages)
Flaws (7)

Note! 17 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/CreateMonitor
Title: CreateMonitor
Flaw count: 2

  • macros:
    • Can't resolve /en-US/docs/Web/API/LanguageDetector/create_static
    • Can't resolve /en-US/docs/Web/API/Translator/create_static

URL: /en-US/docs/Web/API/Summarizer/summarize
Title: Summarizer: summarize() method
Flaw count: 1

  • macros:
    • Can't resolve /en-US/docs/Web/API/Summarize/inputQuota

URL: /en-US/docs/Web/API/Summarizer/summarizeStreaming
Title: Summarizer: summarizeStreaming() method
Flaw count: 1

  • macros:
    • Can't resolve /en-US/docs/Web/API/Summarize/inputQuota

URL: /en-US/docs/Web/HTTP/Reference/Headers/Permissions-Policy/summarizer
Title: Permissions-Policy: summarizer
Flaw count: 3

  • unknown:
    • No generic content config found
    • no blog root
    • no blog root
External URLs (31)

URL: /en-US/docs/Web/API/CreateMonitor
Title: CreateMonitor


URL: /en-US/docs/Web/API/CreateMonitor/downloadprogress_event
Title: CreateMonitor: downloadprogress event


URL: /en-US/docs/Web/API/Summarizer
Title: Summarizer


URL: /en-US/docs/Web/API/Summarizer_API
Title: Summarizer API


URL: /en-US/docs/Web/API/Summarizer_API/Using
Title: Using the Summarizer API


URL: /en-US/docs/Web/API/Summarizer/availability_static
Title: Summarizer: availability() static method


URL: /en-US/docs/Web/API/Summarizer/create_static
Title: Summarizer: create() static method


URL: /en-US/docs/Web/API/Summarizer/destroy
Title: Summarizer: destroy() method


URL: /en-US/docs/Web/API/Summarizer/expectedContextLanguages
Title: Summarizer: expectedContextLanguages property


URL: /en-US/docs/Web/API/Summarizer/expectedInputLanguages
Title: Summarizer: expectedInputLanguages property


URL: /en-US/docs/Web/API/Summarizer/format
Title: Summarizer: format property


URL: /en-US/docs/Web/API/Summarizer/inputQuota
Title: Summarizer: inputQuota property


URL: /en-US/docs/Web/API/Summarizer/length
Title: Summarizer: length property


URL: /en-US/docs/Web/API/Summarizer/measureInputUsage
Title: Summarizer: measureInputUsage() method


URL: /en-US/docs/Web/API/Summarizer/outputLanguage
Title: Summarizer: outputLanguage property


URL: /en-US/docs/Web/API/Summarizer/sharedContext
Title: Summarizer: sharedContext property


URL: /en-US/docs/Web/API/Summarizer/summarize
Title: Summarizer: summarize() method


URL: /en-US/docs/Web/API/Summarizer/summarizeStreaming
Title: Summarizer: summarizeStreaming() method


URL: /en-US/docs/Web/API/Summarizer/type
Title: Summarizer: type property

(comment last updated: 2025-05-21 15:33:41)

chrisdavidmills and others added 3 commits April 24, 2025 15:15
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added size/xl [PR only] >1000 LoC changed and removed size/m [PR only] 51-500 LoC changed labels Apr 25, 2025
@github-actions github-actions bot added the Content:HTTP HTTP docs label Apr 27, 2025
Copy link

@alexandrascript alexandrascript left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answering some editorial questions

@chrisdavidmills chrisdavidmills marked this pull request as ready for review May 5, 2025 13:49
@chrisdavidmills chrisdavidmills requested a review from a team as a code owner May 5, 2025 13:49
@chrisdavidmills chrisdavidmills requested review from bsmth and removed request for a team May 5, 2025 13:49
@chrisdavidmills chrisdavidmills changed the title Document the Summarizer API Technical review: Document the Summarizer API May 6, 2025
@bsmth bsmth removed the request for review from sideshowbarker May 6, 2025 09:50

Next, we use the {{domxref("EventTarget.addEventListener()")}} method to listen to two sets of events:

- `click` events on the `<button>` element; when the button is clicked, the `handleSubmission()` function is called (we're not doing a real form `submit`, as they are disabled in the MDN live example embeds for security purposes).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `click` events on the `<button>` element; when the button is clicked, the `handleSubmission()` function is called (we're not doing a real form `submit`, as they are disabled in the MDN live example embeds for security purposes).
- `click` events on the `<button>` element; when the button is clicked, the `handleSubmission()` function is called (we're not doing a real form `submit`).

You can do this with "allow-forms", like:

{{embedlivesample("example name", "400px", , , , , "allow-forms")}}

See https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Page_structures/Live_samples#sandbox

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I've updated the code and wording to use the real submit.


The rendered exaple looks like this:

{{EmbedLiveSample("summarizer-example", "100%", "400px")}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

750px is tall enough for me to get rid of scroll:

Suggested change
{{EmbedLiveSample("summarizer-example", "100%", "400px")}}
{{EmbedLiveSample("summarizer-example", "100%", "750px")}}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And like this for enabling forms, I believe:

{{EmbedLiveSample("summarizer-example", , "750px", , , , , "allow-forms")}}

@bsmth
Copy link
Member

bsmth commented May 21, 2025

Thanks, @chrisdavidmills - all done if you want a look 👀

chrisdavidmills and others added 21 commits May 21, 2025 11:15
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Co-authored-by: Brian Smith <brian@smith.berlin>
Copy link
Member

@bsmth bsmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from me, thanks! 👍🏻

Co-authored-by: Brian Smith <brian@smith.berlin>
@chrisdavidmills chrisdavidmills merged commit 683890a into mdn:main May 21, 2025
9 checks passed
@chrisdavidmills chrisdavidmills deleted the writing-assistance-apis branch May 21, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTTP HTTP docs Content:WebAPI Web API docs size/xl [PR only] >1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants