Rewriter API

The rewriter API allows you to rewrite some text using the language model.

This API is compatible with the Writing assistance API proposal shipping with Google Chrome

Use the rewriter API to change the length of some text, change the formality, rephrase text or change it to use simpler words and concepts (i.e. explain like I'm 5)

const rewriter = await window.aibrow.rewriter.create({
  tone: "more-formal",
  length: "as-is"
})

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

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

Last updated