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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user