Rasa: FORMBOT example contains bugs

Created on 23 Jan 2020  Â·  7Comments  Â·  Source: RasaHQ/rasa

Rasa version: 1.6.1
Python version: 3.7.6
Operating system (windows, osx, ...): Windows 10 (stable)
Also: Powershell 5.x

Hi. I am new to rasa and have been trying to get the formbot example working. I think the example code in the repository is not so up to date any more, though I cannot be sure. I had several problems.

I pulled the latest repo with the most updated code of the examples, using the following:

git clone https://github.com/RasaHQ/rasa.git
cd rasa/examples/formbot

Assuming this is the correct repo, I still ran into the following problems. To problem 1 I found a solution myself (below), which I suggest you should fix in the repo. Problem 2 has me stumped and I would appreciate both your suggested fix and a change in the repo so everyone enjoys the fix.

Problem 1 was when I ran - as per the instructions - the command rasa train there was a long list of errors

0/11 [00:00<?, ?it/s, # trackers=1]c:\py-workspace.venv\lib\site-packages\rasa\core\domain.py:604: 
UserWarning: Failed to use action ‘utter_greet’ in history. Please make sure all actions are listed in the domains action list. If you recently removed an action, don’t worry about this warning. It should stop appearing after a while. 
f"Failed to use action ‘{latest_action}’ in history. 
" c:\py-workspace.venv\lib\site-packages\rasa\core\domain.py:604: UserWarning: Failed to use action ‘utter_slots_values’ in history. Please make sure all actions are listed in the domains action list. If you recently removed an action, don’t worry about this warning. It should stop appearing after a while. 
f"Failed to use action ‘{latest_action}’ in history. " 
c:\py-workspace.venv\lib\site-packages\rasa\core\domain.py:604: UserWarning: Failed to use action ‘utter_noworries’ in history. Please make sure all actions are listed in the domains action list. If you recently removed an action, don’t worry about this warning. It should stop appearing after a while. 
f"Failed to use action ‘{latest_action}’ in history. " 

Processed Story Blocks: 0%| | 0/11 [00:00<?, ?it/s, # trackers=1]

c:\py-workspace.venv\lib\site-packages\rasa\core\domain.py:604: UserWarning: Failed to use action ‘utter_chitchat’ in history. Please make sure all actions are listed in the domains action list. If you recently removed an action, don’t worry about this warning. It should stop appearing after a while. 
f"Failed to use action ‘{latest_action}’ in history. " 

Processed Story Blocks: 0%| | 0/11 [00:00<?, ?it/s, # trackers=1

c :\py-workspace.venv\lib\site-packages\rasa\core\domain.py:604: UserWarning: Failed to use action ‘utter_ask_continue’ in history. Please make sure all actions are listed in the domains action list. If you recently removed an action, don’t worry about this warning. It should stop appearing after a while.

After working on this it seems that the provided domain.yml file is wrong. I made the following changes and it fixed the above errors.

  1. changed the “responses” section to be called “templates” (in domain.yml)
  2. added a section of “actions” (in domain.yml) with the following content:
    actions:
utter_ask_cuisine
utter_ask_num_people
utter_ask_outdoor_seating
utter_ask_preferences
utter_ask_feedback
utter_submit
utter_slots_values
utter_noworries
utter_chitchat
utter_ask_continue
utter_wrong_cuisine
utter_wrong_num_people
utter_wrong_outdoor_seating
utter_default
utter_greet
utter_iamabot

After these changes the “rasa train” command worked. Problem 1 seems solved. I would appreciate your confirmation I did the right thing.

However, even after this I am stuck, now with the custom actions. I try to run - as per the instructions - the command

Start-Job -ScriptBlock{rasa run actions}

Note the above is in Powershell 5.x on windows 10; it should be equivalent to the Linux command

rasa run actions&

Either way, this fails with the errors

ERROR rasa_sdk.executor - Failed to register package ‘actions’.
Traceback (most recent call last):
File “c:\py-workspace.venv\lib\site-packages\rasa_sdk\executor.py”, line 206, in register_package self._import_submodules(package)
File “c:\py-workspace.venv\lib\site-packages\rasa_sdk\executor.py”, line 191, in import_submodules package = importlib.import_module(package)
File "C:\Users\Gilad\AppData\Local\Programs\Python\Python37\lib\importlib_init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) 
File “”, line 1006, in _gcd_import File “”, line 983, in _find_and_load File “”, line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘actions’

I did see several solutions suggested in the case of using docker with rasa, which had similar errors. But they do not seem to work for my case, a much simpler case (or should be simpler), when you just want to run "rasa run actions&" directly and you want it to work.

After a pretty thorough search I believe I am doing everything as described in the doc but still stuff does not work. Please advise!

Thank you

area type

Most helpful comment

Just for the benefit of others the following does work:

Start-Process -NoNewWindow -ArgumentList "run actions" rasa

All 7 comments

Thanks for the issue, @wochinge will get back to you about it soon!

You may find help in the docs and the forum, too đŸ€—

Hi @giladpn ,

changed the “responses” section to be called “templates” (in domain.yml)

That's because you cloned the repository and master already contains new features while your rasa version 1.6.1 isn't able to deal with them yet. Best to check out the 1.6.x branch after cloning!

ERROR rasa_sdk.executor - Failed to register package ‘actions’.

Can you please try putting a __init__ file in the directory of your actions file and try again?

OK I added an __init__ file but that by itself did not solve it. Still getting the same errors such as

ERROR rasa_sdk.executor - Failed to register package ‘actions’.
ModuleNotFoundError: No module named ‘actions’

However I experimented and here is a fix. Instead of running a background job for

Start-Job -ScriptBlock{rasa run actions}

I just started a separate Powershell terminal and ran

rasa run actions

(with no & at the end!). Now the example works!

So this is a solution that works and maybe other people want to know about it.

However this solution has a significant drawback because you now need to run 3 different terminals, one for each of the commands

rasa run actions
docker run -p 8000:8000 rasa/duckling
rasa shell -m models --endpoints endpoints.yml

Does this give you a hint towards a better solution? Thank you for the effort.

@giladpn Seems Start-Job -ScriptBlock is not executed in the same directory as you run the command in (see https://stackoverflow.com/a/11372785/3429596 ) . So best to fully specify all paths (using the --actions param).
Closing this now since it's an issue with Start-Job -ScriptBlock

Thank you

Just for the benefit of others the following does work:

Start-Process -NoNewWindow -ArgumentList "run actions" rasa

Thanks for sharing your solution @giladpn !

Was this page helpful?
0 / 5 - 0 ratings