Add render prompt method when no API selected (#118136)
This commit is contained in:
parent
dff8c06166
commit
233c3bb2be
3 changed files with 10 additions and 6 deletions
|
@ -221,7 +221,7 @@ class GoogleGenerativeAIConversationEntity(
|
||||||
api_prompt = await llm_api.async_get_api_prompt(empty_tool_input)
|
api_prompt = await llm_api.async_get_api_prompt(empty_tool_input)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
api_prompt = llm.PROMPT_NO_API_CONFIGURED
|
api_prompt = llm.async_render_no_api_prompt(self.hass)
|
||||||
|
|
||||||
prompt = "\n".join(
|
prompt = "\n".join(
|
||||||
(
|
(
|
||||||
|
|
|
@ -138,7 +138,7 @@ class OpenAIConversationEntity(
|
||||||
api_prompt = await llm_api.async_get_api_prompt(empty_tool_input)
|
api_prompt = await llm_api.async_get_api_prompt(empty_tool_input)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
api_prompt = llm.PROMPT_NO_API_CONFIGURED
|
api_prompt = llm.async_render_no_api_prompt(self.hass)
|
||||||
|
|
||||||
prompt = "\n".join(
|
prompt = "\n".join(
|
||||||
(
|
(
|
||||||
|
|
|
@ -23,10 +23,14 @@ from .singleton import singleton
|
||||||
|
|
||||||
LLM_API_ASSIST = "assist"
|
LLM_API_ASSIST = "assist"
|
||||||
|
|
||||||
PROMPT_NO_API_CONFIGURED = (
|
|
||||||
"Only if the user wants to control a device, tell them to edit the AI configuration "
|
@callback
|
||||||
"and allow access to Home Assistant."
|
def async_render_no_api_prompt(hass: HomeAssistant) -> str:
|
||||||
)
|
"""Return the prompt to be used when no API is configured."""
|
||||||
|
return (
|
||||||
|
"Only if the user wants to control a device, tell them to edit the AI configuration "
|
||||||
|
"and allow access to Home Assistant."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@singleton("llm")
|
@singleton("llm")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue