Do you recommend streamUI or the streamobject, streamtext, etc #2162
-
Is it recommended to use streamUI or the streamobject, streamtext, etc? I see there are a lot more changes being applied to streamObject and streamText so I was curious if there was a recommendation of which to use. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
It depends on what you're trying to do.
StreamUI is a bit different, as it allows you to stream back full UI components, but depending on your use case you can handle this yourself too after streaming back the "object". There's a lot of good examples in the documentation. 👍 |
Beta Was this translation helpful? Give feedback.
-
I am also facing an issue related to stream object and streamUI. Can u pls have a look at my open discussion here https://github.com/vercel/ai/discussions/2153 |
Beta Was this translation helpful? Give feedback.
-
When you use RSC (React Server Actions), then you'd go for streamUI. If you use client-side hooks, you'd use streamText + useChat or streamObject + useObject. |
Beta Was this translation helpful? Give feedback.
-
We have added a guide for deciding between AI SDK RSC and AI SDK UI: https://sdk.vercel.ai/docs/getting-started/navigating-the-library |
Beta Was this translation helpful? Give feedback.
We have added a guide for deciding between AI SDK RSC and AI SDK UI: https://sdk.vercel.ai/docs/getting-started/navigating-the-library