From 8c82762b6260dd68d84d19a14fd10400d8943283 Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Mon, 19 Aug 2024 14:28:28 -0700 Subject: [PATCH] revert and fix mem0 memories addition --- apps/cf-ai-backend/src/queueConsumer/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/cf-ai-backend/src/queueConsumer/index.ts b/apps/cf-ai-backend/src/queueConsumer/index.ts index b6338a1a..fec5260f 100644 --- a/apps/cf-ai-backend/src/queueConsumer/index.ts +++ b/apps/cf-ai-backend/src/queueConsumer/index.ts @@ -200,6 +200,12 @@ export async function queue( //add to mem0, abstract + const includeMessages = { + note: "information of this user based on the provided note.", + tweet: "interests of this user based on a twitter post they are saving.", + page: "interests of this user based on a web page they are saving.", + }; + const mem0Response = fetch("https://api.mem0.ai/v1/memories/", { method: "POST", headers: { @@ -209,7 +215,7 @@ export async function queue( body: JSON.stringify({ messages: [ { - role: "system", + role: "user", content: `Extract information about the user based on this saved content provided, remember that the date was ${new Date().toUTCString()} in utc time zone`, }, { @@ -217,6 +223,7 @@ export async function queue( content: vectorData.replace(/.*?<\/raw>/g, ""), }, ], + includes: includeMessages[type], user_id: body.user, }), });