useCompletion
A composable API provided by the Vercel AI SDK in its Vue adapter package, used to implement AI generation features such as text completion within Vue components. It internally maintains reactive variables such as loading state and error information.
Core Facts
The core composables useChat and useCompletion in @ai-sdk/vue are designed following the React version's useChat hook to ensure cross-framework API consistency.
useChat is designed for multi-turn conversation scenarios and maintains a message history list, while useCompletion is suited for single-pass text completion scenarios; both expose an error state field.
useCompletion is suitable for single-turn text completion scenarios.
Timeline (last 90 days)
The Vue binding layer typically exposes composables such as useChat and useCompletion, internally converting the ReadableStream returned by the core package into Vue's ref/computed state.
When upgrading @ai-sdk/vue, it is necessary to verify whether the API signatures, return value structures, and streaming behavior of composables such as useChat and useCompletion remain compatible with changes in the core package.
useChat and useCompletion encapsulate streaming communication with the backend API, loading states, and retry logic.
The useChat and useCompletion provided by @ai-sdk/vue internally maintain reactive variables such as the message list, loading state, and error information, and expose methods such as sendMessage and stop.
Both useChat and useCompletion are designed based on Vue's reactivity system, so developers do not need to manually handle the parsing of SSE or ReadableStream.
Both useChat and useCompletion rely on the streaming parsing capabilities provided by the underlying ai core package.
@ai-sdk/vue provides developers with capabilities such as streaming conversation, tool calling, and structured output in the form of composables (e.g., useChat, useCompletion).
@ai-sdk/vue abstracts the underlying Server-Sent Events or ReadableStream into reactive state through Vue 3 composition functions such as useChat and useCompletion.
Both useChat and useCompletion support specifying a custom backend route via the api parameter, where the backend calls the model provider API, thereby avoiding exposure of keys on the frontend.
The core capabilities of @ai-sdk/vue are exposed in the form of Vue Composables, such as hooks like useChat and useCompletion, which are functionally symmetric with @ai-sdk/react.
16 more timeline events
All Facts (20)
The core composables useChat and useCompletion in @ai-sdk/vue are designed following the React version's useChat hook to ensure cross-framework API consistency.
90%VerifieduseChat is designed for multi-turn conversation scenarios and maintains a message history list, while useCompletion is suited for single-pass text completion scenarios; both expose an error state field.
90%VerifieduseCompletion is suitable for single-turn text completion scenarios.
85%Verified@ai-sdk/vue provides composable functions such as useChat and useCompletion for Vue development.
85%Verified@ai-sdk/vue provides developers with capabilities such as streaming conversation, tool calling, and structured output in the form of composables (e.g., useChat, useCompletion).
75%VerifiedThe core capabilities of @ai-sdk/vue are exposed in the form of Vue Composables, such as hooks like useChat and useCompletion, which are functionally symmetric with @ai-sdk/react.
75%Verified@ai-sdk/vue encapsulates SDK capabilities as Composition API hooks that conform to Vue's usage conventions, providing hooks such as useChat and useCompletion.
75%UnverifieduseChat and useCompletion are the two core composable APIs provided by @ai-sdk/vue.
70%UnverifiedBoth useChat and useCompletion implement streaming output based on the Web Streams API.
70%UnverifiedThe Vue binding layer typically exposes composables such as useChat and useCompletion, internally converting the ReadableStream returned by the core package into Vue's ref/computed state.
50%UnverifiedWhen upgrading @ai-sdk/vue, it is necessary to verify whether the API signatures, return value structures, and streaming behavior of composables such as useChat and useCompletion remain compatible with changes in the core package.
50%UnverifieduseChat and useCompletion encapsulate streaming communication with the backend API, loading states, and retry logic.
50%UnverifiedThe useChat and useCompletion provided by @ai-sdk/vue internally maintain reactive variables such as the message list, loading state, and error information, and expose methods such as sendMessage and stop.
50%UnverifiedBoth useChat and useCompletion are designed based on Vue's reactivity system, so developers do not need to manually handle the parsing of SSE or ReadableStream.
50%UnverifiedBoth useChat and useCompletion rely on the streaming parsing capabilities provided by the underlying ai core package.
50%Unverified@ai-sdk/vue abstracts the underlying Server-Sent Events or ReadableStream into reactive state through Vue 3 composition functions such as useChat and useCompletion.
50%UnverifiedBoth useChat and useCompletion support specifying a custom backend route via the api parameter, where the backend calls the model provider API, thereby avoiding exposure of keys on the frontend.
50%UnverifiedBoth useChat and useCompletion abstract the consumption logic of Server-Sent Events (SSE) and are deeply integrated with Next.js's Route Handlers or Edge Functions.
50%Unverified@ai-sdk/react is the official adapter package for the React ecosystem, encapsulating Hooks such as useChat and useCompletion.
50%UnverifiedBoth useChat and useCompletion are built on Vue 3's Composition API and can be called directly within <script setup>.
50%