Provide more context to your prompts

With the context option, you can provide additional information to the AI model to help it generate more relevant content. This can be useful when you want to generate content that is more aligned with the context of the conversation.

Context option

Context can be provided in two formats, text and url. The text format is used to provide additional text context to the AI model, while the url format is used to provide a URL context.

URL requirements

The url provided must be a valid URL that is accessible by Tiptap Content AI. This is useful when you want to provide additional context to the AI model that is referencing a third-party source.

// Steams the response as rich text into the editor
editor
  .chain()
  .aiTextPrompt({
    text: 'What does Alice do for a living?',
    stream: true,
    format: 'rich-text',
    context: [
      { type: 'text', text: 'John & Alice are a software engineers.' },
      { type: 'url', url: 'https://company.example.com/team' },
    ],
  })
  .run()