# Summarizer

## 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` [`SummarizerCreateOptions`](https://docs.aibrow.ai/api-reference/types/summarizercreateoptions) |

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` [`SummarizerCreateOptions`](https://docs.aibrow.ai/api-reference/types/summarizercreateoptions) |

Returns the compatibility

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

`static async create(options) =>` [`Summarizer`](https://docs.aibrow.ai/api-reference/aibrow/summarizer)

Creates a new embedding session

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

Returns a new Summarizer 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;

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

`number`&#x20;

### sharedContext

`string`&#x20;

### format

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

### length

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

### type

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

### expectedInputLanguages

`string[]`&#x20;

### expectedContextLanguages

`string[]`&#x20;

***

## Methods

### summarize

`async (input, options) => string`

See [summarizeStreaming](#summarizestreaming)

### summarizeStreaming

`(input, options) => ReadableStream`

This prompts the model to rewrite the given input and session options.

| Input                                    |
| ---------------------------------------- |
| A `string`containing the text to rewrite |

| Options (optional)                |
| --------------------------------- |
| **signal** `optional AbortSignal` |
| **context** `optional string`     |

Returns a readable stream that updates each time new tokens are available 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
