Queries for FAQ bot

Hey there! I’m trying to make an FAQ bot. I’m new to this framework and still exploring. How do we go about solving the problem for, say something like this: I want the bot to respond to user’s diet queries whether the user can eat this particular food or not?

For a Lactose Intolerant patient, he/she cannot eat any dairy product and anything that has milk products in it. To tackle this problem, I made diet as intent and two entities, dairy and non-dairy. under the intent diet, I added a list of food items and added their corresponding entities, like this:

intent: diet

– [Buttermilk] (dairy) – [cheese] (dairy) – [rice] (non-dairy) – [potato] (non-dairy)

Now I want my bot to respond according to the entities it finds in user input. If the user asks, “Hey can I have cheese?” I want the bot to pick up the word cheese and say, “No you’re not allowed to have cheese”

How do I go about solving this kind of a problem and what approach should I take?

I wonder if the entity you’re after here is diary or if it is foodproduct. If the entity is foodproduct then it will not be the entitydetectors job to handle the decision making on type of the food, rather just to detect that it is a food product.

The reason why I think this might be better is that this way you can have a custom action check if the foodproduct is known in your database and you can more reliably tell the user allergy information. Machine learning models will make mistakes now and again. You wouldn’t want a person to follow the wrong diary advice … this can have serious consequences.

If you detect a foodproduct but you do not know the allergy information then you have the opportunity to “fail elegantly”. You can tell the user “I can’t say for this product”. This prevents giving the user wrong information and you’ll have a checking mechanism as well. If the foodproduct is not in the database, then you can’t advice the user accurately.

1 Like

That makes sense. Yeah, going forward with the same problem, I’ll consider your suggestion but this is something which I’m doing for my learning purposes and I did solve the problem by extracting the entity and making a custom action.

1 Like