Translator
Last updated
Last updated
static async availability(options) =>
Get the availability of the on-device language model.
Returns the availability
static async compatibility(options) =>
Get the availability of the on-device language model.
Returns the compatibility
static async create(options) =>
Creates a new embedding session
Returns a new Translator session that can be prompted with the pre-provided configuration
boolean
number
number
number
string
string
async (input, options) => string
(input, options) => ReadableStream
This prompts the language model to translate the provided text. The returned stream should contain the translation
A string
to be translated
signal optional AbortSignal
Returns a readable stream that updates each time new tokens are available from the language model
async (input, options) =>
number
Measures the prompt usage of the input
A string
signal optional AbortSignal
Returns prompt usage based on the input
options
options
options
See