Rasa crashes in story with retrieval intents

Hi there,
Since I added some more retrieval intents and conditional responses, my bot crashes while action_listen and the webchat window closes. I tried to change the policies, but I couldn’t fix it on my own. Can someone help, please?
I am using

Rasa Version      :         2.8.1
Minimum Compatible Version: 2.8.0
Rasa SDK Version  :         2.8.1
Rasa X Version    :         0.39.3
Python Version    :         3.8.0

The retrevial intents the create the problems are lexicon/xxx. For them I have a rule:

- rule: Lexicon
  steps:
  - intent: lexicon
  - action: utter_lexicon
  - action: utter_lexicon/link_to_website
  - action: utter_lexicon/back_to_happy_path

as well as stories:

#### LEXICON ####
- story: looking up a word
  steps:
  - intent: lexicon
  - action: utter_lexicon
  - action: utter_lexicon/link_to_website
  - action: utter_lexicon/back_to_happy_path

#### BACK TO HAPPY PATH ####
- story: back to the happy path with own question
  steps:
  - action: utter_lexicon/back_to_happy_path
  - intent: affirm
  - action: utter_go_for_it

- story: lexicon_interactive_story_01
  steps:
  - intent: start
  - action: utter_greet
  - action: utter_inform_lovis
  - action: utter_browse_or_ask
  - intent: affirm
  - action: utter_framing
  - action: utter_lets_get_started
  - intent: lexicon
  - action: utter_lexicon
  - action: utter_lexicon/link_to_website
  - action: utter_lexicon/back_to_happy_path
  - intent: deny
  - action: utter_ok
  - action: utter_come_back
  - intent: thank+goodbye
  - action: utter_thank_goodbye
  - action: utter_ask_feedback

What happens is, that when the user askes a question recognized as intent: lexicon/xxx the bot answers correctly with:

  • utter_lexicon
  • utter_lexicon/link_to_website

but then, instead of answering utter_lexicon/back_to_happy_path it simply crashes. The error message I get is the following:

2022-05-18 09:04:51 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] user intent: affirm | previous action name: utter_framing
[state 1] user intent: affirm | previous action name: utter_lets_get_started
[state 2] user intent: lexicon | previous action name: action_listen
[state 3] user intent: lexicon | previous action name: utter_lexicon
[state 4] user intent: lexicon | previous action name: utter_lexicon/link_to_website
2022-05-18 09:04:51 DEBUG    rasa.core.policies.memoization  - There is a memorised next action 'utter_lexicon/back_to_happy_path'
2022-05-18 09:04:51 DEBUG    rasa.core.policies.rule_policy  - Current tracker state:
[state 1] user intent: start | previous action name: action_listen
[state 2] user intent: start | previous action name: utter_greet
[state 3] user intent: start | previous action name: utter_inform_lovis
[state 4] user intent: start | previous action name: utter_browse_or_ask
[state 5] user intent: affirm | previous action name: action_listen
[state 6] user intent: affirm | previous action name: utter_framing
[state 7] user intent: affirm | previous action name: utter_lets_get_started
[state 8] user intent: lexicon | previous action name: action_listen
[state 9] user intent: lexicon | previous action name: utter_lexicon
[state 10] user intent: lexicon | previous action name: utter_lexicon/link_to_website
2022-05-18 09:04:51 DEBUG    rasa.core.policies.rule_policy  - There is a rule for the next action 'utter_lexicon/back_to_happy_path'.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.unexpected_intent_policy  - Skipping predictions for UnexpecTEDIntentPolicy as either there is no event of type `UserUttered` or there is an event of type `ActionExecuted` after the last `UserUttered`.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'utter_lexicon/back_to_happy_path' based on user intent.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_RulePolicy.
2022-05-18 09:04:51 DEBUG    rasa.core.processor  - Predicted next action 'utter_lexicon/back_to_happy_path' with confidence 1.00.
2022-05-18 09:04:51 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2022-05-18 09:04:51 DEBUG    rasa.core.processor  - Action 'utter_lexicon/back_to_happy_path' ended with events '[BotUttered('Möchtest du mich noch was anderes fragen? Wie wär's mit ...', {"elements": null, "quick_replies": null, "buttons": [{"payload": "/masturbation_menstruation", "title": "Darf man w\u00e4hrend der Periode masturbieren? \ud83e\ude78"}, {"payload": "/mood_how", "title": "Wie komme ich in Stimmung? \ud83d\udca6"}, {"payload": "/masturbation_myth", "title": "Welche Mastrubationsmythen gibt es? \ud83d\udd2e"}, {"payload": "/masturbation_ban", "title": "Darf man Masturbation verbieten? \ud83d\udeab"}, {"payload": "/deny", "title": "nichts, danke!"}, {"payload": "/affirm", "title": "eine eigne Frage"}, {"payload": "/browse_more", "title": "weitere Fragen \ud83d\udc47 "}], "attachment": null, "image": null, "custom": null}, {"utter_action": "utter_lexicon/back_to_happy_path"}, 1652857491.234766)]'.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.memoization  - Current tracker state:
[state 0] user intent: affirm | previous action name: utter_lets_get_started
[state 1] user intent: lexicon | previous action name: action_listen
[state 2] user intent: lexicon | previous action name: utter_lexicon
[state 3] user intent: lexicon | previous action name: utter_lexicon/link_to_website
[state 4] user intent: lexicon | previous action name: utter_lexicon/back_to_happy_path
2022-05-18 09:04:51 DEBUG    rasa.core.policies.memoization  - There is a memorised next action 'action_listen'
2022-05-18 09:04:51 DEBUG    rasa.core.policies.rule_policy  - Current tracker state:
[state 1] user intent: start | previous action name: action_listen
[state 2] user intent: start | previous action name: utter_greet
[state 3] user intent: start | previous action name: utter_inform_lovis
[state 4] user intent: start | previous action name: utter_browse_or_ask
[state 5] user intent: affirm | previous action name: action_listen
[state 6] user intent: affirm | previous action name: utter_framing
[state 7] user intent: affirm | previous action name: utter_lets_get_started
[state 8] user intent: lexicon | previous action name: action_listen
[state 9] user intent: lexicon | previous action name: utter_lexicon
[state 10] user intent: lexicon | previous action name: utter_lexicon/link_to_website
[state 11] user intent: lexicon | previous action name: utter_lexicon/back_to_happy_path
2022-05-18 09:04:51 DEBUG    rasa.core.policies.rule_policy  - There is a rule for the next action 'action_listen'.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.unexpected_intent_policy  - Skipping predictions for UnexpecTEDIntentPolicy as either there is no event of type `UserUttered` or there is an event of type `ActionExecuted` after the last `UserUttered`.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'action_listen' based on user intent.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_RulePolicy.
2022-05-18 09:04:51 DEBUG    rasa.core.processor  - Predicted next action 'action_listen' with confidence 1.00.
2022-05-18 09:04:51 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2022-05-18 09:04:51 DEBUG    rasa.core.processor  - Action 'action_listen' ended with events '[]'.
2022-05-18 09:04:51 DEBUG    rasa.core.tracker_store  - Recreating tracker from sender id 'qda7gdnyO9zdLDRTAAAH'
2022-05-18 09:04:51 DEBUG    rasa.core.tracker_store  - Tracker with sender_id 'qda7gdnyO9zdLDRTAAAH' stored to database
2022-05-18 09:04:51 DEBUG    rasa.core.lock_store  - Deleted lock for conversation 'qda7gdnyO9zdLDRTAAAH'.
2022-05-18 09:05:05 DEBUG    rasa.core.channels.socketio  - User qda7gdnyO9zdLDRTAAAH disconnected from socketIO endpoint.

I read trough the forum and found a similar case, where increasing the epochs of the TEDPolicy and replacing the MemoizationPolicy with the AugmentedMemoizationPolicy helped. But in my case it didn’t. Right now my config,yml looks like this:

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: de

pipeline:
# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# # If you'd like to customize it, uncomment and adjust the pipeline.
# # See https://rasa.com/docs/rasa/tuning-your-model for more information.
   - name: "SpacyNLP"
     model: "de_core_news_md"
     case_sensitive: False
   - name: WhitespaceTokenizer
     intent_tokenization_flag: True
     intent_split_symbol: "+"
   - name: RegexFeaturizer
   - name: LexicalSyntacticFeaturizer
   - name: CountVectorsFeaturizer
   - name: CountVectorsFeaturizer
     analyzer: char_wb
     min_ngram: 1
     max_ngram: 4
   - name: DIETClassifier
     epochs: 100
     constrain_similarities: true
   - name: EntitySynonymMapper
   - name: ResponseSelector
     epochs: 100
     constrain_similarities: true
     retrieval_intent: chitchat
   - name: ResponseSelector
     epochs: 100
     constrain_similarities: true
     retrieval_intent: lexicon
   - name: ResponseSelector
     epochs: 100
     constrain_similarities: true
     retrieval_intent: sex
   - name: ResponseSelector
     epochs: 100
     constrain_similarities: true
     retrieval_intent: orgasm
   - name: FallbackClassifier
     threshold: 0.3
     ambiguity_threshold: 0.1

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# # No configuration for policies was provided. The following default policies were used to train your model.
# # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information.
   - name: AugmentedMemoizationPolicy
   - name: RulePolicy
   - name: UnexpecTEDIntentPolicy
     max_history: 5
     epochs: 200
   - name: TEDPolicy
     max_history: 5
     epochs: 300
     constrain_similarities: true

Thanks in advance for taking a look at it!
Ciao, Vio

@vio_lovis Are “utter_lexicon/link_to_website” and “utter_lexicon/back_to_happy_path” responses to two different indents under “Lexicon” ? or are they just 2 static responses ?

For your issue, I think for each retrieval intent you just need to have a single rule of this format

rules:
  - rule: Lexicon
    steps:
    - intent: lexicon
    - action: utter_lexicon

If you need “utter_lexicon/link_to_website” and “utter_lexicon/back_to_happy_path” after every “Lexicon” intent then rule could be

rules:
  - rule: Lexicon
    steps:
    - intent: lexicon
    - action: utter_lexicon
    - action: utter_lexicon/link_to_website
    - action: utter_lexicon/back_to_happy_path

Also for 2 different paths after this last action, you could create rules like -

rules:
  - rule: Affirm after lexicon
    steps:
    - action: utter_lexicon/back_to_happy_path
    - intent: affirm
    - action: utter_go_for_it
  
  - rule: Deny after lexicon
    steps:
    - action: utter_lexicon/back_to_happy_path
    - intent: deny
    - action: utter_ok
    - action: utter_come_back 

Hope this helps. I suggest going through the documentation for retrieval intents.

Hi @Vin,
thanks for your response.
So, I implemented this lexicon and there are different intents like lexicon/abc, lexicon/def and so on. I want to have the bot responding:

user: lexicon/abc or lexicon/def and so on
bot: utter_lexicon/abc or lexicon/def and so on
and then for every type of retrieval intent the bot should answer
bot: utter_lexicon/link_to_website
bot: utter_lexicon/back_to_happy_path

Right now it breaks after utter_lexicon/link_to_website. It seems like the rule, which then predicts utter_lexicon/back_to_happy_path cannot be followed.

I have other retrieval intents like chitchat in the bot where the same works just fine. (By the way: It’s a sex education bot for German teens, just so you know why I have intents called sex, orgasm and so on :sweat_smile:). The other retrieval intents work just fine.

I didn’t implement the rules affirm after lexicon and deny after lexicon, because there are several other options. Basically the bot is suggesting other intents to the user to choose from. It works fine for the other retrieval intents like chitchat where the bot also suggests different intents to the user to guide them back to the happy path.
:woman_shrugging:

@vio_lovis First off, very interesting project and good luck to you.

I now understand the issue but I am not not sure why it is is crashing bcz in the logs the prediction is done correctly based on rules as seen here

2022-05-18 09:04:51 DEBUG    rasa.core.policies.rule_policy  - There is a rule for the next action 'utter_lexicon/back_to_happy_path'.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.unexpected_intent_policy  - Skipping predictions for UnexpecTEDIntentPolicy as either there is no event of type `UserUttered` or there is an event of type `ActionExecuted` after the last `UserUttered`.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'utter_lexicon/back_to_happy_path' based on user intent.
2022-05-18 09:04:51 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_RulePolicy.
2022-05-18 09:04:51 DEBUG    rasa.core.processor  - Predicted next action 'utter_lexicon/back_to_happy_path' with confidence 1.00.

Also if the stories are working correctly for other retrieval intents, not sure of the issue. Some possible debugging steps you could try

  1. Remove existing models and train a fresh new model
  2. If “utter_lexicon/back_to_happy_path” has any associated buttons or customization, try using a simple static response instead (possibly a different name too)
  3. Possibly try just this “Lexicon” intent conversation flow in a separate bot with just other default rasa intents
1 Like

Hi,
So what I did first is, that I tried to talk with the bot via interactive learning and there are no issues whatsoever. So it’s not a Rasa problem, I guess!?!
I will try what you suggested and get back to you, if that’s ok?
Ciao, :wave:

Hi @Vin,
so - I am back :grin:

  1. I removed the existing model and trained a new one → did’t help, error perservered.
  2. I removed the buttons in the utter_lexicon/back_to_happy_path, deleted the old model, trained a new one and saw some changes: suddenly, it worked for almost all the retrieval intents. The only one which was still causing trouble is one where I use conditional response variation.
utter_lexicon/anal:
  - condition:
    - name: lexicon
      type: slot
      value: Analsex
    text: 'In dem Wort *Anal*sex [...]'
  - condition:
    - name: lexicon
      type: slot
      value: anal
    text: 'Mit dem Begriff *anal* [...]'
  - text: 'Mit dem Analbereich ist  [...] '

What do you think? It is possible that the slot

slots:
  lexicon:
    type: rasa.shared.core.slots.TextSlot
    auto_fill: true
    influence_conversation: false

is creating the problem?
I really don’t want to let go of the condition…

@vio_lovis Great it worked for you. If removing buttons resolved the error then I don’t think it was a Rasa issue.

I don’t see anything wrong in the conditional responses, but can you explain what’s the problem you are encountering ?

A few things to try…

  1. Check this scenario with interactive learning, specifically the slot value or in

rasa shell --debug

  1. Possibly remove the conditions and retry

Hi @Vin,
basically the same issue as before:
When I use any intent from the lexicon/xxx the chat widget closes itself before the utter_lexicon/back_to_happy_path is printed. The chat widget is then completely gone from the website, which I then need to reload to reopen the chat, the conversation lost of course :woman_shrugging:

  1. I checked this scenario in the shell: works fine!
  2. I then retried in the webchat window and it’s still crashing.

I think I should close this topic and look for a solution based on the Botfrot Webchat Window. Do you come to the same conclusion?
Thanks for helping me figuring this out.
Ciao, Vio

@vio_lovis Yeah I agree. Start a separate post for the webchat issue and close this one. I would suggest posting details of the custom payloads (button, etc) which you are using and possibly the custom channel as well.

1 Like