From 3e0d9516a9f59bb217bde7249f7b16b0087d9a7a Mon Sep 17 00:00:00 2001 From: tronikos Date: Wed, 29 May 2024 18:44:33 -0700 Subject: [PATCH] Improve LLM prompt (#118443) * Improve LLM prompt * test * improvements * improvements --- homeassistant/helpers/llm.py | 4 +++- tests/helpers/test_llm.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/llm.py b/homeassistant/helpers/llm.py index 5a39bfaa726..d1ce3047e78 100644 --- a/homeassistant/helpers/llm.py +++ b/homeassistant/helpers/llm.py @@ -250,7 +250,9 @@ class AssistAPI(API): prompt = [ ( "Call the intent tools to control Home Assistant. " - "When controlling an area, prefer passing area name and domain." + "When controlling a device, prefer passing just its name and its domain " + "(what comes before the dot in its entity id). " + "When controlling an area, prefer passing just area name and a single domain." ) ] area: ar.AreaEntry | None = None diff --git a/tests/helpers/test_llm.py b/tests/helpers/test_llm.py index a59b4767196..672b6a6642b 100644 --- a/tests/helpers/test_llm.py +++ b/tests/helpers/test_llm.py @@ -423,7 +423,9 @@ async def test_assist_api_prompt( ) first_part_prompt = ( "Call the intent tools to control Home Assistant. " - "When controlling an area, prefer passing area name and domain." + "When controlling a device, prefer passing just its name and its domain " + "(what comes before the dot in its entity id). " + "When controlling an area, prefer passing just area name and a single domain." ) no_timer_prompt = "This device does not support timers."