Domain Template Variations - Rasa Open Source - Rasa Community Forum

Domain Template Variations

post by avinash1 on Mar 20, 2019

Hi. I recently started using Rasa. My question is about defining multiple responses for an utterance in domain template section and later on access the specific response randomly chosen in the custom actions.

While latest_action = state.get("latest_action_name") can be used to know the last triggered action, how can I extract the specific response that the bot chose and responded for the chosen utterance? Thanks!


post by erohmensing on Apr 4, 2019

I don’t think the specific utterance is actually stored in the tracker. The idea behind the multiple utterances per template is that they shouldn’t matter for the story logic, they’re randomly chosen to provide some variety. If your bot is going to do something different based on the utterance it chose, those utterances should not be under the same utter_{} template.


post by avinash1 on Apr 8, 2019

Thanks for the response @erohmensing. I understand from your response that the random utterance message isn't stored in the tracker. I have an intent for which I need to trigger both an utterance (with multiple responses to choose from) and a custom action. I need access to the utterance response in the custom actions so that I can perform an action with it. Are there any workarounds for this?


post by erohmensing on Apr 10, 2019

I don’t think so – I think the work around would be splitting the “random” utterances into differently named utterances, and then moving the logic of what you do depending on which utterance earlier, to choose the correct utterance in the first place.


post by netcarver on Apr 10, 2019

@avinash1, here’s a possible work-around: as you already have an action being triggered by a story, you could opt to have the start of the action randomly choose from a pool of utterances and send that off to the user via the dispatcher. Your action handler would then know what utterance was, and you can act accordingly.


post by avinash1 on Apr 11, 2019

Thanks for your response. I used a similar workaround where I had a list of utterances and randomly chose one in the custom action.

I still feel that it would be nice to have the variant utterance information in the tracker.