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

Add description to intent handlers and use in LLM helper (#117864)

This commit is contained in:
Michael Hansen
2024-05-21 11:54:34 -05:00
committed by GitHub
parent 0c37a065ad
commit 8079cc0464
13 changed files with 74 additions and 6 deletions

View File

@@ -118,3 +118,21 @@ async def test_assist_api(hass: HomeAssistant) -> None:
"response_type": "action_done",
"speech": {},
}
async def test_assist_api_description(hass: HomeAssistant) -> None:
"""Test intent description with Assist API."""
class MyIntentHandler(intent.IntentHandler):
intent_type = "test_intent"
description = "my intent handler"
intent.async_register(hass, MyIntentHandler())
assert len(llm.async_get_apis(hass)) == 1
api = llm.async_get_api(hass, "assist")
tools = api.async_get_tools()
assert len(tools) == 1
tool = tools[0]
assert tool.name == "test_intent"
assert tool.description == "my intent handler"