Configure Content AI

The Content AI extension for Tiptap accepts different settings to configure the global behavior of the extension and the commands.

SettingTypeDefaultDefinition
appIdstring''Your Application ID which can be obtained by visiting the AI settings in Tiptap Cloud
tokenstring''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
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.
onLoading(context: { editor: Editor, action: TextAction | 'image', isStreaming: boolean }) => voidundefinedCallback for when the AI has begun generating a response.
onSuccess(context: { editor: Editor, action: TextAction | 'image', isStreaming: boolean, response: string }) => voidundefinedCallback for when the AI has successfully finished generating a response.
onChunk(context: { editor: Editor, action: TextAction | 'image', isStreaming: boolean, response: string, chunk: string }) => voidundefinedCallback for when a chunk of the response is generated. chunk being the new string partial response being the generated response so far (including the chunk)
onError(error: Error, context: { editor: Editor, action: TextAction | 'image', isStreaming: boolean}) => voidundefinedCallback for when an error occurs while generating a response.
showDecorationsbooleantrueIf false, will not attempt to decorate AI suggestions in streaming mode. This reduces your ability to style suggestions but can fix issues with undo history