Add toDataStreamResponse for streamobject
Feature Description
Hi,
Can you please add toDataStreamResponse for streamobject to get it to work in useChat with streamprotocol data.
Otherwise can you show a workarround?
the UseObject is not convenient because I can't change dynamically the schema.
And as a workarround possibly I could switch based on the needs on: streamprotocol text which works and then switch to data. But for now I can't switch dynamically.
PS: I use svelte.
Use Cases
No response
Additional context
No response
Can you tell me more about your use case?
One option could be to use streamText with structured outputs: https://sdk.vercel.ai/docs/ai-sdk-core/generating-structured-data#structured-outputs-with-generatetext-and-streamtext
I would like to propose to user to choose structured output or normal chat response within the same usechat.
I have been able to fix it by forking the project in svelte and switch dynamically between streammode text or data.
And it works well. Now streamobject and streamtext works well in usechat
This would be great