Hey there,
One of the most common requests I hear from clients is that they want a custom version of ChatGPT for their business that uses their knowledge.
Whether it's a chatbot on their website, WhatsApp, Instagram, etc. all they want is to have it use their knowledge. So in this guide, I want to teach you how to build such a thing.
I just created a custom chatbot for my website in 40 minutes, you can give it a try on this website (chatbot bubble in bottom right corner). It has access to the entire transcript of the Prompt Master AI Course (170 pages) so if you want, you can learn everything without taking the course. 😂
Step 1: Theorycrafting
Theorycrafting is a term I learned from video games, it's basically when you just do the maths from the game and try to figure out the winning strategy/build on paper without actually playing the game.
So let's start there. You need to figure out the following things:
1/ What's the whole purpose of the chatbot?
My general rule of thumb is one task = one AI. The reason for this is performance. If you give just one task to ChatGPT, it performs pretty well. If you give it multiple, then it will perform each poorly. So decide whether it's a teacher, customer support agent, sales agent, appointment setter, etc.
2/ Where will the chatbot live? (website, IG DMs, whatsapp?)
This will be important for later, when we research integration options. The tool that I used for my chatbot is Chatbase, which currently integrates with: Zapier, Make, Slack, Wordpress, Whatsapp, Instagram, Messenger and can be embedded on HTML sites.
3/ What kind of knowledge does it need to have access to?
This is critical for the performance of the chatbot, without these, you will only be using the model's training data - which is the same as someone just chatting to ChatGPT on their own. So the knowledge base gives the extra value to the chatbot. For mine, it's the entire 12 hour Prompt Master AI course's video lesson transcripts.
Step 2: Preparation
A big chunk of the 40 minutes (let's say half of it) was to prepare the knowledge file. I already had the lesson transcripts in a Google Drive folder, but it was 74 separate documents.
Downloading them and uploading them to the chatbot would've been a nightmare, so I set up a quick Make scenario that would take each of these files and append them into one giant document.
74 docs vs. 1 giant doc doesn't influence the performance of the chatbot, althought some platforms (like Custom GPTs) restrict you on document numbers, others (like Chatbase) restrict you on total character counts in documents. At the same time, I also wanted to update the Prompt Master Tutor GPT, so I decided 1 giant doc is my way to go.
So for you, you need to collect these files. Keep in mind that the files' overall context will be lost, and only text is saved (so don't try to put in images or charts, they won't be loaded).
Generally speaking, print ready PDFs are the safest option for most platforms, but you can get away with .docx, .txt, .rtf files as well.
Step 3: Building
Okay, now you have your knowledge files ready, so let's start building the chatbot. From here on, I'll walk you through how to do it in Chatbase, as I think that's the easiest to use platform at the moment for this. (it's an affiliate link, so if you register, I get a small commission at no extra cost to you. Thank you for supporting my work!)
https://embed.filekitcdn.com/e/uGb79oissDLZsiLe3DBSmu/fGWqfZxSBJPpy2Y4H4PtjU/email
The first thing that Chatbase tells you to do is to upload your files. So if you've prepared them, let's do that, and then click "Create Chatbot" (on the free plan, you can create 1 chatbot with maximum of 400k characters, and you can embed into your site).
Then go to Settings ➔ AI, and here we can write the system prompt for the chatbot.
You can see my prompt below, and you can also ask my course tutor chatbot to help you with writing one for your chatbot.
For starters, I recommend starting with a simple prompt, and emphasize the use of the knowledge base to avoid hallucinations.
Then work on improving your prompt later. We just need to ship it first. Optimize later.
https://embed.filekitcdn.com/e/uGb79oissDLZsiLe3DBSmu/ivKs5wJWrqa1JpVAJPrgxc/email
You can also pick your model here and the temperature settings. I went with Claude 3.5 Sonnet with 0.2 temperature.
In the playground, you can also compare two models. Currently, both GPT-4o and Claude 3.5 Sonnet cost 1 credit each (same as the weaker GPT-4o mini model, so no point in using that at the moment).
See my screenshot on "What are the key elements of a prompt" question response. I just like Claude over GPT right now, personal preference. They both told roughly the same things from my files.
https://embed.filekitcdn.com/e/uGb79oissDLZsiLe3DBSmu/sAa7XJWhGXRudKNb8VQ8sc/email
In the playground you can chat with your chatbot. Take it for a spin. Try to make it sweat, try to jailbreak your own system prompt, and try to break it. If it breaks, go back and adjust your prompt. Rinse and repeat.
Step 4: Deploy
Now go to Connect and either Embed (if you want it on your website) or Integrations (if you want it in your other systems).
Follow the instructions there, and test the chatbot on your website, see how well it works.
Btw, I also tried the chatbot in Hungarian, and even though the entire transcript was in English, it actually gave pretty good responses (although on the backend, its confidence score was a lot lower - 90% in English, 73% in Hungarian).
https://embed.filekitcdn.com/e/uGb79oissDLZsiLe3DBSmu/dnWa1U5WgXLSp1Ua5uXDP9/email
Step 5: Share your chatbot
Send it to your friends, your customers, your followers, and so on, and get them to use it, to interact with it.
So to lead by example, go to this site and try my new Prompt Master tutor chatbot trained on 170 pages of my AI knowledge.
Best,Dave