Unless you have been exceptionally out of touch with current events lately, there’s a good chance you have heard about ChatGPT. Since it was released by OpenAI last year, it has taken the world by storm. ChatGPT is a conversational AI tool, where we can throw a question at it and it answers. At the moment, it's all the rage, and it's being used in a variety of ways.

Regardless of your personal stance, we are witnessing a huge change in technology from an AI perspective. The way end users get used to it might change with time from here on. ChatGPT is one major breakthrough or the first time in the AI world where a human-like interaction is possible. This will only keep getting better.

There are multiple module projects being implemented in the Drupal contrib space for integrating ChatGPT technology. In this article, let’s take you through one such Drupal module today: OpenAI / ChatGPT / AI Search Integration. Before we dive into the module, let us understand something about OpenAI.

What is OpenAI

OpenAI is a research lab based out in California and it focuses on developing AI and finding ways to make AI useful in our everyday lives. Apart from exploring AI technologies, OpenAI provides an API to interact with their software.

Integrating with a good API has become relatively easy in Drupal in 8/9/10 versions. Before we get into the module, you will need to register on the OpenAI site, create a secret key, and get yourselves ready to use the Drupal module. Here’s a short and straightforward video to help you get started with this.

Integrating with the Drupal OpenAI / ChatGPT / AI Search Module

This is one of the contributed modules that bring ChatGPT’s capabilities into Drupal. The OpenAI/ChatGPT/AI Search Integration module is compatible with only Drupal 10 and only has an alpha release right now. We can install this module using Composer.

composer require 'drupal/openai:^1.0@alpha'

The module consists of 9 submodules which provide different functionalities. To mention a few:
•    ChatGPT/Prompt explorer
•    Content Tools
•    CKEditor integration
•    Log analyzer
•    Text Embeddings

We will be dealing with the functionalities that are involved with content generation and manipulation in this blog.


1. Setting up
→ For setting up the module, please create an account on the OpenAI website. 
→ Create a secret key.
→ Make sure to copy the Organization ID as well. 
→ Finally, enter the values in the OpenAI settings from the Drupal admin.

Image: OpenAI settings interface from Drupal setup

2.    ChatGPT/Prompt Explorer
→ ChatGPT/Prompt Explorer enables administrators to experiment with the OpenAI services
→ These work exactly like ChatGPT, where you will have a textbox for asking a question, and the answer is received in a response in another textbox.
→ Apart from this, you will have different form options like model, max tokens, and temperature. Using these options, a user will have different responses.


GIF: ChatGPT/Prompt Explorer

3.    CKEditor
→ This is the most important implementation of this module.
→ There is a CKEditor button provided which lets you ask OpenAI ChatGPT a question and retrieve a text response.
→ The button must be enabled from the “Text format and editor” settings.
→ Apart from content generation, you also have a few other functionalities such as Summarizing, Translating, Adjusting content tone, and Correcting faulty HTML.
→ Every function sends a question to ChatGPT and receives a response back.


 

Image: Pull the button to active toolbar option in Text format settings.

Image: Enable the option from Text Format Settings.

Image: CKEditor settings from article content type


4.    Content Tools
→ The Content Tools functionalities are very similar to CKEditor ChatGPT.
→ With this module, the ChatGPT functionality is available for all the entity forms.
→ The difference between CKEditor and Content Tools functionality is that we can use any field to generate a response.

 

Image: Content Tools options on node form.

Image: Content Tools options on node form.


5.    Log Analyzer
→This functionality adds an extra message to Drupal’s logging system.
→The logger messages sometimes are easily understandable for developers with less or no experience.
→OpenAI adds a very generic simple message explaining that error in a simple way

Image: Logger Analysis

Final Thoughts

As we have seen, the OpenAI ChatGPT module provides various functionalities that bring AI capabilities into Drupal. Also, there are enhancements that can improve this module and add some more new features. There are similar other modules that provide similar functionality in different ways.

That being said, the OpenAI ChatGPT must be used with a lot of caution and content has to be verified before we publish it as this is machine-generated content. We must handle the content responsibly and refrain from sharing sensitive information while interacting with ChatGPT or any similar AI tools.

Explore our Drupal Services for innovative web experiences. Let's build forward together!

 

Contact us

LET'S DISCUSS YOUR IDEAS. 
WE'D LOVE TO HEAR FROM YOU.

CONTACT US