How to write training stories with multiple values for one entity

Hello,

I am new to the Rasa platform and I have a question about how to write the stories for training where one entity can have two or more different values extracted from the NLU part. I will ask my question through example.

  1. I have an intent ask_product_info with the following training data:
## intent:ask_product_info
- Can you tell me more about rasa [core](product)?
- Please, provide me more information about rasa [nlu](product)
- information about [core](product)
- can you explain how [nlu](product) works 
  1. I have separate utterances that explains core and nlu utter_provide_core_info utter_provide_nlu_info.

  2. At the beginning, I have the following stories:

* greet
    - utter_greet
* ask_product_info{"product": "core"}
    - utter_provide_core_info

* greet
    - utter_greet
* ask_product_info{"product": "nlu"}
    - utter_provide_nlu_info

So, basically I want the bot to provide different information based on the entity that is extracted. I am somewhat familiar with slots as well, but I excluded that part for simplicity.

Question: My question is, is there a way to create story where for the product entity there would be multiple values, for example something like this:

* greet
    - utter_greet
* ask_product_info{"product": ["core", "nlu"]}
    - utter_provide_core_info
    - utter_provide_nlu_info

I haven’t seen this kind of example yet. Also, I tried using Interactive Learning, but it didn’t solve my problem. I typed “Can you tell me more about rasa core and rasa nlu?”, and the NLU part extracted both entities correctly, but after I finished with Interactive Learning and exported the data, my story had the following format:

* greet
    - utter_greet
* ask_product_info{"product": "nlu"}

So, the entity value for “core” was lost.

I would appreciate if someone could help me with this or provide me an opinion how to solve this. This is just an example, I couldn’t provide the original code because it is in Cyrillic and tried to reformat my problem with the example that I used. Thanks

2 Likes

Hi Goran, there’s a good example of this in the CarbonBot and it’s use of the city slot. You would define your product entity as a list (like city) and then use a form like airtravel_form. From the stories.md you’ll see the example:

* inform{"city": "Berlin"}
    - slot{"city": ["Berlin", "San Francisco"]}
    - airtravel_form
    - form{"name": "airtravel_form"}
    - form{"name": null}