[KongchangAI]
ConceptuseObject composable

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)

Oct 13

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.

Unverified50%
Oct 13

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.

Unverified50%
Oct 13

AI SDK's useObject is the core Hook that Vue developers use to stream-generate structured objects.

Unverified50%
Oct 13

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().

Unverified50%
Oct 13

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.

Unverified50%
Oct 13

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.

Unverified50%
Oct 13

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.

Unverified50%
Oct 13

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.

Unverified50%
Oct 13

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.

Unverified50%
Oct 13

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.

Unverified50%

7 more timeline events

All Facts (17)

Unverified

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%
Unverified

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.

50%
Unverified

useObject relies on AbortController to manage the request lifecycle.

50%
Unverified

The 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%
Unverified

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.

50%
Unverified

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.

50%
Unverified

AI SDK's useObject is the core Hook that Vue developers use to stream-generate structured objects.

50%
Unverified

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.

50%
Unverified

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.

50%
Unverified

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().

50%
Unverified

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.

50%
Unverified

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.

50%
Unverified

4.0.138 版本修复了 useObject 请求中 Headers 实例形式请求头丢失的问题(commit 1b5fd20),修复后普通对象和 Headers 实例两种形式都能被正确保留并透传。

50%
Unverified

使用 useObject 实现流式对象生成的开发者建议升级到 4.0.138,尤其是存在取消不生效或使用 Headers 实例传参的情况。

50%
Unverified

4.0.138 版本修复了 useObject 中『请求尚未开始时的取消失效』问题(commit 7ff6a15),即当提交在请求真正发出前被停止时取消逻辑没有正确生效。

50%
Unverified

useObject 是 AI SDK 为 Vue 提供的组合式函数(Composable),用于在组件中消费模型返回的流式结构化对象,内部维护持续的流式响应通道,并暴露 loading、object、error 等响应式状态。

50%
Unverified

useObject supports real-time parsing of structured JSON objects from model output.

50%

Source Articles