Subscribe To Our NewsLetter
Share This Post:
AI (artificial intelligence) has become a powerful tool to improve the process of making and managing digital content. Drupal, the most famous content management system (CMS) known for its flexibility and robustness, has already started to integrate this new technology. This adds exceptional capabilities for creating and enhancing content.
In this read, we will highlight how to install and configure the modules AI (Artificial Intelligence) and Image Genie AI in Drupal. The AI module improves CKEditor by adding AI-powered features such as tone adjustment, text generations, and translations. On the other hand, Image Genie AI allows image generation, for the efficient and rapid creation of complete content.
Prerequisites
To make everything function smoothly it is necessary to ensure that certain requirements are fulfilled before starting to integrate AI capabilities.
All you need is Drupal 9 atleast or a higher version installed, based on what you want to use. For example if you want to use the image generation module, you would need at least Drupal 10.3.
However, in this article we are going to focus more on using OpenAI services, various other LLM models which are both free and private such as Claude, Mistal, Ollama, and LM Studio. Regardless of what kind of model is chosen, having an API key is required to make requests. And in case of OpenAI, you can obtain the API key from its API keys page.
Basic Installation and Configuration
After the prerequisites are confirmed, you can start with the installation and basic configuration of your Drupal to integrate the chosen AI.
Provider Configuration
Installing and activating the OpenAI Provider module is the first step in integrating an AI capabilities provider. As previously stated, we will concentrate on OpenAI's services.
composer require 'drupal/ai_provider_openai:1.0.x-dev@dev'
drush en ai_provider_openai
As indicated, the module needs an OpenAI API key. As these keys are sensitive data because of the credit consumption that happens with each request to the AI provider’s API. For a secure secret storage. As it is highly dependent on the OpenAI provider module, you should definitely install it beforehand. If it is not installed already, you can run the following commands:
composer require 'drupal/key'
drush en key
After it is installed, you will be able to add a new key in the System> Keys section within the Drupal admin panel. Add the OpenAI API key on that configuration page.
At the end, assign the API key added to the OpenAI provider. For this, get the AI>Provider settings sections of the configuration panel and select the key made beforehand.
OpenAI Module Installation
Any Drupal-built website can incorporate artificial intelligence capabilities using the foundation provided by the Drupal AI module. Semantic search, automatic translations, and content creation and update are just a few of the features made possible by this module's set of tools and base API.
In order to install it, just use composer as we did previously:
composer require 'drupal/ai:^1.0@beta';
drush en ai
Integration CKEditor
In order to maximize content creation in digital settings, we will pay particular attention to its skills in the areas of content generation and translation. We need CKEditor to be able to rapidly and simply employ AI for this.
Enabling the Drupal AI module's AI CKEditor integration module, one of its submodules, is the initial step. This module presents a CKEditor plugin that serves as a link between language models and the text editor, including features like text generation, translation, formatting HTML code, and text tone modification, among others.
You can activate the module, we will run the following command:
drush en ai_ckeditor
CKEditor Configuration
Your next step is to configure the plugin in CKEditor. In the section Configuration > Content authoring > Text formats and editors, we should install the AI CKEditor plugin to the toolbar and change the text format for which we want this tool to work. We should also activate the Source Editing plugin since it is also necessary.
- Configuring the enabled functionalities
After the plugin is integrated, make sure to enable and customize the different functionalities we want to be able to use. In the AI Tools section of the vertical tabs, the various options are accessible in the CKEditor plugins setup panel and can be enabled by ticking the appropriate checkboxes.
- Configuration translation and tone
For functionalities such as tone adjustment and translation, it is important to connect vocabularies that describe the available options. For translations, it is essential to make a vocabulary with the languages to translate to. Let’s take an example, create a taxonomy called “IA Translations” and add terms for languages including English, Spanish, Italian, etc.
And for tone, create a taxonomy with the tones you want to use. Such as, a vocabulary called “IA Tone” and add terms like “critical”, “formal”, “informative”, “technical”, or “humorous”.
We can choose the vocabularies in the configuration of each functionality after they have been created.
Selecting an LLM model from the chosen provider is made feasible by each enabled functionality; for OpenAI, this includes models such as gpt4o, gpt40-mini, and o1-preview, to name a few.
Let’s Take An Example On How To Use It
After the CKEditor is correctly integrated with our AI provider, we can start using it. We have made a couple of videos that will give you the proper tutorial on how to use it: generating content, translating it, changing the tone, and reformatting the text:
Video 1
Video 2
Integration With Drupal Translation System
As demonstrated in the previous video, it is feasible to translate texts from CKEditor; nevertheless, this is not the best option for automatically translating content. The process can be laborious because Drupal content can contain numerous fields and various texts. However, this process may be made cleaner and faster by integrating AI with the Drupal translation system.
Prerequisites
The first step is to allow the AI Translate submodule, either with the Drupal administration interface or Drush.
Configuration > Regional and language > Languages is where we must add any languages that aren't already enabled on our website. Likewise, we need to enable the content translation mechanism in the section if it isn't already. Although Drupal multilingual configuration is complicated, in general, we must enable the Multilingual: content translation module and then select which fields and content will be translated under Configuration > Regional and language > Content language and translation.
Module Configuration
Lastly, we can specify the translation options by going to Configuration > AI > AI Translate Settings and accessing the AI Translate configuration. We can configure the following for every language:
- OpenAI Model: An AI model (such as GPT-3.5) that will be utilized for language translation.
- Prompt: this prompt can be set up for every language since it is ultimately sent to the AI supplier. Because every language is unique and we may want to define certain uses (e.g., not using title case when translating into Spanish), this is very important.
We may also specify which entities should be translated and whether we want them to be translated at all. Translating paragraphs would be one example, whereby the translation of an entity would also translate its paragraphs.
Translating Content
Content translation Simply select any content's translation tab to begin translating it. A link to translate the material using the model you provided in the module configuration should show up in the AI Translations column.
Configuring Permissions
The Drupal AI module declares numerous permissions that allow you to control who can access and utilize the various AI-based features. For instance, it seems sensible to restrict access to these sophisticated tools to editors or administrators only if we wish to limit the expenses that excessive usage of AI services may cause.
In other situations, it might, for instance, make the translation service accessible to all users. To offset the cost of applying AI, let's look at a blog platform that offers membership access.
Final Thoughts
The integration of artificial intelligence into Drupal opens up a world of possibilities for improving the management and creation of content. This integration not only optimizes the editorial workflow but also places the project that uses it at the technological forefront in terms of content management thanks to the new capabilities offered by AI-based solutions.
At LN Webworks, we focus on integrating AI with Drupal to streamline content management, translation, and automation. Our expert team ensures an efficient, smarter workflow, helping your business stay on top in the digital landscape.
Share This Post:
Talk With Certified AI Experts Of LN Webworks!
Related Articles
June 20, 2023
CKEditor 5 & Drupal 10: Fueling Innovation in Content Creation
January 20, 2025
Drupal AI: Super Easy Guide to Setup and Try It Out
January 6, 2025