Content AI extension
Initialization
The integration into your editor instance is done like every other Tiptap extension. This is an example on how it could look like:
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 below)
}),
// … more extensions
]
})
Configuration
The extension accepts different global settings on configuration.
Setting | Type | Default | Definition |
---|---|---|---|
appId | string |
'' |
Your Application ID which can be obtained by visiting the AI settings in Tiptap Cloud |
token | string |
'' |
In order to authenticate against our AI backend service, you’ll need to generate a JWT (with HS256) using your JWT secret, which you also obtain in your team’s AI settings page |
autocompletion | boolean |
false |
Enables 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. |
autocompletionOptions | object |
{ 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. |