]> git.giacomolli.uk - onechat/blobdiff - prompt.go
Keep the connection of a new WhatsApp link
[onechat] / prompt.go
index 8bd96911aef70364b58dfbef8c97d92b9d6fe5b3..8210575e99ce2e4db0926cacc6075fa5e322ce6a 100644 (file)
--- a/prompt.go
+++ b/prompt.go
@@ -185,8 +185,9 @@ func promptSubagent(name, instructions string) string {
 }
 
 // promptTools returns the function tools of every call of the agent: the tools
-// of promptSubagentTools, then spawn. A compaction sends them too and never
-// calls them, because a change of the tools ends the shared prompt cache.
+// of promptSubagentTools, then spawn, tell, and the WhatsApp tools. A
+// compaction sends them too and never calls them, because a change of the tools
+// ends the shared prompt cache.
 func promptTools() []ModelTool {
        return append(promptSubagentTools(), ModelTool{
                Type:        "function",
@@ -205,6 +206,33 @@ func promptTools() []ModelTool {
                        },
                }),
                Strict: true,
+       }, ModelTool{
+               Type:        "function",
+               Name:        "tell",
+               Description: `Send a message to a subagent, by name. One at work reads it between its tool calls, and its report answers it; a finished one goes on from its chat, and its reply reaches you as a message "[Name] reply".`,
+               Parameters: promptObjectSchema(map[string]any{
+                       "name":    promptStringSchema("The name of the subagent."),
+                       "message": promptStringSchema("The message."),
+               }),
+               Strict: true,
+       }, ModelTool{
+               Type:        "function",
+               Name:        "whatsapp_find",
+               Description: "Find the WhatsApp contacts and groups of the user whose name contains the text, with no regard to case and accents. Gives up to 20 matches, each as ID | name | contact or group. Give the ID to whatsapp_send.",
+               Parameters: promptObjectSchema(map[string]any{
+                       "name": promptStringSchema("A part of the name of the contact or the group."),
+               }),
+               Strict: true,
+       }, ModelTool{
+               Type:        "function",
+               Name:        "whatsapp_send",
+               Description: "Send a text message to a WhatsApp chat. Send only a message that the user asked you to send, to the chat that the user named. Give a new id for each message: a call with an id that was used gives the answer of the first call and sends nothing.",
+               Parameters: promptObjectSchema(map[string]any{
+                       "id":   promptStringSchema("A new id for this message, such as a short random word."),
+                       "chat": promptStringSchema("The ID of the chat, from whatsapp_find or from a [WhatsApp] message."),
+                       "text": promptStringSchema("The text of the message."),
+               }),
+               Strict: true,
        })
 }