API Reference
BrowserAI Class

BrowserAI Class

The main class that provides access to all AI capabilities.

Constructor

const browserAI = new BrowserAI();

Creates a new instance of the BrowserAI class. No parameters required.

loadModel(modelIdentifier: string, options?: ModelOptions)

Loads an AI model for use.

await browserAI.loadModel('smollm2-135m-instruct', {
  quantization: 'q4f16_1',
  onProgress: (progress) => console.log(`Loading: ${progress.progress}%`)
});

Parameters

ParameterTypeRequiredDescription
modelIdentifierstringYesName of the model to load
optionsModelOptionsNoConfiguration options

ModelOptions

OptionTypeDefaultDescription
quantizationstring'q4f16_1'Model quantization level
onProgressfunction-Progress callback
onCompletefunction-Completion callback
onErrorfunction-Error callback

Returns

Promise<void>