How to add comments section

Hi,

My question is, is there a way to ask user for their comments for example after the action,

action - Would you like to add a comment?

yes or no

user chooses yes and then

Please add your experience in a few words

and then no matter what user writes no intent recognition should happen and we just store that comment in a database or do nothing with it and just respond with,

Thank you for your comment.

So please tell me is there a way to do no intent recognition for one msg or how can I make this comment section.

Thank you for your time.

1 Like

@Devershi you can use forms for that without slot validation

slots:
  feedback:
    type: text
    auto_fill: false
    influence_conversation: false
utter_ask_feedback:
  - text: "Please add your experience in a few words."
utter_close:
  - text: "Thank you for your comment."
forms:
  feedback_form:
    required_slots:
        feedback:
        - type: from_text
class ValidateFeedbackForm(FormValidationAction):
    def name(self) -> Text:
        return "feedback_form"
    @staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        return ["feedback"]
    def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
        return{"feedback": [self.from_text()]}
- story: feedback form
  steps:
  - intent: affirm
  - action: feedback_form
  - active_loop: feedback_form
  - active_loop: null
 -  action: utter_close
1 Like

@bharath-madduri I am facing this error while trying it please help me here.

@Devershi you need to mention all of your intents in domain.yml

intents:
  - greet
  - goodbye
  - affirm
  - deny
  - mood_great
  - mood_unhappy
  - bot_challenge
  - comment
  - inquire_time

If you are very new to Rasa, please watch tutorials and follow the documentation on how to design a bot.

NOTE : The syntax I gave is for Rasa 2.7 , whereas you are using Rasa 3.0, please check the syntax according to your Rasa Version

1 Like

@bharath-madduri I have done everything right now but it is now giving this error.

@Devershi Please go through this docx. You have to follow Rasa 3.0 structure, the code I have provided is for Rasa 2.7 Version. After modifying , if you still encounter the issue, share your files as well.

Hi @bharath-madduri I am also using rasa 2.7 for this and I am still facing this error. I am sharing the files and please let me know what I am doing wrong. actions.py (2.1 KB) domain.yml (1.4 KB) nlu.yml (1.9 KB) rules.yml (407 Bytes) stories.yml (1.4 KB) config.yml (1.6 KB) endpoints.yml (1.4 KB) credentials.yml (980 Bytes)

@Devershi you need to remove feedback_from mentioned under actions in domain.yml, retrain the model, it just works fine. You can also ignore mentioning feedback_form in actions.py

Yes thank you it worked

Hi @bharath-madduri , It worked perfectly in rasa 2.7 but when I am trying to switch back to rasa 2.1.2 on which I have to work on It is giving this error UserWarning: Loading domain from ‘domain.yml’ failed. Using empty domain. Error: ‘The slot mappings for slot ‘required_slots’ in form ‘feedback_form’ have type ‘<class ‘dict’>’. It is required to provide a list of slot mappings. Please see Forms for more information.’ Can you plz tell what can be the cause of this error. Are there some syntax differences in rasa 2.1 and 2.7 and how can I resolve it. And I have made no changes in the files just changed the rasa version. Thank you

@Devershi have you included this part in actions.py?

class ValidateFeedbackForm(FormValidationAction):
    def name(self) -> Text:
        return "feedback_form"
    @staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        return ["feedback"]
    def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
        return{"feedback": [self.from_text()]}

also, please check the syntax and indentation.

Hey, thank you

For the Rasa 3.0 we have to mention the mapping of the slots, like to which entity it belong

slots:
  slot_name:
    type: text
    mappings:
    - type: from_entity
      entity: entity_name

So how can we do this feedback thing in 3.0 version?

@HarshMagiya7 Are you providing me information about the syntax for 3.0 or asking how to implement on 3.0?

I am asking for how to implement on 3.1

Like I was having issue implementing this in rasa 3.1

So if you could help me with it

Like what changes should I make in the above code provided by you

@HarshMagiya7 I wish I could, unfortunately I am using 2.7 only. You can tag Rasa Heroes, may be they have tried latest versions.

@Heroes Can anyone assist me here with rasa 3.0 forms and slot