Defined form wont retrieve values for slots

I defined a form for below usecase. (this was done by me to get familiar with rasa forms)

My target - User ask whats my name after a greeting. Then bot asks my first name and then ask my second name and reply a message.

My form name is name_form.

My slot names - firstname, secondname.

My entities - firstname, secondname.

Down below is parts relevant for my form in domain.py file.

`entities:

  • firstname

  • secondname`

slots: firstname: type: unfeaturized auto_fill: false secondname: type: unfeaturized auto_fill: false

templates: utter_ask_firstname:

  • text: What’s your first name utter_ask_secondname:
  • text: What’s your second name

`forms:

  • name_form`

Below is my story `## name_ask path

  • greet
    • utter_greet
  • request_name
    • name_form
    • form{“name”: “name_form”}
  • thank
    • utter_welcome`

below is my action.py

I put some prints for my use. Below is my result

Use the debug output to see what’s going wrong. There might be several reasons.Guess the two main reasons are, that on the one hand the NLU components dont extract the right entities. Names are usually really hard and it should be really hard to distinguish between first and second names. Might be possible with lookup tables, but you dont mention that. On the other hand the NLU component doesnt classify your answer ‘as’ as a message with intent ‘request_name’. So he wont map this entity to a slot as you specified in slot mappings. What you might want to add there is self.from_text(), which just transfers the users complete input message into the slot.

But as I said, use debug output (rasa shell -vv) to see what the bot is doing in the background.

1 Like

okay @IgNoRaNt23 I’ll try that. Btw Do i need to define an intent for my firstname and secondname. ? If yes, can you please give a samll example so that i know what i should do :slight_smile:

You should find everything here

I strongly advice you to read through all the docs. It seems like youre still missing a lot about how Rasa bot works

1 Like

okay @IgNoRaNt23 Thanks a lot. I’ll go through that doc :slight_smile: