Slot Filling using from_text

@akelad I have a situation in which i have applied mapping policy triggers to some of the intents in my domain and other are free intents handled by the stories.

Now lets say i am in the form action and i want to fill the slot having slot mapping free_text = [self.from_text(intent=None)] and when the user types in the message, unfortunately it gets mapped to the intent that is mapped with some action using mapping policy and now instead of filling the slot bot executes the action against the predicted intent, but it should instead fill the free_text slot regardless of the intent. My question is how can we avoid this situation, as i also don’t want to remove triggers all over my domain? Thanks

Also what will happen if an entity gets extracted using lookup table against the slot in the form action but the intent gets predicted that is mapped to an action using mapping policy? Shouldn’t bot fill the slot instead of calling an action against the intent?

@Ghostvv may be you can help. Thanks

If you have intent that does different things, unfortunately, you are overusing the mapping policy. I’d recommend to try 2.0 alpha version where we agglomerated all rule base policies into one RulePolicy, this policy is capable of figuring out that a form should be predicted first. But you’ll need to remove all your triggers anyhow

No i don’t have an intent that do different things but for Name and Email slots we can cannot train entities. So names and emails can be predicted to some intent that we don’t know and if that intent is mapped to some action then there will no no use of this slot mapping namet = [self.from_text(intent=None)] . My question is how can we avoid this?

I don’t think with a mapping policy it is that simple to avoid, without modifying source code of the policy ensemble

Hmm ok. do we still face this issue in RulePolicy as well?

no, RulePolicy should always predict forms first (unless there is specific default mapping like restart)

Great, but know if we want to get the answer of an intent using mapping policy while the form is activated we wouldn’t be able to achieve that except default mapping like /restart? which is also what we don’t desire. I think the solution should be like: In the case of this slot mapping name = [self.from_text(intent=None)] , every Rule policy should be ignored except the Formpolicy. What do you think?

in 2.0 there is no FormPolicy. RulePolicy is responsible for everything

Ok but do that fullfil my above requirement?

no, overwriting default action would need to update RulePolicy, why do you need that?

I need it because during the activated form user can ask for some FAQ before providing the information for some slot and that FAQ intent will be mapped to an action using mapping policy, but as you said RulePolicy will still run the Form. But i want the bot should answer the FAQ and using custom code i will divert the bot back to the activated form. And in the case of slot = [self.from_text(intent=None)] bot should not call the action for the FAQ intent instead it should fill the slot

the idea is that the form is always executed first, but if it doesn’t extract requested slot, it’ll reject execution, and RulePolicy or TEDPolicy will predict smth else. In case of from_text the form will not reject.

ok, i got it. Thank you so much for your time @Ghostvv :slight_smile:

1 Like

@Ghostvv

What happens when there’s a form with slots that have two types, i.e., from_entity and failing that, from_text?

In my case, the RulePolicy rejects it when it’s supposed to use from_text.

Also, in domain, what is the correct format for form definition:

– type: from_entity

entity: some_entity

Or, as the interactive learning sessions save it:

– entity: some_entity

type: from_entity

I have been working for months on an assistant but it’s difficult to form the intuition for these things without more understanding of the fundamental principles sadly.

Thanks

What happens when there’s a form with slots that have two types

The form applies them one after another, until one can be used to fill the slot. If none is suitable. The form is rejected

Also, in domain, what is the correct format for form definition:

the order is not important. In yaml format it read as a dict

Thanks for the answers.

Do you have any suggestions for why unhappy paths during forms, i.e. user talking about something else, makes the bot stray from the form, never to return? active_loop still says the form name but nothing is asked for by the assistant. My rules file has nlu fallback and only form rules.

it requires debugging. Could you share the logs and the rules relevant to the problems, that you experience?

Sure. The most recent testing leads to it working somewhat correctly but it’s difficult to see a pattern.

The biggest problem I have right now is filling slots with from_text that doesn’t work still. It’s using a voice interface on phone so there’s tons of mistakes. I’m also going to add more data later, so that should help.

Here’s the log file: out.log (212.9 KB) If you see anything that’s being done in a sub-optimal or wrong way, please let me know. I’d like to have better performance.

Rules: rules.yml (1.3 KB)

Thank you.