Summarizer

Static Methods

static availability

static async availability(options) => AIModelAvailability

Get the availability of the on-device language model.

Options (optional)

options optional SummarizerCreateOptions

Returns the availability

static compatibility extension web

static async compatibility(options) => AIModelCoreCompatibility

Get the availability of the on-device language model.

Options (optional)

options optional SummarizerCreateOptions

Returns the compatibility

static create

static async create(options) => Summarizer

Creates a new embedding session

Options (optional)

options optional SummarizerCreateOptions

Returns a new Summarizer session that can be prompted with the pre-provided configuration


Properties

gpuEngine extension web

AIModelGpuEngine

dtype extension web

AIModelDtype

flashAttention extension web

boolean

contextSize

number

inputQuota

number

repeatPenalty extension web

number

sharedContext

string

format

SummarizerFormat

length

SummarizerLength

type

SummarizerType

expectedInputLanguages

string[]

expectedContextLanguages

string[]


Methods

summarize

async (input, options) => string

See summarizeStreaming

summarizeStreaming

(input, options) => ReadableStream

This prompts the model to rewrite the given input and session options.

Input

A stringcontaining the text to rewrite

Options (optional)

signal optional AbortSignal

context optional string

Returns a readable stream that updates each time new tokens are available from the language model

measureInputUsage

async (input, options) => number

Measures the prompt usage of the input

Input

A string

Options (optional)

signal optional AbortSignal

Returns prompt usage based on the input

Last updated