samtecspg / articulate

A platform for building conversational interfaces with intelligent agents (chatbots)
http://spg.ai/projects/articulate/
Apache License 2.0
598 stars 158 forks source link

Handling Non-Linear Dialogue - Modifier Intents and Response Intents - WIP #223

Closed wrathagom closed 5 years ago

wrathagom commented 6 years ago

WORK IN PROGRESS

I've been cooking for awhile now on a proposal for how to handle non-linear dialog. Right now our slot filling allows linear dialog. But take for instance an insurance chatbot, with a non-linear dialog, or tree based dialog: (italics are the bot, bold is the user)

To handle situations like this as well as #192 I would like to propose two new concepts: Modifier Intents and Follow-Up Intents.

Modifier Intents

The main purpose of modifier intents is to handle slot prompt responses. In the example above, when the bot asked the user whether or not they were trying to find an old policy or create a new one the user response could have been any of the following (and then some):

These could possibly be trained as entities, but that doesn't feel right. They are intents, but not a high level intent like looking up a policy. These are intents meant for modifying a slot value: modifier intents.

Even our common pizza shop example has use for modifier intents. Let's say you offer both sandwiches and pizza, which have very similar toppings. Right now when the bot prompts for What toppings would you like on your pizza? and the user replies with hame and pepperoni that response has to be trained. And training it on both the orderSandwhich and orderPizza intents means that you can randomly be yanked from one intent to another. This is the case in #193 but if there was a modifier intent for the toppings slot, then it could be handled in a better way.

Given that we don't want modifier intents to factor into he main intent recognition of the bot the question is: where do they belong? The idea that I am proposing is that they belong to a separate model for the agent which contains all of the modifier intents. They belong to the agent, because they are operating at the same level as entities and often will be paired with entities. Here are a few facts about modifier intents:

For a given slot the modifier intents can perform multiple actions:

Affirmation/Negation are good examples of the SET action. Replying with just cheese is a good example of an ADD action for filling a pizza topping slot. And I didn't want pepperoni is a good example of a REMOVE action for the pizza topping slot.

This probably means that we've got a new threshold to consider: the modifier threshold. This is how high the confidence has to be in a modifier intent for us to use it. It may be possible to share it with the domain/intent thresholds. Have to think more on that.

Here is a proposal for the UI for modifier Intents, both defining them and using them in scenarios.

To address the needs of #192 I am thinking that there is a 5th kind of action, not directly tied to a modifier intent, but rather just a wildcard. Were almost any reply is taken as the value of that slot. Perhaps there is a way to combine that with the modifier thresholds to allow breakout.

Response Intents

The second piece to non-linear dialog is being able to take a slot value or response and moving the conversation in a particular direction with it. That is where response intents come in. Calling them intents feels a little bit wrong, but I haven't thought too much on the verbiage.

A response intent is a bit different in that it has no user examples. Just slots, prompts, modifier intents, and responses. And they are directly tied to the response of another intent.

For example main intent in the example above could be called insurancePolicyStart and it has a slot called policyAge which can be set to either new or old. Right now the user could use the agent response to generate the replied above:

and given how we handle dialog we would reply with the correct one because one of them would be an empty string.

So response intents are tied to these. For example in the case where policyAge is new, we could select the newPolicy response intent. This would automatically dump the user directly into that intent. That intent has a slow for policyType and based on the value of that slot we would guide the user to a new intent. until the reach the end...

Granted that there is certainly value in responses being able to be linked to any intent. allowing conversations to converge from multiple starting places. Maybe I need a better name for this. still WIP.

wrathagom commented 5 years ago

Done. 😌