Lesson 1: Intro: Job Description and Plan of Actions
Welcome to this mini-course of building a Python chatbot that provides the answers from the database of cars.
This is based on a real job from Upwork:
The goal is to have a widget to be embedded on any website.
Here are a few screenshots of the final product we will build:
This course is about the database of cars but you can use the same logic and concept to query database of any kind: e-commerce, blog articles, etc.
Job Description
This course is based on a real job from Upwork. So first, let's take a look at its original description from the client.
We have 2 million vehicles and like to train the chatbot on all our new and used inventory on Year, make, model, trim, Price, Miles, options, specs....
Our use-case is to have a chat bot on our website that can answer questions about our inventory and help customers find the right vehicle for them.
Here's a quick chat example
- User: i want a ford f150- AI: do you need 4x4?- User: Yes- AI: are there any features you would like- User: leather and apple car play also 4 doors- AI: how about a price range?- User: under $40,000- Ai: great here is a list of vehicle that closely match your request
Plan of Actions
To build this chatbot, we need to have a few main components. I will list them and specify the tech-stack we will use:
- Database of Vehicles (MySQL)
- Chatbot Engine as API (Python). That API will ask the database for the cars and call the OpenAI API to formulate the final human-friendly answer.
- Chat widget (JavaScript). It can be embedded into a website and would call the chatbot API from above.
Here's the architecture of the chatbot in a more detailed way:
In the Python script, we will make two calls to the AI GPT engine:
- First, we will ask GPT to generate the MySQL query based on the user's question and database tables.
- Then, we will run that query, get the results, and ask GPT to generate a human-friendly response based on the results.
That's the basic plan for now. Let's start building it!
You will get the link to the GitHub repository at the end of the last lesson.
- Intro: Structure and Preparation
- AI Engine and Main Python Script
- Front-end JavaScript Widget
- Bonus
Why you don't use vectors as knowledge base instead of SQL query generation from GPT?
The goal here was to explore options and see how things can be done. We found people looking into database as their source of truth so, we looked if that is possible and how hard it is
We have a different tutorial with vectors