Capturing free text as slot


I am not able to get a solid idea on entity extraction and slot filling. I am trying to build a bot, where user will register a device (additionally there will be other tasks as well) by entering its serial number… So the story will be something like

user > Hi
bot > Welcome. How can I help you?
user > I want to register my device.
bot > Please enter your devices serial number.
user > {serial_number_arbitrary_text}
bot > [Perform a custom action]

Next bot needs to capture that arbitrary text and run a custom action to validate the serial number and proceed ahead.

Now when user will enter the serial number, it will be really an arbitrary text and I am not sure how to handle that using NLU data.

Hi, you can use a form for setting slot from user input. You just have to map the slot in this format in slot_mappings

return {“new_slot_name”: self.from_text()}

It will set the full user input to the new_slot_name

Hi, how the story will look like? Can you please help?

  • register_device
    • device_registration_form
    • form{“name”: “device_registration_form”}
    • form{“name”: null}

You can go though rasa form documentation for much better understanding.

Okay thanks… I’ll check that out… I was trying to do it with entities and slots though…