Retrieval intents for two categories of people

@atwine When it comes to health bro, it should take it more cautiously! If there is any other use case, I will not suggest and guide you more in detail. If your wrong suggestion, can make cause to someone health then ? I will help you. I already told you I respect your use case and this is my own perception you can agree or disagree I dn’t mind :slight_smile:

@atwine Yes! I will give you solution. But, honestly I have my own priorities and office work :slight_smile: I hope you respect that. Thanks

@nik202

Its okay il figure it out somehow. Thanks.

@atwine Mean, I should not see your use case? :thinking:

I am looking for help with rasa not advise on health: I have many doctors who are doing that. So humbly just let me know how I can do this. If not…then thank you for your time. Il find a way somehow.

@nik202

@atwine Sure!

@fkoerner

Any idea how I can work on this one, its been a while. I have not yet solved it.

Any ideas I can borrow from you?

Hi @atwine, if the different responses are the same in meaning but different in phrasing or complexity you can use conditional response variations for this. I would set a boolean slot depending on what the doctor/non-doctor responds, and then condition the responses on this slot. This is described in more detail here.

Thank you @fkoerner

I have rushed through the article but it looks like what am talking about. Let me implement it and get back to you.

Thanks.

@fkoerner

I have looked at the code, however I am not really sure how they are using the boolean slot. Its confusing how to fill it. Do you have an example where its being used so I can check it out.

Let me attach what I have done maybe you can have a look and tell me what am doing wrong.config.yml (1.6 KB) domain.yml (2.7 KB) stories.yml (518 Bytes) rules.yml (338 Bytes) nlu.yml (203 Bytes) nlu.yml (1.9 KB) doctor.yml (885 Bytes) notdoctor.yml (918 Bytes)

Hi, can you elaborate on what’s confusing you?

You can see an example of how boolean slots are used here:

There are different ways to fill the slot. In your case, since the setting of the slot will change the assistant’s behaviour, I think giving the users buttons to select from is a good approach. Your commented-out button approach should work, did you have problems with this?

I looked at your code briefly (note that it is much easier for us to look at this if you include snippets in your actual comments). I would not recommend setting an initial value for the slot, especially if you are trying to condition based on the slot. If you don’t set an initial value, the boolean slot will be handled differently for unset than it is for set to true or false, which I think is your desired behaviour.

Thank you @fkoerner

So this is what is confusing me, and I have written this before looking through your links. So for a slot like text , I know its the presence that matters, but now this boolean, I am not sure how the filling works, when I try to use buttons, I don’t know what payload to send through.

I could used a good example of using the boolean and conditional variation to answer some questions.

  1. Define the slot as follows:
#domain.yml
slots:
  is_doctor:
    type: bool
    auto_fill: false # don't auto-fill because there's no corresponding entity
    influence_conversation: true
    # don't set an initial value!
  1. Set the slot using buttons:
responses:
  utter_ask_doctor:
  - text: "Are you a doctor?"
    buttons:
    - title: "yes"
      payload: '/inform{{"is_doctor":true}}'
    - title: "no"
      payload: '/inform{{"is_doctor":false}}'
  1. define conditional responses like so:
responses:
  utter_explain_flu:
    - condition:
        - type: slot
          name: is_doctor
          value: False
      text: <your non-doctor response here>
    - condition:
        - type: slot
          name: is_doctor
          value: True
      text: <your doctor response here>
  1. define rules or stories for the conditional responses:
rules:
- rule: Answer flu question
  steps:
  - intent: what_is_flu
  - action: utter_explain_flu

I think you shouldn’t need separate intents for doctor vs not doctor.

Thank you @fkoerner

Let me try it and see how it goes.

Hey @fkoerner

I tried your method but I am running into this error:

2021-11-29 15:10:17 ERROR    rasa.core.actions.action  - Couldn't create message for response 'utter_inform'.
Your input ->  what is flu                                                                                                                                                
2021-11-29 15:10:28 ERROR    rasa.core.actions.action  - Couldn't create message for response 'utter_explain_flu'.
Your input ->  bye                                                                                                                                                        
Bye
Your input ->        

My rasa version:

(rasaenv) Drs-MacBook-Pro:Trial-CategoricalSlot drjamesmugume$ rasa --version
Rasa Version      :         2.8.13
Minimum Compatible Version: 2.8.9
Rasa SDK Version  :         2.8.3
Rasa X Version    :         0.39.3
Python Version    :         3.7.5

I am not sure what is causing that now.

Utter Inform

utter_inform:
    - condition:
        - type: slot
          name: is_doctor
          value: false
      text: "Welcome NON DOCTOR, how can we assist you today?"
    - condition:
        - type: slot
          name: is_doctor
          value: true
      text: "Welcome DOCTOR, how can we assist you today?"

Utter Explain Flu

utter_explain_flu:
    - condition:
        - type: slot
          name: is_doctor
          value: false
      text: "Flu explanation for NON DOCTORS so that we know the logic works"
    - condition:
        - type: slot
          name: is_doctor
          value: true
      text: "Flue explanation for DOCTORS such that the logic flow works well."

Ask Doctor

  utter_ask_doctor:
  - text: "Are you a doctor?"
    buttons:
    - title: "yes"
      payload: '/inform{{"is_doctor":true}}'
    - title: "no"
      payload: '/inform{{"is_doctor":false}}'

That seems odd, that message might appear if the response wasn’t defined or something went wrong in the definition. Is utter_explain_flu under responses?

domain.yml (1.6 KB)

I have attached my domain file. Maybe there is something I am missing. Please have a look.

@fkoerner