Predicting intent while asking slot value

I have defined a form that takes username slot and performs custom action to display user profile. My slot value is set to be filled with frim_entity. When the bot finds entity while asking for profile it works fine. If entity is not found it asks please provide your username which is also fine. But after that when I provide my username it is predicting other intent instead of setting slot value. How can I fill slot value using both entity and text.

Slots that have the same name as the entity in question can be auto-filled, even outside of forms. See Domain

@Aadesh Hi, what you trying to archive? I’m trying to understand can you brief give example for above use case. Thanks.

@nik202 example use case: User: Can you provide me information about Aadesh? Should take entity username Aadesh and fill the required slot. It ok till now. Now if it doesn’t find entity to fill required slot. It will prompt please provide your username. Now when I provide username Aadesh it is predicting another intent instead of setting a slot value a s Aadesh. What I want is if the required entity is not found in the user input it should prompt to ask slot value and take whole user input as slot value instead of predicting another intent.

Hi, use from_text for username entity and just give generic training data. Because name can’t be extracted properly. SO, with the help of from_text you can get the whole text what user said to bot. Here’s an example:

form_name:
  required_slots:
     username:
        type: from_text

Hello @Horizon733 What I want is use of both entity and text. It should use entity if found otherwise just use text.

You need a Custom Slot Mapping then.

Check if the entity is present with tracker.latest_message['entities']['username'], and, if not, you can get the whole text with tracker.latest_message['text'].

Adding on to Chris answer use . get() It will be like below:

next(tracker.get_latest_entity_value("name of entity"), tracker.latest_message)

This will check if that is present else will give you text.

1 Like