# LanguageDetector

## Static Methods

### <mark style="background-color:red;">static</mark> availability

`static async availability(options) =>`  [`AIModelAvailability`](https://docs.aibrow.ai/api-reference/types/aimodelavailability)&#x20;

Get the availability of the on-device language model.

| Options (optional)                                                                                                                 |
| ---------------------------------------------------------------------------------------------------------------------------------- |
| **options** `optional` [`LanguageDetectorCreateOptions`](https://docs.aibrow.ai/api-reference/types/languagedetectorcreateoptions) |

Returns the availability

### <mark style="background-color:red;">static</mark> compatibility <mark style="background-color:green;">extension</mark> <mark style="background-color:purple;">web</mark>

`static async compatibility(options) =>`  [`AIModelCoreCompatibility`](https://docs.aibrow.ai/api-reference/types/aimodelcorecompatibility)&#x20;

Get the availability of the on-device language model.

| Options (optional)                                                                                                                 |
| ---------------------------------------------------------------------------------------------------------------------------------- |
| **options** `optional` [`LanguageDetectorCreateOptions`](https://docs.aibrow.ai/api-reference/types/languagedetectorcreateoptions) |

Returns the compatibility

### <mark style="background-color:red;">static</mark> create

`static async create(options) =>` [`LanguageDetector`](https://docs.aibrow.ai/api-reference/aibrow/languagedetector)&#x20;

Creates a new embedding session

| Options (optional)                                                                                                                 |
| ---------------------------------------------------------------------------------------------------------------------------------- |
| **options** `optional` [`LanguageDetectorCreateOptions`](https://docs.aibrow.ai/api-reference/types/languagedetectorcreateoptions) |

Returns a new LanguageDetector session that can be prompted with the pre-provided configuration

***

## Properties

### gpuEngine <mark style="background-color:green;">extension</mark> <mark style="background-color:purple;">web</mark>

[`AIModelGpuEngine`](https://docs.aibrow.ai/api-reference/types/aimodelgpuengine)&#x20;

### dtype <mark style="background-color:green;">extension</mark> <mark style="background-color:purple;">web</mark>

[`AIModelDtype`](https://docs.aibrow.ai/api-reference/types/aimodeldtype)&#x20;

### flashAttention <mark style="background-color:green;">extension</mark> <mark style="background-color:purple;">web</mark>

`boolean`

### contextSize

`number`&#x20;

### inputQuota

`number`&#x20;

### expectedInputLanguages

`string[]`&#x20;

***

## Methods

### detect

`async (input, options) =>` [`LanguageDetectorDetectResult`](https://docs.aibrow.ai/api-reference/types/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
