Using OpenAI and ChatGPT Models with LearnDash

By: LearnDash Collaborator March 23, 2023
Filed Under:

When people hear the term “artificial intelligence” they tend to think of rogue robots, anarchic androids or sinister cyborgs taking over the world and giving humanity the same short shrift that the asteroid gave to the dinosaurs all of those years ago. While, we admit, an AI-induced apocalypse might—but probably won’t—one day come to pass, the AI that we have today is here to help.

In this guide, we’ll show you how to use OpenAI and ChatGPT models with LearnDash so you can harness the power of AI for your e-learning platform. Automatically draft lessons, create course outlines, and even answer students’ questions with the help of AI and automation tools such as Uncanny Automator.

Join the robot revolution in e-learning—and save yourself countless hours and thousands of dollars in the process!

Introduction to OpenAI and ChatGPT

OpenAI is the artificial intelligence research laboratory behind the popular chatbot, ChatGPT. Built on OpenAI’s Generative Pre-trained Transformer 3 (GPT-3) model, ChatGPT is the very latest in natural language processing (NLP) technology.

With a beta version that launched in 2020, the AI uses statistical modeling and deep learning to create human-like text. That’s basically just the high-tech way of saying that ChatGPT read a lot (and we mean A LOT) of content across the internet to learn how people write on various topics so that it could do the same.

Using OpenAI and ChatGPT Models with LearnDash OpenAI Homepage

Since ChatGPT’s official launch in November 2022, the internet has had fun prompting it to make poemscreate languages, and compose fan fiction—but the advanced AI can do so much more.

You’ll need to create an account with OpenAI to power your e-learning platform with artificial intelligence. To create an account, all you need is an email and a password—and the ability to take a single-question Turing test to prove that you are not, yourself, a robot.

Introduction to LearnDash

LearnDash is the #1 learning management system (LMS) for WordPress. Whether you’re running an after school program or managing training and compliance for a multinational corporation, LearnDash has all of the features you need to create a functional (and futuristic) digital classroom.

Using OpenAI and ChatGPT Models with LearnDash LearnDash Homepage

With LearnDash, you can easily build your e-learning platform from the ground up—from granular lessons and quizzes, up to modules and even course groups that define entire curricula. And don’t forget to keep your students motivated with certificates for completion or outstanding grades.

If you haven’t already, click here to get the LearnDash plugin and join the future of e-learning!

The Benefits of Automation and AI in E-learning

Pairing your LearnDash LMS with OpenAI comes with several benefits:

  • Save Time: OpenAI churns out large amounts of text faster than a caffeinated cartoon typist. Cut back on the time it takes you to create course content, leaving you more time to interact with your students.
  • Save Money: Cut back on your content creation costs with OpenAI by reducing the amount of time it takes to generate quality content.
  • Stay on Brand: Once you find the right configurations and prompts for your OpenAI model, you’ll be able to rapidly produce content that is consistent and on-brand.

Developers and educators are constantly finding new ways to apply AI to e-learning. But here are just some of the ways that you can start using AI in your LearnDash LMS today:

  • Create Course Outlines: Standardize your course creation process and help educators save time with auto-generated course outlines.
  • Draft Lessons: Use simple forms or other input methods to automate the process of drafting new lessons.
  • Tutor and Support: Once you get the hang of OpenAI, you can create chatbots to help tutor your students and support them through the learning process.

In the following sections, we’re going to actually walk through the steps of connecting LearnDash to OpenAI. You’ll need at least the Pro version of Uncanny Automator to follow along, however Automator offers a 14-day money back guarantee so trying out premium features comes at no-risk to you.

After you’ve downloaded Automator Pro, read this guide on connecting it with your new OpenAI account or find the abridged version below:

  1. Under your account tab in your OpenAI account page, click on View API keys. In the API Keys screen, click Create new secret key and copy the new key.
  2. From your WordPress Admin Sidebar, navigate to Automator > Settings. Click on the Premium integrations tab and scroll down to OpenAI.
  3. Paste the key from your OpenAI account into the field labeled Secret key and click Connect OpenAI account.

Now you’re ready to power your LearnDash LMS with OpenAI!

Build an AI-Generated Course Outline

OpenAI is, perhaps unsurprisingly, great at understanding structure—it is, after all, a computer. That makes it the perfect teacher’s assistant when it comes to creating course outlines. Here’s how it’s done.

Step 1: Create a New Recipe

From your WordPress Admin Sidebar, navigate to Automator > Add New. In the pop-up window that appears, select Logged-in users.

Automator Recipe type selector Logged-in users

Step 2: Name Your Recipe

We’ve named this recipe OpenAI LearnDash Course Outline but we recommend coming up with whatever naming convention suits your workflows best.

Step 3: Configure Your Trigger(s)

The trigger is the event that will set your recipe into motion. For our workflows, we’ve created a WPForms form to pass information to OpenAI. Based on the OpenAI inputs (that we’ll discuss later), a basic form can look something like this:

Using OpenAI and ChatGPT Models with LearnDash WPForms

A form-based trigger can be useful to restrict direct access to OpenAI while still allowing multiple users to take advantage of it.

To use a form-based trigger, in the Triggers panel, from the menu of available integrations, click WPForms or your preferred form-building plugin.

Using OpenAI and ChatGPT Models with LearnDash Automator WPForms Integration

From the drop-down list that appears, select A user submits a form.

Automator WPForms Action A user submits a form

Automator will prompt you to select a form. After you’ve selected your course outline creator form, click Save. Your trigger should look like this:

Automator WPForms Action A user submits a form Live

Step 4: Configure Your Primary Action

In the Actions panel, click Add action. From the menu of available integrations, select OpenAI.

Using OpenAI and ChatGPT Models with LearnDash Automator OpenAI Integration

From the drop-down list that appears, select Use a prompt to generate text with the Davinci model.

Automator OpenAI Action Use prompt to generate text with the Davinci Model

Automator will present you with an editor where you can configure the information that it will pass along to OpenAI.

Temperature defines how “creative” you want OpenAI to be in its response with lower values indicating less creativity and higher values indicating more creativity.

Maximum length refers to the number of tokens that OpenAI has, with 100 OpenAI tokens roughly correlating to 75 English language words. For a comprehensive breakdown of OpenAI tokens, click here.

Not to be confused with OpenAI’s tokens, Automator has its own tokens (i.e., dynamic pieces of data pulled from your website and even from within recipes).

In our example, we’re allowing users to pass along both temperature and maximum length information to OpenAI by using Automator tokens that pull data from the WPForms trigger. To use Automator tokens, click on the Asterisk and select a token from the drop-down list.

Automator OpenAI Tokens

Note: In practice, temperature is correlated to your brand’s voice and OpenAI calculates cost based on the number of tokens you use. As such, you may not want to permit all users to change those settings and opt, instead, to use static values in those fields.

Using all Automator tokens, we’ve filled in the remaining fields as such:

Automator OpenAI Action Tokens

Once you’ve filled in the fields in the way that best suits your workflows, click Save. Your action should look like this:

Automator OpenAI Action Use prompt to generate text with the Davinci Model Live

Step 5: Configure Your Secondary Action

The first action that we’ve created will get OpenAI to generate our course outline. This secondary action will get that course outline created in LearnDash.

In the Actions panel, click Add action. From the menu of available integrations, select WordPress.

Automator WordPress Integration

From the drop-down list that appears, select Create a post.

Automator WordPress Action Create a post

Automator will present you with an editor, similar to the one from the first OpenAI action. In the field labeled Type, select Course.

Automator WordPress Action Create a post Type Course

In the field labeled Content is where we’re going to include the output from OpenAI. Click on the Asterisk and select Actions > Use a prompt to generate text with the Davinci model > Response.

Automator OpenAI Tokens Response

Similarly, in the Title field, use the Course Title token from the WPForms trigger to automatically generate your course title.

Once you’re finished, click Save. Your Actions panel should now look like this:

Using OpenAI and ChatGPT Models with LearnDash Automator OpenAI and LearnDash Actions

Step 6: It’s Alive! It’s Alive!

The last thing for you to do is to toggle the recipe from Draft to Live.

Using OpenAI and ChatGPT Models with LearnDash Automator OpenAI LearnDash Course Outline Recipe

Just for fun, here’s the course outline that OpenAI returned from the information that we put in our form:

OpenAI Sample Writing Introduction to Supercomputers

…maybe the AI is sentient after all.

Note: OpenAI is fast—but not necessarily instantaneous. It can take a few seconds to return content, so if you don’t see a new post right after it runs, wait approximately 30 seconds. The time it will take also depends on the model you choose (Davinci is slowest) and the number of tokens you allow (more tokens means more time). If the action times out, consider changing the model or reducing the number of tokens.

Build an AI-Generated Lesson

Now that we have our outline, it’s time to generate the lessons that will make up the bulk of our course content. And if anyone knows anything about supercomputers, it’s probably OpenAI—it’s built on one.

Step 1: Create a New Recipe

From your WordPress Admin Sidebar, navigate to Automator > Add New. In the pop-up window that appears, select Logged-in users.

Step 2: Name Your Recipe

We’ve named this recipe OpenAI Lesson Generator.

Step 3: Configure Your Trigger

We’ll be using the same form submission trigger with a different form for this recipe as we did with the last one, albeit with a much higher temperature.

Using OpenAI and ChatGPT Models with LearnDash WPForms Lesson

In the Triggers panel of the recipe builder, from the menu of available integrations, click WPForms or your preferred form-building plugin

Automator WPForms Trigger A user submits a form

Step 4: Configure Your Primary Action

We’ll be using the same primary action for this recipe as we did in the previous one with slightly different configurations for OpenAI.

Using OpenAI and ChatGPT Models with LearnDash OpenAI Prompt Editor

Once you’re finished, click Save.

Step 5: Configure Your Secondary Action

This secondary action is also very similar to the secondary action from the first recipe, with the only difference being that we’re creating a lesson instead of a course.

Automator WordPress Action Create a post Type Lesson

Your Actions panel should look something like this:

Using OpenAI and ChatGPT Models with LearnDash Automator OpenAI and LearnDash Actions Lesson

Step 6: Go Live

Toggle your recipe from Draft to Live. It should look like this:

Using OpenAI and ChatGPT Models with LearnDash Automator OpenAI LearnDash Lesson Draft Recipe

Here’s a snippet of the lesson that OpenAI returned:

OpenAI Sample Writing on Introduction to Supercomputers

If you’ve ever wondered what artificial intelligence does in its spare time, wonder no longer: it creates beautiful works of art.

With OpenAI’s image-generator, DALL-E 2, you can create original images that suit your needs—no matter how outlandish they are. Even if you asked DALL-E 2 to generate totally random images of, say, “a kangaroo dressed as a French artist sitting at an easel in the desert at dusk, digital art”.

DALL-E 2 images of a kangaroo painting in a desert

Now that you see what DALL-E 2 can do and you’ve created some new course and lesson content, it’s time to add original featured images using Automator’s OpenAI integration.

We modified our original WPForms form to include an image prompt field.

Using OpenAI and ChatGPT Models with LearnDash WPForms course and image prompt form

Next, in our OpenAI LearnDash Course Outline recipe, we’ll add the action to generate an image using the prompt from our updated form.

Automator OpenAI integration to generate an image

In our WordPress action to create a post, we simply add the image URL token from our OpenAI action into the Featured image URL field.

Automator OpenAI integration image url tokens

Note: Actions in Automator occur sequentially as they appear on screen. If the OpenAI action to generate an image appears after the WordPress action to create a post, then the image url tokens will not appear in the WordPress action. To correct this, simply drag the OpenAI action above the WordPress action and the image url tokens will appear.

With the action to generate an image, your new recipe should look like this:

Using OpenAI and ChatGPT Models with LearnDash Course Outline Recipe with Image

Our new course outline now includes some amazing, AI-generated artwork.

Using OpenAI and ChatGPT Models with LearnDash Course Outline with Featured Image

Automator also saved us the trouble of downloading the image ourselves and uploaded it directly into our WordPress media library.

Automator OpenAI integration media library support

Build an AI-Powered Chatbot for Students

Now that we have AI-generated course content, why not extend the power of AI to  support your students with a chatbot?

Meta Properties

Automator integrates with all of Meta’s major platforms such as Instagram, Facebook, and WhatsApp. Follow these steps to create your very own chatbot:

  1. Create a WhatsApp Business app and connect your app to Automator. Click here to find the full instructions.
  2. Download and activate the WhatsApp-powered Click to Chat App on your WordPress website.
  3. Create an Automator recipe for Everyone and select WhatsApp from the menu of available integrations. From the drop-down list that appears, select A message is received.
  4. In the Actions panel, click OpenAI and select Use a prompt to generate text. In the editor, use the WhatsApp Message token as the prompt and click Save.
  5. In the Actions panel, click Add action and select WhatsApp from the menu of available integrations. From the drop-down list, select Send a message to a number. Your recipe should look something like this:
Using OpenAI and ChatGPT Models with LearnDash OpenAI WhatsApp Chatbot

Now, with this recipe, every time a student asks a question on your site, Automator will route the question to OpenAI and the student will get an immediate AI-generated answer. For questions about learning content, students can get an immediate—and hopefully helpful—answer instead of waiting for an instructor. It’s like they’ll have their own (virtual) teacher’s assistant!

In the (not-so-distant) future, you’ll be able to train OpenAI on your specific documentation and content so that it can even provide more detailed course and site feedback. Imagine a more dynamic AI that can provide context-sensitive answers, based on your own content!

We’re not quite there yet, but it’s coming soon.

The Future of AI in E-learning

With AI that is this user-friendly, the android apocalypse is a long way off. And, as powerful as OpenAI is, it’s just the beginning of AI in e-learning. With exciting new tools such as Nolej AI on the horizon, you’ll be able to create interactive learning experiences within your LearnDash LMS at the push of a button.

NoleJ AI Homepage

What we covered in this article is the very cutting edge of AI in e-learning—but it’s just the beginning. The ability to train an AI, automatically generate full course structures and even create H5P and other interactive objects are on the horizon.

“Using OpenAI and ChatGPT Models with LearnDash” was originally published on https://automatorplugin.com/. This post has been republished here for educational and informational purposes only with the consent of the original author.

LearnDash Collaborator

A LearnDash specialist wrote this article to help guide new and current LearnDash members.