# Wrong action is getting called in between a story

**URL:** <https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397>\
**Category:** Rasa Open Source\
**Created:** [September 25, 2018, 6:48pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397 "2018-09-25T18:48:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogeshkakde](https://avatars.discourse-cdn.com/v4/letter/y/e47774/32.png) [@yogeshkakde](https://forum.rasa.com/u/yogeshkakde)\
**Post date:** [September 25, 2018, 6:48pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/1 "2018-09-25T18:48:50Z")

</div>

Hi, I am facing an issue where in-between a story some other action is getting called. eg. Let’s say there are two stories or paths… 1. create a reservation 2. edit existing reservation. Now when I am in the first story. Ill ask a user for details such as restaurant name, booking date etc. .similar questions will be asked when editing the booking. So when I am in story1 for some reason it’s asking some questions related to editing. Intent and entities are identified properly.

## story 2

- greet

- utter\_ask\_howcanhelp

- activate\_lpar

- utter\_on\_it
- action\_edit\_reservation
- slot{“requested\_slot”: “editcityname”}

- inform{“editcityname”: “newyork”}

- action\_edit\_reservation
- slot{“editcityname”: “newyork”}
- slot{“requested\_slot”: “editrestaurantname”}

- inform{“editrestaurantname”: “newyorkpizza”}

- action\_edit\_reservation
- slot{“editrestaurantname”: “newyorkpizza”}
- slot{“requested\_slot”: “fieldToEdit”}

- inform{“fieldToEdit”: “restaurant”}

- action\_edit\_reservation
- slot{“fieldToEdit”: “restaurant”}

- thankyou

- utter\_goodbye

## story 1

- greet

- utter\_ask\_howcanhelp

- create\_reservation

- utter\_on\_it
- action\_create\_reservation
- slot{“requested\_slot”: “cityname”}

- inform{“cityname”: “newyork”}

- action\_create\_reservation
- slot{“cityname”: “newyork”}
- slot{“requested\_slot”: “restaurantname”}

- inform{“restaurantname”: “newyorkpizza”}

- action\_create\_reservation
- slot{“restaurantname”: “newyorkpizza”}
- slot{“requested\_slot”: “numberofseats”}

- inform{“numberofseats”: 2}

- action\_create\_reservation
- slot{“numberofseats”: 2}

- thankyou

- utter\_goodbye

ActionCreateReservation(FormAction):

```
RANDOMIZE = False

@staticmethod
def required_fields():
    return [
        CityNameFormField("cityname"),
        RestaurantNameFormField("restaurantname"),
        NumberOfSeatsFormField("numberofseats")
    ]

def name(self):
    return 'action_create_reservation'

def submit(self, dispatcher, tracker, domain):
    //Code to create reservation
    return [AllSlotsReset()]

```

class ActionEditReservation(FormAction):

```
RANDOMIZE = False

@staticmethod
def required_fields():
    return [
        CityNameFormField("editcityname"),
        RestaurantNameFormField("editrestaurantname"),
        FieldToEditFormField("fieldToEdit")
    ]

def name(self):
    return 'action_edit_reservation'

def submit(self, dispatcher, tracker, domain):
    //Code to edit reservation
    return [AllSlotsReset()]
```

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [September 25, 2018, 8:56pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/2 "2018-09-25T20:56:54Z")

</div>

It seems like your two stories are getting confused. Can you print a confusion matrix to see which actions are getting confused a lot?

there is a evaluate.py script in rasa core to check that

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [September 25, 2018, 8:57pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/3 "2018-09-25T20:57:32Z")

</div>

Also Interactive learning will help you understand at which point you start to get wrong actions, easy to debug

---

<div class="post-metadata">

**Author:** ![yogeshkakde](https://avatars.discourse-cdn.com/v4/letter/y/e47774/32.png) [@yogeshkakde](https://forum.rasa.com/u/yogeshkakde)\
**Post date:** [September 26, 2018, 2:20am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/4 "2018-09-26T02:20:08Z")

</div>

It is happening when its in story1 and user gives restaurant name. After that its says “DEBUG:rasa\_core.policies.memoization:There is no memorised next action” and goes to story2. It askes for which reservation to edit.

---

<div class="post-metadata">

**Author:** ![yogeshkakde](https://avatars.discourse-cdn.com/v4/letter/y/e47774/32.png) [@yogeshkakde](https://forum.rasa.com/u/yogeshkakde)\
**Post date:** [September 26, 2018, 2:41am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/5 "2018-09-26T02:41:59Z")

</div>

I am new to rasa so I have a basic question. If there is a story and inputs are given according to the story then whats the reason for it move to other story?

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [September 26, 2018, 8:39am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/6 "2018-09-26T08:39:22Z")

</div>

Did you check which slots is set in story 1 during your conversation was is editcityname or city name?

---

<div class="post-metadata">

**Author:** ![yogeshkakde](https://avatars.discourse-cdn.com/v4/letter/y/e47774/32.png) [@yogeshkakde](https://forum.rasa.com/u/yogeshkakde)\
**Post date:** [September 26, 2018, 8:50am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/7 "2018-09-26T08:50:48Z")

</div>

Its city name. In logs I could see “rasa\_core.policies.memoization:There is no memorised next action” and then it predicts action from other story.

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [September 26, 2018, 8:56am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/8 "2018-09-26T08:56:01Z")

</div>

you only have two examples ? or you have more for each of them?

That’s weird, if the slots are different for each story that should matter for the next story’s prediction.

Did you try interactive learning? you can correct this behaviour

---

<div class="post-metadata">

**Author:** ![yogeshkakde](https://avatars.discourse-cdn.com/v4/letter/y/e47774/32.png) [@yogeshkakde](https://forum.rasa.com/u/yogeshkakde)\
**Post date:** [September 26, 2018, 9:14am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/9 "2018-09-26T09:14:07Z")

</div>

I have more stories but I cannot paste the exact stories. I tried interactive online learning. I got similar stories from that as well. I tried evaludate.py and it says no wrong story and even the matrix is fine. If I train multiple times it resolves the issues sometimes. I am not sure whats wrong.

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [September 26, 2018, 9:39am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/10 "2018-09-26T09:39:28Z")

</div>

That is weird. You are running 0.11 version or previous?

Are your slots featurised as text or categorical? though if you receive the right slot name as ‘city name’ which is not present in any other story, there shouldn’t be any confusion.

---

<div class="post-metadata">

**Author:** ![Abir](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abir/32/771_2.png) [@Abir](https://forum.rasa.com/u/Abir)\
**Post date:** [December 1, 2018, 8:22am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/11 "2018-12-01T08:22:46Z")

</div>

it’s not your fault , don’t expect rasa stories to be accurate . I have been struggling to do the same for sometime but no luck . Tried a lot of permutations but eventually gave up 😕

---

<div class="post-metadata">

**Author:** ![Abir](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abir/32/771_2.png) [@Abir](https://forum.rasa.com/u/Abir)\
**Post date:** [December 2, 2018, 7:19am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/12 "2018-12-02T07:19:44Z")

</div>

But does a city name say “NYC” or “LA” in a slot is different ? Both means true right? we can distinguish between two paths on the basis of slot’s emptiness not it’s content . Only if it’s categorical then only different content of slots means different.

@akelad please do respond , it seems this issue is popping out every now and then

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [December 2, 2018, 9:10pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/13 "2018-12-02T21:10:07Z")

</div>

which issue precisely? If it’s a text slot, then the value of the slot doesn’t matter. If it’s categorical, then the value does matter

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [December 2, 2018, 9:10pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/14 "2018-12-02T21:10:59Z")

</div>

> [@Abir](#):
>
> it’s not your fault , don’t expect rasa stories to be accurate . I have been struggling to do the same for sometime but no luck . Tried a lot of permutations but eventually gave up 😕

They are accurate. If they’re not, there’s very likely a mistake in them

---

<div class="post-metadata">

**Author:** ![Abir](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abir/32/771_2.png) [@Abir](https://forum.rasa.com/u/Abir)\
**Post date:** [December 5, 2018, 1:25pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/15 "2018-12-05T13:25:38Z")

</div>

I am simply using interactive learning , the stories are purely generated by them. I haven’t added a single story on my own apart from the initial stateless stories. Can you explain where could be the mistake ?

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [December 20, 2018, 11:17am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/16 "2018-12-20T11:17:40Z")

</div>

Could you show me what kind of issues you’re experiencing @Abir? A specific story example would be good

---

<div class="post-metadata">

**Author:** ![Abir](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abir/32/771_2.png) [@Abir](https://forum.rasa.com/u/Abir)\
**Post date:** [December 20, 2018, 3:46pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/17 "2018-12-20T15:46:34Z")

</div>

@akelad

- posting\_date
  - action\_check\_intent
  - slot{“conv\_id”: “1”}

- inform{“param”: “1”}
  - action\_check\_reg
  - slot{“regid”: “1”}

- inform{“param”: “1”}
  - action\_check\_proc
  - slot{“procid”: “1”}

- inform{“param”: “1940”}
  - action\_check\_iss
  - slot{“issid”: “1940”}

- inform{“param”: “1001”}
  - action\_check\_com
  - slot{“comid”: “1001”}
  - action\_validate
  - slot{“is\_valid”: true}
  - utter\_file

- file
  - action\_check\_file
  - slot{“file”: “windows\_txt\_4567.wmp”}
  - action\_post
  - utter\_ack2

- affirm
  - utter\_ack1

- deny
  - action\_deny
  - action\_restart

* * *

- sequence
  - action\_check\_intent
  - slot{“conv\_id”: “1”}

- inform{“param”: “1”}
  - action\_check\_reg
  - slot{“regid”: “1”}

- inform{“param”: “1”}
  - action\_check\_proc
  - slot{“procid”: “1”}

- inform{“param”: “1940”}
  - action\_check\_iss
  - slot{“issid”: “1940”}

- inform{“param”: “1001”}
  - action\_check\_com
  - slot{“comid”: “1001”}
  - action\_validate
  - slot{“is\_valid”: true}
  - action\_seq
  - utter\_ack2

- affirm
  - utter\_ack1

- deny
  - action\_deny
  - action\_restart

You see both the story starts with 2 distinct intents r8 , but it doesn’t follow the expected path . rather it follows one path for a portion and then jumps to another path , hence ruining the overall flow of bot. But only when we make each custom action distinct by name , it works to some extent. If you could address this issue 😕

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [January 8, 2019, 10:30am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/18 "2019-01-08T10:30:02Z")

</div>

Ah i know what’s going wrong – it’s because your max\_history is not long enough. The stories start to be different at this point right?

> [@Abir](#):
>
> inform{“param”: “1001”}
> 
> - action\_check\_com
> - slot{“comid”: “1001”}
> - action\_validate
> - slot{“is\_valid”: true}
> - action\_seq
> - utter\_ack2

For this to properly be able to distinguish between the stories you’d need a max\_history of something like 17. That’s not really advisable though because it won’t memorise shorter story segments anymore. What you can do is create one action that you use for both, but does different things dependent on what the state of the conversation is.

---

<div class="post-metadata">

**Author:** ![Abir](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abir/32/771_2.png) [@Abir](https://forum.rasa.com/u/Abir)\
**Post date:** [January 13, 2019, 4:57am UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/19 "2019-01-13T04:57:16Z")

</div>

So @akelad , i have found a way to solve this issue after failing multiple number of times with tuning hyperparameters lol

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [January 17, 2019, 5:01pm UTC](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397/20 "2019-01-17T17:01:28Z")

</div>

how did you solve it? with the max\_history?

[Next page](https://forum.rasa.com/t/wrong-action-is-getting-called-in-between-a-story/1397.md?page=2)
