LanguageModel
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 LanguageModel session that can be prompted with the pre-provided configuration
boolean
number
number
number
number
number
number
number
async (input, options) => string
(input, options) => ReadableStream
This prompts the language model with a continuation of the conversation. Internally, the input is appended to the set of messages in the language model's context window. Older messages outside of the language model's context window are automatically discarded.
Either a string
, single prompt or array of prompts such as
signal optional AbortSignal
responseConstrains optional object
Returns a readable stream that updates each time new tokens are available from the language model
async (input) =>
void
Appends a message to the conversation without prompting the model
A string
async (input, options) =>
number
Measures the prompt usage of the input
A string
signal optional AbortSignal
Returns prompt usage based on the input
options optional
options optional
options optional
See