AiBrow
  • Welcome
  • AiBrow web API
    • Getting started
    • Feature comparison
  • AiBrow Extension
    • Getting started
    • Web polyfill
    • Helping users install the AiBrow extension
    • Remove the on-device helper or models
  • Examples
    • CoreModel API
    • Embedding API
    • LanguageDetector API
    • LanguageModel API
    • Rewriter API
    • Summarizer API
    • Translator API
    • Writer API
    • Using different models
    • Model download feedback
    • Getting JSON output
  • API Reference
    • AI
      • AiBrowAI
      • BrowserAI
      • WebAI
    • AiBrow
      • CoreModelFactory
        • CoreModel
        • CoreModelCapabilities
      • EmbeddingFactory
        • Embedding
        • EmbeddingCapabilities
      • LanguageDetectorFactory
        • LanguageDetector
        • LanguageDectectorCapabilities
      • LanguageModelFactory
        • LanguageModel
        • LanguageModelCapabilities
      • RewriterFactory
        • Rewriter
        • RewriterCapabilities
      • SummarizerFactory
        • Summarizer
        • SummarizerCapabilities
      • TranslatorFactory
        • Translator
        • TranslatorCapabilities
      • WriterFactory
        • Writer
        • WriterCapabilities
    • Types
      • AICapabilityAvailability
      • AICapabilityGpuEngine
      • AICreateMonitor
      • AILanguageDetectorDetectResult
      • AIRewriterFormat
      • AIRewriterLength
      • AIRewriterTone
      • AISummarizerFormat
      • AISummarizerLength
      • AISummarizerType
      • AIWriterFormat
      • AIWriterLength
      • AIWriterTone
      • AIModelDtype
    • Models
Powered by GitBook
On this page
  1. Examples

Using different models

PreviousWriter APINextModel download feedback

Last updated 5 months ago

Unlike the built-in window.ai API, AiBrow has support for multiple models. It ships with a default model, but you can request that your page use a different model. When a model is downloaded it becomes available to all sites on the machine meaning it only needs to be downloaded once.

Specifying a model can be useful if a specific model provides better responses to the types of prompts you're using.

Look at the current list of , or !

Use a different model

All the top-level AiBrow APIs support requesting a model through the create call.

// All the top level APIs support the model field, such as
//   * window.aibrow.languageModel({ ... })
//   * window.aibrow.summarizer.create({ ... })
//   * window.aibrow.writer.create({ ... })
const session = await window.aibrow.coreModel.create({
  model: "phi-3-5-mini-instruct-q4-k-m"
})

const stream = await session.promptStreaming("write a long poem");
for await (const chunk of stream) {
  console.log(chunk)
}
supported models
request more