Add state transition

(Autogenerated transcript)

[00:00:00]
 Alright, so now let's add more state transitions into our bot. If you go and click on this state 25, the state, you will see that the only thing that we have right now is you have entered state 25, the entry dialog. What I'm going to do is I'm going to add an intent in the intent routes in this page. So here, this is one of the nicest features in Dialogflow CX. You can just reuse an intent you have declared before. So in our case, we know that we already created this add a quarter intent, which has this phrase which just says add a quarter. And now when I select that intent, notice that it allows me to change the response. In other words, you can have different responses for the same intent based on which page you have added that intent into. That is what is the current state of the bot.

[00:01:00]
 And that makes perfect sense if you think about it because if you're in state 25 and you add 25 cents by adding a quarter, and let's say that the agent is going to give you the balance, right? If it's in state zero and you add a quarter, the balance here, it should say 25 cents. On the other hand, if you are already in state 25 and then you add a quarter, the balance should say 50 cents. It shouldn't say 25 cents, right? So this is an important distinction because in the case of Dialogflow ES, you will come back, it will come back with the same response. When I say it comes back with the same response, what I'm really saying is, yes, you can select from a set of possible responses, but that's actually selected at random as you know, right? Here the concept is very different. You took an intent which we have already declared, but you have changed the response, not randomly selected from a list, but you have actually changed the meaning of the response

[00:02:00]
 because you are able to edit the fulfillment depending on which state you are in right now. But in our case, I'm just going to say you have added a quarter. I'm not going to provide the balance here. That's what I mean. But I will change the state to state 50. That is I'm going to transition to the page called state 50. So let's save this. Now let's go to state 50. And if it doesn't open, you can actually click on this edit here. And in the fulfillment, I'm going to say you have entered state 50. Okay. Now save it and let's test it quickly. I'm going to start with add a quarter. You can see that it's coming back with, okay, I added a quarter.

[00:03:00]
 You have now entered state 25. It's already in state 25. So if I were to say add a quarter again, you can see that it says you have added a quarter. You have entered state 50, which is exactly what we want. So let's continue in that same fashion. Now we are in state 50. Let's edit state 50 and go to the page view of, okay. What I'm going to do is minimize this and expand this state 50. We will add a new intent. Well, we are just adding the old intent back into this new page. And once again, the agent says, okay, you have added a quarter and then it will transition to state 75. Right? Let's save that and let's go to state 75. And in the entry dialogue, we will just say you have now entered state 75.

[00:04:00]
 That's pretty much all we have for the, in terms of changing the state. So let's go ahead and test the agent. We start by saying add a quarter. You have entered state 25. Then I say add a quarter. You have entered state 50. You say add a quarter. And you can see that it's now entered state 75. We don't allow the user to add any more quarters. You remember the logic of the vending machine. So this is explaining to you what is going on in terms of the state transitions. That is the page transitions in our bot. And if you come to the visualization of the flow, you can see that it's got this nice, I guess you can say that it's got this nice flow diagram where you can see that the bot

[00:05:00]
 is able to move from start to state 25 to state 50 to state 75. Now you may not be able to see the full details. So if you remember the image that I had here, you can even see exactly which text moves it from which state to which state. That level of granularity is not available in the overall view in your CX console, but you could click on this, right? And then you can see, you should click on this specific intents and you do have this information here. And of course the reason for that is because they are trying to provide you with the most compact representation of the flow diagram. If they try to provide all this information in one view, I am pretty sure that there will be so much information on this page that you will not be able to make sense of what is going on. So they have to decide on some kind of tradeoffs as to how much of a high level picture they

[00:06:00]
 can show on this flow diagram. And I think that to me it looks like a reasonably good balance till now. So what we have done now with this particular video is that we have added all the state transitions into our Vendee bot.


About this website

BotFlo1 was created by Aravind Mohanoor as a website which provided training and tools for non-programmers who were2 building Dialogflow chatbots.

This website has now expanded into other topics in Natural Language Processing, including the recent Large Language Models (GPT etc.) with a special focus on helping non-programmers identify and use the right tool for their specific NLP task. 

For example, when not to use GPT

1 BotFlo was previously called MiningBusinessData. That is why you see that name in many videos

2 And still are building Dialogflow chatbots. Dialogflow ES first evolved into Dialogflow CX, and Dialogflow CX itself evolved to add Generative AI features in mid-2023