Skip to content

Conversation

@marcelklehr
Copy link
Member

No description provided.


if (isset($input['memories']) && is_array($input['memories']) && count($input['memories'])) {
/** @psalm-suppress InvalidArgument */
$systemPrompt .= "\n\nYou can remember things from other conversation with the user. If they are relevant, take into account the following memories:\n" . implode("\n\n", $input['memories']) . "\n\nDo not mention these memories explicitly. You may use them as context, but do not repeat them. At most, you can mention that you remember something.";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$systemPrompt .= "\n\nYou can remember things from other conversation with the user. If they are relevant, take into account the following memories:\n" . implode("\n\n", $input['memories']) . "\n\nDo not mention these memories explicitly. You may use them as context, but do not repeat them. At most, you can mention that you remember something.";
$systemPrompt .= "\n\nYou can remember things from other conversations with the user. If they are relevant, take into account the following memories:\n" . implode("\n\n", $input['memories']) . "\n\nDo not mention these memories explicitly. You may use them as context, but do not repeat them. At most, you can mention that you remember something.";

You can remember things kind of means if you want, then remember things now. How about something like You have memories of other conversations with the user?

Copy link
Member Author

Choose a reason for hiding this comment

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

You can remember things kind of means if you want, then remember things now

That is on purpose, because the llm needs to be aware that it can remember things from the current conversation as well. Ie. if the user asks "Can you remember this conversation?" the LLM needs to respond "Yes, I can." -- in my tests it said stuff like e.g. "I cannot remember this interaction in other conversations but I will keep this in mind for the current conversation."

Copy link
Contributor

@kyteinsky kyteinsky Dec 11, 2025

Choose a reason for hiding this comment

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

That is on purpose, because the llm needs to be aware that it can remember things from the current conversation as well
"I cannot remember this interaction in other conversations but I will keep this in mind for the current conversation."

the memories would be summaries of other conversations, no? I suppose this instruction of being aware that it can store any memories would be more needed in cases where it needs to do a tool call to store a particular memory.

nevermind

to inform the llm that it can remember things

Signed-off-by: Marcel Klehr <[email protected]>
@marcelklehr marcelklehr merged commit ead039b into main Dec 11, 2025
26 checks passed
@marcelklehr marcelklehr deleted the feat/memories branch December 11, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants