Help your chatbot learn
Introduction
Why is this necessary?
If the chatbot doesn't have enough information, it can just ask for clarification. But non-technical users usually don't understand the database, so it's important that the chatbot has enough information about your database and company.
Imagine Facebook hires a new data analyst, and asks them to answer this question using their database:
"Who are the 10 most active users?" - In this case it's not clear what is meant by "most active user". Should it just check their logs, or also chat messages? and which logs are relevant?
Imagine the database includes this column:
"Gender" in the "User" table, with unique values 1 and 2 - It's not clear what 1 means, and what 2 means.
So if the data analyst is asked "Which countries have the most active female users?", they will have to get help from their team or ask for documentation first.
It's possible that BlazeSQL can answer your questions without help
BlazeSQL extracts comments/descriptions you might have in your database, as well as foreign/primary keys, and categories.
It's possible that it will write the correct queries without additional learning, but it's important to test first and improve its knowledge if necessary.
Requirements
Example questions from the team
Get 5-10 examples of questions that your team will ask the chatbot. These can be used to test the chatbot's understanding of your database and your company.
Technical user
This testing needs to be done by technical users who understand the database and know how to write the correct SQL code.
Connected database
The database your team will use needs to be connected in BlazeSQL.
Step 1: Testing the chatbot
Get example questions
As mentioned in the requirements (above), you need 5-10 examples of questions your team might ask the chatbot. These will be used to test the chatbot's ability to answer requests correctly.
Review the questions
Are the questions clear enough? It's easy to assume the AI isn't smart enough, even though your question/request just wasn't clear. Make sure the questions are clear and could be answered correctly by a human, ex. a new data analyst that joined your company recently.
Send the requests in the chat
Send the questions/requests in the chat and check the responses:
If all responses are correct: you do not need to train/teach the chatbot. Feel free to invite your team, and start asking the chatbot for the insights you need.
If the chatbot makes mistakes or asks for clarification: Continue to step 2.
Step 2: Improving the chatbot
Understand the mistakes
Take a look at the SQL code to understand what the chatbot is doing wrong. If you are in the "No-code analytics chatbot" mode or signed up as a Non-technical user, click the "Queried database" widget to see the SQL code.
Chatbot Knowledge
Click the Brain Icon in the bottom left of the BlazeSQL chat page to access the AI Chatbot Knowledge section
Optionally watch the below video for a detailed breakdown of how to use the AI Chatbot Knowledge section to teach your chatbot
Teaching your chatbot with helpful notes and descriptions
For questions where the chatbot made a mistake, or asked for clarification, think about what information or knowledge may have helped the chatbot. This information can be added in the "Database Info" tab of the knowledge section. Simply add helpful information to the database, schemas, tables, or columns by writing a short and clear note. Less is more.
The chatbot will check this information before responding to your messages.
Alternatively (ex. for more complex situations), you can just provide an example of a correct query (See the next section "Teaching your chatbot with Example queries").
Extracting unique values for categorical columns
When a query needs to filter on a certain column, the user may not necessarily provide the exact value to filter on. Ex. Someone might ask about female customers, but technically the value in the gender column could be F, Female, FEMALE, female, or something else. The same can apply to other categories, cities, etc. Non-technical users might not always know what these values are, so they won't necessarily mention the correct value in their request.
For categorical columns that have a text/string type and up to 10 unique values, these values will be extracted automatically if you enable the "Extract category values" option when connecting or updating your database.
For columns with up to 100 unique values, you can simply click the category icon to extract their unique values.
For columns with successfully extracted categories, hover your mouse over the category icon to see the extracted values.
Tell your AI to remember something from your message
If you tell the chatbot something about your database or company that it should remember every time it receives a request from any user for the current database, Hover over your message and click the "Remember" button. This will automatically generate a note for the appropriate table and column, or just a general note for the database. You can edit this, or just save it.
Teaching your chatbot with Example queries
If the chatbot made a mistake or asked for clarification, you can also just provide an example of a correct query. This is especially useful in complex cases, and other cases where the chatbot required a lot of help and clarification to get to the correct result. In those cases, you can just add the final correct query as an example query.
Simply add the queries, and write a simple description of the query result (or just write the question that the query answers).
Every time the chatbot responds to a message, it will first look at the 3 most relevant example queries you provided. This can help it figure out how to write the query correctly.
Step 3: Final testing
If the database descriptions and example queries didn't help
If the chatbot keeps making the same mistakes even though you added database descriptions and example queries, we can fix this for you with a custom chatbot. We have had a 100% success rate creating custom versions of our chatbot to solve these problems. Simply open the chat at the bottom of this page and provide a screenshot with the request and the query, with a brief explanation of the mistakes the chatbot makes.
If the chatbot now successfully answers your example questions
Ask 5 new example questions, and see if the chatbot answers them correctly.
If they are answered correctly: Invite your team and start getting data insights! (Optionally, read articles on graphs and dashboards)
If the chatbot asks for clarification or makes mistakes: go back to step 2. and repeat this process. Are you stuck? Open the support chat at the bottom of this page and we will customize a chatbot for your company and database.
Updated on: 23/09/2024
Thank you!