Using the affirm intent multiple times and storing the "yes" or "no" values

Hi.

I get the use of entities and slots (i think). But just wondering how to handle a situation where you might have the same intent eg. Affirm or Deny where the user an provide “yes” or “no” answers to utterances said by the bot. eg.

Is the sky blue? “yes”

Do you like chocolate? “yes”

How would you store the “yes” for each of these instances so they can be recalled?

Thanks.

Hi @Jmg007,

that depends on how you currently set your slots. If, for example, you know exactly how you want the user to affirm/deny something hence using “Yes” or “No”, you can simply use a categorical slot. If you have, let’s say more than 3-4 slots overall for which one or more of them can have the same value due to its type, I’d recommend Forms for such a task since handling a couple of slots inside several stories can be a bit tricky sometimes.

If you take a closer look at the slot filling mechanism of a FormAction, you can for example write something like this:

return {
    "color_of_sky": [
        self.from_intent(intent="deny", value="False"),
        self.from_intent(intent="affirm", value="True"),
    ],
    "likes_chocolate": [
        self.from_intent(intent="deny", value="False"),
        self.from_intent(intent="affirm", value="True"),
    ],
}

which will store the value of every slot separately and provide its value via the Tracker.

So basically it depends on your concrete situation and what you want to achieve. If you have further questions, feel free to ask!

Regards
Julian

Hi Julian,

Thanks for that. I have a general question about intents and was hoping to confirm something because I find it interesting and a bit counter-intuitive that a story starts off with a user intent and is only then followed by the bot’s utterance.

I would have thought given that the chat bot is kind of controlling the conversation, it would be the bot that would start the conversation and wait for the user to answer. Is there a reason things are structured this way?

greet

  • greet
    • utter_greet

Hi @Jmg007,

you’re welcome. I think it’s not that easy to answer your question since I am convinced that this has something to do with Dialog Design.

One could argue that in a real dialog between two humans, there won’t necessarily be an initial criterion that leads to one human talking first except one: Human A wants something from Human B or vice versa. Hence I think a good framework should offer the capability to provide both “ways” of handling a conversation - which Rasa is actually able to.

I’d like to point you to this conversation in which reaching out proactively to the user has been discussed in detail. So if we agree that you could “start” a conversation by the bot itsself, the better question is: Should a story cover this feature and if so, how could this be implemented?

Currently, if a bot e.g. utters something, this will most likely lead to the user responding something - this response with its intent will be classified by Rasa and then the storyline of choice starts. So far, everything pre-story can be considered as “unknown” for the storyline but not for the Tracker which will be used to enforce any action as discussed in the link.

So - besides those explanations - I think you can build almost every scenario I can think of, no matter who starts the conversation and how - in almost every case it’s a matter of Design.

Kind regards and a Happy New Year Julian