How to make a Dialogflow fallback for specific intents - dialogflow-es

I'm trying to make a chatbot to allow users to book items. I have 2 departments with items, so I have made 1 intent for each department. Department A has boardgames, Department B has computer equipment.
I've set up my intents so a user can ask "I want to book Monopoly" or "I want to book a laptop" - those queries work.
Now, I want to be able to handle the user asking "I want to book a room". That query won't match any of the training phrases for either of the departments, but I do want to give the user a context-specific answer of "We don't have that item available".
How to I configure an intent to match "I want to book [noun]", where [noun] is an unknown thing?

We solved this by creating a Book "anything" intent. It uses the built-in #sys.any parameter. So we defined phrases like "I want to book #sys.any". This intent seems to be matched only if the intents for department A and B do not match. In this way, it is a fallback of sorts that matches for all booking questions for unknown "things"

Related

IBM Watson: what should be the right granularity of intent?

Let's imagine we are opening a restaurant. We use a chatbot to handle customer ordering.
Intent: #order
Entity: #food: burger, noodle, chicken #drinks: coke, water, wine #compliantItem: service, burger, chicken, noodle
Currently I put "I am thirsty, can I order a can of #drinks", and "I am hungry, can I order a #food" in the intent #order. Does any one know if this would confuse Watson?
I am wondering if this should be improved by
create a new entity called #menuItem and put 2 values food and drinks in it, while keeping entity #food and # drinks
create a new entity called #menuItem and put all values from #food and #drinks in it and remove entities #food and #drinks
maintain 2 intents: (1) #orderfood: put sample "I am hungry, can I order a #food" in the intent #orderfood and (2) #orderdrinks: put sample "I am thirsty, can I order a can of #drinks" in the intent #orderdrinks
Thanks a lot!
Your question is discussed in "How entity references are treated" in the IBM Watson Assistant documentation. You can reference entities as you did. It cancels out any specific examples.
I cannot comment on your intent definitions and improvements. It depends on your dialog flow and how the bot is used. It is learning from user input and how it is processed. If there is something wrong, you as admin can correct it and Watson Assistant would learn it.

How to provide dynamic answer for the selected entity as parameter in dialogflow fulfillment

I have an entity (items) and its values are ('name', 'colour', 'awards')
I have three intents
Intent1 = Welcome Intent (user will get the options in the form of chips)
Intent2 = Select Option (bot will ask question to enter detail for selected option)
Intent3 = Update Option (bot will save the record and ask next option to update.)
Example -
bot: welcome! what you want to update? name, colour, awards.
user: name
bot: Enter your name.
user: John
bot: record updated, what to update next? name, colour, awards.
now the issue is awards have multiple fields to update, to update awards a user has to provide three things (award name, award date, award description)
What I want is when a user selects awards options from the chips then it should be taken to new intent where I will get all the data through slot filling.
The first thing to remember is that an Intent represents what the user has said and not what you are doing with what they have said. So it doesn't make sense to say that you are "going to an Intent".
Second, while slot filling seems like a good idea, it usually leads to further problems, since it doesn't handle conditional information well, or handle users if they skip around in what they want to update.
All of these are better solved by setting up a state machine where they are in the conversation, what information you need, and what they have provided so far. Based on these settings, you can prompt them yourself for what you expect next. (You may also find using one or several Dialogflow contexts useful for shaping how to accept results as well.)
So, for example, when the user has indicated they are updating the awards, it might work like this:
User: Awards
[Your fulfillment sets the 'awards' context with a parameter that we are prompting for the name.]
Bot: Ok, I'm going to need the award name, description, and when it was awarded. What is the name?
User: Merit
[This matches the Fallback Intent with an Input Context for 'awards', since it is free-form input. Your fulfillment stores this and sets the 'awards' context with a parameter that we are now prompting for the date.]
Bot: Got it, the award is named Merit. When was it awarded?
User: Today
[This matches an Intent with a training phrase of "<#sys.date>" and the Input Context of 'awards'. There are also training phrases for things like "It was awarded <#sys.date>" and so forth. Your fulfillment sets the date and sets the 'awards' context with a parameter that we're now prompting for description.]
Bot: Got it. Awarded on March 1st. What is the description?
User: They were awesome.
[This matches the Fallback Intent with the Input Context of 'awards' again, because it is still free-form input. Our fulfillment, however, knows that this is about the description this time, so it stores it and removes the 'awards' context since we've captured everything.]
Bot: I've recorded that as a description of "they were awesome" - sure thing. That was everything we needed for now. Do you want to update the name, colour, or awards next?
That all seems pretty straightforward. But consider if the conversation had gone this way:
User: Awards
[Your fulfillment sets the 'awards' context with a parameter that we are prompting for the name.]
Bot: Ok, I'm going to need the award name, description, and when it was awarded. What is the name?
User: [Having done this many times] They were given the award for Honor yesterday
[This might match an Intent with an Input Context of 'awards' and the training phrase of "Given the award for <#sys.any> <#sys.date>" and possibly "<#sys.date> they got an award for <#sys.any>". Your fulfillment sets the name and date from this, sees what information it still needs, and prompts with...]
Bot: Got it. Award named Honor. Awarded March 1. What is the description?
User: Actually, it is named Honorable Service
[This matches an Intent with a training phrase of "named <#sys.any>" and an Input Context for 'awards'. Your fulfillment changes the name stored, checks what we still need, and again prompts...]
Bot: Ok, I've changed the award name to Honorable Service. What is the description?
The first scenario could be handled by slot filling and simple prompting, but the second can't. Being able to handle more natural responses from people and more flexible prompting will be better for your users.

Complex Statements Intent Classification

Consider following sentences:
1) I want to watch movies watched by Srikanth but not by tarun
2) I want to watch movies of Christoper Nolan but not having Christian Bayle
3) I want watch movies watched by Srikanth but not liked by Tarun
The problem I am facing is -
Even though I can successfully define entities such as "not watched", "watched" , "not liked" , "having" , "not having" etc; etc;
Hence I will know what kind of action user is referring to.
I will also get to know names like Srikanth, Tarun, Nolan, Bayle etc;
But How do I establish Relationship between name and action. How do i know which action was related to which name.
I am not able to achieve this in LUIS / DIALOGFLOW.
What I feel is only way is to break statement into 2 distinct statements, How can we do that and is that a right approahc
We cannot directly assign multiple intents to the same utterance through LUIS. You can use NLTK along with LUIS to fix this issue as discussed here.
Another workaround is to create 2 apps with each intent and assign the same utterances and add the code which would differentiate the intent based on the keyword in the sentence.

How to implement "Change of mind" ability into the bot or conversation for any given intent in Dialogflow?

Consider a scenario where user wants to order a meal :
User : I would like to order 1 burger 1 orange juice and one coffee
Bot : Would you like to have a veg burger or a non-veg one?
User: A veg burger
User: Sorry, I would like it to be non-veg
Bot: (Generally how would we handle this change of mind without having to start the conversation from scratch) ?
In this part where I've been implementing something like a bus ticket booking, this the bot seems to remember the previous order that is veg-burger or some how ends up falling on to default intent or fallback intent whichever is suitable. But I would like to know if there is a way for letting the bot know that the user has "Changed the mind" (Hopefully it is possible using or manipulating the context) and wants a non-veg burger now?
Can we work out an followup intent recognizing words like Sorry and then entity such as type i.e. non-veg here. What is the best practice? Because starting the conversation from scratch doesn't seem to be a good idea from UX point of view.
Good day TGW,
You have 2 options, either you split your intents into a search intent and book intent e.g. search.salad and buy.salad intents OR you have a confirmation step before you actually send to Fulfilment.
If you choose to split your intents into 2 then a similar flow should work for you:
If the food type is finite then create an entity with the options.
Add your search.salad intent that should have most of what the users will say to order a salad. Remember to incoporate the entity from step 1.
Add a followup intent to your search.salad Intent, and select custom from the options.
In this newly created followup Intent add the User says that you want to use to update the search, enable fulfilment and save.
NB: Ensure the newly created intent has an intent that ends with *-followup in the In-context and this same intent is in the Out-context of the search.salad intent. Dialogflow will automatically update the parameters for you based on what the user enters.
The second option is similar to this, you can add your confirmation step as a followup to the search.salad intent and enable fulfilment only on the confirmation intent.

Dialogflow: How to restrict an Action parameter to one of the allowed values

Say I create an intent AskForFruit in Dialogflow where the user says:
I want an apple
here apple gets assigned to a param fruit
I want to restrict the value of fruit to 'apple', 'orange' and 'banana' only
If the user says 'peach' the agent will respond with 'Please select between apple, orange and banana'
How do I restrict the value of fruit to these 3 fruits only?
There are two things you need:
fruit should be assigned to a Custom Entity type
You will need a Fallback Intent (or a lower priority Intent) to handle input if there isn't a match.
Custom Entity
You'll create a custom entity by selecting the Entity menu item on the right and then Create Entity.
You'll enter in the possible values this Entity can take on. You can also add aliases for some of the entities if you want.
When you go to create your Intent, you want to make sure the entered phrase has a word highlighted and the Entity Type correctly selected for that word. (And, as #Ido notes in the comments, you probably want to say the parameter is required.)
Fallback Intent
That handles the case when the user says one of the valid fruits. But what about invalid fruits? How you handle this depends on what other things you're talking about.
The easiest solution is to create a Fallback Intent, which is an intent of last resort if nothing else matches. If you're using contexts, you can create a fallback intent for a particular context, and this is a great way to keep track of where you are in a conversation.
In either case, you'd edit your responses to tell them what valid fruits they can pick.
If, however, you want to very specifically respond if they ask for something you don't want, you can create a lower priority intent that will match if there isn't a better match. This is useful if you have a lot of conversation parts and aren't using contexts (but you should use contexts) or want to reserve your Fallback Intent for a more general message.
You change the priority of an intent by clicking on the dot next to the intent name.
So, for example, if you have an AskForSomethingElse intent that would match the more general #sys.any type, you could have it respond with the valid types.

Resources