Update LLM prompt to improve quality for local LLMs (#122746)

This commit is contained in:
Allen Porter
2024-07-29 03:04:23 -07:00
committed by GitHub
parent 85aca4f095
commit e5bb1b2cc6
2 changed files with 52 additions and 69 deletions

View File

@@ -324,8 +324,7 @@ class AssistAPI(API):
(
"When controlling Home Assistant always call the intent tools. "
"Use HassTurnOn to lock and HassTurnOff to unlock a lock. "
"When controlling a device, prefer passing just its name and its domain "
"(what comes before the dot in its entity id). "
"When controlling a device, prefer passing just name and domain. "
"When controlling an area, prefer passing just area name and domain."
)
]
@@ -363,7 +362,7 @@ class AssistAPI(API):
prompt.append(
"An overview of the areas and the devices in this smart home:"
)
prompt.append(yaml.dump(exposed_entities))
prompt.append(yaml.dump(list(exposed_entities.values())))
return "\n".join(prompt)
@@ -477,6 +476,7 @@ def _get_exposed_entities(
info: dict[str, Any] = {
"names": ", ".join(names),
"domain": state.domain,
"state": state.state,
}