useObject
A composable function provided by the AI SDK for Vue, used to consume streaming structured objects returned by a model within a component. It exposes reactive state such as loading, object, and error.
Timeline (last 90 days)
useObject usually initiates the request after the component is mounted; if the headers depend on reactive values that are only available at runtime (such as a token obtained after login), you should ensure these values are ready before the call, otherwise even if the headers are passed correctly, authentication failure may occur because an empty value is obtained.
If you use @ai-sdk/vue's useObject and the case involves passing custom authentication headers, constructing request headers via a Headers instance, or relying on the backend to do routing or rate limiting based on specific headers, it is recommended to upgrade to 2.0.275.
AI SDK's useObject is the core Hook that Vue developers use to stream-generate structured objects.
useObject is a composable that internally uses reactive primitives such as ref, shallowRef, and watch to expose generation state (such as object, isLoading, error) and allows the caller to interrupt the streaming request via stop().
useChat targets message-streaming conversation scenarios, where the output is usually text or a message array appended character by character; useObject targets streaming generation of structured objects, relying on streamObject underneath, which progressively parses the model output according to a JSON Schema into a continuously completed JavaScript object.
The issue fixed by @ai-sdk/[email protected] is: when developers pass request headers in the form of a Headers instance, the useObject request cannot correctly preserve these headers.
The article recommends that developers who are using useObject to build Vue AI applications upgrade to 3.0.305, and focus on verifying two types of scenarios: state consistency when quickly aborting a request and whether custom request headers are received correctly.
Version 3.0.305 fixes the issue where the useObject composable fails to correctly cancel the submission when it is aborted before the request starts, corresponding to commit fac482b.
Version 3.0.305 fixes the issue where useObject fails to preserve custom headers when handling request headers passed in the form of a Headers instance, corresponding to commit 2479c33.
useObject is one of the core composables provided by @ai-sdk/vue, used to initiate streaming object generation requests in Vue components, outputting structured objects according to a JSON Schema.
7 more timeline events
All Facts (17)
Version 3.0.305 fixes the issue where the useObject composable fails to correctly cancel the submission when it is aborted before the request starts, corresponding to commit fac482b.
50%UnverifiedVersion 3.0.305 fixes the issue where useObject fails to preserve custom headers when handling request headers passed in the form of a Headers instance, corresponding to commit 2479c33.
50%UnverifieduseObject relies on AbortController to manage the request lifecycle.
50%UnverifiedThe object returned by useObject is a reactive ref that updates continuously with the streaming data; submit(input) triggers the request; stop() actively aborts the current stream.
50%UnverifieduseObject is one of the core composables provided by @ai-sdk/vue, used to initiate streaming object generation requests in Vue components, outputting structured objects according to a JSON Schema.
50%UnverifiedThe article recommends that developers who are using useObject to build Vue AI applications upgrade to 3.0.305, and focus on verifying two types of scenarios: state consistency when quickly aborting a request and whether custom request headers are received correctly.
50%UnverifiedAI SDK's useObject is the core Hook that Vue developers use to stream-generate structured objects.
50%UnverifiedThe issue fixed by @ai-sdk/[email protected] is: when developers pass request headers in the form of a Headers instance, the useObject request cannot correctly preserve these headers.
50%UnverifieduseChat targets message-streaming conversation scenarios, where the output is usually text or a message array appended character by character; useObject targets streaming generation of structured objects, relying on streamObject underneath, which progressively parses the model output according to a JSON Schema into a continuously completed JavaScript object.
50%UnverifieduseObject is a composable that internally uses reactive primitives such as ref, shallowRef, and watch to expose generation state (such as object, isLoading, error) and allows the caller to interrupt the streaming request via stop().
50%UnverifiedIf you use @ai-sdk/vue's useObject and the case involves passing custom authentication headers, constructing request headers via a Headers instance, or relying on the backend to do routing or rate limiting based on specific headers, it is recommended to upgrade to 2.0.275.
50%UnverifieduseObject usually initiates the request after the component is mounted; if the headers depend on reactive values that are only available at runtime (such as a token obtained after login), you should ensure these values are ready before the call, otherwise even if the headers are passed correctly, authentication failure may occur because an empty value is obtained.
50%Unverified4.0.138 版本修复了 useObject 请求中 Headers 实例形式请求头丢失的问题(commit 1b5fd20),修复后普通对象和 Headers 实例两种形式都能被正确保留并透传。
50%Unverified使用 useObject 实现流式对象生成的开发者建议升级到 4.0.138,尤其是存在取消不生效或使用 Headers 实例传参的情况。
50%Unverified4.0.138 版本修复了 useObject 中『请求尚未开始时的取消失效』问题(commit 7ff6a15),即当提交在请求真正发出前被停止时取消逻辑没有正确生效。
50%UnverifieduseObject 是 AI SDK 为 Vue 提供的组合式函数(Composable),用于在组件中消费模型返回的流式结构化对象,内部维护持续的流式响应通道,并暴露 loading、object、error 等响应式状态。
50%UnverifieduseObject supports real-time parsing of structured JSON objects from model output.
50%