Forms action_ask

Hi everyone!

I have just started experimenting RASA about 2 weeks ago and I am enjoying it. However, I would like to ask for some advice on Forms. I am trying to build a bot that will ask the user a set of same questions repeatedly until the user indicates that he/she does not want to continue anymore (for example, a bus arrival bot where the user can keep checking for the bus until it arrives). I will also need to make an API call in between each question.

After some research, I believe that I could achieve my goal using forms (with action_ask). The idea is since forms only end after all required slots are filled, I can create a slot to capture if the user wants to stop the form or to continue. The proposed flow is: start form → utter_ask → action_ask(call API) → ask if the user wants to repeat the form.

However, after following this link [Forms] and adding the action_ask in the domain, the form does not execute this action. Therefore I would like to check if I am missing any steps or there is anything that I misunderstood about forms.

Here’s a snippet of my code

Thank you!

Is your action server running? Have you added it to your endpoints.yaml? If so, could you share your action server logs?

Hi,

Yup my action server is running and I am able to invoke the other actions in actions.py. I edited my bot to a bus service bot, with form name choose_bus_form and the action I wanted to invoke is ‘action_ask_bus_service’ (“bus_service” is a required slot). The logic of the action is similar to the code shared in my first post.

Below is a screenshot of the action server logs:

Thank you!

That looks right. What’s in your endpoint.yml file? Does it have this line?

action_endpoint:
  url: "http://localhost:5055/webhook"

Yup. This is my endpoint.yml. I can run other customs actions in the same actions.py file image

This is my config.yml if it helps image

This is part of my domain.yml (The slots required are bus_stop and bus_service) image

Definition of form image

This is my current stories.yml image

I have tried to run action_ask_bus_serivce and it works perfectly, but what I want to achieve is that the form will execute this action automatically when requesting for bus_service slot

Thank you for your time!

Ah, ok, I think you may be getting some funky outputs because of how your form is defined. In Rasa 2.x, you no longer need to have the form in your actions.py. if you only want your form to get slots (which it looks like is what this form is doing?), you can define it like this in your domain file:

forms:
  choose_bus_form:
    bust_stop:
      - type: from_entity
        entity: bus_stop
    bus_service
      - type: from_entity
        entity: bus_service

Hi, I wasn’t aware of the change in rasa forms in Rasa 2.x., thanks for pointing this out! However, I am really confused on how to convert my current form into Rasa 2.x as I spent quite a lot of effort reading tutorials and guide on Forms for Rasa 1.x. I will be very grateful if you can link me to some guides for forms written in Rasa 2.x. My form currently does validation, calls API for every slot filled by form and set another slot using the value returned by the API.

Thank you.

[Edit] I found this blog which is quite useful to me Migrating your Rasa 1.x assistant to Rasa 2.0

[Edit 2] This is very useful to me too! (My Step-by-step Process for Updating to Rasa Open Source 2.0)

1 Like