Clarification re: formbot form action example on github

Hi,

I was going through the rasa example on building a form (blog link below) and watched the videos re forms and checked out the formbot on the github repo. I get the idea and have used the principles to implement my own form action (it’s still not working great) so was hoping to clarify a couple of things.

Below is the happy path in stories:

  • greet
    • utter_greet
  • request_restaurant
    • restaurant_form
    • form{“name”: “restaurant_form”}
    • form{“name”: null}
    • utter_slots_values

I don’t quite get how the request_restaurant intent links up with the restaurant_form. In the nlu the request_restaurant intent has a large number of phrases which will kick off the restaurant_form.

Does the restaurant_form know which questions to ask because in the domain file the utter_ask_cuisine, etc. are associated with the restaurant_form required slots?

Also, in the domain file was just after an explanation of use_entities in:

intents:

  • request_restaurant: use_entities:

entities:

  • cuisine
  • num_people
  • number
  • feedback
  • seating

And finally with running the actions.py file I’m a bit confused about endpoints. In the endpoints file the url is url: http://localhost:5055/webhook. But when running rasa it says starting server on localhost:5005. One says 5055 and the other is 5005 just wasn’t sure what was going on there. In the blog post from Jan '19 the rasa is executed with the following:

rasa run actions&
rasa shell -m models --endpoints endpoints.yml

Is that correct?

Thanks.

Hi @Jmg007,

I don’t quite get how the request_restaurant intent links up with the restaurant_form. In the nlu the request_restaurant intent has a large number of phrases which will kick off the restaurant_form.

The story you have defined sais:

If the user greets, we should greet him back. Now we can only assume what the user is going to utter next - but if he decides to ask for a restaurant, we should start the form by using restaurant_form.

The scheme used here is:

* <possible intent detected by rasa>
 - <action that follows up the detected intent>

Is this clear now or was your question headed in a different direction?

Does the restaurant_form know which questions to ask because in the domain file the utter_ask_cuisine, etc. are associated with the restaurant_form required slots?

This is explained in Form Basics. Basically you define the slots that should be filled during processing the Form. In your actions.py you define how they get filled, e.g. by an entity or an intent. To generalize the way a bot asks for those slots, you simply have to follow the scheme:

utter_ask_<slotname>
utter_wrong_<slotname>

The former asks for the slot once, the latter asks again if the validation of the slot failed. The utterances therefore have to be defined as templates in your domain.yml aswell.

Also, in the domain file was just after an explanation of use_entities in:

intents:

  • request_restaurant: use_entities:

This is explained in Ignoring entities for intents which simply means, that for the given intent, all entities are unfeaturized hence don’t impact the prediction for the next action in the story. Most of the time, you won’t really need excluding entities but in certain cases it makes totally sense. For a better understanding imagine a case in which you want to design a story for 5 restaurants which differ on their cuisine, a slot that is filled by using entities. In 4 of the 5 cases, you want to story to proceed like you defined it earlier but in case the user wants to have fast food you want to give him an advice rather than to proceed with the form. In this case, you want the prediction of the next action depending on the entity hence need it featurized.

And finally with running the actions.py file I’m a bit confused about endpoints. In the endpoints file the url is url: http://localhost:5055/webhook. But when running rasa it says starting server on localhost:5005. One says 5055 and the other is 5005 just wasn’t sure what was going on there. In the blog post from Jan '19 the rasa is executed with the following:

The endpoint with the port 5055 is most likely your action endpoint since this is a service started separatedly from the core, which is most likely started with the port 5005. The action server is started by calling rasa run actions - if you want to, you can watch the command-line logging out on which port it is started. Since it is started separatedly, the rasa core need to know where to send the request to if one of the designed actions should happen hence you need to define it in your endpoints.yml.

I hope this gets clearer now! :slight_smile:

Kind regards
Julian