vercel / ai

Build AI-powered applications with React, Svelte, Vue, and Solid
https://sdk.vercel.ai/docs
Other
9.41k stars 1.38k forks source link

add output config option to useObject #2895

Open nicoalbanese opened 1 week ago

nicoalbanese commented 1 week ago

Feature Description

When using the new array streaming (output: "array") feature with streamObject, users can't use the same schema between the useObject and streamObject functions. Currently, users have to wrap their schema in a z.array(). Suggestion to add equivalent output config option to useObject so that schemas can be shared.

Use Case

Streaming structured objects with the new array output option

Additional context

No response

glamboyosa commented 1 week ago

hi there @lgrammel. I'm interested in contributing to this issue, is it open to external contributors? if so I'd be happy to take a crack at it. could you provide any specific guidelines or context I should be aware of before starting. thanks 😄

lgrammel commented 1 week ago

@glamboyosa this issue is fairly complex, requires knowledge on how streamText is implemented as well as potential data transfer protocol changes, and is time critical. I'm planning to work on it myself.

glamboyosa commented 1 week ago

fair enough @lgrammel.