mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-21 00:06:30 +00:00
Document provide LLM data (#2696)
This commit is contained in:
parent
2c2ebba1d6
commit
4fd60d5378
@ -64,10 +64,11 @@ def async_get_options_schema(
|
|||||||
When interacting with the LLM, the provided `ChatLog` will make any selected tools available from the selected API and the conversation entity should pass them to the LLM together with the extra prompt provided by the API.
|
When interacting with the LLM, the provided `ChatLog` will make any selected tools available from the selected API and the conversation entity should pass them to the LLM together with the extra prompt provided by the API.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from homeassistant.const import CONF_LLM_HASS_API
|
from homeassistant.const import CONF_LLM_HASS_API, CONF_PROMPT
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.components import conversation
|
from homeassistant.components import conversation
|
||||||
from homeassistant.helpers import intent, llm
|
from homeassistant.helpers import intent, llm
|
||||||
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
class MyConversationEntity(conversation.ConversationEntity):
|
class MyConversationEntity(conversation.ConversationEntity):
|
||||||
@ -86,11 +87,11 @@ class MyConversationEntity(conversation.ConversationEntity):
|
|||||||
"""Call the API."""
|
"""Call the API."""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await chat_log.async_update_llm_data(
|
await chat_log.async_provide_llm_data(
|
||||||
DOMAIN,
|
user_input.as_llm_context(DOMAIN),
|
||||||
user_input,
|
|
||||||
self.entry.options.get(CONF_LLM_HASS_API),
|
self.entry.options.get(CONF_LLM_HASS_API),
|
||||||
self.entry.options.get(CONF_PROMPT),
|
self.entry.options.get(CONF_PROMPT),
|
||||||
|
user_input.extra_system_prompt,
|
||||||
)
|
)
|
||||||
except conversation.ConverseError as err:
|
except conversation.ConverseError as err:
|
||||||
return err.as_conversation_result()
|
return err.as_conversation_result()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user