The initial version of the Drupal CMS AI recipe was merged into Drupal CMS on December 3 and I couldn't wait to check it out…(well, I guess I could wait just until the end of my vacation last week 😀.) Anyway, the first chance I had, I updated my local development copy of Drupal CMS and got right to it.
Quick sidenote
The first thing I noticed is that the installer had changed since I last updated my local copy (about three weeks ago.) It has a much cleaner look, but it also appears that the AI recipe hasn't been deemed "installer worthy" just yet: not a big deal.
I verified that the recipe was in my local codebase (/recipes/drupal_cms_ai) and went about applying the recipe via the command line. I also reviewed the recipe.yml file to discover that this initial release includes two main bits of AI functionality:
- The Drupal Agent Chatbot - this is an admin-only chatbot that knows how to create some Drupal entities, bundles, and fields.
- The AI Image Alt Text module - this generates alternate text for uploaded content images.
I also noticed that the recipe included the AI Simple Provider Installer module (which provides a form to easily select a provider and enter your API keys), but there is no link (yet) directly to the form, so instead I navigated directly to /admin/config/ai/simple_provider_wizard and entered my OpenAI API key.
Drupal Agent Chatbot
Once the recipe was applied and my API credentials entered, I immediately noticed the Drupal Agent Chatbot in the admin area. I did not waste any time, as I wanted to know what it could do:
Prompt: What do you know how to do?
Response: I can help you perform a variety of tasks on your Drupal site, including:
- Content Types: Create, edit, or gather information about content types.
- Fields: Add or configure fields on content types or other entities.
- Taxonomies: Create and manage vocabularies and terms, which are essentially categories or tags for organizing content.
- Nodes: Assist in content creation, though this would often require configuration of content types and fields first.
If you have a specific task in mind, feel free to ask, and I can let you know how I can assist or even perform the task for you directly!
Oh my! This was very exciting! I decided to challenge it right away with the creation of a content type that I often use in our beginner-focused Drupal Career Online course:
Prompt: Create a new content type named "Movie" with fields for box office gross, a movie poster, a link to a YouTube video for a trailer, the year of release, and the director's name.
Response:
I've created a new content type named "Movie" with the following fields:
- Box Office Gross: A decimal field.
- Movie Poster: An image field.
- YouTube Video Trailer: A link field allowing both internal and external links.
- Year of Release: An integer field.
- Director's Name: A text field.
The response also contained links to each field's config page as well as the Drupal configuration that was used to create the above.
Holy mackerel!
The only change I wanted to make was due to my lack of specificity in the prompt - I actually wanted the YouTube Video Trailer field to be of type Media: Remote video. Since the agent isn't allowed to delete things, I manually deleted the existing YouTube Video Trailer field from the Movie content type and went back to the chatbot:
Prompt: Please add a YouTube Video Trailer field as a Media (remote video) field.
Response:
I've added a new YouTube Video Trailer field as a Media (remote video) field to the "Movie" content type. You can now add videos to be displayed as media items from remote sources, like YouTube.
The response also contained a link to the field's config page as well as the Drupal configuration that was used to create the above.
A-maze-balls.
Image alt text
Next, I wanted to test the ability to generate alt(ernate) text for uploaded content images. I figured it would be a bit anticlimactic compared to the Drupal Agent Chatbot example I had just completed, but the fact that this worked out-of-the-box without any manual configuration on my part (other than my OpenAI API key) is really slick.
I simply went to create a new Basic page, navigated directly to the image field, uploaded an image of my dog, and clicked the Generate with AI button. After a few seconds the results populated the Alternative text field.
Summary
This initial version of the Drupal CMS AI recipe is super-impressive and really demonstrates the power of not just AI, but also of the Drupal APIs and the amazing work of the AI contrib module maintainers.
I can't wait to see how this progresses!
While writing this article, I spent a total $0.18USD on OpenAI API calls.
Add new comment