Slot filling without evaluating intent

Hello everybody,

Is there any way to fill a slot directly by listening the next user input ? I tried to use a FormAction but the result is not the expected one.

Maybe it’s better with an example. Let’s take the example from the Rasa docs : Weather bot.

I want to extract the intent ask_weather and the entity city.

Now let’s get two potential user inputs :

  • The user precised the location (Example : What’s the weather in San Francisco ? → Intent = ask_weather / “city” = San Francisco)
  • The user didn’t precised the location (Example : What’s the weather ? Intent = ask_weather)

The first line can be tranlated to the following story :

* ask_weather{"location": "San Francisco"}
    - action_give_weather

For the second line, I want my bot to ask For which city do you want to know the weather ?.

Directly after that, I want the bot to listen the answer and that the next user utterance is directly interpreted as the expected answer and stored in the city slot.

In terms of dialog, the result would be as follows :

  1. [user] What’s the weather ?
  2. [bot] For which city do you want to know the weather ?
  3. [user] San Diego # Slot filling here
  4. [bot] Here is the weather for San Diego : … # Result from “action_give_weather”

If I’m using a FormAction, I’m forced to detect an “inform” intent, which will potentially be misinterpreted, as follows :

* ask_weather
    - utter_ask_location
    - weather_form
    - slot{"requested_slot": "location"}
* inform{"location": "San Diego"}
    - slot{"location": "San Diego"}
    - action_give_weather

When scenarios like that are multiplying in the stories, the second intent (inform in the example above) is frequently misinterpreted (because this kind of intents are often composed of a single word).

Thanks in advance for your help :slight_smile:

3 Likes

HI @ souvikg10

Can you please give your thoughts.

Thanks and Regards Rohit Haritash

That’s a very common problem and the easiest way I know to deal with it is the addons. (full disclosure: I am the maintainer) The idea is that for intents that are hard to pick up (usually made of proper nouns) you can tell Core that any user input after a certain action/utterance should be understood as inform See the intent substitution in the docs

Another way if you want to avoid an external package is to add more examples with cities and maybe use the lookup table feature to help NLU extract the right entity. The risk with that approach which will force you to tag entire utterances with a location entity is that one/two work utterances may be picked up as location as well. But I think Core offers a mechanism to filter entities based on intents

2 Likes

I used FormAction plus setting fallback_threshold to negative number to solve this problem. In FormAction validation, say the intent was incorrectly detected (other than ‘inform’ intent) you can re-ask the same question again by returning empty list. if it is okay to use user’s last intent, you can just set that value to the slot to fill etc. You don’t have to set fallback_threashold to negative as long as the intent confidence is greater than threashold (regardless of intent detected) but problem occurs when detected intent confidence is zero. That’s when you want to set fallback_threashold to negative on dialog training. So… how user can get out of potential trap? I do 2 things. (a) train hand off human intent and if detected, go ahead get out of form and set follow up action of you need (b) bot will utter special exit method that user can type (e.g. /exit) then it ends converstaion etc.

prediction of FormPolicy overrides Fallback prediction, so there is no need to do that with the new FormAction

as Ghostvvv said, the latest master (merged on Jan 17) has fix to the following issue.

FallbackPolicy shouldn’t act on NLU confidence if the last user message was part of a form

So I would give it try with latest master and see?

Does the addons package you have recommended work for rasa 1.0.X, after they merged nlu and core?

can you share an example

can you share the code? or an example