How AI can enhance the Drupal content management system
We're building AI tools into Drupal to make it a more powerful CMS. Our prototype helps streamline CMS admin tasks.
When our team of developers and designers aren’t delivering innovative digital projects, they love to get excited about the latest technology. AI is no exception, but it is more than just the latest tech fad. The potential of AI tools is already huge and growing rapidly.
To realise this potential we’re developing tools that leverage AI and bringing them directly into our Drupal content management system (CMS), putting the latest technology at our clients’ fingertips.
How can AI tools improve a CMS?
Content management systems allow anyone to create, edit, and manage content on a website without needing to edit the code itself. CMS users often find that alongside their expected tasks of uploading content and assets, a CMS also requires lots of additional ‘housekeeping’ tasks. For example, writing alt text for visual media, writing summary snippets when content has ‘summary teasers’ elsewhere on the site, and SEO best practices like writing well-crafted meta descriptions. These tasks are important, but they take a lot of time.
We thought if we could come up with ways to use the power of AI to automate some of these additional tasks effectively, then we’d have created a set of tools that would make the Drupal CMS vastly more useful to our clients, and beyond.
Our approach to using AI
We did our homework to work out how best to utilise the AI tools currently available. The latest AI tools, like Chat GPT, Claude, Bard and GPT-4 are extremely powerful, and yet also have weaknesses and can be prone to ‘hallucinate’, meaning they sometimes make things up. It can be hard to tell what’s real and what isn’t, so it can sometimes be difficult to trust the output. Generally, the output is only as good as the prompt the AI tool ingested, so the prompts need to be as detailed as possible.
Understanding these weaknesses is key to building an effective AI tool. We wanted to use our understanding to leverage AI’s strengths, whilst successfully mitigating its weaknesses. This led us to build our AI CMS tools with the following principles. It has to be:
- Collaborative: We should foster human-AI collaboration, not just hand things over to AI. Humans and AI’s strengths and weaknesses complement each other, so the two working together can produce better results than either alone.
- Controllable: We don’t want to build a black box that spits out the answer without the ability for the user to fine-tune it. Users want different kinds of responses, so we want to let them fine-tune it to their needs. That means allowing them to set parameters that affect how the AI responds.
- Optional: Using AI-generated content should be built in a way that it only offers a suggestion, so a user can always edit the resulting output or not use it at all if it’s not helpful.
- Open: Drupal is an open-source CMS based on collaboration. We’ve benefited immensely from the modules generated by the community over the years, so it’s only right that we make our AI modules available openly so the community can benefit from them.
- Freeing: We focus on automating the boring, routine tasks with AI so humans can spend more time freed up to think creatively and focus on crafting great content.
These principles mean that our AI tools should always add value without ever detracting from the user experience by forcing their output on the user.
Automating alt text in Drupal CMS
Most of Numiko’s sites are powered by Drupal, so naturally this was our choice of CMS when we started prototyping our first AI tools. Open-source modules mean we can collaborate, and the resulting output can be used by the wider community.
Alt text is a description of an image used either when the image can’t be displayed or when the user is using a screen reader. It’s important for accessibility and helps SEO because it is indexed by search engine crawlers to better understand the content on the page.
It’s crucial your images have accurate alt text descriptions, but this takes time and is frequently overlooked or rushed by time-poor teams.
That’s where AI can help. We’re developing an AI tool for Drupal that will automate the generation of alt text for images. The AI reviews the image and auto-generates a short, accurate description that’s fed into the alt text field in the CMS. The resulting alt text is easily editable by the user, who can improve it or correct it if necessary. The alt text shown in our example was generated by our AI prototype tool. The final version may differ significantly from this early prototype.
Using AI to generate teaser summaries
Many websites use ‘teaser summaries’ where a page is featured in another area of the site. The featured summary will likely show the page title and a short snippet of text designed to give a user an idea of what the featured page or article is about.
Generating these teaser snippets is another important task that takes time and can often be rushed, meaning the copy isn’t always useful to users. We set out to automate this with an AI tool for generating teaser summaries within Drupal.
When the user hits the ‘summarise’ button, a teaser of the required length is generated by the AI, which ‘reads’ the content of the article to produce an accurate summary. The user can set the length of summary they require (the max tokens), as well as the ‘temperature’ and the ‘top probability’ which influence the way the AI writes the summary.
Controlling the AI: Temperature
Similarly to how different writing styles are used in different contexts, you can adjust certain parameters to have AI generate its responses in different styles.
What a large language model (LLM) is doing when responding to a prompt is ‘predicting the next token’. This means it’s using its vast amount of training data to guess what word or part of a word is most likely to come up next (GPT-4 was trained on 1-petabyte of data, which is 1,000 terabytes). Small words are one token, large words contain multiple tokens. Think of them a bit like semantic syllables for AI.
Temperature is used to add variety to this. If the model always picked the exact most likely word to come up next, its answers would have very little variety and would be quite generic. It’s essentially injecting a level of randomness to how it chooses the next token.
- Low temperature means little randomness, so it generates answers that are conservative, focused, and un-creative.
- High temperature means lots of added randomness, generating more creative and diverse answers, which are sometimes less coherent.
- Medium temperature is a middle ground between coherence and creativity.
We find a temperature of 0.7 is an effective middle ground for generating creative yet sensible summaries, but different brands will have different preferences.
Controlling the AI: Top probability
You can also set the top probability (Top P) to influence how the AI will respond. The Top P effectively sets how big the ‘pool’ of available tokens the AI chooses to respond with. Temperature sets how randomly it chooses from that pool, but Top P sets the cut-off for being in the pool.
- A high Top P means a big pool, meaning you’ll get very creative or random answers when combined with high temperature.
- A low Top P means a small pool of only the most relevant tokens, meaning the answer will be more coherent and focused, and less random.
We’ve set up our teaser summary generator tool to allow the user to set the temperature and Top P so they can fine tune their answers to suit their brand.
Using AI tools in your CMS
Our AI alt text generator and teaser summary tools for Drupal are currently in the prototype stage. We’ll be trialling them on select projects with our clients over the coming months.
In keeping with the open-source spirit of Drupal our plan is to release these modules to the community once we’ve been able to fine-tune them. If your organisation has a large digital estate that you think could be made more manageable with these AI tools, get in touch via [email protected] or take a look at our Drupal website development service.