memory metadata
I've got a setup where I'm doing conversation agents with different personalities. The user can switch personalities mid conversation. I'm wondering, is there a way to persist this information with the memory on messages so that I can display the personalilty name and maybe an avatar? I can't find any documentation (please point me there if there is some) on how to add metadata to messages and then use it with AI SDK useChat.
Thanks!
5 Replies
Hi @rogueturnip ! You currently cannot attach metadata to a message, however, you can attache metadata to a thread, see this message https://discord.com/channels/1309558646228779139/1428396355180695572/1428510155221368924
Thanks @Romain I'm[ not sure if this will solve my needs. I'm actually using a single thread as a personal assitant type setup that the user can change their personality
slight follow up. is it possible to know which agent placed something in memory?
Actually, I think the metadata at the message level is actually possible I just forgot... BUT, it's currently buggy, you can watch this GH issue for updates https://github.com/mastra-ai/mastra/issues/8938
GitHub
[BUG] Custom metadata no longer being returned on UIMessages · Iss...
Describe the Bug Custom metadata is not being returned for messages on latest version. Loading threads now returns [messages, uiMessages, legacyMessages]. The UI messages no longer contain the cust...
As for your other question, you cannot know at the moment which agent inserted the message into memory, but, it's something you should be able to do using the metadata (once they work again...)
Wonderful! I was curious cause I was debugging and I see in the client side the meta data there
Bug looks exactly like what I'm wondering.. but do you konw how to actually add the custom metadata? I don't see that in the bug directions.