Building a marketing chatbot pt. 2

I’ve had a lot of fun over the last few weeks building a marketing chatbot. I started here and thought “How difficult can it be?!”

Two months later I have found out both how difficult some of it is, but also how easy some of it is. The easy bits were putting together sources of information and using ChatGPT to help with the structure of the app. The most difficult bits were anything to do with permissions (even on my own data) and anything where I needed to use Microsoft Graph API. Still a long way to go, but I thought I’d post an update on the tech stack I’ve used so far.

Screenshot of the app so far! I will publish the real thing when I’ve had a look at the security implications…

Tech Stack

The very simple architecture/workflow for the app can be split in half:

  1. Server-side: Run various processes to collect together everything I know about marketing and put it into a database.
  2. Client-side: A way of running queries against that database

Having these guidelines helped enormously with choosing the technology and also helped to make sure everything worked together.

I wanted to use the following guidelines:

  • As free as possible. Only pay for something if the cost was minimal and it saved me an enormous amount of time/reduced complexity
  • Linux based. Again for cost purposes, but also because it’s just much easier to use 3rd party libraries

I ended up with the following, first for server-side then for client-side.

Server-side

  • Google Cloud. I have used Google Cloud in three places. If you are in the world of Linux then it is so easy to call the Google Cloud API, the online help is superb and it is relatively easy to use. But the biggest winner was the integration between Google Sheets and the API. I thought this would be tricky, but actually you were guided through it very simply. Specifically I used it for:
    • Speech-to-text encoding
    • Cloud Run to run the independent scans of various types of content
    • Google Sheets as document storage, including a sheet which lists all of my blog posts
  • Microsoft Personal OneDrive for documents. This is a significant source of information as I have used Microsoft personal OneDrive for a decade or more to keep notes on various ideas. With hindsight, I would have kept this much cleaner and better governed. There has been a lot of work cleaning up what was in here in all sorts of formats
  • GitHub for storing all Python code. A private repo for now
  • ChatGPT to help me with everything. It would be a lie to say that I wrote everything from scratch. I went to a very impressive lecture recently at the Cambridge Marketing Meetup from Siok Siok Tan who talked about how, going forward, people would work side-by-side with the machines splitting out tasks as appropriate. The way forward for this sort of work is being smart about what you should do and what the machine should do. What I found particularly interesting was the symbiotic relationship needed for writing code. For example, chat gpt wrote quite a lot for me as a starting point but I usually found I had to do a reasonable amount of work on top of that, because the ChatGPT sources were out of date, and APIs seem to be getting updated all the time.
  • Microsoft Graph API. Sigh. I use this extensively to programmatically access my OneNote notes. I had just finished working with the Google technology and thought “Surely the Microsoft APIs are just as easy?”. No they are not. A lot of this is to do with security of course, and that is good as I don’t want everybody reading my personal files. However the structure of OneNote files is nontrivial and getting API access to work correctly there’s a lot of hard work.

Client-side

  • Pinecone was a big breakthrough for me. I want a chatbot which isn’t just a simple text search. I wanted to try and do something which allowed me to use some sort of fuzzy search mechanism. As an example, my records might say something like “Account based marketing is a great strategy”, But I want that to come up if I searched for something like “What is ABM?”. I needed something more than just simple keyword based retrieval, so moved over to using embedding based retrieval with OpenAI.
  • Docker to containerize everything. Is that a real word!?
  • Google’s speech-to-text API. I’m going to save this for the 3rd blog post, partly because it is just so impressive it deserves a post of its own.

That will do for now. The next stage is all the testing, particularly to make sure the time using the right security for my documents. One of the key issues with using AI technologies on your own notes (essentially what I’m doing here), is the problem of oversharing information when you shouldn’t. It is something that we help customers with at Syskit, albeit in a different context (Microsoft 365 governance). But the principles are the same – are you sharing things outside your organisation that you shouldn’t be?! Be careful out there… I will eventually put a link in here that links to my app, but not until I have gone through all of the information and documents that I am using to make sure I am not oversharing. I will need to do this by hand so I may be some time…


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *