How to make buttons to call certain FAQs?

To guide the user to ask some question under some condition, I need to add faqs to the button list (shown in following domain), rules, stories, reponses are shown below. However, it doesn’t work. The error msg is shown at the end.

domain

utter_ask_hydro_project_button:
  - buttons:
    - payload: /hydro_button{"hydro_type":"AAA"}
      title: AAA
    - payload: /hydro_button{"hydro_type":"BBB"}
      title: BBB
    - payload: /faq
      title: CCC
    - payload: /faq
      title: DDD

rules

rules:
- rule: faq
  steps:
  - intent: faq
  - action: utter_faq

story

- story: ask_hydro_project + faq
  steps:
  - intent: ask_hydro_project
  - action: utter_ask_hydro_project_button
  - intent: faq
  - action: utter_faq

response

responses:
  utter_faq/CCC:
  - text: abcdefg
  utter_faq/DDD:
  - text: defghijk

Error log

2020-11-15 17:59:03 DEBUG    rasa.core.processor  - Received user message '/faq' with intent '{'name': 'faq', 'confidence': 1.0}' and entities '[]'
2020-11-15 17:59:03 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 15 events.
2020-11-15 17:59:03 DEBUG    rasa.core.policies.memoization  - Current tracker state [{'user': {'intent': 'faq'}, 'prev_action': {'action_name': 'action_listen'}}, {'user': {'intent': 'faq'}, 'prev_action': {'action_name': 'utter_faq'}}, {'user': {'intent': 'ask_hydro_project'}, 'prev_action': {'action_name': 'action_listen'}}, {'user': {'intent': 'ask_hydro_project'}, 'prev_action': {'action_name': 'utter_ask_hydro_project_button'}}, {'user': {'intent': 'faq'}, 'prev_action': {'action_name': 'action_listen'}}]
2020-11-15 17:59:03 DEBUG    rasa.core.policies.memoization  - Launch DeLorean...
2020-11-15 17:59:03 DEBUG    rasa.core.policies.memoization  - Current tracker state [{}, {'user': {'intent': 'ask_hydro_project'}, 'prev_action': {'action_name': 'action_listen'}}, {'user': {'intent': 'ask_hydro_project'}, 'prev_action': {'action_name': 'utter_ask_hydro_project_button'}}, {'user': {'intent': 'faq'}, 'prev_action': {'action_name': 'action_listen'}}]
2020-11-15 17:59:03 DEBUG    rasa.core.policies.memoization  - There is a memorised next action 'utter_faq'
2020-11-15 17:59:03 DEBUG    rasa.core.policies.rule_policy  - Current tracker state: [{}, {'user': {'intent': 'ask_hydro_project'}, 'prev_action': {'action_name': 'action_listen'}}, {'user': {'intent': 'ask_hydro_project'}, 'prev_action': {'action_name': 'utter_ask_hydro_project_button'}}, {'user': {'intent': 'faq'}, 'prev_action': {'action_name': 'action_listen'}}, {'user': {'intent': 'faq'}, 'prev_action': {'action_name': 'utter_faq'}}, {'user': {'intent': 'ask_hydro_project'}, 'prev_action': {'action_name': 'action_listen'}}, {'user': {'intent': 'ask_hydro_project'}, 'prev_action': {'action_name': 'utter_ask_hydro_project_button'}}, {'user': {'intent': 'faq'}, 'prev_action': {'action_name': 'action_listen'}}]
2020-11-15 17:59:03 DEBUG    rasa.core.policies.rule_policy  - There is a rule for the next action 'utter_faq'.
2020-11-15 17:59:03 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_2_RulePolicy
2020-11-15 17:59:03 DEBUG    rasa.core.processor  - Predicted next action 'utter_faq' with confidence 1.00.
2020-11-15 17:59:03 ERROR    rasa.core.processor  - Encountered an exception while running action 'utter_faq'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
  File "/home/sz/py36-bert110-grakn181-rasa203/lib/python3.7/site-packages/rasa/core/processor.py", line 681, in _run_action
    events = await action.run(output_channel, nlg, tracker, self.domain)
  File "/home/sz/py36-bert110-grakn181-rasa203/lib/python3.7/site-packages/rasa/core/actions/action.py", line 314, in run
    RESPONSE_SELECTOR_PROPERTY_NAME
KeyError: 'response_selector'
2020-11-15 17:59:03 DEBUG    rasa.core.processor  - Action 'utter_faq' ended with events '[]'.

I tried other ways in domain like:

utter_ask_hydro_project_button:
  - buttons:
    - payload: /hydro_button{"hydro_type":"AAA"}
      title: AAA
    - payload: /hydro_button{"hydro_type":"BBB"}
      title: BBB
    - payload: /faq/CCC
      title: CCC
    - payload: /faq/DDD
      title: DDD

But it still doesn’t work by shown the error that ‘/faq/CCC’ and ‘/faq/DDD’ are not defined in domain.

I checked all post in forum about the issue, it seems to solution yet. I’d like to have a conclusion that wether or not it’s possible to connect faq and buttions. I understand that buttions are capable to pass intent and slot. And faq is also one type of intent, how to pass it to faq/CCC and faq/DDD from buttons?

Thanks for your attention and help!

Hi @yiouyou

Please share your nlu & config file contents ?

config

language: zh
pipeline:
- name: JiebaTokenizer
  dictionary_path: ./jieba
- name: RegexFeaturizer
- name: CountVectorsFeaturizer
- name: CRFEntityExtractor
- name: EntitySynonymMapper
- name: DIETClassifier
  epochs: 75
- name: ResponseSelector
  retrieval_intent: faq
  epochs: 100
- name: FallbackClassifier
  threshold: 0.7
  ambiguity_threshold: 0.1
policies:
- name: TEDPolicy
  epochs: 100
  max_history: 5
  batch_size:
  - 32
  - 64
- name: AugmentedMemoizationPolicy
  max_history: 5
- name: RulePolicy
  core_fallback_threshold: 0.4
  core_fallback_action_name: action_default_fallback
  enable_fallback_prediction: True

nlu

version: "2.0"
nlu:
- intent: faq/CCC
  examples: |
    - cdcd
    - dcdc
    - ccdd
    - ddcc
- intent: faq/DDD
  examples: |
    - dede
    - eded
    - ddee
    - eedd

Hi @yiouyou

Try updating your nlu & domain as below.

utter_ask_hydro_project_button:
  - buttons:
    - payload: /hydro_button{"hydro_type":"AAA"}
      title: AAA
    - payload: /hydro_button{"hydro_type":"BBB"}
      title: BBB
    - payload: "faq ccc"
      title: CCC
    - payload: "faq ddd"
      title: DDD


version: "2.0"
nlu:
- intent: faq/CCC
  examples: |
    - ccc
- intent: faq/DDD
  examples: |
    - ddd

If it still doesn’t work, Share me your action server logs as well.

@siriusraja It works. Thank you so much! The key here is to use payload: “faq ccc”, in which ccc is from nlu example.

Hi @yiouyou

Great that it works. Since you are using buttons, response from user is always going to be same for each button. Hence having variety of examples doesn’t make sense in this case.

Also you need to exclude “/” in the button payload parameter to enable RASA NLU to process it. Else it will be processed by RegexInterpreter.

Kindly mark it as solution if its working.

@siriusraja Multi examples still make sense if buttons are not the only way to invoke the faq :slight_smile:

To exclue “/”, do you mean for “payload: /hydro_button{“hydro_type”:“AAA”}”, I need to remove “/” as well?

Hi @yiouyou

You no need to exclude for hydro buttons. I was referring for only faq buttons.