LanguageDetector
Static Methods
static availability
static async availability(options) =>
AIModelAvailability
Get the availability of the on-device language model.
options optional
LanguageDetectorCreateOptions
Returns the availability
static compatibility extension web
static async compatibility(options) =>
AIModelCoreCompatibility
Get the availability of the on-device language model.
options optional
LanguageDetectorCreateOptions
Returns the compatibility
static create
static async create(options) =>
LanguageDetector
Creates a new embedding session
options optional
LanguageDetectorCreateOptions
Returns a new LanguageDetector 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
expectedInputLanguages
string[]
Methods
detect
async (input, options) =>
LanguageDetectorDetectResult
[]
This prompts the language model to detect which language is being used in the input text
A string
signal optional AbortSignal
Returns an array of detection results 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