Assist : Custom_sentences and skip_words configuration

Hi, :raised_hand_with_fingers_splayed:
I use the new rhasspy3 satellite service to communicate with assist with my home assistant cloud account.

It work very well but because my speaker output a .wav with a word (“monsieur ?” ( “sir ?” in french)) even with my active noise reduction mic it can sometimes register the word ad add it to the sentence that i say.

So i use the “skip_words” argument to my customs sentences yaml files.

But because i start to have many different files for different type of sentence, if i want to add a word to “skip_word” i must add the word to each files witch is kind of time consuming.

So i’ve tried to create a “skip_words.yaml” file with the words to skip and add the “!include” tag on each file instead.

Unfortunatly i get this error :

skip_words: !include skip_words.yaml

but every time i get this error

2023-09-08 12:17:32.672 ERROR (MainThread) [homeassistant.components.assist_pipeline.pipeline] Unexpected error during intent recognition
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/assist_pipeline/pipeline.py", line 774, in recognize_intent
    conversation_result = await conversation.async_converse(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/conversation/__init__.py", line 467, in async_converse
    result = await agent.async_process(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py", line 208, in async_process
    result = await self.async_recognize(user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py", line 183, in async_recognize
    lang_intents = await self.async_get_or_load_intents(language)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py", line 391, in async_get_or_load_intents
    return await self.hass.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py", line 455, in _get_or_load_intents
    custom_sentences_yaml := yaml.safe_load(
                             ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yaml/__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/usr/local/lib/python3.11/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yaml/constructor.py", line 143, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yaml/constructor.py", line 427, in construct_undefined
    raise ConstructorError(None, None,
yaml.constructor.ConstructorError: could not determine a constructor for the tag '!include'
  in "/config/custom_sentences/fr/questions.yaml", line 25, column 13

Is anyone know if is it possible or if y just mistype something ?

Thanks

I’m not sure I understand your problem correctly, as you should post one or more of the files you’re talking about (eg. questions.yaml). :wink:

In theory you can include different files, even nested. But what you can’t do is include one file more than once aka include xy.yaml in aa.yaml and bb.yaml. Btw. this isn’t necessary.

On the other hand, if my guessing is correct, you might want to do it another way. With your way, you’d overwrite the skip_words set by HA. You should expand them, so the HA skip_words are still included. :slight_smile:

For a start, please post your file(s), and we’ll see, where these get us. :slight_smile:

1 Like