Rasa core testing fails with ranged entities (from - to)

When I generate test stories with Rasa - X, with entities like amount-of-money and time, the stories fail, throwing this error:

InvalidEntityFormatException: Incorrect training data format ('{"entity": "amount-of-money", "value": {"to": 5101, "from": 670}'). More info at https://rasa.com/docs/rasa/training-data-format#nlu-training-data: line 1 column 65 (char 64)

In my test stories, this is returned by rasa-x like this:

  - intent: some_intent
    user: |-
      some_intent ...  [670-5101]{"entity": "amount-of-money", "value": {"to": 5101, "from": 670}}
     ...
  - slot_was_set:
    - amount-of-money:
        to: 5101
        from: 670

Versions:

Rasa Version      :         2.6.0
Minimum Compatible Version: 2.6.0
Rasa SDK Version  :         2.7.0
Rasa X Version    :         0.38.1
Python Version    :         3.7.10

I’ve no way of testing conversations where these entities have from-to values, apart from doing it manually, which isn’t practical. Not sure if this was fixed in a later version but I can’t upgrade right now, so in the case that this was fixed in a later version, I’m looking for at least a temporary solution before I upgrade…

Hi @Polaris000, I think you might be looking for entity roles and groups to capture the from-to situation. Note that these are separate keys i.e. not under “value”.

For the slot, if you want these values to influence the conversation, you’ll need to split it into two slots e.g.:

  - slot_was_set:
    - from-amount-of-money: 670
    - to-amount-of-money: 5101

Hi @mloubser . Thanks a lot for your answer. Actually, my question is slightly different. I’m using Duckling to extract amount-of-money and time (both of which are standard entities provided by duckling). My stories (training stories) are written like this with the from-to range:

  - intent: some_intent
  - slot_was_set:
    - amount-of-money:
        from: 1000
        to: 1000

There are no issues in the training or performance of the bot when I have my stories set up like this. In fact, this is what Rasa - X generates.

The issue I’m referring to arises when I’m testing my bot. When I generate a test story using rasa -x, I get something that looks like this:

  - intent: some_intent
    user: |-
      some_intent ...  [670-5101]{"entity": "amount-of-money", "value": {"to": 5101, "from": 670}}
     ...
  - slot_was_set:
    - amount-of-money:
        to: 5101
        from: 670

which is technically valid (at least based on what Rasa considers valid when it comes to training stories).

But, it throws an invalid error while running tests, which I’ve mentioned in the post above.

TLDR: format of extracted entities/slots that works for training stories doesn’t work for test stories.

Ah, I see what you’re saying. I get an invalid error for training stories as well with your example sentence - the issue is that at training time it’s only seeing slots, not the entity markup. This seems like a bug - Can you open a bug report for it on github please?

will do, thanks