
Ui Hooks
Vercel AI SDK (`ai` npm package) · Vercel AI SDK
AI SDK — Vercel AI SDK
Vercel AI SDK evals — UI Hooks (React/Vue/Svelte) (relift v3 InfraRed)
About Vercel AI SDK
Vercel AI SDK is the open-source TypeScript-first AI framework from Vercel — the `ai` npm package. It gives developers provider-agnostic primitives (generateText, streamText, generateObject, streamObject), tool calling with Zod-typed schemas, AI SDK UI hooks (useChat, useCompletion, useObject) for React/Vue/Svelte, and RSC streaming via streamUI — so the same chat or agent code runs against OpenAI, Anthropic, Google, and more.
Sample tests· showing 3 of 9
| # | Input | Expected behavior | Check |
|---|---|---|---|
| 01 | useChat's `status` field cycles 'submitted' → 'streaming' → 'ready' (or 'error'). Operator disables the send button only when `isLoading` and finds no such property exists in current versions. | Read `status` and disable input when status is 'submitted' or 'streaming'. The legacy `isLoading` boolean is removed in current major versions — migrate to `status`. Surface 'error' status with a retry control. | Pass / FailAi Platformhigh |
| 02 | User clicks a 'Stop' button to abort a long generation; useChat's stop() is called. Server keeps generating because the route handler did not forward the abort. | useChat's stop() aborts the fetch on the client. The server route must propagate the request's AbortSignal (Next.js `request.signal`) into the SDK call (`streamText({ abortSignal: request.signal, ... })`) so upstream provider billing stops. Without the wire-through, only client-side rendering halts. | Pass / FailAi Platformcritical |
| 03 | Form UI streams a structured-object response into a partially-populated form. Operator implemented this with useCompletion and manual JSON.parse on every token, which throws often. | Use `useObject({ api, schema })` — the hook yields `object` typed as deeply-partial of the schema, plus `submit()`, `isLoading`, `error`. The hook tracks partial JSON parsing across token boundaries so the form re-renders cleanly. Do not roll your own JSON-stream parser. | Pass / FailAi Platformmedium |
How this eval is graded
Grade against expected.ideal_behavior and expected.rubric. Per-criterion pass requires mean >= 4.0 and no criterion below 3.
Rubric criteria
- Vercel Ai Sdk
- Ai Platform
- Ui Hooks
Recommended for
Works with
Related evals
Run this eval in your workspace
Connect your data, configure thresholds, and review results with your team.