I created a custom converter to use sentences like “turn the heating to 22 point 5 degree”. The converter gets the “22 point 5” and sends “22.5” to Rhasspy.
This is what my converter looks like:
#!/usr/bin/env python3
import sys
import json
# [22, ".", 5]
args = json.load(sys.stdin)
# 22.5
if type(args) == int:
num = args
else:
num = "".join(str(s).strip() for s in args)
print(num)
Unfortunately, I get an NluException when using it:
[DEBUG:2022-01-04 16:35:26,616] rhasspyserver_hermes: -> NluQuery(input='stelle heizung auf zwei komma fünf grad', site_id='default', id='7778a8e0-c81f-46f6-a627-3da520445ce5', intent_filter=None, session_id='7778a8e0-c81f-46f6-a627-3da520445ce5', wakeword_id=None, lang=None, custom_data=None, asr_confidence=None, custom_entities=None)
[DEBUG:2022-01-04 16:35:26,617] rhasspyserver_hermes: Publishing 295 bytes(s) to hermes/nlu/query
[DEBUG:2022-01-04 16:35:26,658] rhasspynlu_hermes: <- NluQuery(input='stelle heizung auf zwei komma fünf grad', site_id='default', id='7778a8e0-c81f-46f6-a627-3da520445ce5', intent_filter=None, session_id='7778a8e0-c81f-46f6-a627-3da520445ce5', wakeword_id=None, lang=None, custom_data=None, asr_confidence=None, custom_entities=None)
[ERROR:2022-01-04 16:35:26,673] rhasspynlu_hermes: handle_query
Traceback (most recent call last):
File "/usr/lib/rhasspy/rhasspy-nlu-hermes/rhasspynlu_hermes/__init__.py", line 118, in handle_query
extra_converters=self.extra_converters,
File "/usr/lib/rhasspy/rhasspy-nlu/rhasspynlu/fsticuffs.py", line 70, in recognize
extra_converters=extra_converters,
File "/usr/lib/rhasspy/rhasspy-nlu/rhasspynlu/fsticuffs.py", line 566, in path_to_recognition
converter_func = converters[last_converter.name]
KeyError: 'customFloat'
[DEBUG:2022-01-04 16:35:26,674] rhasspynlu_hermes: -> NluError(error="'customFloat'", site_id='default', context='stelle heizung auf zwei komma fünf grad', session_id='7778a8e0-c81f-46f6-a627-3da520445ce5')
[DEBUG:2022-01-04 16:35:26,674] rhasspynlu_hermes: Publishing 154 bytes(s) to hermes/error/nlu
[DEBUG:2022-01-04 16:35:26,675] rhasspyserver_hermes: Handling NluError (topic=hermes/error/nlu, id=b0beaa49-10ac-443f-980b-1a492db2cd18)
[ERROR:2022-01-04 16:35:26,677] rhasspyserver_hermes: NluError(error="'customFloat'", site_id='default', context='stelle heizung auf zwei komma fünf grad', session_id='7778a8e0-c81f-46f6-a627-3da520445ce5')
[DEBUG:2022-01-04 16:35:26,677] rhasspyserver_hermes: -> HandleToggleOn(site_id='default')
[DEBUG:2022-01-04 16:35:26,677] rhasspyserver_hermes: Publishing 21 bytes(s) to rhasspy/handle/toggleOn
[ERROR:2022-01-04 16:35:26,677] rhasspyserver_hermes: 'customFloat'
Traceback (most recent call last):
File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1821, in full_dispatch_request
result = await self.dispatch_request(request_context)
File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1869, in dispatch_request
return await handler(**request_.view_args)
File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__main__.py", line 1452, in api_text_to_intent
site_id=site_id,
File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__main__.py", line 2706, in text_to_intent_dict
text, intent_filter=intent_filter, site_id=site_id
File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 530, in recognize_intent
raise NluException(result.error)
rhasspyserver_hermes.NluException: 'customFloat'
Funny thing is, it’s working on my development machine. I only get this error on production. And other people can confirm this error on their systems too.
My production environment is a Debian system with Docker version 20.10.12, build e91ed57
using Porcupine.
On my development machine I’m using Docker Desktop for Windows with Docker version 20.10.11, build dea9396
using Snowboy.
Docker images are all up to date (2.5.11), Rhasspys configuration is identical between dev and prod.
I found the same error in this topic. There @synesthesiam mentioned to have it fixed. But this was a year ago.
Does anyone of you have an idea, what’s the problem here? And why dev and prod do not behave the same way?
Thanks a lot!