When should we use Mapping Policy

What are the benefits of Mapping policy and when should we use it?

Secondly: An example would be really helpful in case of form actions.

Like if the form action is activated and requested slot is “XYZ” but user asked for the time that is mapped to an action ‘action_get_time’ after performing the action and event UtteranceReverted(), how can a bot re-ask the user for the ‘XYZ’ slot?

@erohmensing you can answer here. Thanks

Use MappingPolicy, when youre 100% sure, that youre okay with the exact same reaction every time to a certain intent.

I only use it for things like unhappy path in forms.

(In a FormAction) Bot: What is your ID? User: I dont want to answer that Bot: Do you want to stop the form? Buttons Yes/No

Now its very clear, if the user hits the ‘Yes’-button (‘Yes’ is just the title of the button here, the payload is another intent) I send a special intent, which should always lead to a ‘Deactivate’-Event (one that stops the FormAction). This can be easily achieved if the MappingPolicy triggering the Deactivate-Action.

Other things I might think of are FAQ-Bots, but even there Id rather have may bot ask if somethings wrong if the user repeats a question multiple times.

3 Likes

@IgNoRaNt23 Great.

Referring my example given above, if a user chitchats during the form action at the state when the bot requested a slot from the user e.g “Please provide your ID”, and my chitchat intents are mapped to a custom action that returns an event UtteranceReverted(). So after the UtteranceReverted() event how can a bot again prompt the user with “Please provide your ID”. As it is not happening by default and i want to achieve this. Thanks you reply on this would be highly appreciate-able.

Why do you want to revert the Utterance? If you dont do that, the bot can easily jump back to the FormAction and wont end up in action_listen

So i want to revert the utterance because i want my story not to be affected by the chitchat during the form action and this way i dont need to write stories that will handle the chitchat during form actions. Secondly i think even if i dont revert the utterance bot still predicts action_listen after the chitchat action execution during the activation of the form action.

if you revert the utterance, than core will predict previous action again which is asking for XYZ

i have tested it but core does not ask for the slot “XYZ” again.

ok let’s say we don’t revert utterance, and during form action an intent gets predicted with mapping policy and after than bot returns back to the form action. How can we track that the bot has now come back to the form action and its a 3rd time for bot after the mapping policy and how can we now prompt the user for the slot or some other random message?

oh, true, it probably predicts action_listen, you can also return ActionReverted(), it might help

2 Likes

if the bot returns to form action, it should automatically ask for the correct slot again

Did you define utter_ask_{slot_name} in the template?

If not, nothing will happen even if the form is reactivated by ActionReverted() or UserUtteranceReverted().

but the bot does not ask for the correct slot automatically after being returned to the form action again.

obviously i have defined utter_ask_{slot_name} in the domain templates

@Ghostvv Also i want to know that, is it recommended to use the mapping policy with every intent, either its a form action, custom action or a utterance action?

MappingPolicy can be used when prediction is independent of context: Policies

2 Likes

with ActionReverted(), i get this error "Circuit breaker tripped. Stopped predicting more actions for sender ‘default’ " and bot also went into action_listen

what is your return statement?

return [ActionReverted()]

try return [FollowupAction(tracker.active_form[‘name’])]. That should take you back to your active form and reask the last question you were asking.

1 Like