1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Omit state from the Assist LLM prompts (#141034)

* Omit state from the Assist LLM prompts

* Add back the stateful prompt
This commit is contained in:
Allen Porter
2025-03-22 12:41:51 -07:00
committed by GitHub
parent 61e30d0e91
commit 4e2dfba45f
4 changed files with 60 additions and 63 deletions

View File

@@ -622,6 +622,40 @@ async def test_assist_api_prompt(
domain: light
state: unavailable
areas: Test Area 2
"""
stateless_exposed_entities_prompt = """An overview of the areas and the devices in this smart home:
- names: Kitchen
domain: light
- names: Living Room
domain: light
areas: Test Area, Alternative name
- names: Test Device, my test light
domain: light
areas: Test Area, Alternative name
- names: Test Service
domain: light
areas: Test Area, Alternative name
- names: Test Service
domain: light
areas: Test Area, Alternative name
- names: Test Service
domain: light
areas: Test Area, Alternative name
- names: Test Device 2
domain: light
areas: Test Area 2
- names: Test Device 3
domain: light
areas: Test Area 2
- names: Test Device 4
domain: light
areas: Test Area 2
- names: Unnamed Device
domain: light
areas: Test Area 2
- names: '1'
domain: light
areas: Test Area 2
"""
first_part_prompt = (
"When controlling Home Assistant always call the intent tools. "
@@ -640,7 +674,7 @@ async def test_assist_api_prompt(
f"""{first_part_prompt}
{area_prompt}
{no_timer_prompt}
{exposed_entities_prompt}"""
{stateless_exposed_entities_prompt}"""
)
# Verify that the get_home_state tool returns the same results as the exposed_entities_prompt
@@ -663,7 +697,7 @@ async def test_assist_api_prompt(
f"""{first_part_prompt}
{area_prompt}
{no_timer_prompt}
{exposed_entities_prompt}"""
{stateless_exposed_entities_prompt}"""
)
# Add floor
@@ -678,7 +712,7 @@ async def test_assist_api_prompt(
f"""{first_part_prompt}
{area_prompt}
{no_timer_prompt}
{exposed_entities_prompt}"""
{stateless_exposed_entities_prompt}"""
)
# Register device for timers
@@ -689,7 +723,7 @@ async def test_assist_api_prompt(
assert api.api_prompt == (
f"""{first_part_prompt}
{area_prompt}
{exposed_entities_prompt}"""
{stateless_exposed_entities_prompt}"""
)