The context lifespan you set for an output context is like a "hidden" feature. I mention this because I still see many people come to me for help with fixing their Dialogflow chatbot. But I notice they don't use a lifespan of 1. To make things worse, quite often they don't see the connection between using the default lifespan and the unpredictable behavior of their chatbot.
In this article, I will point out some benefits of rigorously following a context lifespan of 1. (the article linked here needs an update, but I stand by the original premise).
Why use a context lifespan of 1
1 Understand your chatbot's behavior completely
When you understand your chatbot's candidate, target and surplus intents at each step in the conversation, you are going to have a much better understanding of your chatbot, period.
2 Build more complex dialogs
Sure, you cannot yet build a chatbot that can actually talk like a human (unless you wish to end up with a Tay).
But you CAN build fairly complex dialogs if you are able to better guide the conversation along a given path.
3 Better fallback handling
4 Better input validation
Closely tied to the previous point, you can validate the input on your backend and do a better job of guiding the conversation if you strictly use a context lifespan of 1.
5 Create a library of conversation patterns
Understandably, design patterns are sometimes ridiculed.
But when a subject is fairly new (such as building chatbot dialogs), having a library of patterns you can understand and reuse (synergy:management::reuse:programming) is quite helpful.
You can also create a library of these conversation patterns without using the context lifespan of 1. But you will have a hard time managing the behavior.
Example of patterns:
- input validation
- reprompt for input
- slot filling (the concept, not the feature)
- getting multiple inputs from the user
6 Create chatbot building blocks
Once you actually define a few conversation patterns, you will be able to combine them (once again, very hard to do if you don't enforce the context lifespan = 1 constraint).
What does this mean?
It means you can start programmatically generating your agent's intents. For example, creating a chatbot which should take a set of user inputs and can also do intelligent input validation and error re-prompting can be done using predefined templates. (Would you be interested in a course about the topic? Let me know in the comments below. If I get at least a handful of comments, I will get to it sooner).
Here is my simple conclusion: when in doubt, set your context lifespan to 1. If you think there is a genuinely good reason not to, let me know in the comments and let us debate it.
- How to debug your Dialogflow bot
- Client Question: Can I use GPT2 for my Dialogflow bot?
- Weekly Free Mini Courses
- 15 things all Dialogflow bot makers should know
- Autogenerating FAQ bot from training text
- A MUST read article on Dialogflow training phrase quality
- Using Collect.chat for preNLU bots
- Reader Question: How to get some sample training data for Dialogflow?
- Getting the top 3 (or top N) intents in Dialogflow: An experiment
- Dialogflow Regexp (regular expression) entity