Open Rudd-O opened 1 month ago
LOL.
I have done some more debugging. It appears that when I send the exact same text (or nearly the same text, I explain to the model that the entities list is formatted in YAML), directly from Open-WebUI, I can get valid informational responses (although it doesn't seem to recognize some entities, no doubt due to default context token size, for which I opened #119946 a while ago).
So, it's almost certain that something in the Ollama side is totally ignoring the role: system
prompt. Not sure how this will need to be fixed, but it does seem like that's broken right now and, as a result anything that uses a system prompt prior to the role: user
prompt simply won't work properly.
I literally updated Ollama today. Sigh.
Possibly related? https://github.com/ollama/ollama/issues/6176
Yeah so I have confirmed that the issue is in latest ollama.
I'm closing this.
I figured it out! I figured it out. When the system prompt is above a certain length (in my case, about half the text of what HA generates), it is totally ignored. Halve the text or double the context token size and BAM, suddenly it works!
Once again, I must ask that the context token size be configurable https://github.com/home-assistant/core/issues/119946 or that it is dynamically increased proportional to the amount of system prompt text. The fix is here: https://github.com/home-assistant/core/pull/121803 .
Something to consider here is that you may want to try playing with a model with and without assist. From https://llama.meta.com/docs/model-cards-and-prompt-formats/llama3_1 Note: We recommend using Llama 70B-instruct or Llama 405B-instruct for applications that combine conversation and tool calling. Llama 8B-Instruct can not reliably maintain a conversation alongside tool calling definitions. It can be used for zero-shot tool calling, but tool instructions should be removed for regular conversations between the model and the user.
This is a contributing factor to the above behavior your are seeing, so just sharing for context for now.
I myself recognized that the language setting is also totally ignored. I have configured german but assist with llama is ignoring that and is always speaking in english with me. Also it is totally unable to control things. It seems that he does not know that if i am taking about lights, that he needs to control entities of the domain light. In addition he cant handle unavailable devices at all. As soon there is a single unailable device he is stopping his work at all. Totally useless right now. All of that works fine with chat-gpt-4.0-mini
Hey there @synesthesiam, mind taking a look at this issue as it has been labeled with an integration (ollama
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
ollama documentation ollama source (message by IssueLinks)
The problem
Whenever I ask the model to give me the state of any of the entities listed in the preamble sent to Ollama, the response from the LLM is basically trash.
This is actually worse than the previous version. In the previous version, the model would at least recognize some of the entities in the listing sent within the preamble. Now the model just hallucinates entities that don't exist, and refuses to identify / describe / control them.
I'm using llama3.1:8b and also mistral-nemo:latest. Same result with both models. I've verified with
tcpdump
that the calls are correct and the responses are flowing back to HA.In every way this is a massive regression.
I also can't alter the entities part of the prompt by configuration either. The default prompt is basically a paragraph, and all the templated entity stuff that used to be in the configurable prompt is gone -- it is replaced by something which HA is adding on its own without any configurable (templated) content. (Plus, of course, the tools JSON.) I can see it all in the logs and in
tcpdump
output.What version of Home Assistant Core has the issue?
core-2024.8.0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Core
Integration causing the issue
ollama
Link to integration documentation on our website
No response
Diagnostics information
debuglog.txt
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response