Loop on some question

hello all, i hope you are fine i need to ask the end user some of questions for example: bot say > how many animals you like ? == end-user say > 3 == bot say > animal 1 name ? == end-user respond > dog == bot say > animal 2 name ? == end-user respond > cat == bot say > animal 3 name == end-user respond > camel == finally i can save all the mentioned animals

Try the next using a form.

Add the next slots to the domain:

  • count: unfeaturazed
  • aninum: unfeaturized
  • aniname: unfeaturized
  • namelist: list

also add the templates:

  • utter_ask_aninum: “How many animals you like?”
  • utter_ask_aniname: “Animal {count} name?”

Create a form with the requiered slot being aninum and aniname. You also need a validate function for each one. The one for aninum to make sure you get an integer and to set count to 1. In the one for aniname, you will increase count by one, add the captured name to namelist and reset aniname to NULL, this way the form will repeat the utterance and ask again for aniname. Repeat this until count is bigger than aninum, when that happens set aniname to “end” or something.

Ask me any doubt you have about this.

1 Like

please if you can show me example