DrupalEasy: Drupal's OpenAI / ChatGPT / AI Search Integration contrib module - initial impressions

Image removed.Ever since it was announced, I've been itching to play with the new OpenAI / ChatGPT / AI Search Integration contrib module. From what I had read about it from Kevin Quillen, it was being written in a way that was going to make it flexible and with an eye toward customization. 

On a self-serving note, one of our clients is interested in an AI-based solution for a task we're working on for them, so I had an agenda; test-driving this module for content-related tasks. 

My initial impressions came from using version 1.0.0-alpha10 and within the first 20 minutes:

  • The module only supports text fields (so far…)
  • The module is only compatible with Drupal 10.
  • There's not too much documentation yet - which isn't super-surprising considering it's being actively developed (and is still in alpha state). 

While the module includes nine(!) sub-modules, I decided to focus on only three of them - all related to content generation and manipulation.

While there is a free OpenAI API tier, it is important to note that the experiments below were all made with a paid OpenAI API account - the total cost was less than $0.25 USD.

A note about OpenAI API keys

My OpenAI account has two organizations - my Personal organization and an organization created by our DrupalEasy client. My Personal organization is not yet on a paid plan, but our client's organization is. When creating an API key be sure to select the Default organization first, and then click to create a new API key. It appears that API keys are somehow associated with the organization.

Before I figured this out, none of my initial testing worked, I would always get a OpenAI\Exceptions\ErrorException or a You exceeded your quota… error because my personal account's initial credit has expired ☹️

OpenAI ChatGPT Devel Generate

Being able to generate realistic sample content is the dream (or not) of many Drupal developers - this submodule promises to provide this functionality. Via the Configuration | Generate | Generate content from ChatGPT admin menu item, this allows developers to select the content type, Profile (which is provided as part of the prompt provided to the OpenAI API), and text fields to populate with the OpenAI response. With the following Profile, I was able to populate the Title and Body fields with content.

Profile: Your task is to generate content. I would like you to generate content about Batman.

Sample node content:

Title: The Gadgets and Tech of Batman: Examining the Caped Crusader's Arsenal

Body: Batman is known for his impressive arsenal of gadgets and technology, which he uses to fight crime and protect the citizens of Gotham City. From his iconic Batarangs to his high-tech Batmobile, Batman's gadgets are an essential part of his crime-fighting persona. One of Batman's most famous gadgets is the utility belt, which contains a variety of tools and weapons that he can use in a pinch. These include smoke pellets, grappling hooks, and even a miniature explosive charge…

The content generation process is much slower than standard Devel Generate (for obvious reasons), but it does result in much more engaging sample content. 

Image removed.OpenAI Content Tools

This submodule provides some interesting tools for updating content. Once enabled, the module provides some options in the sidebar of the Drupal add/edit content page.

Each of the three tools demonstrated below provide their results directly in the sidebar - it is up to the author to copy/paste the results into the appropriate fields in the node's add/edit form. It seems that there are contribution opportunities for further integration. For example, it would be useful to automatically add the summary text to the Summary sub-field, should it exist (with consideration for what, if any summary text already exists…)

Adjust content tone

This allows the author to change the tone of the body text by selecting one of the default options: Friendly, Professional, Helpful, High school level reader, College level reader, and Explain it like I'm 5.

For example, with the original text of:

But we’ve met before. That was a long time ago, I was a kid at St. Swithin’s, it used to be funded by the Wayne Foundation.

The Friendly option returned:

Oh wow! We've actually met before, haven't we? That was such a long time ago when I was a youngster at St. Swithins. I remember it was funded by the Wayne Foundation back then!

The College level reader option returned:

We've met before. That was quite a while ago - when I was a student at St. Swithins. It was funded by the Wayne Foundation back then.

Extending the module to include additional options looks to be currently possible via a hook_form_alter().

Summarize text

This option summarizes the original text as:

The speaker and the listener have met before, when the speaker was a child attending the St. Swithins school. The school was funded by the Wayne Foundation.

When testing with much longer body text (~45,000 words) a summary was provided, but due to limitations of the API, only the first 3,900 characters of the body text were provided to the API. 

Suggest taxonomy

Using the same original text, OpenAI provides the following taxonomy term suggestions:

Funded, Kid, St. Swithins, Wayne, Long

Taking a quick peek at the code, the prompt used is Suggest five words to classify the following text. The words must be nouns or adjectives in a comma delimited list.

Again, poking around the source code for a few minutes showed that there are potential options to extend the current functionality. This includes the ability to add additional content tone and taxonomy term generations options.

OpenAI CKEditor integration

Image removed.This submodule provides a new OpenAI button that can be placed on any CKEditor toolbar. For this example, I added it to the default Basic HTML text format toolbar (be sure to also enable the OpenAI tools option in the CKEditor 5 plugin settings area for each text format!)

Text completion

When selected, a text field is displayed for the author to provide the prompt to generate text based on (much like ChatGPT). I tested it with the prompt:

Who is Batman's best friend?

The response:

Batman's best friend is his loyal butler, Alfred Pennyworth.

The response is added directly in the text field at the current cursor position. 

Adjust tone/voice

Allows the author to provide an adjective to adjust the tone/voice of the entire (or selected portion of) body field. This is very similar to the OpenAI Content Tools module's Adjust content tone option, but allows for a freeform prompt.

Original text:

Bruce Wayne, eccentric billionaire. I'll be standing where l belong. Between you and the peopIe of Gotham. Does it come in black? No guns, no killing. It's ends here. Hero can be anyone. Even a man knowing something as simple and reassuring as putting a coat around a young boy shoulders to let him know the world hadn't ended.

Using formal resulted in the original text being replaced with:

Bruce Wayne, eccentric billionaire. I'll be standing where I belong - between you and the people of Gotham. Does it come in black? No guns, no violence. Let's put an end to this. Heroes come in all shapes and sizes - even a man who can show a young boy that the world is still a safe and comforting place, simply by draping a coat around his shoulders.

Summarize

Same as the option provided by the OpenAI Content Tools submodule. 

Reformat/correct HTML

Not tested.

Translate

Allows the author to provide language to translate the contents of the body field. Using Flemish on the same original text as above resulted in the original text being replaced with:

Bruce Wayne, excentrieke miljardair. Ik zal staan waar ik hoort. Tussen jou en de mensen van Gotham. Komt het in het zwart? Geen wapens, geen doden. Het eindigt hier. Een held kan iedereen zijn. Zelfs een man die iets zo simpels en geruststellends doet als een jongen een jas omhangen om hem te laten weten dat de wereld niet was geëindigd.

I'm not a native Flemish speaker, but both Google translate and a close-to-fluent Flemish speaker agree that the translation is sound.

Summary

Overall, once I got past the API and (minor) configuration hurdles, the submodules I tested performed as I expected. I did poke around the code a bit with an eye toward expandability/customization to support our client's requests and was not surprised by the high quality of the code.

I continue to think about how scary it is to generate quality content based on a short(ish) prompt - I really worry about the implications of relying on potentially low-quality content generated purely by AI.

I look forward to seeing how this module develops in the next few months. 
 

Promet Source: 6 Steps to Build a Solid Banner Component in Drupal 10

We’re well familiar with the saying that “You never get a second chance to make a first impression.” Nowhere is that more true than on a web page. The banner component is an essential element in effectively conveying the brand and the culture within a framework for design flexibility. There’s a lot riding on getting it right.   The question is: what makes a banner work, and how do we build it properly so that it is reusable, responsive, configurable, aesthetically appealing, and useful? 

Drupal Association blog: Drupal Association hires Alex Moreno

The Drupal Association is pleased to announce that Alex Moreno joined the team as of May 2023! We are thrilled to bring Alex’s talent and experience in the Drupal Community to the team.

Image removed.

Bringing Alex on continues the Drupal Association’s effort to become more global in our hiring.

Already very well known for his work in Drupal, Alex’s background includes a degree in Software Engineering with a major in Artificial Intelligence. For the past decade, he lived in London, working for big enterprise companies as a consultant and Technical Architect representing Acquia, Pantheon, The BBC, and Capgemini.

Additionally, Alex has a passion for journalism, communication, and marketing, which made him jump into a developer relations role during the past 12 months. At the Drupal Association, Alex works on the engineering team working on various projects. Considering himself a digital nomad, Alex lives between Madrid and his hometown near the Mediterranean Sea in Santa Pola. He enjoys anything related to the sea when in the Mediterranean, including windsurfing, kayaking, and sailing small dinghies.

When in Madrid, he swaps his passion for the sea with CrossFit and weightlifting! Recently, Alex got more into bodybuilding and healthy food habits, which made him lose around 15 kilograms in just a few months! He plans to promote healthy habits and exercise in the Drupal community as the biggest hack to improve productivity.

“Take care of your body. It’s the only place you have to live.” – Jim Rohn

Welcome to the Drupal Association team, Alex!

Consensus Enterprises: Aegir5 + Pitch-burgh

See our recent Aegir5 Roadmapping series for more background! Recently, Dries announced an exciting event at the upcoming DrupalCon Pittsburgh: Shark Tank meets Drupal: pitch your best innovation ideas/): Announcing “Pitch-burgh”, an innovation contest at DrupalCon Pittsburgh, where members of the Drupal community can pitch their ideas to receive funding. […] The entrepreneurs give short 2-3 minute presentations in the hopes of securing funding for their idea. Since we’re actively pursuing partners and funding for Aegir5 development, this seemed like it could be a good opportunity.

Golems GABB: Best Practices for Cross-Platform Development in 2023

Best Practices for Cross-Platform Development in 2023 Editor Wed, 05/31/2023 - 15:42

Cross-platform mobile application development continues to gain popularity. This is due to the sharp rise in the creation of native software products that do not always bring the expected results. For instance, a cross-platform application can run on multiple operating systems, including Windows, Linux, and Mac OS X. Below, we will discuss cross-platform development and the tools to create multi-platform applications. 
It is worth considering that creating a high-quality cross-platform application without high-level programming languages is impossible. Choosing the right development environment that supports conditional compilation is also crucial. The principle of multi-platform development is based on using a single code base, ensuring compatibility with different platforms. Stability is achieved by timely and correct translation of the application code under a certain operating procedure.

Salsa Digital: BenefitMe runner up for Non-profit Splash Award

Image removed.BenefitMe takes home runner-up award BenefitMe was honoured as the runner up in the Non-profit Splash Award. This project brought Drupal and Rules as Code (RaC) together. The project team consisted of members from the Digital Aotearoa Collective and Salsa Digital.  Special thanks A special thanks to all the people who contributed to BenefitMe, including: The initial crew from the Digital Aotearoa Collective : Jo Allum, Pia Andrews, Jonah Duckles, Robert O’Brien, Arama Maitara, Hamish Fraser, Tom Barraclough, Ben Tairea, Brenda Wallace, Siobhan McCarthy, Regan Gilmour, and more.

Salsa Digital: CivicTheme wins UX/Design Splash Award

Image removed.CivicTheme takes home the award Salsa’s CivicTheme won the UX/Design Splash Award at DrupalSouth 2023.    Special thanks A special  thanks to all the people who’ve contributed to CivicTheme along the way, including:  Early designs: Adam Walton from Oliver Grace. Early contributors: Australian Government and the Civil Aviation Safety Authority   Early client adopters: The Australian Radiation Protection and Nuclear Safety Agency (ARPANSA), The Australian Energy Infrastructure Commissioner (AEIC), Australian Commission for Law Enforcement Integrity, Vision Australia, Bendigo Wayfinder, Access Hub and Digital Aotearoa Collective.

Community posts: Introducing the Updated Drupal Community Code of Conduct

The Drupal Community Working Group (CWG) is excited to announce the release of an updated Code of Conduct for the Drupal community. It will take effect on July 1, 2023. 

This new version is designed to reflect the growth of the Drupal community since the original Code of Conduct was adopted in 2010 and to help foster a safer, more inclusive, and harassment-free environment for everyone. While it retains the same basic structure as the previous document, much of the text was rewritten to make it easier to read. It also includes new elements inspired by other widely-used open source codes of conduct.

Some of the highlights of the updated Code of Conduct include:

  • Improved Readability: The new document has shorter sentences and paragraphs than the previous version, making it easier to read and comprehend. It is also written in a less formal tone.
  • Increased Clarity: The updated version includes more detail about where the Code of Conduct applies and the consequences of violating it. It emphasizes the shared responsibility of maintaining a welcoming community.
  • More Specificity: Examples of positive and unacceptable behaviors have been added to each section to help community members better understand the expectations and guidelines for their conduct within the Drupal community
  • Inclusivity and Diversity: The updated Code of Conduct places a stronger emphasis on fostering an inclusive and diverse environment for people of all backgrounds and identities, and is more consistent with Drupal’s Values and Principles.
  • More Actionable: Instructions for reporting Code of Conduct violations are now broken out in an alert box to make them easier for people to find.

The process of updating the Code of Conduct began in earnest in the summer of 2022, building upon community feedback gathered by the CWG since 2017. It was spearheaded by a subgroup of the CWG’s Community Health Team, who gathered feedback and shared drafts with a diverse group of stakeholders across our global community. A draft was then shared publicly with the community for additional feedback and revision. Finally, the document was reviewed and approved by the CWG’s Conflict Resolution Team and Review Panel. If you will be attending the Community Summit at DrupalCon Pittsburgh, members of the team will be sharing additional  details at the “How We Updated the Drupal Code of Conduct” session.

We would like to express our gratitude to everyone who contributed to the development of the updated Code of Conduct. Your input and dedication have been invaluable in creating a more inclusive and welcoming environment for all community members.

We encourage all community members to read and familiarize themselves with the updated Code of Conduct. Drupal.org users will also be alerted to the new language when it goes into effect July 1.

If you have any questions or concerns, please do not hesitate to file an issue in the CWG’s issue queue. If you would prefer to reach out privately, you can also send an email to drupal-cwg@drupal.org. Your feedback is always welcome as we continue to improve and adapt our Code of Conduct to the evolving needs of our community.

Thank you for being a part of the Drupal community, and for your commitment to making it a welcoming and inclusive place for everyone.