Reputation: 31
I’m building a DialogFlow Agent with multiple intents, some has conflicting variables, and I’m struggling creating a clean conversational flow - specifically around the area of moving back and forth between intents.
For example, let’s say I support supplying information about weather and flights, to each I built a corresponding intent. Consider the following dialog:
At this point, I’d wish to flight intent to get recognized, and get “Rome" as a parameter, in addition to the previously saved parameter of “today”. However, I cannot tell if the system would identify a flight or a weather intent, as the sentence may apply to both - depending on the context.
I managed to get the desired behavior by defining a main and 2 context dependent parameter intents per each dialog subject (i.e. flight with flight as output context, flight-time with flight as input and output context, flight-destination with flight as input and output context, and same for weather), by setting a life-span of 1 for each context, and restoring it in code once the other intent is finialized - in order to keep the already filled slots, and also to support phrases such as “Rome” and understanding they are contextual. I also thought about dynamically alter intent priority, not sure yet if it’s possible.
That being said, it feels like this is something I should be getting out of the box, from the infrastructure. I’m referring to a stack-like intent prioritization, so that the last unfulfilled intent context would get the highest priority. Did any of you encounter such issues? Am I missing some key features that could help me achieve such behavior more naturally? Maybe a way to interfere with intent identification?
Upvotes: 3
Views: 486
Reputation: 50701
I think what is tripping up your approach is that conversations aren't stack-like necessarily, and Intents aren't "fulfilled" in the Dialogflow model. Intents just match what the user has said, with the ability to narrow that down by context if appropriate. Being able to set contexts let you shape the direction of how you handle the user response, but it is still up to you to use those inputs to determine what the user is responding to.
Typically, I keep one long-lived Context with parameters that just maintains all the state that I want to preserve that gets the user towards their goal. Each time the user says something, I may update that state depending on shorter-lived contexts and the actual Intent that was triggered. I avoid Followup Intents for the most part, since they end up becoming a rats nest of duplication.
Upvotes: 1