From 2bd142d3a63a0967878f8d2b9dce0661e74ff9a0 Mon Sep 17 00:00:00 2001 From: tronikos Date: Thu, 30 May 2024 19:03:57 -0700 Subject: [PATCH] Improve LLM prompt (#118520) --- homeassistant/helpers/llm.py | 3 ++- tests/helpers/test_llm.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/llm.py b/homeassistant/helpers/llm.py index 57b72bc9618..b4b5f9137c4 100644 --- a/homeassistant/helpers/llm.py +++ b/homeassistant/helpers/llm.py @@ -253,8 +253,9 @@ class AssistAPI(API): prompt = [ ( - "Call the intent tools to control Home Assistant. " + "When controlling Home Assistant always call the intent tools. " "Do not pass the domain to the intent tools as a list. " + "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 an area, prefer passing just area name and domain." diff --git a/tests/helpers/test_llm.py b/tests/helpers/test_llm.py index 1c13d643928..355abf2fe5d 100644 --- a/tests/helpers/test_llm.py +++ b/tests/helpers/test_llm.py @@ -422,8 +422,9 @@ async def test_assist_api_prompt( + yaml.dump(exposed_entities) ) first_part_prompt = ( - "Call the intent tools to control Home Assistant. " + "When controlling Home Assistant always call the intent tools. " "Do not pass the domain to the intent tools as a list. " + "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 an area, prefer passing just area name and domain."