Required Slots of the Form in Rasa 2.x

Hi all.

Previously I used to define required slots of the form with an API call. Every time I checked the null values in an SQL table and used those as my required slots for the form. This has a critical meaning for my chat-bot.

How can I keep the same flow after migrating to Rasa 2.x? I have read the documentation and the blog-posts. Still no answer.

P.S. Any news on conveRT featurizer? :slight_smile:

The most up to date information on ConveRT should be described in the original github issue.

To understand your form problem I need to know a little bit more information. Could you explain in more detail what your API call does? It might help to share a little bit of code of the action.

@koaning Sorry for the late response. We have had some other issues recently. Now back to the question (which is still open).

This is the required_slots method of our custom form action. As you can see the slots are being defined by an API call to a database. How we can keep this logic in Rasa 2.x versions?

def required_slots(tracker):
    userid = tracker.sender_id
    endpoint = backend_endpoints["get_by_userId"]
    response = requests.get(url=endpoint, params={"userId": userid})
    required_slots = []
    if response.status_code == 200:
        response = response.json()
        all_required_slots = ["Salary", "Bonus", "Debts", "FicoScore"]
        required_slots = [slot for slot in all_required_slots if response["Data"][slot] is None]
    return required_slots 

Wouldn’t it be easier to have a custom action that runs at the beginning of the form that will set all the known slots? As the docs explain here you can define all the required slots upfront and the assistant will keep asking for values until all slots are filled. If some of the slots are filled because of your custom action then it shouldn’t ask for them if you’ve confirmed the form the right way.

1 Like