• Portretfoto van Esper Kuijs
    Esper Kuijs

Bringing AI to Wagtail's text editor

Since the release of ChatGPT, content editing has undergone a significant transformation for many individuals. In addition to content generation, large language models (LLMs) have excelled in tasks such as text analysis and rewriting. This includes fixing spelling errors, simplifying language, or adjusting tone to cater to specific audiences. The exciting news is that these features can now be integrated into your Wagtail editor, even if your organization adheres to strict privacy policies.

What is Wagtail AI?

Wagtail AI was introduced as an extra feature during the ChatGPT buzz. It was kickstarted by Tom Usher and is backed by Torchbox, the team behind Wagtail. Its main aim is to assist editors by providing a range of customizable tools. The idea behind the plugin is to offer flexibility in features, prompts, and even LLM backends.

Screenshot of text selection and running a predefined AI prompt
Example of selecting a text to use as input for a predefined AI prompt

Using AI in Wagtail's text editor

When Wagtail AI is integrated into your website, simply select a text, and the toolbar will appear. Within this toolbar, you'll find the wand icon, offering various prompting options for you to choose from. Depending on the selected prompt type, the text can either be replaced (in the case of a rewrite prompt) or augmented (in a completion prompt). What's more, these prompts can be edited by a Wagtail user directly from the admin interface, adding a layer of customization and control.

Screenshot of the form to add a predefined prompt
Example of adding a predefined prompt

Prompt customization within Wagtail

As mentioned earlier, Wagtail users can handle prompts directly within the CMS! These prompts will be accessible in the text context menu for all users, offering a range of benefits for editors, such as:

  • Translating text into specific languages
  • Rewriting text to align with particular language proficiency levels
  • Adapting text to specific styles (e.g., 'professional semi-formal tone' or 'tone suitable for early teenagers')
  • Ensuring correct grammar and spelling
  • Generating headers based on content
  • Generating content based on bullet points

Not only does this streamline content creation for editors, but it also guarantees a consistent reading experience for end users.

Using local large language models for privacy

When ChatGPT comes to mind, it's natural to think about their API, which, of course, is supported and functions seamlessly. But what if you require an open-source LLM, or perhaps a private model due to your company's privacy restrictions? Or maybe you need a specialised model trained for programming tasks? Not to worry – it's entirely feasible to swap out the model being used. For instance, you can effortlessly switch to using a local running LLM like Llama2.

AI generated picture of a wagtail bird
AI generated picture of a wagtail bird

The Future of AI in Wagtail

Looking ahead, AI integration in Wagtail holds great potential:

  • Recommended Content: Personalized suggestions for users.
  • Link Suggestions: AI-assisted relevant linking.
  • Image Suggestions: Streamlined image selection.
  • Alt Tag Generation: Automated alt text for accessibility and SEO.
  • Image Generation: Future possibilities for AI-created visuals.

Interested in AI for your Wagtail application?

We're actively experimenting with these features and eager to collaborate on solving your content editing needs.

Get in touch to explore the possibilities.

We love code