ckeditor prompt 1
ckeditor prompt 2

The OpenAI module aims to provide a suite of modules and an API foundation for OpenAI integration in Drupal for generating text content, images, content analysis and more. OpenAI is the company behind artificial generational intelligence products that powers applications like ChatGPT, GPT-4, GPT-3, DALL-E, GitHub CoPilot, and more. Our goal is to find ways of augmenting and adding assistive AI tech leveraging OpenAI API services in Drupal, transforming the way you manage your content and maintenance tasks.

If you would like to partner in this initiative, please contact us. Please note that functionality can change a lot during the alpha/dev releases.

Interested? Join us in the #openai channel in the Drupal Slack: https://www.drupal.org/community/contributor-guide/reference-information....

Updating the module

Some releases update the upstream client dependency. Update the module with Composer with the following to ensure you always get the up to date version:

composer update drupal/openai -W

Token limits

While the newest GPT-4 models support up to 128,000 token context window, please note that the number of tokens you can send and receive is dependent on the limits of your OpenAI account.

You can review your limits and Tier on your account page here: https://platform.openai.com/account/limits

This module cannot override your tier limitations with OpenAI.

Included submodules

  • openai_audio: Adds capability to interact with the OpenAI audio (speech to text) endpoints.
  • openai_chatgpt: Enables interaction with the Chat endpoint via ChatGPT API
  • openai_ckeditor: Provides a button for CKEditor 5 to send a prompt to OpenAI and get generated text back.
  • openai_content: Adds assistive tools for different areas of the content editing process. It adds functionality to adjust the tone of the content, summarize body text, suggest taxonomy terms for nodes, and checks content for Moderation violations.
  • openai_dalle: Adds capability to interact with the OpenAI DALL·E (image generation) endpoint, using either the new DALL·E 3 model or DALL·E 2 model.
  • openai_eca: Adds capability to build your own custom workflows with the ECA module. With this, you can create and combine your own custom functionality with ChatGPT.
  • openai_devel: Adds GPT content generate capability to Devel Generate. This provides Devel a way of generating realistic content (not lorem ipsum) using GPT and ChatGPT models. Users can generate sample content from the Drupal UI or via Drush. This is useful if you want to fill out your site with realistic sounding content for client demonstration, layout, theming or QA.
  • openai_dblog: This module demonstrating log analysis using OpenAI to find potential solutions/explanations for error logs. Responses from OpenAI are saved and will persist for common error messages so you can review them.
  • openai_prompt: Adds an area in the admin where you can explore OpenAI text generation capability and ask it (prompt) whatever you'd like.
  • openai_embeddings: This module that analyzes nodes and generates vectors and text embeddings of your nodes, taxonomy, media, and paragraph entities from OpenAI. Responses from OpenAI are saved and could augment search, ranking, automatically suggest taxonomy terms for content, and improve search relevancy without expensive search backends. Content personalization and recommendation may also be possible with this approach.
  • openai_tts: Adds capability to interact with the OpenAI TTS (text to speech) endpoints.

Example: Using the openai_ckeditor module adds a list of actions in CKEditor 5 to run many OpenAI / ChatGPT commands:

ckeditor and open ai integration inserting generated text

Generate text, change and rewrite its tone, summarize text, translate it and more. All right from CKEditor 5.

Example: Creating custom actions and workflows using the ECA module. In this instance, generating an article summary if the summary field is blank:

Example: Using the openai_chatgpt module to ask ChatGPT for editorial advice:

Example: Using Devel Generate via openai_devel to generate realistic sounding test content from GPT models:

drush devel-generate:content-gpt 5 --base-fields=body,field_foo,field_bar --system="I want to generate content about popular content management systems."

Example: Using the openai_prompt module adds an area in the backend for admins to try out OpenAI text completion / text generation:

Example: Using the openai_content module adds a "Summarize" and "Suggest taxonomy" feature on nodes helping you generate summaries and potential taxonomy terms to categorize the page making a great jumpstart for your content editors:

Suggesting taxonomy:

Example: Putting together keyword search using openai_embeddings module combined with Pinecone to return the most similar/relevant results very fast:

This integration with a vector database can be used to put together a simple content recommendation service without the overhead of Solr/ElasticSearch/Algolia or expensive PAAS. Track the issue #3343800: Document content recommendation approach for more information.

The development branch contains the latest ongoing work. The OpenAI parent module now implements the https://github.com/openai-php/client client for interacting with OpenAI's API. Since this API client requires PHP 8.1, the dev branch (and future releases) will only work on Drupal 10+.

Releases

The alpha tagged release are very usable, but may contain bugs. When features are stabilized and deprecated ones removed we will begin tagging beta releases.

Supporting organizations: 
Sponsoring development
AttachmentSize
Screenshot from 2023-03-04 15-54-07.png362.01 KB

Project information

Releases