You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If setting an alarm, the time to schedule the alarm for in ISO 8601 format, e.g. '2023-07-12T00:00:00-07:00'. Required for alarms. Must always be in the future.
29
+
// The time to schedule the alarm for in ISO 8601 format, e.g. '2023-07-12T00:00:00-07:00'. Must always be in the future.
30
30
Timestring`json:"time"`
31
+
// An optional name for the alarm.
32
+
Namestring`json:"name"`
33
+
}
34
+
35
+
typeTimerInputstruct {
31
36
// If setting a timer, the number of seconds to set the timer for. Required for timers.
32
37
Durationint`json:"duration_seconds"`
33
-
// True if this is a timer, false if it's an alarm.
// The expiration time of the timer to delete in ISO 8601 format, e.g. '2023-07-12T00:00:00-07:00'.
49
+
Timestring`json:"time"`
49
50
}
50
51
52
+
typeEmptystruct{}
53
+
51
54
funcinit() {
52
55
params:= genai.Schema{
53
56
Type: genai.TypeObject,
54
57
Nullable: false,
55
58
Properties: map[string]*genai.Schema{
56
59
"time": {
57
60
Type: genai.TypeString,
58
-
Description: "If setting an alarm, the time to schedule the alarm for in ISO 8601 format, e.g. '2023-07-12T00:00:00-07:00'. Required for alarms. Must always be in the future.",
61
+
Description: "The time to schedule the alarm for in ISO 8601 format, e.g. '2023-07-12T00:00:00-07:00'. Must always be in the future.",
59
62
Nullable: true,
60
63
},
61
-
"duration_seconds": {
62
-
Type: genai.TypeInteger,
63
-
Description: "If setting a timer, the number of seconds to set the timer for. Required for timers.",
64
-
Nullable: true,
65
-
Format: "int32",
66
-
},
67
-
"is_timer": {
68
-
Type: genai.TypeBoolean,
69
-
Description: "True if this is a timer, false if it's an alarm.",
70
-
Nullable: false,
71
-
},
72
64
},
73
-
Required: []string{"is_timer"},
74
65
}
75
66
// This registration is for old watch apps that don't support named alarms. The anticapability prevents it
76
67
// from being seen by newer apps.
77
68
registerFunction(Registration{
78
69
Definition: genai.FunctionDeclaration{
79
70
Name: "set_alarm",
80
-
Description: "Get or set an alarm or a timer for a given time.",
Description: "Only if explicitly specified by the user, the name of the alarm or timer. Use title case. If the user didn't ask to name the timer, just leave it empty.",
84
+
Description: "Only if explicitly specified by the user, the name of the alarm. Use title case. If the user didn't ask to name the alarm, just leave it empty.",
94
85
Nullable: true,
95
86
}
96
87
// This registration is for new watch apps that support named alarms. The capability prevents the option for
97
88
// naming being presented to the model for older apps.
98
89
registerFunction(Registration{
99
90
Definition: genai.FunctionDeclaration{
100
91
Name: "set_alarm",
101
-
Description: "Get or set an alarm or a timer for a given time.",
92
+
Description: "Set an alarm for a given time.",
102
93
Parameters: ¶msWithNames,
103
94
},
104
95
Cb: alarmImpl,
@@ -110,65 +101,142 @@ func init() {
110
101
registerFunction(Registration{
111
102
Definition: genai.FunctionDeclaration{
112
103
Name: "get_alarms",
113
-
Description: "Get any existing alarms or timers. **There is no get_timers, call this with is_timer=true instead.**",
104
+
Description: "Get any existing alarms.",
105
+
},
106
+
Aliases: []string{"get_alarm"},
107
+
Cb: getAlarmImpl,
108
+
Thought: getAlarmThought,
109
+
InputType: Empty{},
110
+
})
111
+
112
+
registerFunction(Registration{
113
+
Definition: genai.FunctionDeclaration{
114
+
Name: "delete_alarm",
115
+
Description: "Delete a specific alarm by its expiration time.",
114
116
Parameters: &genai.Schema{
115
117
Type: genai.TypeObject,
116
118
Nullable: false,
117
119
Properties: map[string]*genai.Schema{
118
-
"is_timer": {
119
-
Type: genai.TypeBoolean,
120
-
Description: "True if retrieving timers, false if returning alarms.",
120
+
"time": {
121
+
Type: genai.TypeString,
122
+
Description: "The time of the alarm to delete in ISO 8601 format, e.g. '2023-07-12T00:00:00-07:00'.",
Description: "Only if explicitly specified by the user, the name of the timer. Use title case. If the user didn't ask to name the timer, just leave it empty.",
162
+
Nullable: true,
163
+
}
164
+
registerFunction(Registration{
165
+
Definition: genai.FunctionDeclaration{
166
+
Name: "set_timer",
167
+
Description: "Set a timer for a given time.",
168
+
Parameters: &timerParamsWithNames,
169
+
},
170
+
Cb: timerImpl,
171
+
Thought: timerThought,
172
+
InputType: TimerInput{},
173
+
Capability: "named_alarms",
131
174
})
132
175
133
176
registerFunction(Registration{
134
177
Definition: genai.FunctionDeclaration{
135
-
Name: "delete_alarm",
136
-
Description: "Delete a specific alarm or timer by its expiration time. When deleting a timer, you must call get_alarm first to get the expiration time (calculating it from the chat history will only be approximate)",
178
+
Name: "get_timers",
179
+
Description: "Get any existing timers.",
180
+
},
181
+
Aliases: []string{"get_timer"},
182
+
Cb: getTimerImpl,
183
+
Thought: getTimerThought,
184
+
InputType: Empty{},
185
+
})
186
+
187
+
registerFunction(Registration{
188
+
Definition: genai.FunctionDeclaration{
189
+
Name: "delete_timer",
190
+
Description: "Delete a specific timer by its expiration time.",
137
191
Parameters: &genai.Schema{
138
192
Type: genai.TypeObject,
139
193
Nullable: false,
140
194
Properties: map[string]*genai.Schema{
141
195
"time": {
142
196
Type: genai.TypeString,
143
-
Description: "The time of the alarm or timer to delete in ISO 8601 format, e.g. '2023-07-12T00:00:00-07:00'.",
144
-
Nullable: false,
145
-
},
146
-
"is_timer": {
147
-
Type: genai.TypeBoolean,
148
-
Description: "True if deleting a timer, false if deleting an alarm.",
197
+
Description: "The time of the alarm to delete in ISO 8601 format, e.g. '2023-07-12T00:00:00-07:00'.",
"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. "+
120
120
"**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. "+
121
121
"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. "+
122
-
"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_alarm'). If the user asks about a specific timer, respond only about that one. "+
122
+
"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. "+
123
123
"Your responses will be displayed on a very small screen, so be brief. Do not use markdown in your responses.\n"+
124
124
//"If asked to perform a calculation, YOU MUST ALWAYS respond with the answer. The user cannot see the results of calling functions automatically.\n" +
0 commit comments