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

Ollama: Unexpected error during intent recognition #211

Open
Teagan42 opened this issue Aug 22, 2024 · 6 comments
Open

Ollama: Unexpected error during intent recognition #211

Teagan42 opened this issue Aug 22, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Teagan42
Copy link
Contributor

Home-Assistant: 2024.8.1
llama-conversation: 0.3.6
webcolors: 1.13

Exact same issue was marked as fixed in 0.3.3 but appears not to be: #165
What is odd is that I looked at the webcolors package inside of home-assistant and the constant definitely exists and is exported.

"""
Utility functions for working with the color names and color value
formats defined by the HTML and CSS specifications for use in
documents on the web.

See documentation (in docs/ directory of source distribution) for
details of the supported formats, conventions and conversions.

"""
from .constants import (
    CSS2,
    CSS2_HEX_TO_NAMES,
    CSS2_NAMES_TO_HEX,
    CSS3,
    CSS3_HEX_TO_NAMES,
    CSS3_NAMES_TO_HEX,
    CSS21,
    CSS21_HEX_TO_NAMES,
    CSS21_NAMES_TO_HEX,
    HTML4,
    HTML4_HEX_TO_NAMES,
    HTML4_NAMES_TO_HEX,
)
from .conversion import (
    hex_to_name,
    hex_to_rgb,
    hex_to_rgb_percent,
    name_to_hex,
    name_to_rgb,
    name_to_rgb_percent,
    rgb_percent_to_hex,
    rgb_percent_to_name,
    rgb_percent_to_rgb,
    rgb_to_hex,
    rgb_to_name,
    rgb_to_rgb_percent,
)
from .html5 import (
    html5_parse_legacy_color,
    html5_parse_simple_color,
    html5_serialize_simple_color,
)
from .normalization import (
    normalize_hex,
    normalize_integer_triplet,
    normalize_percent_triplet,
)
from .types import HTML5SimpleColor, IntegerRGB, IntTuple, PercentRGB, PercentTuple

__version__ = "1.13"

__all__ = [
    "HTML4",
    "CSS2",
    "CSS21",
    "CSS3",
    "HTML4_NAMES_TO_HEX",
    "HTML4_HEX_TO_NAMES",
    "CSS2_NAMES_TO_HEX",
    "CSS2_HEX_TO_NAMES",
    "CSS21_HEX_TO_NAMES",
    "CSS21_NAMES_TO_HEX",
    "CSS3_HEX_TO_NAMES",
    "CSS3_NAMES_TO_HEX",
    "name_to_hex",
    "name_to_rgb",
    "name_to_rgb_percent",
    "hex_to_name",
    "hex_to_rgb",
    "hex_to_rgb_percent",
    "rgb_to_hex",
    "rgb_to_name",
    "rgb_to_rgb_percent",
    "rgb_percent_to_hex",
    "rgb_percent_to_name",
    "rgb_percent_to_rgb",
    "html5_parse_simple_color",
    "html5_parse_legacy_color",
    "html5_serialize_simple_color",
    "normalize_hex",
    "normalize_integer_triplet",
    "normalize_percent_triplet",
    "IntegerRGB",
    "PercentRGB",
    "HTML5SimpleColor",
    "IntTuple",
    "PercentTuple",
]

Describe the bug
When performing a chat completion via the Assist Pipeline, the integration raises an AttributeError.

Expected behavior
The Assist Pipeline should be able to determine the intent.

Logs
If applicable, please upload any error or debug logs output by Home Assistant.

024-08-22 05:40:19.961 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 1015, 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 "/usr/src/homeassistant/homeassistant/components/conversation/entity.py", line 47, in internal_async_process
    return await self.async_process(user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/conversation.py", line 365, in async_process
    message = self._generate_system_prompt(raw_prompt, llm_api)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/conversation.py", line 776, in _generate_system_prompt
    exposed_attributes = expose_attributes(attributes)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/conversation.py", line 759, 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'
@Teagan42 Teagan42 added the bug Something isn't working label Aug 22, 2024
@cryptobench
Copy link

Same issue here

@acon96
Copy link
Owner

acon96 commented Aug 24, 2024

Can you check home assistant log for errors related to conflicting dependencies? My best guess is that another integration you are using requires the most recent versions of webcolors which do not expose those dictionaries anymore.

@pixselious
Copy link

Same issue here
HASS 2024.8.2
home-llm 0.3.6

LLM Model 'fixt/home-3b-v3:q4_k_m' (remote)

Temporarily fixed by removing additional attribute "rgb_color" (which exists by default).

@IneffableEllie
Copy link

IneffableEllie commented Sep 8, 2024

Same issue, here is the traceback:

Logger: homeassistant.components.assist_pipeline.pipeline
Source: components/assist_pipeline/pipeline.py:1015
integration: Assist pipeline ([documentation](https://www.home-assistant.io/integrations/assist_pipeline), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+assist_pipeline%22))
First occurred: 16:52:27 (6 occurrences)
Last logged: 17:01:00

Unexpected error during intent recognition
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/assist_pipeline/pipeline.py", line 1015, 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 "/usr/src/homeassistant/homeassistant/components/conversation/entity.py", line 47, in internal_async_process
    return await self.async_process(user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/conversation.py", line 365, in async_process
    message = self._generate_system_prompt(raw_prompt, llm_api)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/conversation.py", line 776, in _generate_system_prompt
    exposed_attributes = expose_attributes(attributes)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/conversation.py", line 759, 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'

@simcop2387
Copy link
Contributor

This has been fixed in the develop branch as shown here, but I don't know how to use that in HACS (I couldn't figure it out). So I've taken my fork and made a tag and release v0.3.7-preview2 over here that's got it cherry picked on top of v0.3.6. It'll cause you to have to reconfigure all the integrations but should let people test and use it until the next release happens. https://github.com/simcop2387/home-llm

@thk-socal
Copy link

Having this issue as well. Any chance we can get an updated release pushed out to fix this? @simcop2387 I appreciate the fork.

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

7 participants