Capturing all variables required for an intent

rasa-core
rasa-nlu

(Manpreet Singh) #1

I have a bot in which I need to capture multiple slots in an intent. Examples of the same are:

book a [uber go](cabType) in [London](city) for [Sam](personName)
book a cab

Now if a user utters ‘book a cab’, agent needs to ask follow up questions to capture cabType, city and personName. I can define follow up questions in stories.md, by having mechanism like:

## story-5
* bookCab{"cabType": null, "city":null, "personName":null}
  - cabType_ask
* bookCab{"cabType": "uber go"}
  - city_ask
* bookCab{"city": "london"}
  - personName_ask
* bookCab{"personName": "Sam"}
  - bookCab_action

Couple of questions here:

  1. Is there any better way of capturing variables instead of manually sequencing follow up questions in stories.md?
  2. cabType could also be captured in another intent (e.g. What is per mile fare of uberGo ). While capturing cabType for bookCab intent, internally NLU thinks it has got fareCabType. And changes the story flow. Or behaviour can be vice versa as well, i.e. while capturing fareCabType, NLU thinks it has received cabType. Is there any way by which I can make sure that this switch of intents doesn’t happen. And conversation flow is as per the story sequence I define? Or in a way all the mandatory variables of intent are captured before doing anything else?

(Akela Drissner) #2

Ok so first thing, when you write stories and no entities are picked up, you don’t need to write them in. So your story would look like this:

## story-5
* bookCab
  - cabType_ask
* bookCab{"cabType": "uber go"}
  - city_ask
* bookCab{"city": "london"}
  - personName_ask
* bookCab{"personName": "Sam"}
  - bookCab_action

But this is how you would handle this, yes. Alternatively you can also use FromActions.

As for your second question, could you post some NLU training data so I can understand better what you mean?


(Manpreet Singh) #3

Thanks Akela. For second question, NLU data is like:

intent:fare

For the first it is:

intent:book


(Akela Drissner) #4

Since this isn’t formatted with ```, it’s been processed as Markdown, so I can’t actually see the labels of the entities. but I assume you’ve labelled the entities as fareCabType and cabType? Please just label them both as cabType. Also utterances like “uber go” or “London” should belong in a third intent called, e.g. inform as it’s ambiguous whether the user wants to book or as for the fare.