Content AI editor commands
The Content AI for Tiptap Editor includes a set of preconfigured commands that you can integrate into your rich text editor. These commands allow you to adjust text tone, complete text, generate images, and more, enhancing your editor's functionality.
To see how these commands are used, check out the examples on the overview page.
Most text commands
Most of the text commands accept the same options and their usage is similar. The following example demonstrates how to use the aiBloggify
command:
editor.chain().focus().aiBloggify(options: TextOptions)
aiAdjustTone
// Tone: 'default' | 'academic' | 'business' | 'casual' | 'childfriendly' | 'confident' | 'conversational' | 'creative' | 'emotional' | 'excited' | 'formal' | 'friendly' | 'funny' | 'humorous' | 'informative' | 'inspirational' | 'memeify' | 'narrative' | 'objective' | 'persuasive' | 'poetic' | string
editor.chain().focus().aiAdjustTone(tone: Tone, options: TextOptions).run()
aiTranslate
Translates the selected text content into the given output language.
It accepts two letter ISO 639-1 language codes.
// Language: 'en' | 'de' | 'nl' | ...
editor.chain().focus().aiTranslate(language: Language, options: TextOptions).run()
Text command options
On every command which supports TextOptions
, you’re able to specify the following options:
Setting | Type | Default | Definition |
---|---|---|---|
modelName | see Supported text models | gpt-3.5-turbo | The model used at OpenAI |
format | 'rich-text' | 'plain-text' | plain-text | Determines the format of how the model should respond |
stream | boolean | false | Should the command stream characters to the editor? It’s like the typewriter behavior in ChatGPT. This requires the newest extension version! |
insertAt | undefined | number | {from: number; to: number} | undefined | Where to insert the response into the editor, if undefined the response will be inserted at the current selection. If a number, the response will be inserted at that position. If an object it will replace that range. |
language | string (e.g. en , de ) | null | Although we do our best to prompt OpenAI for a response in the language of the input, sometimes it’s better to define it yourself. |
tone | string | null | A voice of tone the response should be transformed to |
textLength | number | undefined | The number of textLengthUnit s the AI should respond with (e.g. the 3 in "3 paragraphs") |
textLengthUnit | 'paragraphs' | 'words' | 'characters' | undefined | The unit of textLength s the AI should respond with (e.g. the paragraphs in "3 paragraphs") |
collapseToEnd | boolean | true | Whether the cursor should be set to the end after the operation or the insertion should get selected. |
context | Array<{ type: 'text', text: string} | { type: 'url', url: string }> | [] | Context to provide the model for generating a Response. |
text | string | undefined | An optional message to have the model respond to |
insert | boolean | true | Allows disabling inserting content directly into the editor |
append | boolean | true | If true , the response will be appended to the end of the current selection. If false , the response will replace the current selection. |
Unfortunately the combination of tone and language sometimes leads to responses which are not in the desired language.
Supported text models
We currently support the following OpenAI chat models:
gpt-4o
gpt-4o-2024-05-13
gpt-4
gpt-4-turbo-preview
gpt-4-0125-preview
gpt-4-1106-preview
gpt-4-0613
gpt-4-32k
gpt-4-32k-0613
gpt-3.5-turbo-0125
gpt-3.5-turbo
gpt-3.5-turbo-1106
gpt-3.5-turbo-16k
Choose the right Model
When configuring the Tiptap AI extension, consider the specific needs of your application:
- For Cost-Effective Operations: Opt for GPT-3 or DALL-E 2 if the primary concern is budget and the tasks do not demand the most advanced capabilities.
- For Advanced Requirements: Choose GPT-4o or DALL-E 3 when your application requires the highest level of language understanding or image generation quality, and budget is less of a constraint.
The Tiptap AI extension's flexible configuration allows you to tailor the AI integration to match your specific requirements and budgetary considerations.
Note: The pricing details are not provided here due to variability and the need for up-to-date information. It's recommended to refer to the official OpenAI pricing page for the latest figures.