Autocompletion in Content AI

When you enable autocompletion, the system uses a segment of the text you've already written to generate suggestions.

To trigger autocompletion, simply press the Tab key while writing. Press Tab again to accept the suggested completion.

If you want to see it in action, hit the Tab key after any line of text in this demo.

Configure autocompletion

When you're integrating the Content AI extension you can specify that you want to enable autocompletion, how the autocompletion feature should behave and what context it should consider.

SettingTypeDefaultDefinition
autocompletionbooleanfalseEnables the autocompletion feature. When writing text, just hit Tab to trigger the autocompletion and another Tab to accept the completion. We’re using a portion of your already written text to build a prompt for OpenAI.
autocompletionOptionsobject{ trigger: 'Tab', inputLength: 4000, modelName: 'gpt-3.5-turbo' }Defines the trigger and length of text used to generate autocompletion suggestion. You can also choose the OpenAI model to run the autocompletion task.

To see all other Content AI extension configuration option, head over to the install page.

Enable autocompletion

import { useEditor } from '@tiptap/react'
import StarterKit from '@tiptap/starter-kit'
import Ai from '@tiptap-pro/extension-ai'

const editor = useEditor({
  extensions: [
    StarterKit,
    Ai.configure({
      appId: 'APP_ID_HERE',
      token: 'TOKEN_HERE',
      autocompletion: true,
      // … other options (see above)
    }),
    // … more extensions
  ],
})