How best to fill a slot that can have any value

I’m trying to fill a slot with an item from an extensive product catalog. I also need this to be a required slot in a form. How best to go about doing this, as I obviously can’t train on every product.

Many thanks for the help…

1 Like

Just made some progress by diagramming a story like this:

## happy path - support
* hello
  - utter_greet
* get_product
  - slot{"requested_slot": "product"}
  - action_fill_product_slot
  - slot{"product": "tv"}
  - product_form
  - slot{"action" : "support"}
  - form{"name": "product_form"}
  - form{"name": null}
  - action_product_form_submit_confirm
* affirm OR thankyou
  - utter_youre_welcome
  - utter_bye

FYI most of my issues were from understanding when you should introduce the form into the stories flow. IMHO you want to fill the problem slot before invoking the form, so that you have more control over coaching a user through the language.

In the example above that is done here:

* get_product
  - slot{"requested_slot": "product"}
  - action_fill_product_slot
  - slot{"product": "tv"}
  - product_form

You can check out this post on how to use forms: Building contextual assistants with Rasa Forms

Rather than using a custom action for just filling a product slot, you could use the validate_[slot] method in forms to validate whenever the slot is filled.

For the slot value to be set to whatever the user enters, you can use sth like this in the slot_mapping function.

def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
    return {
        "loan_amount": self.from_text(intent=None),

For more details about the above answer, read the blog post. It’s really good for getting started with forms.

Got busy prepping for a demo, but I didn’t want to forget to thank you for this reply @lahsuk. That did the trick. My form is working now! Thanks again.

Hi all,

I want get the username from the chat conversations

example:- bot:- Hi user:- Hi Bot: May i know your name? User: I am Karthik Bot : Thanks for providing details Karthik

Like the above example i have call the user with there name can anybody please help

@karthik1 you can train nlu model with entity & slot as name, where it will extract user name in name slot and you can use this slot in response.


intent: details

  • I am [ Karthik ] ( name )



  • name slots: name: type: text

responses: utter_details:

  • text: Thanks for providing details {name}