ActionForm, does it work?

I followed the documentation describing usage of ActionForm class but the form doesn’t get activated although the intent and the entity are detected correctly.

Here’s an example: I have a bot that is used to make room reservations. One of its functions is checking which rooms are free in the specified range of time. It needs to collect “time_from” and “time_to” so I created ActionForm “CollectDates” that requires this slots. There’s also a story that looks like that:

  • find_room
    • collect_dates
    • form{“name”: “collect_dates”}
    • form{“name”: null}
    • action_find_room

where “action_find_room” is a regular Action that reads “time_from” and “time_to” slots and checks rooms’ availability.

Once I write to the bot: “find free room from 19 to 20” it correctly recognizes intent and entities:

2019-12-06 17:41:36 DEBUG rasa.core.processor - Received user message ‘find free room from 19 to 20’ with intent ‘{‘name’: ‘find_room’, ‘confidence’: 0.9993829727172852}’ and entities ‘[{‘start’: 20, ‘end’: 22, ‘value’: ‘19’, ‘entity’: ‘time_from’, ‘confidence’: 0.8934354521387873, ‘extractor’: ‘CRFEntityExtractor’}, {‘start’: 26, ‘end’: 28, ‘value’: ‘20’, ‘entity’: ‘time_to’, ‘confidence’: 0.9332133550577135, ‘extractor’: ‘CRFEntityExtractor’}]’

but it doesn’t activate the form:

2019-12-06 17:41:36 DEBUG rasa.core.policies.form_policy - There is no active form

and doesn’t predict next action to be “action_find_room”:

2019-12-06 17:41:36 DEBUG rasa.core.processor - Predicted next action ‘action_default_fallback’ with confidence 0.30.

I’ve searched for answers but all discussions regarding this issue were left with no answers. I also spent hours experimenting with ActionForm but with do success. Any help will be appreciated.

did you add - name: FormPolicy in the config.yml file. If not add this line in the policies section of config.yml file

Yes, this are my policies:

> policies:
>   - name: "FormPolicy"
>   - name: "MemoizationPolicy"
>   - name: "EmbeddingPolicy"
>   - name: "MappingPolicy"
>   - name: "FallbackPolicy"
>     nlu_threshold: 0.3
>     core_threshold: 0.3
>     fallback_action_name: 'action_default_fallback'

I finally solved the problem. I had wrong formatting in the story related to the ActionForm. I started it with single “#” instead of “##”.

Wrong:

# happy path
* intent
    - action

Correct:

## happy path
* intent
    - action