Integrating generative AI in Optimizely CMS: A quick test with OpenAI
Integrating AI services in Optimizely CMS is nothing new. More than three years ago, I released an addon that uses AI to generate metadata for images; alt-text, image description, tags, etc, etc.
Recently, there are several new services available that use generative AI to help create text and images with astonishing results. You have probably heard about a least few of them:
- ChatGPT
- DALL·E 2
- Midjourney
- Stable Diffusion
Wouldn't it be awesome if you had all their superpowers available and integrated with Optimizely CMS? Of course, you can! If the service has an API, you can integrate with it.
I did a quick test with the APIs from OpenAI. OpenAI has created both ChatGPT and DALL·E 2. I'm not a big fan of dojo, so the integration in the Optimizely CMS edit mode is not the most user-friendly, client-side, smooth intuitive type of integration, but rather quick and dirty proof of concept.
On this very Optimizely blog, I created a new AI tab, where all the magic happens. This is the first part.
Using the OnPublishing content event, I check if any of the generate-checkboxes are checked, and if they are checked I send the corresponding input to OpenAI and populate the correct property with the result. And then uncheck the checkbox. Very easy!
Using the above properties I could check «Generate main body from prompt», and provide a prompt like this
Write a fun and engaging article on how to enjoy your weekend, and make the most of it. The target audience is young adults, or parents with young children. List some activities one might engage in, and end with a conclusion.
Then also check the «Generate heading from main body» checkbox, hit the «Publish» button, and within a couple of seconds an article like this is live and published.
What about images? The OpenAI APis can generate images too! I've just created some more properties, that let me choose the number of images, and how to generate them!
Simply generate a few images, and they're automatically saved to your page's assets folder. Just choose the one you like best!
Also, even if you prefer to use ChatGPT directly in the browser, it's not always available! That's why I've added a simple input/output integration. The OpenAI APIs are always available, even when ChatGPT is unavailable!
This kind of integration is so straightforward, that I'm not including any code. If you are interested let me know, and maybe I'll write a follow-up blog post, with code.
This idea was inspired by Allan Thraen, and his demo at last years Opticon.
That's it! What kind of AI integration would you want for your Optimizely site?