We’re in the middle of a bit of a series on Drupal and AI, and there is so much coming. It’s absolutely crazy. If you watched Dries’ keynote at DrupalCon Barcelona, it gave you a little bit of an idea. Today, I want to show you something new: how to change the tone of a node using your own voice in AI.
Today, I’m going to show you how to change the content of a node and make it more like your own voice. If you’re using ChatGPT to create content, for instance, you know it doesn’t quite sound like you. Wouldn’t it be great if you could automatically convert it to be more like you? Well, in Drupal, you can do just that. Let’s dive in!
Watch the Video
To do this, you’ll need the latest version of the AI module available at https://drupal.org/project/ai. If you scroll down, you can click to get the latest development version, which is 1.0.x-dev. If you’ve already installed this module, make sure to update it; it was last updated this morning. I’m writing this on October 9th, 2024, and updates are happening frequently, but it doesn’t work in the alpha version, so grab the dev version and install it on your site.
Once you’ve installed it, you’ll want to set it up. After going to Configuration > AI, the first step is to set up provider settings. This feature doesn’t work well with the free version of OpenAI, so I’m using the paid version, GPT 4.0.
Next, set up a taxonomy by going to Structure > Taxonomy and adding a vocabulary called “Tone.” In this vocabulary, add terms for tones you might want to use, such as “mad,” “sad,” “professional,” or one that reflects your style.
How did I get a personal tone? Well, one of the great things about ChatGPT is its ability to read information you provide and summarize it. I uploaded a PDF and a few articles I’d written, then asked ChatGPT to define the tone of my writing. It created a list that wasn’t perfect but was pretty close. I’m generally a friendly, conversational, supportive, and enthusiastic kind of guy, so the tone matches my style!
Once you’ve created the tone, go to Configuration > Content Authoring > Text Formats and Editors, and update one of your text formats. In this case, I added the AI button to my Basic HTML toolbar. When you do that, it will prompt you to configure settings. Stick with the defaults, but enable the tone and select the vocabulary you created for content tone. My AI provider is GPT 4.0, and that’s it.
Head over to a piece of content or generate new content with ChatGPT—say, a blog post on “Five Reasons to Use Drupal.” The AI assistant can generate, summarize, change the tone, and translate content. For this demo, I’ll use a prompt to generate content: “Provide a blog post with five reasons to use Drupal, including an introduction, five points, and a conclusion.”
The AI module might take a bit to process if you’re using GPT 4.0. Wait until the content is fully formatted in the response window before doing anything. When it’s ready, click “Save Changes to Editor.” The generated content says, “Choosing the right content management system is crucial for any website’s success. Drupal is a powerful and flexible CMS that offers myriad features tailored to build robust and scalable websites.” That’s not bad!
Now, select all, click “Change Tone,” and choose the tone ChatGPT generated based on my writing style. After saving changes, you’ll see it’s slightly modified. Now it reads, “Choosing the right content management system is a big deal for a website’s success.” This version is more friendly and casual—possibly too casual for this blog post, but it definitely aligns with my style.
Once you’ve developed a tone that works for you, you can apply it to any content, not just content from ChatGPT. You can use it to refine your writing and make it more consistent. This tool is powerful: a tone rewrite that might take an hour can now be done in about 30 seconds with a prepared prompt that captures your style.
There’s so much happening with AI and Drupal right now. Creating your own "tone" is really a great time saver!