mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Add base prompt for LLMs (#118592)
This commit is contained in:
parent
dfb407728f
commit
f3b20d30ae
@ -245,7 +245,8 @@ class GoogleGenerativeAIConversationEntity(
|
||||
prompt = "\n".join(
|
||||
(
|
||||
template.Template(
|
||||
self.entry.options.get(
|
||||
llm.BASE_PROMPT
|
||||
+ self.entry.options.get(
|
||||
CONF_PROMPT, llm.DEFAULT_INSTRUCTIONS_PROMPT
|
||||
),
|
||||
self.hass,
|
||||
|
@ -167,7 +167,8 @@ class OpenAIConversationEntity(
|
||||
prompt = "\n".join(
|
||||
(
|
||||
template.Template(
|
||||
options.get(CONF_PROMPT, llm.DEFAULT_INSTRUCTIONS_PROMPT),
|
||||
llm.BASE_PROMPT
|
||||
+ options.get(CONF_PROMPT, llm.DEFAULT_INSTRUCTIONS_PROMPT),
|
||||
self.hass,
|
||||
).async_render(
|
||||
{
|
||||
|
@ -34,10 +34,13 @@ from .singleton import singleton
|
||||
|
||||
LLM_API_ASSIST = "assist"
|
||||
|
||||
BASE_PROMPT = (
|
||||
'Current time is {{ now().strftime("%X") }}. '
|
||||
'Today\'s date is {{ now().strftime("%x") }}.\n'
|
||||
)
|
||||
|
||||
DEFAULT_INSTRUCTIONS_PROMPT = """You are a voice assistant for Home Assistant.
|
||||
Answer in plain text. Keep it simple and to the point.
|
||||
The current time is {{ now().strftime("%X") }}.
|
||||
Today's date is {{ now().strftime("%x") }}.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -30,10 +30,9 @@
|
||||
'history': list([
|
||||
dict({
|
||||
'parts': '''
|
||||
Current time is 05:00:00. Today's date is 05/24/24.
|
||||
You are a voice assistant for Home Assistant.
|
||||
Answer in plain text. Keep it simple and to the point.
|
||||
The current time is 05:00:00.
|
||||
Today's date is 05/24/24.
|
||||
Only if the user wants to control a device, tell them to edit the AI configuration and allow access to Home Assistant.
|
||||
''',
|
||||
'role': 'user',
|
||||
@ -82,10 +81,9 @@
|
||||
'history': list([
|
||||
dict({
|
||||
'parts': '''
|
||||
Current time is 05:00:00. Today's date is 05/24/24.
|
||||
You are a voice assistant for Home Assistant.
|
||||
Answer in plain text. Keep it simple and to the point.
|
||||
The current time is 05:00:00.
|
||||
Today's date is 05/24/24.
|
||||
Only if the user wants to control a device, tell them to edit the AI configuration and allow access to Home Assistant.
|
||||
''',
|
||||
'role': 'user',
|
||||
@ -146,10 +144,9 @@
|
||||
'history': list([
|
||||
dict({
|
||||
'parts': '''
|
||||
Current time is 05:00:00. Today's date is 05/24/24.
|
||||
You are a voice assistant for Home Assistant.
|
||||
Answer in plain text. Keep it simple and to the point.
|
||||
The current time is 05:00:00.
|
||||
Today's date is 05/24/24.
|
||||
<no_api_prompt>
|
||||
''',
|
||||
'role': 'user',
|
||||
@ -202,10 +199,9 @@
|
||||
'history': list([
|
||||
dict({
|
||||
'parts': '''
|
||||
Current time is 05:00:00. Today's date is 05/24/24.
|
||||
You are a voice assistant for Home Assistant.
|
||||
Answer in plain text. Keep it simple and to the point.
|
||||
The current time is 05:00:00.
|
||||
Today's date is 05/24/24.
|
||||
<no_api_prompt>
|
||||
''',
|
||||
'role': 'user',
|
||||
@ -258,10 +254,9 @@
|
||||
'history': list([
|
||||
dict({
|
||||
'parts': '''
|
||||
Current time is 05:00:00. Today's date is 05/24/24.
|
||||
You are a voice assistant for Home Assistant.
|
||||
Answer in plain text. Keep it simple and to the point.
|
||||
The current time is 05:00:00.
|
||||
Today's date is 05/24/24.
|
||||
<api_prompt>
|
||||
''',
|
||||
'role': 'user',
|
||||
@ -314,10 +309,9 @@
|
||||
'history': list([
|
||||
dict({
|
||||
'parts': '''
|
||||
Current time is 05:00:00. Today's date is 05/24/24.
|
||||
You are a voice assistant for Home Assistant.
|
||||
Answer in plain text. Keep it simple and to the point.
|
||||
The current time is 05:00:00.
|
||||
Today's date is 05/24/24.
|
||||
<api_prompt>
|
||||
''',
|
||||
'role': 'user',
|
||||
|
Loading…
x
Reference in New Issue
Block a user