Create a High Quality WordPress AI Chatbot

Create a High Quality WordPress AI Chatbot

In 2016 WordPress released an HTTP REST API. A couple of days ago we released a plugin that can use the WordPress API to extract pages and posts.

This significantly increases your chatbot's quality, since it doesn't extract copyright notices, headers, footers, navbars, etc. By avoiding importing superflous information, we are able to transmit much more relevant information to OpenAI as users are using your AI chatbot.

How it works

The process is quite simple, we integrate with your WP account's REST API to retrieve pages once per week for instance, resulting in that your AI chatbot automatically updates as you publish changes to your site.

Once you've setup things, everything is 100% automatic, and you never have to think about it again. This allows your AI chatbot to have recent information from your website, by creating a scheduled task that extracts this information as often as you need. Below is the process simplified.

  1. Make sure you've got a recent version of WP installed.
  2. Create a user in WordPress and give it read only access to pages and posts.
  3. Create your chatbot type / model.
  4. Install the "wordpress" plugin on your Magic cloudlet.
  5. Create a scheduled task containing the example code from the plugin.
  6. Schedule your task to execute once every Sunday 5AM in the morning.
  7. Execute the task once to verify it's working.

You can watch me go through the whole process in the following video.

Why not use the scraper?

This is a little bit up to you, but the website scraper will extract a lot of irrelevant information, such as navbars, headers, footers, etc. This is typically general information found on every single page in your WordPress website, and results in "cognitive noise", reducing the chatbot's quality.

We are super proud of our website scraper, and we believe it's one of the best website scrapers that exists out there - However, obviously when retrieving "semantic data" directly through the WP API, the quality of your training data significantly increases. Software developers have a saying ...

Crap in, crap out

Implying the less crap you send in, the higher quality you get out. This is true for software development and this is true for AI. The last month we've significantly increased the quality of our UI frontend, we've significantly increased the quality of our system message logic, and now we've got the ability to retrieve semantic data from WordPress.

All of these changes combined simply creates an amazing AI chatbot experience, where the quality of its responses increases to the point, where it arguably "runs in circles" around the vanilla ChatGPT - In addition to other AI chatbot vendors.

Code

Below is the code for your scheduled task.

execute-file:/modules/wordpress/import.hl
   type:YOUR_TYPE_NAME
   url:"https://YOUR_WEBSITE.COM"
   username:YOUR_WP_USERNAME
   password:YOUR_WP_PASSWORD
   blogs:bool:true
   vectorize:bool:true

The following fields needs to be exchanged of course to your values.

  • YOUR_TYPE_NAME - The name of your chatbot type / model.
  • YOUR_WEBSITE.COM - The URL of your WordPress website.
  • YOUR_WP_USERNAME - WordPress username.
  • YOUR_WP_PASSWORD - The password for the above user.

Notice, you should create a specific user for only this purpose and not use your admin user.

Retrieving blogs can be turned off by changing blogs:bool:true to blogs:bool:false. This is sometimes better actually, depending upon how many irrelevant blogs you have that are not related directly to your company's value proposition. Then you need to schedule the task. This can be done as follows in the Task Manager.

Scheduling your WordPress import

The above repetition value implies every Sunday 5AM UTC time. For a detailed walk through watch the above video.

Conclusion

With this new WordPress plugin, you can significantly increase your AI chatbot's quality, in addition to automate the updating process completely. This eliminates the need to "wash" your model completely, and increases quality a lot. If you want to talk to us about an integrated AI chatbot for your WordPress site, you can contact us below.

Thomas Hansen

Thomas Hansen I am the CEO and Founder of AINIRO.IO, Ltd. I am a software developer with more than 25 years of experience. I write about Machine Learning, AI, and how to help organizations adopt said technologies. You can follow me on LinkedIn if you want to read more of what I write.

Published 3. May 2024