mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Allow unregistering LLM APIs (#135162)
This commit is contained in:
@@ -85,7 +85,7 @@ def _async_get_apis(hass: HomeAssistant) -> dict[str, API]:
|
||||
|
||||
|
||||
@callback
|
||||
def async_register_api(hass: HomeAssistant, api: API) -> None:
|
||||
def async_register_api(hass: HomeAssistant, api: API) -> Callable[[], None]:
|
||||
"""Register an API to be exposed to LLMs."""
|
||||
apis = _async_get_apis(hass)
|
||||
|
||||
@@ -94,6 +94,13 @@ def async_register_api(hass: HomeAssistant, api: API) -> None:
|
||||
|
||||
apis[api.id] = api
|
||||
|
||||
@callback
|
||||
def unregister() -> None:
|
||||
"""Unregister the API."""
|
||||
apis.pop(api.id)
|
||||
|
||||
return unregister
|
||||
|
||||
|
||||
async def async_get_api(
|
||||
hass: HomeAssistant, api_id: str, llm_context: LLMContext
|
||||
|
||||
Reference in New Issue
Block a user