Ask the question in form again

Hello!

I have a form that asks for a city and a bunch of numbers.

stories.yml is like this:

version: "2.0"
stories:
  - story: Activate form
    steps:
      - intent: ask_housing
      - action: utter_ask_specifics
      - action: housing_form
      - active_loop: housing_form
      - active_loop: null
      - action: utter_done
      - action: action_get_housing

form itself is like this:


forms:
  housing_form:
    ignored_intents:
    - bot_challenge
    - greet
    - goodbye
    required_slots:
      housing_city:
      - entity: city
        type: from_entity
      max_price:
      - entity: number
        type: from_entity
      min_area:
      - entity: number
        type: from_entity
      min_price:
      - entity: number
        type: from_entity
      min_rooms:
      - entity: number
        type: from_entity

I want that in case the form asks for a city (intent: tell_city) and user responds with a city (intent: tell_number), then the form should respond with utter_this_is_wrong and then asks the same question again.

How can i do that?

@jegork can you please share the action_get_housing file and please check this form validation repo and video: https://github.com/RasaHQ/rasa-2.x-form-examples/blob/main/05-validation/actions/actions.py | How to Validate Form Input in Rasa | Rasa Tutorials - YouTube

1 Like