Writer

Static Methods

static availability

static async availability(options) => AIModelAvailability

Get the availability of the on-device language model.

Options (optional)

options optional WriterCreateOptions

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 WriterCreateOptions

Returns the compatibility

static create

static async create(options) => Writer

Creates a new embedding session

Options (optional)

options optional WriterCreateOptions

Returns a new Writer 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

tone

WriterTone

format

WriterFormat

length

WriterLength

expectedInputLanguages

string[]

expectedContextLanguages

string[]


Methods

write

async (input, options) => string

See writeStreaming

writeStreaming

(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