Skip to content

Commit a5ac329

Browse files
committed
Comment about previous turns no longer relevant.
Signed-off-by: Katharine Berry <[email protected]>
1 parent 6f1bb52 commit a5ac329

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

service/assistant/system_prompt.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ func generateLanguageSentence(ctx context.Context) string {
5454
var language = util.GetLanguageName(query.PreferredLanguageFromContext(ctx))
5555
if language != "" {
5656
sentence += "Respond in " + language + ". "
57+
} else {
58+
sentence += "Respond in the language the user is using, unless they specify otherwise."
5759
}
5860
return sentence
5961
}
@@ -76,10 +78,19 @@ func generateWidgetSentence(ctx context.Context) string {
7678
}
7779
sentence := "You can embed some widgets in your responses by using a special syntax. The following widgets are available:\n"
7880
if query.SupportsWidget(ctx, "weather") {
79-
sentence += "<!WEATHER-CURRENT location=[here|place name] units=[metric|imperial|uk hybrid]!>: embeds a weather widget showing the weather right now in the given location\n" +
80-
"<!WEATHER-SINGLE-DAY location=[here|place name] units=[metric|imperial|uk hybrid] day=[the name of a weekday, like Tuesday]!>: embeds a weather widget summarising the weather in the given location for a single day within the coming week.\n" +
81-
"<!WEATHER-MULTI-DAY location=[here|place name] units=[metric|imperial|uk hybrid]!>: embeds a weather widget summarising the weather in the given location for the next three days\n" +
82-
"Before including a weather widget, you *must* still look up the weather, and include a textual response after the widget. Always call get_weather first, then put the widget before any other text. If showing the weather for the user's current location, always use 'here' instead of a place name. If asked for only one day of weather, don't respond with multiple days.\n\n"
81+
has_location := query.LocationFromContext(ctx) != nil
82+
location_value := "place name"
83+
if has_location {
84+
location_value = "here|place name"
85+
}
86+
sentence += "<!WEATHER-CURRENT location=[" + location_value + "] units=[metric|imperial|uk hybrid]!>: embeds a weather widget showing the weather right now in the given location\n" +
87+
"<!WEATHER-SINGLE-DAY location=[" + location_value + "] units=[metric|imperial|uk hybrid] day=[the name of a weekday, like Tuesday]!>: embeds a weather widget summarising the weather in the given location for a single day within the coming week.\n" +
88+
"<!WEATHER-MULTI-DAY location=[" + location_value + "] units=[metric|imperial|uk hybrid]!>: embeds a weather widget summarising the weather in the given location for the next three days\n" +
89+
"Before including a weather widget, you *must* still look up the weather, and include a textual response after the widget. Always call get_weather first, then put the widget before any other text. "
90+
if has_location {
91+
sentence += "If showing the weather for the user's current location, always use 'here' instead of a place name. "
92+
}
93+
sentence += "If asked for only one day of weather, don't respond with multiple days.\n\n"
8394
}
8495
if query.SupportsWidget(ctx, "timer") {
8596
sentence += "<!TIMER targetTime=[time in ISO 8601 format] name=[name of the timer]!>: embeds a timer widget counting down to the given time. If the timer doesn't have a name, the `name` field can be omitted\n" +
@@ -117,7 +128,6 @@ func (ps *PromptSession) generateSystemPrompt(ctx context.Context) string {
117128
"If the user asks to set an alarm, assume they always want to set it for a time in the future. " +
118129
"As a creative, intelligent, helpful, friendly assistant, you should always try to answer the user's question. You can and should provide creative suggestions and factual responses as appropriate. Always try your best to answer the user's question. " +
119130
"**Never** claim to have taken an action (e.g. set a timer, alarm, or reminder) unless you have actually used a tool to do so. " +
120-
"Even if in previous turns you have apparently taken an action (like setting an alarm) without using a tool, you must still use tools if asked to do so again. " +
121131
"Alarms and reminders are not interchangable - *never* use alarms when a user asks for reminders, and never user reminders when the user asks for an alarm or timer. If a user asks to set a timer, always set a timer (using 'set_timer'), not a reminder. If the user asks about a specific timer, respond only about that one. " +
122132
"If asked to perform language translation (e.g. 'what is X in french?'), *don't* look anything up - just respond immediately. You know how to do translations between any language pair. " +
123133
"Your responses will be displayed on a very small screen, so be brief. Do not use markdown in your responses.\n" +

0 commit comments

Comments
 (0)