Writer
Static Methods
static availability
static async availability(options) => AIModelAvailability
Get the availability of the on-device language model.
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 WriterCreateOptions
Returns the compatibility
static create
static async create(options) => Writer
Creates a new embedding session
options optional WriterCreateOptions
Returns a new Writer session that can be prompted with the pre-provided configuration
Properties
gpuEngine extension web
dtype extension web
flashAttention extension web
boolean
contextSize
number
inputQuota
number
repeatPenalty extension web
number
sharedContext
string
tone
format
length
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.
A stringcontaining the text to rewrite
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
A string
signal optional AbortSignal
Returns prompt usage based on the input
Last updated