Story does not continue after form has ended

Hello,

I have a story with a form, where a user is asked to give more information (a course title) and then they story should continue (more actions). To keep it simpler, I shortend the story so that after the slot of the form has filled, there are two utters, one that prints out the slot.

However, the problem is, that after the form has ended (- active_loop: null) the story is not continued. Instead this is shown in the console Predicted next action 'action_listen' with confidence 0.93.

What am I doing wrong here?

This is the story:

- story: Get Achievements happy path with message providing requested value
  steps:
  - user: |
      Ich möchte meine aktuellen Erfolge sehen
    intent: get_achievements
  - action: action_get_courses
  - action: course_form
  - active_loop: course_form
  - user: |
      Kurs123
    intent: inform
  - action: course_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
  - action: utter_submit
  - action: utter_slots_values

the form declaration in the domain file:

forms:
  course_form:
    ignored_intents:
    - faq
    - greet
    - goodbye
    - thank
    - deny
    - affirm
    required_slots:
        current_course_title:
          - type: from_text

This is my config:

language: "de"

pipeline:
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: char_wb
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 100
  - name: EntitySynonymMapper
  - name: RegexEntityExtractor
    case_sensitive: False
    use_lookup_tables: True
  - name: ResponseSelector
    epochs: 100
    retrieval_intent: faq

policies:
  - name: MemoizationPolicy
  - name: RulePolicy
  - name: TEDPolicy
    max_history: 5
    epochs: 100
    constrain_similarities: true

importers:
- name: MultiProjectImporter

imports:
- projects/test_project1

Can anybody help me out here? Is there something wrong with my config or the way I wrote the story with the form?

Thanks in advance! I already deleted all the trained models and trained it again.

rasa --version:

Rasa Version      :         2.8.1
Minimum Compatible Version: 2.8.0
Rasa SDK Version  :         2.8.1
Rasa X Version    :         None
Python Version    :         3.7.2
Operating System  :         Darwin-20.6.0-x86_64-i386-64bit
Python Path       :         /Users/theresa/.pyenv/versions/3.7.2/bin/python3.7
1 Like

Hello,

Try setting a rule for it:

- rule: Submit course_form
  condition:
  - active_loop: course_form
  steps:
  - action: course_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
  - action: utter_submit
  - action: utter_slots_values

Thanks for the input. It’s true, it works with rules. However this story should end with a checkpoint which is not possible with rules, right? So I need to use stories

I mean you can use both! :slight_smile:

Write rules for the basic stuff, then extend them with stories.

But is it possible to connect rules and stories? With checkpoints? I mean how could I define a rule for that case and then extend / use it in stories?

No no.

I meant you keep your stories as they are, but you just add this rule on top of them.

So I transform the story from above as a rule and just not use checkpoints, instead I just let the rule continue (with the actions from the checkpoints)? This is kind of an overhead but I think it would work. I could do that.

Nevertheless I am wondering why it’s not working with the story above? I think I used the form correctly (as stated in the documentation). I just like the usage of checkpoints as it makes (similar) stuff (with different a lot more clearer and better to maintain.

No, you keep all your current stories and checkpoints as they are. Just add the rule.

It’s just because stories don’t force the bot to act in some way, so they’re not always reliable.

I usually prefer to write short simple intent-to-action rules, then take stories from real conversations (of course they should be correct or manually corrected).

Oh okay so I just add a additional rule? I will try this out tomorrow. Thanks for the help!

1 Like

Yup! Hope it’ll work! :slight_smile:

1 Like

I have not seen in stories this user:, what it is doing? Where to use it?

This is End-to-end Training @InnoOmnia :slight_smile:

1 Like

Hello,

so I added the rule and updated the story to end with a checkpoint (to another story). However now the following is happening: Contradicting rules or stories found. Do I need to adapt the story further? Can I use the rule in the story?

1 Like

Aha. Can you please show the story?

So I fixed the contradiction. However, the story is still not continued after the form has ended.

This is my current story:

- story: Get Achievements happy path with message providing requested value
  steps:
  - user: |
      Ich möchte meine aktuellen Erfolge sehen
    intent: get_achievements
  - action: action_get_courses
  - action: course_form
  - active_loop: course_form
  - user: |
      Kurs123
    intent: inform
  - action: utter_submit

utter_submit is not run afterward.

This is my rule:

  - rule: Submit course_form
    condition:
    - active_loop: course_form
    steps:
    - action: course_form
    - active_loop: null
    - slot_was_set:
      - requested_slot: null
    - action: utter_slots_values

action: utter_slots_values is working and shown.

Why is asking the user’s username (or whatever is given in the inform intent) outside the form?

Why is it outside? It’s right after the course_form is activated? Or should that then be part of the rule?

I’m sorry, I misread the story.

  • Do you want to submit the form if the inform intent is detected? Or if the user said exactly “Kurs123”?
  • What are the required_slots mentioned in the domain?
  • If there are many unfilled required_slots, should the form still submit when the 1st point happens?

Hey,

The form should be submitted if the inform intent is detected. The form is defined with one requiered slot:

forms:
  course_form:
    ignored_intents:
    - faq
    - greet
    - goodbye
    - thank
    - deny
    - affirm
    required_slots:
        current_course_title:
          - type: from_text

As far as I understood the type “from_text”, it means any input given after the form has started, is the required_slot (in this case the current_course_title).

After the form was submitted, the checkpoint should be used (to trigger the next story) which needs this required slot to get some data from an API.

Does that make sense?

Even if the required slot has not been filled? If yes, here is a similar example which uses the intents stop and deny as stop points (more here):

- story: User fills form_log_in and stops
  steps:
  - intent: log_in
  - action: form_log_in
  - active_loop: form_log_in
  - or:
    - intent: stop
    - intent: deny
  - action: action_deactivate_loop
  - active_loop: null
  - action: utter_okay

Yup!