Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error during intent recognition (not enough values to unpack) #171

Open
caphector opened this issue Jun 14, 2024 · 5 comments
Open
Labels
bug Something isn't working

Comments

@caphector
Copy link

Describe the bug
When I tell any of the LLM models to change device state ("turn on office light" for example) it returns Unexpected error during intent recognition

Expected behavior
Device state is changed

Logs

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/assist_pipeline/pipeline.py", line 994, in recognize_intent
    conversation_result = await conversation.async_converse(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/conversation/agent_manager.py", line 108, in async_converse
    result = await method(conversation_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/agent.py", line 396, in async_process
    tool_response = await llm_api.async_call_tool(tool_input)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/llm.py", line 158, in async_call_tool
    return await tool.async_call(self.api.hass, tool_input, self.llm_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/__init__.py", line 145, in async_call
    domain, service = tuple(tool_input.tool_args["service"].split("."))
    ^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)
@caphector caphector added the bug Something isn't working label Jun 14, 2024
@caphector
Copy link
Author

Here are some more logs:

2024-06-16 23:18:33.795 DEBUG (MainThread) [custom_components.llama_conversation.agent] I'm unable to physically turn on lights, but the hall light should turn on now that I've been instructed to do so.

{"service": "light", "target_device": "light.hall_light", "state": "on"}

@christoros
Copy link

christoros commented Jun 18, 2024

I also have this error. Using version 0.3.3 and ollama api.

Unexpected error during intent recognition

Logs:

2024-06-18 11:17:56.054 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 994, in recognize_intent
    conversation_result = await conversation.async_converse(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/conversation/agent_manager.py", line 108, in async_converse
    result = await method(conversation_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/agent.py", line 284, in async_process
    message = self._generate_system_prompt(raw_prompt, llm_api)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/agent.py", line 694, in _generate_system_prompt
    exposed_attributes = expose_attributes(attributes)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/agent.py", line 677, in expose_attributes
    value = F"{closest_color(value)} {value}"
               ^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/utils.py", line 31, in closest_color
    for key, name in webcolors.CSS3_HEX_TO_NAMES.items():
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'webcolors' has no attribute 'CSS3_HEX_TO_NAMES'

Removing the rgb_color attribute fixes the error.

@acon96
Copy link
Owner

acon96 commented Jun 18, 2024

Here are some more logs:

2024-06-16 23:18:33.795 DEBUG (MainThread) [custom_components.llama_conversation.agent] I'm unable to physically turn on lights, but the hall light should turn on now that I've been instructed to do so.

{"service": "light", "target_device": "light.hall_light", "state": "on"}

The model output shown here isn't quite in the correct format. It should be:

{"service": "light.turn_on", "target_device": "light.hall_light"}

I can make the error handling better so that the error message isn't so confusing.

@rwjack
Copy link

rwjack commented Jul 20, 2024

I keep getting this one with the default settings, tried with the Ollama API + mistral:7b:

2024-07-20 17:51:41.176 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 995, in recognize_intent
conversation_result = await conversation.async_converse(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/conversation/agent_manager.py", line 108, in async_converse
result = await method(conversation_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/llama_conversation/agent.py", line 284, in async_process
message = self._generate_system_prompt(raw_prompt, llm_api)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/llama_conversation/agent.py", line 694, in _generate_system_prompt
exposed_attributes = expose_attributes(attributes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/llama_conversation/agent.py", line 677, in expose_attributes
value = F"{closest_color(value)} {value}"
^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/llama_conversation/utils.py", line 31, in closest_color
for key, name in webcolors.CSS3_HEX_TO_NAMES.items():
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'webcolors' has no attribute 'CSS3_HEX_TO_NAMES'

Oh, just saw this:

Removing the rgb_color attribute fixes the error.

No more error, but still the same:

image

@allenporter
Copy link

allenporter commented Jul 20, 2024

My impression is you need to use and older version of webcolors 1.13 or earlier because CSS3_HEX_TO_NAMES was not meant to be part of the API and was removed in later releases.

See the version pin in

added in 7c0b3ab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants