mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
LLM Tools support for Google Generative AI integration (#117644)
* initial commit * Undo prompt chenges * Move format_tool out of the class * Only catch HomeAssistantError and vol.Invalid * Add config flow option * Fix type * Add translation * Allow changing API access from options flow * Allow model picking * Remove allowing HASS Access in main flow * Move model to the top in options flow * Make prompt conditional based on API access * convert only once to dict * Reduce debug logging * Update title * re-order models * Address comments * Move things * Update labels * Add tool call tests * coverage * Use LLM APIs * Fixes * Address comments * Reinstate the title to not break entity name --------- Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
@@ -18,12 +18,13 @@ async def test_get_api_no_existing(hass: HomeAssistant) -> None:
|
||||
|
||||
async def test_register_api(hass: HomeAssistant) -> None:
|
||||
"""Test registering an llm api."""
|
||||
api = llm.AssistAPI(
|
||||
hass=hass,
|
||||
id="test",
|
||||
name="Test",
|
||||
prompt_template="Test",
|
||||
)
|
||||
|
||||
class MyAPI(llm.API):
|
||||
def async_get_tools(self) -> list[llm.Tool]:
|
||||
"""Return a list of tools."""
|
||||
return []
|
||||
|
||||
api = MyAPI(hass=hass, id="test", name="Test", prompt_template="")
|
||||
llm.async_register_api(hass, api)
|
||||
|
||||
assert llm.async_get_api(hass, "test") is api
|
||||
|
||||
Reference in New Issue
Block a user