0

I have created a pizza bot in dialogflow. The scenario is like..

Bot says: Hi What do you want.

User says : I want pizza.

If the user says I want watermelon or I love pizza then dialogflow should respond with error message and ask the same question again. After getting a valid response from the user the bot should prompt the second like

Bot says: What kind of pizza do you want.

User says: I want mushroom(any) pizza.

If the user gives some garbage data like I want icecream or I want good pizza then again bot has to respond with an error and should ask the same question. I have trained the bot with the intents but the problem is validating the user input. How can I make it possible in dialogflow? A glimpse of training data & output traning data

raj_tx
  • 229
  • 1
  • 5
  • 18

2 Answers2

0

If you have already created different training phrases, then invalid phrases will typically trigger the Fallback Intent. If you're just using @sys.any as a parameter type, then it will fill it with anything, so you should define more narrow Entity Types.

In the example Intent you provided, you have a number of training phrases, but Dialogflow uses these training phrases as guidance, not as absolute strings that must be matched. From what you've trained it, it appears that phrases such as "I want .+ pizza" should be matched, so the NLU model might read it that way.

To narrow exactly what you're looking for, you might wish to create an Entity Type to handle pizza flavors. This will help narrow how the NLU model will interpret what the user will say. It also makes it easier for you to understand what type of pizza they're asking for, since you can examine just the parameters, and not have to parse the entire string again.

How you handle this in the Fallback Intent depends on how the rest of your system works. The most straightforward is to use your Fulfillment webhook to determine what state of your questioning you're in and either repeat the question or provide additional guidance.

Remember, also, that the conversation could go something like this:

Bot says: Hi What do you want.

User says : I want a mushroom pizza.

They've skipped over one of your questions (which wasn't necessary in this case). This is normal for a conversational UI, so you need to be prepared for it.

Community
  • 1
  • 1
Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • But the problem is when `bot says : what do you want?` & I reply with `I want good pizza` it is promting the next question.Instead of throwing any fallback intent. Here good pizza is not what we expect. The response must be like mushroom pizza ,chicken pizza & etc. Then only it should prompt the next question. – raj_tx Oct 30 '18 at 11:31
  • @raj_tx have you made any custom entity for type of pizza? if yes then you should restrict the entity to use only those examples. You can do this by unchecking `allow automated expansion` – sid8491 Oct 30 '18 at 12:03
  • @raj_tx - We'd need to see what training phrases you're using for each intent and how you're defining the parameters to evaluate that further. I've updated my answer to talk about entity types and parameters as well, which you should pay attention to. – Prisoner Oct 30 '18 at 13:00
  • (If you want, please update your original question to show the Intent definitions, and we may be able to guide you further.) – Prisoner Oct 30 '18 at 13:00
  • I have tried it by declaring the entities too. But I'm getting the same response. – raj_tx Oct 30 '18 at 15:28
  • Can you show the Intent and the Entities you used so we can try to duplicate and understand why it might have worked that way? – Prisoner Oct 30 '18 at 15:59
0

The type of pizzas (eg mushroom, chicken etc) should be a custom entity.

entity for the pizza flavours

Then at your intent you should define the training phrases as you have but make sure that the entity is marked and that you also add a template for the user's response:

intent

There are 3 main things you need to note here:

  1. The entities are marked
  2. A template is used. To create a template click on the quote symbol in the training phrases as the image below shows. Make sure that again your entity is used here
  3. Make your pizza type a required parameter. That way it won't advance to the next question unless a valid answer is provided.

switching from example to template and vice versa

One final advice is to put some more effort in designing the interaction and the responses. Greeting your users with "what do you want" isn't the best experience. Also, with your approach you're trying to force them into one specific path but this is not how a conversational app should be. You can find more about this here. A better experience would be to greet the users, explain what they can do with your app and let them know about their options. Example: - Hi, welcome to the Pizza App! I'm here to help you find the perfect pizza for you [note: here you need to add any other actions your bot can perform, like track an order for instance]! Our most popular pizzas are mushroom, chicken and margarita? Do you know what you want already or do you need help?

Eliza Camber
  • 1,536
  • 1
  • 13
  • 21
  • Thanks for you effort. Now I'm working on a different thing like interviewing the user on technical skills. Now I have large user responses. – raj_tx Oct 31 '18 at 14:32