From a88558cc3282496109503c419a4d0b93edfb8457 Mon Sep 17 00:00:00 2001 From: Raj Sharma Date: Thu, 10 Oct 2024 08:43:56 +0530 Subject: [PATCH] chore: updated system prompt for messaging --- assistant/system-prompts.ts | 2 +- tools/events.ts | 27 ++++++++++----------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/assistant/system-prompts.ts b/assistant/system-prompts.ts index 4be18d8..c5ab058 100644 --- a/assistant/system-prompts.ts +++ b/assistant/system-prompts.ts @@ -120,7 +120,7 @@ You: Request 'event_manager' the following: 'When i reach home, ask 'home_assist You: Request 'event_manager' the following: 'I leave home, ask 'home_assistant_manager' to turn off all the lights. Make this listener a recurring one, also as this is recurring and mundane it doesnt make sense to notify the user every time, so notify can be false.' - When I get a message on WhatsApp from Pooja, reply that I'm driving. -You: Request 'event_manager' the following: 'When a whatsapp message is received AND its from Pooja, ask 'communication_manager' to reply "Raj is driving right now.".' +You: Request 'event_manager' the following: 'When a whatsapp message is received AND its from Pooja, ask 'communication_manager' to message Pooja the following message: "Raj is driving right now.".' You can send these request directly to the event manager, you can add any more details if needed as you have more context about the user and conversation. diff --git a/tools/events.ts b/tools/events.ts index 1f8fb7d..0cbcf85 100644 --- a/tools/events.ts +++ b/tools/events.ts @@ -428,14 +428,6 @@ function registerListener(listener: EventListener) { otherContextData.type };base64,${Buffer.from(buffer).toString("base64")}`; - // Create the object with base64 URL - const imageObject = { - type: "image_url", - image_url: { - url: base64Url, - }, - }; - // Do something with imageObject, like sending it in a response or logging attached_image = base64Url; } else { @@ -447,7 +439,6 @@ function registerListener(listener: EventListener) { } console.log("Running ASK for event listener: ", listener.description); - console.log("Payload: ", payload); const system_prompts = is_voice ? await buildSystemPrompts(contextMessage) @@ -490,7 +481,7 @@ function registerListener(listener: EventListener) { - **Event ID:** ${eventId} - **Description:** ${description} - - **Payload:** ${JSON.stringify(payload, null, 2)} + - **Payload:** ${JSON.stringify(payload)} - **Will Auto Notify Creator of Listener:** ${notify ? "Yes" : "No"} - **Instruction:** ${listener.instruction} @@ -500,7 +491,7 @@ function registerListener(listener: EventListener) { **Action Required:** - - Follow the instruction provided. + - Follow the instruction provided in the payload. - Return the notification text based on the instruction. `; @@ -508,12 +499,12 @@ function registerListener(listener: EventListener) { The voice event that triggered this is: - Event ID: ${eventId} - - Description: ${description} - - Payload: ${JSON.stringify(payload, null, 2)} + - Listener Description: ${description} + - Payload: ${JSON.stringify(payload)} - Follow the transcript provided in the payload. + Do the instruction provided in the payload of the event listener. - You response must be in plain text without markdown or any other formatting. + Your response must be in plain text without markdown or any other formatting. `; if (system_prompts) { @@ -545,12 +536,14 @@ function registerListener(listener: EventListener) { } // Send a message to the user indicating the event was triggered - if (notify) + if (notify) { await contextMessage.send({ content, flags: is_voice ? [4096] : undefined, }); - else console.log("Silenced Notification: ", content); + } else { + console.log("Silenced Notification: ", content); + } // Handle auto-stop options if (options.autoStopAfterSingleEvent) {