How to check for a missing entity in intent in rasa

Suppose my Question is - Where is the company XYZ located?

Here XYZ is the entity which gets detected. But if the user types something like - Where is the company located?

Here the entity is missing so I want my bot to ask - Company name? How can I achieve this. Detailed answer would be really appreciated. Thank you.

@Shreya You mean this scenario

Bot: Welcome! I am your technical assistant!

[ ------ general conversation as based on stories] then user asked

User: Where is your company? OR What is your company [Rasa] entity Located?

Bot: Alright, Which company you are looking at, please tell me the company name?

User: Rasa or I am looking for Rasa Company

Two Scenario:

  1. “Where is your company” – can also mean the user is asking about your company address.
  2. If the user asked “Where is your company”, you can ask "Alright. Which Company you want to know ? please tell me the company name?

Solution:

  1. This you can create the Intent company with training examples (without company name) and response in domain file about your current company location (on the website your chatbot is running, address, headquarters etc etc) only one response in this case.
  2. This you can create the Intent company_name with a training example while using entity extraction or slot or custom actions.

Some resources on entity, slots, forms and custom actions : https://youtu.be/HCmK_INWadI | https://youtu.be/Ss1xRQv9jWg |
https://youtu.be/U3an88fjFRc | https://youtu.be/rvHg7N8ux2I

Note: If you have a lot of company names then the approach will be different. Try archived your goal in step by step process.

Good Luck!

Hey Nik thank you for the help. I was trying to implement custom actions.

So the name of my entity is companyName. I am doing this - companyName = tracker.latest_message[‘entities’][0][‘companyName’]

I get an error saying- entityList= tracker.latest_message[‘entities’][0][‘companyName’] ^ SyntaxError: invalid character in identifier

Is this not the right way to get the entity value? Thank you

@Shreya Have you seen the suggested video’s?

You fetching the entities from where?

Yes in that video they were fetching slots. The entities listed in domain.yml, I want to check if am getting all of them and depending on that I want to ask the next question to the user.

@Shreya go step by step with small codes.

Yes am doing that. While trying to fetch the entities through custom actions I rand into this error. So just wanted to confirm if this is the right way to search for entities.

@Shreya No, This approach we follow for dataframe in python or for excel data or json.

Any approach you can suggest to get the entities through custom actions. Like I know what has to be done, but I am not sure what the syntax should be or how to write it.

@Shreya It’s shown in the video’s. Please see.

Thank you for the help :slight_smile: