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

Writer API

PreviousTranslator APINextUsing different models

Last updated 6 months ago

The writer API allows you to generate some text using the language model.

This API is compatible with the shipping with Google Chrome

Use the writer API to generate textual explanations of structured data, expand pro/con lists, break through writer's block and create a first draft of blog articles.

const writer = await window.aibrow.writer.create({
  tone: "formal",
  length: "medium"
})

// Prompt the model and wait for the whole result to come back.
const result = await writer.write("An article comparing Vim vs Emacs as the best text editor")

// Prompt the model and stream the result:
const stream = await writer.writeStreaming("An article comparing Vim vs Emacs as the best text editor")
for await (const chunk of stream) {
  console.log(chunk)
}
Writing assistance API proposal