Context | DialogFlow

Dialogflow Context Lifespan

I have mentioned in many of my articles and videos that I recommend using a context lifespan of 1 in all your intents. I have collected all the related ideas into this single article, and also updated it with my current view as of June 2020. This article is based on a few different articles I had written previously on the topic of context lifespan. Optimal context lifespan in DialogFlow Note: this is a somewhat advanced topic, and certainly a bit opinionated. I wouldn’t recommend beginners get into this article until they have built at least a toy bot and experienced all the features in Dialogflow. Contexts If you are building bots using Dialogflow, you are probably aware of contexts….

Context | DialogFlow

Three types of Dialogflow contexts

You might not have realized this, but there are actually three types of Dialogflow contexts. And I recommend only one of them. Implicit and auto-generated contexts When you use the slot filling feature, which I do not recommend, you are using implicit, auto-generated contexts. (Note: I use auto-generated and system generated interchangeably, they mean the same thing). These contexts are auto-generated because you didn’t create them but they are automatically generated by the system when you define a parameter as being required. They are implicit, because their presence cannot be used to infer candidate intents. Explicit and auto-generated contexts When you use the follow-up intents feature, you will notice that Dialogflow automatically adds an output context to the parent intent…

Context | DialogFlow

Extending context duration in Dialogflow

As you might know, Dialogflow contexts expire within 10 minutes (or 20 minutes, depending on who you ask). In any case, there is a time limit for all contexts and they expire after that time. Sometimes, people need to extend the context duration for long running chat scenarios. This is what someone asked me in a comment: Yeah i do have undeterministic values for my context variables. I’m writing a Chatbot for my master thesis. I do have different courses – the user is able to get information about it. I use the context variables to track about which course he is now talking about and which intents i have to use (intends that are shared among courses). If the…

Context | DialogFlow

Reader Question: How to store variables in a long Dialogflow conversation?

This question came in via Twitter recently: When you wish to store variables in a long conversation, you should try and use the concept of session variables. A small tip I would like to add here: make sure that the actual parameter names you use in your different intents are different. That is, if you were to use a parameter name $geo-city to capture the departure city in the first intent, and you again use $geo-city to capture the destination city in the next intent (which is quite likely as that will be the default choice), then the second value will actually overwrite your first value within the session variable. So the fix for this is to change the parameter…