Flip prompts to put user prompt on top (#118085)

This commit is contained in:
Paulus Schoutsen 2024-05-25 00:33:24 -04:00 committed by GitHub
parent 69f237fa9e
commit 81f3387d06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View file

@ -224,7 +224,6 @@ class GoogleGenerativeAIConversationEntity(
prompt = "\n".join( prompt = "\n".join(
( (
api_prompt,
template.Template( template.Template(
self.entry.options.get(CONF_PROMPT, DEFAULT_PROMPT), self.hass self.entry.options.get(CONF_PROMPT, DEFAULT_PROMPT), self.hass
).async_render( ).async_render(
@ -233,6 +232,7 @@ class GoogleGenerativeAIConversationEntity(
}, },
parse_result=False, parse_result=False,
), ),
api_prompt,
) )
) )

View file

@ -141,7 +141,6 @@ class OpenAIConversationEntity(
prompt = "\n".join( prompt = "\n".join(
( (
api_prompt,
template.Template( template.Template(
options.get(CONF_PROMPT, DEFAULT_PROMPT), self.hass options.get(CONF_PROMPT, DEFAULT_PROMPT), self.hass
).async_render( ).async_render(
@ -150,6 +149,7 @@ class OpenAIConversationEntity(
}, },
parse_result=False, parse_result=False,
), ),
api_prompt,
) )
) )

View file

@ -30,8 +30,8 @@
'history': list([ 'history': list([
dict({ dict({
'parts': ''' 'parts': '''
Only if the user wants to control a device, tell them to edit the AI configuration and allow access to Home Assistant.
Answer in plain text. Keep it simple and to the point. Answer in plain text. Keep it simple and to the point.
Only if the user wants to control a device, tell them to edit the AI configuration and allow access to Home Assistant.
''', ''',
'role': 'user', 'role': 'user',
}), }),
@ -83,8 +83,8 @@
'history': list([ 'history': list([
dict({ dict({
'parts': ''' 'parts': '''
Only if the user wants to control a device, tell them to edit the AI configuration and allow access to Home Assistant.
Answer in plain text. Keep it simple and to the point. Answer in plain text. Keep it simple and to the point.
Only if the user wants to control a device, tell them to edit the AI configuration and allow access to Home Assistant.
''', ''',
'role': 'user', 'role': 'user',
}), }),
@ -136,8 +136,8 @@
'history': list([ 'history': list([
dict({ dict({
'parts': ''' 'parts': '''
Call the intent tools to control Home Assistant. Just pass the name to the intent.
Answer in plain text. Keep it simple and to the point. Answer in plain text. Keep it simple and to the point.
Call the intent tools to control Home Assistant. Just pass the name to the intent.
''', ''',
'role': 'user', 'role': 'user',
}), }),
@ -189,8 +189,8 @@
'history': list([ 'history': list([
dict({ dict({
'parts': ''' 'parts': '''
Call the intent tools to control Home Assistant. Just pass the name to the intent.
Answer in plain text. Keep it simple and to the point. Answer in plain text. Keep it simple and to the point.
Call the intent tools to control Home Assistant. Just pass the name to the intent.
''', ''',
'role': 'user', 'role': 'user',
}), }),