Roles and groups: confused about domain format

Today I started using the rasa feature groups, for I think it’s a great feature to on one hand influence conversation by entity and on the other hand influence conversation on a common property of some entities, i.e. belonging to a group.

But I run into an issue.

According to the docs, if I understand well, I should define the groups in the domain file as well as in the nlu trainingdata.

My domain looks like:

entities:
- wachtwoord
- gebruikersnaam
- systeem:
    groups:
      - windows
      - mainframe
- applicatie:
    groups:
      - mainframe-applicatie

When doing so, training gives me this error:

core/domain.py", line 248, in merge_lists
    return sorted(list(set(l1 + l2)))
TypeError: unhashable type: 'dict'

When leaving out the “-” on highest level, I don’t get the error:

entities:
- wachtwoord
- gebruikersnaam
systeem:
    groups:
      - windows
      - mainframe
applicatie:
    groups:
      - mainframe-applicatie

So without these dashes, training won’t fail, but then when running rasa interactive, I get the warning “Interpreter parsed an entity ‘systeem’ which is not defined in the domain.”

So, is the doc wrong or is this a bug, or am I doing wrong?

And what about the yaml syntax for dict in list? i.e. the entities “wachtwoord” and “gebruikersnaam” are explicitly denoted as list-items by there dashes, whereas systeem and applicatie aren’t.

Rasa Open Source 2.3.4

Some disturbing mistakes corrected on 20210706 6:45 CEST

1 Like

I have the same problem: the ‘unashable type’ error occurs when role are added in the domain.yml file for entities

entities:
   - people
   - number:
       roles:
       - min
       - max
   - color:
       roles:
       - favorite

The error stack:

File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\a.porporato\Anaconda3\envs\rasatestenv\Scripts\rasa.exe\__main__.py", line 7, in <module>
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\__main__.py", line 117, in main
    cmdline_arguments.func(cmdline_arguments)
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\cli\train.py", line 59, in <lambda>
    train_parser.set_defaults(func=lambda args: run_training(args, can_exit=True))
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\cli\train.py", line 91, in run_training
    training_result = train_all(
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\api.py", line 109, in train
    return rasa.utils.common.run_in_loop(
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\utils\common.py", line 296, in run_in_loop
    result = loop.run_until_complete(f)
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\asyncio\base_events.py", line 608, in run_until_complete
    return future.result()
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\model_training.py", line 100, in train_async
    domain = await file_importer.get_domain()
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\utils\common.py", line 141, in decorated
    return await cache.cached_result()
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\importers\importer.py", line 448, in get_domain
    original, e2e_domain = await asyncio.gather(
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\utils\common.py", line 141, in decorated
    return await cache.cached_result()
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\importers\importer.py", line 331, in get_domain
    existing_domain = existing_domain.merge(domain_with_retrieval_intents)
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\core\domain.py", line 311, in merge
    combined[key] = merge_lists(combined[key], domain_dict[key])
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\core\domain.py", line 281, in merge_lists
    return sorted(list(set(l1 + l2)))
TypeError: unhashable type: 'dict'

Any solution for that? Is there an error in the documentation?

Rasa Version : 2.6.1

Minimum Compatible Version: 2.6.0

Rasa SDK Version : 2.7.0

Rasa X Version : None

Python Version : 3.8.0

Operating System : Windows-10-10.0.19041-SP0

Python Path : c:\users\a.porporato\anaconda3\envs\rasatestenv\python.exe

Thanks

1 Like

Upgrading to Rasa 2.7 did not fix the problem, nor did upgrading to Rasa 2.8:

(rasatestenv) C:\Communities_of_Practice\Voice_Machine_Interface\PoCs\Rasa\Rasa_2_from_Scratch>rasa --version
Rasa Version      :         2.8.0
Minimum Compatible Version: 2.8.0
Rasa SDK Version  :         2.8.0
Rasa X Version    :         None
Python Version    :         3.8.0
Operating System  :         Windows-10-10.0.19041-SP0
Python Path       :         c:\users\a.porporato\anaconda3\envs\rasatestenv\python.exe

The error stack (at the beginning of the rasa train process)

2021-07-14 11:35:38 WARNING  rasa.shared.utils.common  - The conditional response variation feature is currently experimental and might change or be removed in the future 🔬 Please share your feedback on it in the forum (https://forum.rasa.com) to help us make this feature ready for production.
Traceback (most recent call last):
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\a.porporato\Anaconda3\envs\rasatestenv\Scripts\rasa.exe\__main__.py", line 7, in <module>
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\__main__.py", line 117, in main
    cmdline_arguments.func(cmdline_arguments)
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\cli\train.py", line 59, in <lambda>
    train_parser.set_defaults(func=lambda args: run_training(args, can_exit=True))
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\cli\train.py", line 91, in run_training
    training_result = train_all(
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\api.py", line 109, in train
    return rasa.utils.common.run_in_loop(
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\utils\common.py", line 296, in run_in_loop
    result = loop.run_until_complete(f)
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\asyncio\base_events.py", line 608, in run_until_complete
    return future.result()
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\model_training.py", line 100, in train_async
    domain = await file_importer.get_domain()
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\utils\common.py", line 141, in decorated
    return await cache.cached_result()
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\importers\importer.py", line 448, in get_domain
    original, e2e_domain = await asyncio.gather(
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\utils\common.py", line 141, in decorated
    return await cache.cached_result()
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\importers\importer.py", line 331, in get_domain
    existing_domain = existing_domain.merge(domain_with_retrieval_intents)
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\core\domain.py", line 313, in merge
    combined[key] = merge_lists(combined[key], domain_dict[key])
  File "c:\users\a.porporato\anaconda3\envs\rasatestenv\lib\site-packages\rasa\shared\core\domain.py", line 283, in merge_lists
    return sorted(list(set(list1 + list2)))
TypeError: unhashable type: 'dict'

Any advice for this problem? Thanks