How to extend message with custom attributes for AI SDK UI? #3284
Unanswered
Godrules500
asked this question in
Help
Replies: 1 comment 13 replies
-
Would https://sdk.vercel.ai/docs/ai-sdk-ui/streaming-data be an option? |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
With RSC I was able to extend messages to add any attribute that I wanted this
messages[index].feedback= true
Now that I'm switching to ai sdk ui, how do I handle the same thing? I see data and annotations, but I remove the typescript benefits by doing messages[index].data = {feedback:true}. I could mispell it, or put a string instead of a boolean and etc.
So what is the best way to extend it so that I can add custom attributes to the message property for it to go back and forth with the api calls?
I get I could do something like this and set sendExtraMessageFields to true, but I was curious if there was an easier or better way.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions