Migrating Messages to AI SDK v5 UIMessage Format #7988
Unanswered
khanhduyvt0101
asked this question in
Help
Replies: 1 comment
-
Same issue here, any update on this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
After upgrading to AI SDK v5, I need to migrate existing chat messages in PostgreSQL. My messages currently have both old format fields (
content
,annotations
) and newparts
array, but tool invocations still use the oldstate: "result"
instead of v5's 4-state system. I also store messages in jsonb type.Current Message Format (Mixed)
Target AI SDK v5 Format
Questions
Best migration approach for ~500k messages?
result
→output-available
)?Should I remove legacy fields (
content
,annotations
) or keep for backward compatibility?How to handle tool invocations that might fail during migration?
Looking for advice on:
Thanks! 🙏
Beta Was this translation helpful? Give feedback.
All reactions