Extract form slots correctly

I have made a form, which should ask for several slots to change the delivery address of an order. Here is how it is configured:

domain.yml

slots:
  order_number:
    type: text
    auto_fill: false
    influence_conversation: false
  name:
    type: text
    auto_fill: false
    influence_conversation: false
  street:
    type: text
    auto_fill: false
    influence_conversation: false
  city:
    type: text
    auto_fill: false
    influence_conversation: false
  zip:
    type: text
    auto_fill: false
    influence_conversation: false
forms:
  change_delivery_address_form:
    city:
    - entity: city
      type: from_entity
    name:
    - entity: name
      type: from_entity
    order_number:
    - entity: order_number
      type: from_entity
    street:
    - entity: street
      type: from_entity
    zip:
    - entity: zip
      type: from_entity

I have an intent where I can already set the order_number via the intent. This is working fine so far. However, when the other slots are being requested, the order_number is overridden. The problem is, that rasa recognizes the zip code for example as the order_number. The same thing happens with the street. When answering with “Somestreet 23”, Rasa extracts the 23 and sets it as the order number.

How do I need to set my form up, so Rasa asks for all the required slots and sets them correctly?

Hi @ThomasGoehringer!

I think this problem is about your slots being unique. From rasa docs:

“when an extracted entity uniquely maps onto a slot, the slot will be filled even if this slot wasn’t requested by the form”

and an example here:

“entity city without a role can fill both departure_city and arrival_city slots, depending which one is requested, so if an entity city is extracted when slot arrival_date is requested, it’ll be ignored by the form”

I can imagine that if you define an entity number and another slot street_number, then the entity number will not uniquely maps onto order_number anymore. Probably this would also influence the zip code.

Also I think that you would want to add required_slots: to your form.

Let me know if I understood the problem correctly and if this helps!!

Thanks for your answer. My question is more general. I understand a form as a simple question/answer way of asking for specific data. So with this unique mapping in mind, that from_entity brings with it, what is generally best practice to extract the correct information in a form with similar slots like order_number and zip?

Hi @ThomasGoehringer! Sorry for the late reply! But maybe if you’re still interested, you can read about entity roles and groups (documented here).