How to create Multiple choice questions form using RASA 2.0

Hello, I am new to this forum. I want to create a Multiple choice question answer form. and after finishing the exam bot should display marks. How I should do this… Please help me in this I am in learning phase. Thank you!

Hi @amitgawade1989 ! You’re right, this is a great use case for using forms in Rasa. Could you share some details about what you have so far in setting up your form?

Thank you for replay! I want to create a form that contains DEPRESSED MOOD (sadness, hopeless, helpless, worthless) (depreesed) 0 Absent. 1 These feeling states indicated only on questioning. 2 These feeling states spontaneously reported verbally. 3 Communicates feeling states non-verbally, i.e. through facial expression, posture, voice and tendency to weep. 4 Patient reports virtually only these feeling states in his/her spontaneous verbal and non-verbal communication.

2 FEELINGS OF GUILT (Guilt) 0 Absent. 1 Self reproach, feels he/she has let people down. 2 Ideas of guilt or rumination over past errors or sinful deeds. 3 Present illness is a punishment. Delusions of guilt. 4 Hears accusatory or denunciatory voices and/or experiences threatening visual hallucinations.

3 SUICIDE (Suicide) 0 Absent. 1 Feels life is not worth living. 2 Wishes he/she were dead or any thoughts of possible death to self. 3 Ideas or gestures of suicide. 4 Attempts at suicide (any serious attempt rate 4).

4 INSOMNIA: EARLY IN THE NIGHT (Insomnia_Early_Night) 0 No difficulty falling asleep. 1 Complains of occasional difficulty falling asleep, i.e. more than 1⁄2 hour. 2 Complains of nightly difficulty falling asleep

5 INSOMNIA: MIDDLE OF THE NIGHT (Insomnia_Middle_Night) 0 No difficulty. 1 Patient complains of being restless and disturbed during the night. 2 Waking during the night – any getting out of bed rates 2 (except for purposes of voiding).

At the end I want to calculate the score as per options selected… This is my form: forms: user_details_form: name: - type: from_entity entity: name gender: - type: from_entity entity: gender age: - type: from_entity entity: age depression: - type: from_entity entity: depression suicide: - type: from_entity entity: suicide guilt: - type: from_entity entity: guilt insomnia_middle_night: - type: from_entity entity: insomnia_middle_night insomnia_early_night: - type: from_entity entity: insomnia_early_night

My slots: slots: name: type: text gender: type: text age: type: text suicide: type: any influence_conversation: false depression: type: any influence_conversation: false guilt: type: any influence_conversation: false insomnia_early_night: type: any influence_conversation: false insomnia_middle_night: type: any influence_conversation: false

I am new to this. This is working but what i am doing here is capturing entity as entire option and in I am extracting slots ans comparing entire option with slot value like

if tracker.get_slot(“absent”)==“absent”: suicide_m=0 elif tracker.get_slot(“suicide”)==“Feels life is not worth living”: suicide_m=1 elif tracker.get_slot(“suicide”)==“Wishes he/she were dead or any thoughts of possible death to self”: suicide_m=2 elif tracker.get_slot(“suicide”)==“Ideas or gestures of suicide”: suicide_m=3 else: suicide_m=4 but this is not convincing me… Please help I have uploaded domain, nlu and rule.yml file.

domain.yml (4.4 KB) nlu.yml (4.8 KB) rules.yml (738 Bytes)

Thanks so much for this! You could use buttons in your responses for each question. With each button you can define a payload where you can set an entity value based on the user response.

Here’s a generic example of what could look like.

    - text: "Some question text."
      - title: "Text for answer 1"
        payload: /inform{{"answer_a":"1"}}
      - title: "Text for answer 2"
        payload: /inform{{"answer_a":"2"}}

Each button has a piece of text and a payload. The payload will determine the intent to be returned, inform in this case, and then can set entity values, answer_a above. For your use case you would want to convert all of your text utterances into buttons and for each answer map the proper entity to its numeric response.

On the action server when you process the form you should have all the slots filled where you can process the user responses to determine what message to send back.

1 Like

Thanks @m.vielkind , I will try this.