question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RulePolicy: Replace `...` in YAML training data

See original GitHub issue

General information Related discussion: Notion

Consider a rule like the following:

- rule: Submit form
  steps:
  # Condition that form is active.
  - form: loop_q_form
  - ...
  - action: loop_q_form
  - form: null
  - slot: requested_slot
    value: null
  # The action we want to run when the form is submitted.
  - action: utter_stop

Everything before the ... is the condition for the rule to apply. We want to make this explicit by moving the condition steps to a special key condition. The rule would then look like:

- rule: Submit form
  condition:
  # Condition that form is active.
  - form: loop_q_form
  steps:
  - action: loop_q_form
  - form: null
  - slot: requested_slot
    value: null
  # The action we want to run when the form is submitted.
  - action: utter_stop

There a currently two other applications for ... in rules besides conditions:

  • the lack of ... at the start of a rule indicates that the rule only applies at conversation start. As this is way less frequent than having a rule which can apply at all conversation parts, we need to replace this with a different construct
  • ... at the end of the rule steps indicate that the rule should not predict action_listen once the rule is finished, but that another action (e.g. from a different rule / story) should be predicted

Steps to Solution

  • enable YAML reader to parse steps from condition key. It’s probably easier to keep the conversation events as they are, which means that the condition part should be insert as the initial conversation events, followed by a ActionExecuted("...") and then the remaining steps from steps. Phrased differently: No need to touch anything besides the yaml reader. We just translate the condition to what we currently have (unless this is a huge implementation pain)
  • these steps might make sense to do as part of the issue depending on the discussion state:
    • replace ... at the end of a rule with another indicator to tell Rasa to not predict action_listen at the end of a rule
    • find a different indicator than the missing ... at the start of steps to tell Rasa that a rule is only applicable at the beginning of a story

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
akeladcommented, Jul 27, 2020

The current suggestion for the start of the conversation is something like:

- rule: Greet user (only relevant at start of conversation)
  condition:
    - action: action_session_start
  steps:
    - intent: greet
    - action: utter_greet

There’s been some debate as to whether it should say conversation_started instead of action: action_session_start to make it clearer to the user.

The current suggestion for the end of the conversation is:

- rule: FAQ detailed
  steps:
    - intent: faq
    - action: utter_faq
  wait_for_user_input: false

This key should only need to be added when the case is not the default option of waiting for user input after a predicted action.

Let me know if anyone has more questions on this topic

0reactions
wochingecommented, Aug 6, 2020

Awesome, will work it in, merge and then update docs 🎉 Thanks for your input!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Policies - Rasa
The MemoizationPolicy remembers the stories from your training data. It checks if the current conversation matches the stories in your stories.yml file. If...
Read more >
integrate RulePolicy with YAML training data reader #6065
With the new RulePolicy we got stories and rules. They have to be distinguishable for the polices, so that the policies can decide...
Read more >
Replace with YAML | Buddy: The DevOps Automation Platform
The type of the action. Should be set to REPLACE . replacements. Required, Replacement[], The list of pairs of strings for replacement.
Read more >
panos_security_rule - Create security rule policy on PAN-OS ...
Parameter Choices/Defaults Comments action Default: allow Action to apply once rules maches. antivirus Default: None Name of the already defined antivirus profile. application Default: any List...
Read more >
Handling chatbot failure gracefully | by Aniruddha Karajgi
No matter how well you train your Rasa Chatbot, there are going to be ... is used to specify the threshold for NLU...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found