LanguageDetector

Static Methods

static availability

static async availability(options) => AIModelAvailability

Get the availability of the on-device language model.

Options (optional)

Returns the availability

static compatibility extension web

static async compatibility(options) => AIModelCoreCompatibility

Get the availability of the on-device language model.

Options (optional)

Returns the compatibility

static create

static async create(options) => LanguageDetector

Creates a new embedding session

Options (optional)

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

expectedInputLanguages

string[]


Methods

detect

async (input, options) => LanguageDetectorDetectResult[]

This prompts the language model to detect which language is being used in the input text

Input

A string

Options (optional)

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

Input

A string

Options (optional)

signal optional AbortSignal

Returns prompt usage based on the input

Last updated