Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include top 5 reflection memories in converse() function #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Aug 16, 2023

Description

This PR addresses the issue #5 by modifying the converse() function in conversation.ts to include the top 5 reflection memories in the chat prompt. Currently, the function only fetches conversation memories and does not consider reflection memories. This update ensures that the chat prompt includes relevant reflection memories, providing a more contextually aware conversation experience.

Summary of Changes

  • Imported the filterMemoriesType function from ./lib/memory in conversation.ts.
  • Added a new line in the converse() function to fetch the top 5 reflection memories using filterMemoriesType() with 'reflection' as the memory type.
  • Modified the prefixPrompt variable to include the reflectionMemories in the chat prompt.
  • Updated the prefixPrompt to include the descriptions of the relevant reflection memories.
  • Created a new branch fix-converse-function for these changes.

Fixes #5.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/fix-converse-function

To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.

@sweep-ai sweep-ai bot added the sweep Assigns Sweep to an issue or pull request. label Aug 16, 2023
: '';
const relevantMemories: string = conversationMemories
.slice(0, 2) // only use the first 2 memories
const relevantReflections: string = reflectionMemories
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do .slice(0.5) on this object instead.

@@ -147,6 +143,7 @@ export async function converse(
prefixPrompt += `Last time you chatted with some of ${nearbyPlayersNames} it was ${lastConversationTs}. It's now ${Date.now()}. You can cut this conversation short if you talked to this group of people within the last day. \n}`;

prefixPrompt += `Below are relevant memories to this conversation you are having right now: ${relevantMemories}\n`;
prefixPrompt += `Below are your recent reflections: ${relevantReflections}\n`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: When calling converse(), use the top 5 reflection memories
1 participant