Embracing AI

In my 40+ years in the IT industry, I have seen fads come and go. Whilst in the past couple of years, I have watched the whole ‘web 3’ movement from the sidelines with some cynicism, I watched the emergence of mainstream AI in the past 12 months with more interest. Especially since OpenAI hit the mainstream with ChatGPT.

I’ve looked at AI over the years, and never really seen a good fit for any of the project I have been building. The early iterations of AI seemed clumsy and woefully inadequate - basically just an extension of a thousand “if…then…else” statements that didn’t really bring anything new to the table.

However, with the release of ChatGPT 3.x, something seemed to change. I sensed the excitement was more than just an opportunity to make a quick buck off people (I am looking at you ‘web3’!), but rather, a way to let any layperson grasp knowledge that was beyond their current understanding.

As a musician, I watched this video with interest when another guitarist with very limited programming knowledge used ChatGPT to help him create a VST plugin for a guitar effects pedal. I have tried writing a plugin in the past, and even with my 4 decades of programming knowledge, it was no easy task. It STILL isn’t an easy task, but watching ChatGPT break it down into simple steps, including helping to choose the technologies involved (which is really much harder than it sounds in this day and age of so much choice), it was the “Aha!” moment for me to see that AI could now work alongside so humans quite easily.

So I decided to see how I could incorporate AI into my SaaS app with renewed vigour.

The first thing I looked at was the feedback we had from customers that writing a job advertisement for our recruitment module was quite challenging for people who had not done a lot of it before. There were a lot of things to cover, and our customers just wanted to have a quick way of getting some sort of starting template that they could work with. Our options were (a) create a bunch of standard pro-forma templates for a wide variety of job listings, or (b) get ChatGPT to write them for us on an ‘as needs’ basis.

So we opted for (b) because it was a LOT less work for us, and added this new widget to our job listing creation screen:

Which in turn pops up this dialog which lets you query ChatGPT all from within our app, then lets you edit the returned job ad, and post it directly into your job listing within our app:

To say we were blown away with the results is an understatement. This was also the first indication to us that AI could really help to reduce human workloads. I mean, it would have taken our team weeks to create 20 or 30 pro-forma job ads, and even then, we wouldn’t cover all bases with the tens of thousands of job ads that our customers post on our platform. Using ChatGPT will help our customers much faster, and with more flexibility, than we ever could.

AND it was only about 4 hours work on a weekend for me to build this new feature into our app!

So this got me thinking on how much deeper we could go. I noticed that ChatGPT was great for general queries which relied on information that was readily available in the public domain. But what about doing things like helping customers to really get to grips with our own app, using app specific knowledge?

So down this rabbithole I went. How could I teach ChatGPT about our app so that it could give answers that were contextually based around HR Partner? Where do I start? How do I teach ChatGPT how my app works?

Well, the answer, as it should be, is “Ask ChatGPT!”…

Well, we already have a fantastic support knowledgebase with hundred of articles that my amazing Customer Success team have created and maintained, so we had a starting point. I then found this excellent blog post on the step by steps required to prepare a knowledgebase for interpretation by ChatGPT.

I followed the principles of that article, except instead of storing my documents in a CSV file, I stored them on DynamoDB, since we use the AWS infrastructure extensively in our app.

The basics of the process is:

  • Use the HelpScout Docs API to extract all the knowledgebase articles one by one

  • Strip out all the HTML from the extracted articles to basically convert them to plain text

  • Run the plain text through Open AI’s embedding process in order to create a matrix of vectors that explains to ChatGPT the various aspects of the text based on keywords, sentiment, verbosity etc.

  • Store all these embedding vectors and the plain text in a database somewhere so we can do the comparisons later

Once we had done all the above (which really only needed to be done once a week or so), then to actually make use of this, we had to:

  • Get the support query from the customer

  • Run the query through the Open AI embedding API to convert it to a vector matrix

  • Do a vector cosine similarity to see which help doc article is the closest match to the original customer query

  • Use that matched help doc article to generate an answer for the customer

Sounds simple in principle, but there were some tricky aspects to this. The stripping down of HTML documents to plain text, and the storing of that in a NoSQL database was quite simple, but what on earth is a ‘vector cosine similarity’ and how do I achieve that using Ruby, our language we developed our app in?

Solution - ask ChatGPT to help out with that too:

And there we have our answer.

Another weekend’s work, and I managed to build a system that could teach ChatGPT about our app, and answer support queries.

The main reason for building this is that I found myself hard pressed to keep up with our excellent support team. The team does an amazing job of looking after our customers, and answering their queries, but I was struggling to keep up with their superb output, with all the other things on my plate involved in running a business.

So I wrote a sneaky script that would grab the customer query that was sitting in our HelpScout inbox, and then allow me to fine tune the question by stripping out all un-needed text, then prepare an answer that I could cut and paste right back into HelpScout again to quickly answer simple, common questions:

Not bad. It points the customer to the correct help article with all the details that will help them. Note that the answer also includes the name of the customer sending in the query, as well as the signature including the name of the support team member generating the query!

What about a more complex question relating to one of the most used modules in our system?

Once again, sterling work by ChatGPT. It answered with the correct information to get the customer started, PLUS it added other contextual information on setting up extra bits that the customer might need to do afterward.

This will never replace our friendly, smart support team, but I hope it certainly goes a long way towards making their lives easier. This is really the objective of AI, in my opinion. To take away the ‘boring’ bits like typing repeated common answers by our team, and allowing them to thrive and spend time in other aspects of their roles, like conducting customer demos and onboarding, which ultimately is more creative, and makes a difference to my startup’s bottom line.