I wanted to share my latest project which is relevant to both people searching for a project management tool and DIYers interested in building AI tools.
I decided this old dog needed to learn AI. Rather than take a course, I thought I’d learn by building my own custom AI chatbot from scratch. Sounds crazy, but I learned this is within reach of almost anyone with just a little bit of technical experience.
I loaded all my website’s existing reviews of project management tools into a vector database on the cloud. Then I built a WordPress plugin to handle the user interface for the chatbot. Here is the finished product: Project Management Tool Chatbot.
Here are the main things I learned:
- Anyone can program using AI coding tools like Claude or ChatGPT.
- Building a chatbot is incredibly cheap.
- The chatbot can easily be designed to provide accurate responses without hallucinations.
- The chatbot build consists of three main steps: prepping the data, loading the data into a vector database, building the user interface.
Anyone Can Program Using AI Coding Tools
I have some technical experience but I haven’t programmed in over twenty years, and never in the modern languages. I was able to code in PHP and javascript without any experience using the AI tool Claude.
This project required building about ten java scripts. First, scripts to scrape data from my website, transform it and then load it via an API to a vector database. Next, I had to build scripts as part of the WordPress plugin.
The amazing thing is that I was able to build all of this, and yet if you put a gun to my head I couldn’t write a single line of java script on my own. It is like I’ve built a symbiotic relationship with Claude. I learned how to guide and nudge it, but I didn’t have to learn any of the coding syntax.
Building a Chatbot is Cheap
My only expense so far has been a monthly subscription to the AI chatbot Claude for $20/month. I only needed this because I was bumping up against Claude’s daily volume limits. A smaller project could have been done with the free version of Claude.
I will incur costs for the Pinecone vector database and calling the OpenAI large language model (LLM). But these costs are pay as you go, and ridiculously cheap. Each time someone submits a question to my chatbot, I’ll be charged about two cents after I exceed the monthly allotment for the free plan. The chatbot will have to become incredibly popular for me to incur more than a few dollars a month in costs.
Chatbots Without Hallucinations
Everyone who has used ChatGPT has gotten a crazy answer that ChatGPT has simply made up. These are called hallucinations. But a custom chatbot (also known as a RAG model) doesn’t have these issues.
When a user submits a question to my chatbot my personal knowledgebase is searched on the vector database. Matching blocks of text (called context chunks) are returned with a percentage match score. I set how good a match is required to use a returned block of text. In testing my chatbot, about an 82% (B minus) is the sweet spot.
The blocks of text which clear the quality hurdled are then sent to the OpenAI LLM. However, the LLM is instructed to answer only using the provided text. It doesn’t tap its training data and it doesn’t hallucinate. The LLM is only used to summarize and format the response based on the text from my knowledgebase.
Building a Chatbot in Three Steps
The first step is to pull your data and transform it into JSON files. I had to build scripts to chop my blog posts and scoring spreadsheets into blocks of text and format them as JSON.
The second step is submitting the JSON files to a vector database. I chose to use a cloud-based database called Pinecone. I simply submitted the files to Pinecone and it ‘embedded’ the data. Embedding means it calculates a vector score for the chunk of text. But this isn’t the three-dimensional vectors you learned in high school. These vectors have 1,500 dimensions.
Step three was building a user interface for the chatbot. I’m a big fan of the WordPress opensource model, so I built a WordPress plugin which I could simply insert on any page of my website. The plugin manages a four-step process:
1. Collects the user prompt and submits it to Pinecone’s API to be embedded into a vector and matched.
2. Filters out low-quality text chunks returned by Pinecone. If there aren’t any high-quality text chunks, tells the user it can’t answer the question.
3. Submits the high-quality text chunks to the OpenAI API.
4. Displays the natural language response received by OpenAI.
Conclusion
I hope my experience will encourage you to build your own AI chatbots. I actually found it pretty fulfilling and a great learning opportunity. Next I’m going to build my first AI agent. I’ll keep you updated on how that goes.
If you have interest in the WordPress plugin I built for this project, I’m selling it for a nominal price of $30. You can find more details here.
Leave a Reply