Candidate Intents

At any point in the conversation, there is a set of intents which can fire. We will call these candidate intents. To understand candidate intents, it helps to first understand which intents cannot fire.

Which intent cannot fire?

Suppose an intent has an input context called ContextA. Unless ContextA is active at that point in the conversation, the intent cannot fire.

An intent with no input context can fire anytime

If an intent doesn’t have an input context, it can fire (i.e. be mapped) at any point during the conversation. Of course, it will only actually fire if Dialogflow uses its pattern matching and decides that the pattern of the user’s message is close to one of the training phrases in the intent.

The video below explains candidate intents:

I also have another article where I go into this topic in some depth.

Autogenerated YouTube transcript

[00:00] so in the previous videos we saw that having a context lifespan which is smaller than one was causing a couple of issues the first is it wasn’t letting the intent that we expected to be mapped and it was. Also causing the intents we did not want to get mapped to actually get triggered right so this means that having a context lifespan which is more than one was leading to some unpredictable behavior in your chat BOTS [00:30]. So let’s take a look at this in some more detail and see if we can come up with a more systematic way to study the whole the whole problem and. As well as see if we can come up with some heuristics and see if we can make our BOTS more predictable by following certain conventions.

So the first thing I want to talk about is the notion of the ⌛ [01:00] candidate intents what do I mean by candidate intents at any given point in the conversation there are a certain set of intents which can fire now we already know that if an intent has an input context

Unless that context is active it’s not possible for that intent to fire at that point in the conversation now what this. Also means is that if you [01:30] have an intent which has no input context it means it can fire at any point. During the conversation which means it’s a candidate intent at every point in the conversation and you.

Also know that if the input context of that intent is active at that point in the conversation it’s possible for that intent to fire which means it will be a ⌛ [02:00] candidate intent at the point in the conversation now to make it a little more concrete let’s take a look at the pot we’ve been building and let’s just look at it at the starting point

So here we already know that the default fallback the default welcome don’t have any input context we know that these two are context based fallbacks which means that they do have input context and we.

Also know based on the previous videos that [02:30] user draw its first name and user provides last name will have input context user wants to by Island won’t have an input context so it’s a candidate intent at the first step in the conversation

And the same way user wants to by submarine has no input context but these two follow – up intents will have input context and these two can not trigger at the starting of the conversation now. There is another way to study this I have built an app called the the dialog ⌛ [03:00] flow navigator.

So the Dialogflow navigator allows you to take the zip file of your agent and filter the intents by input and output context

So here you have it can also do like a search within and all that but for now let’s we are only concerned with the context. And you can see that it’s basically. As soon as you load the zip file it’s going to show you all the details of each intent you have the intent name. And the input context the [03:30] output context.

And then you have like actions and so forth

And then you have on the two columns on the right you have the user size places. As well as three responses now you see at the top here. There is a way to filter by input context so what I’m going to do is you can see that you can even either choose all the intents or you can choose the input context the intents which have input context none that is if they don’t have any input context. So let’s say I ⌛ [04:00] select that. And this list has changed and you can see that it’s come back to the list I was just talking about you have the default fallback the default welcome the user wants to by Island.

And the user wants to by submarine so these intents are the ones which do not have an input context and they are the candidate intents at the very first step of the conversation now let’s say that at this point the user says I want to buy a submarine so it’s going [04:30] to trigger this user wants to buy a submarine intent and it’s

Also going to set this user wants to buy submarine – follow – up context so this is now active at this point in the conversation.

So let’s take a look at which current which intents can actually fire so we are looking at this context over here let’s select that

And you can see that these are the two intents which can now fire ⌛ [05:00] it’s the first name fallback intent. As well as the user wants to buy submarine – first name intent so this can these are the two intents which can fire at this point in the conversation but I. Also want you to remember one more thing the input context whether it’s active or not. Also matters so what what do I mean by they like if I go back here and I say that if I just give my first name let’s say the usual the atom so what do you see here [05:30] is the user wants to buy submarine – follow – up is still active.

And you can see that the user wants to buy submarine – first name – follow – up is

Also active so effectively what this means for us is if either this. Or this context is active if either if this. Or this context whatever intents are using them as the ⌛ [06:00] input context they are all going to be candidate intents at that point in the conversation. So when I move this to users wants to buy submarine first name follower you can see that now we have these two intents last name fallback and user wants to buy submarine – last name but remember that this context is.

Also still active which means these two in terms the first name fallback

And the user wants to buy submarine are. Also candidates so if I come back to this list here what I just told you is at [06:30] this step in the conversation user wants to buy submarine – last name is active. Because of this context okay last name fallback is an is a candidate intent. Because of this context but first name fallback is. Also a candidate intent because this context is still active and. In the same way user wants to buy submarine – first name is a candidate intent because this context is ⌛ [07:00] active.

In other words you can take a look at the active context from this in the Dialogflow simulator over here and based on that you will be able to look at this list and figure out which of these intents are candidates and don’t forget at every step we still have these fallback

And the welcome and the user wants to buy I’ll end – user was to buy submarine all these are. Also still candidate intents simply because they [07:30] don’t have an input context so they are the other other way to look at it is if an input context is set that can still trigger intents which don’t have any input context at all set. In other words the like I said before the intents which don’t have any input context will be ⌛ [08:00] candidate intents at every step in the conversation.

Now that actually has some benefits for example you want the fallback to always be active to always be a candidate at every step because you know if we can’t handle it then you

Certainly you want the fallback to get triggered but it. Also means that you have to be careful when you create intents which don’t have input context because you want to be pretty sure that they will not be conflicting with the other intents which you want to actually [08:30] fire at that point in the conversation.

Transcript auto-formatted using ATF

ℹ️ All Courses | ? How to unlock all lessons (free) | ? Live chat

>