chromium/third_party/blink/renderer/modules/ai/ai_summarizer.idl

// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(crbug.com/356058864): Add explainer link

dictionary AISummarizerSummarizeOptions {
  DOMString context;
};

[
  Exposed=(Window,Worker),
  RuntimeEnabled=AISummarizationAPI
]
interface AISummarizer {
  [
    Measure,
    CallWith=ScriptState,
    RaisesException
  ]
  Promise<DOMString> summarize(DOMString input, optional AISummarizerSummarizeOptions options = {});
  [
    Measure,
    CallWith=ScriptState,
    RaisesException
  ]
  ReadableStream summarizeStreaming(DOMString input, optional AISummarizerSummarizeOptions options = {});
  [
    Measure,
    CallWith=ScriptState,
    RaisesException
  ]
  void destroy();

  [Measure]
  readonly attribute DOMString sharedContext;
  [Measure]
  readonly attribute AISummarizerType type;
  [Measure]
  readonly attribute AISummarizerFormat format;
  [Measure]
  readonly attribute AISummarizerLength length;
};