I created a simple project with api ai. Then, I want to add a context. I add "location" in the context's text field but I do not understand what I have to do next.
Any help is very appreciated, thanks.
I created a simple project with api ai. Then, I want to add a context. I add "location" in the context's text field but I do not understand what I have to do next.
Any help is very appreciated, thanks.
If there is the same sentence is entered by the user then the context will be used. Refer this link for more details.
The user will enter text as 'What time is?' and context is null then the simple answer is about the current time
. If the context is related to train departure
time and it has the station name
in context. At that time the answer to the 'What time is?' is the time of the train.
Also, this Medium blog will help you to understand more in detail.
Contexts in api.ai are used to bind two/more intents. You can easily define workflow of your chat & in lemon terms, contexts set a path for chatbot to follow.
Let's say in weather intent you said, "Need weather information" & then you need to know for which location? So workflow would be weather(intent)->City (intent)
& so here you set contexts, where output context (location) of weather(intent) will be input context (location) of city intent which in fact binds two intents & if user tries to go out of that workflow, fallback intent will be triggered saying, I didn't understand
.
Now, you can set the lifetime of these contexts as well Which can help you keep an intent alive for that lifetime, after which you will again need to start from start. On the other hand, it is interesting to know, city(intent)
won't be called unless weather(intent)
gets called & that too because, city(intent)
didn't get location context as input.
Contexts are used to relate some intents with others to complete a complete cicle. As mentioned by Krunal, HERE you can see some detailed description and how/when you have to use contexts. Just to help with the next step, you'd create another intent with the "location" context as input and the follow up of the intent used before. All parameters that you would have in the intent used will be passed to the next intent to be used at the console or even in the back end.