M
MastraAI3d ago
awy

Conversation history without user messages

Recently, i've faced an issue where the list of messages that were pased to the AI model consists of only assistant messages + the last message from a user. Thus, AI looses the context as there are no previous user-related messages in the conversation history. I am using the upstash storage (all user messages successfully stored to the database - I've verified that). I've attached screenshots from langfuse: the first one is the current state where only the last question is related to the user. On. the second screenshot is the expected history, which includes user-related messages.
No description
No description
3 Replies
Mastra Triager
GitHub
[DISCORD:1429476174068842546] Conversation history without user mes...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1429476174068842546 Recently, i've faced an issue where the list of messages that were pased to the AI...
awy
awyOP2d ago
upd. After further investigation, it seems that messages returned from Upstash are not sorted properly. After increasing the lastMessages property to 50, some user messages were included in the list (not all of them, but some are now visible).
const memory = new Memory({
storage: upstashStorage,
options: {
lastMessages: 50,
workingMemory: {
enabled: true,
scope: "thread",
schema: workingMemorySchema,
},
},
});
const memory = new Memory({
storage: upstashStorage,
options: {
lastMessages: 50,
workingMemory: {
enabled: true,
scope: "thread",
schema: workingMemorySchema,
},
},
});
_roamin_
_roamin_19h ago
Thanks @awy for the addtional info, I added it to the GH issue mentioned above 😉

Did you find this page helpful?