An AI product team is using the Vercel AI SDK's useChat hook to build a chat interface. They want to display a typing indicator while the assistant is generating a response and hide it once streaming is complete. Which property of the useChat hook should they use to drive this behavior?
- A.
streamStatus— it exposes'streaming','idle', and'error'states that can be used directly. - B.
messages[messages.length - 1].isStreaming— each message object tracks its own streaming status. - C.
isLoading— it istruewhile a request is in-flight or streaming, and returns tofalsewhen the stream ends.✓ Correct - D.
isPending— it transitions totrueafter the first token arrives and remainstrueuntil the full response is committed.
Explanation
useChat exposes an isLoading boolean that is true from the moment a request is submitted until the streaming response is fully received, making it the correct property to show/hide a typing indicator. B is wrong — isPending is not a property exposed by the Vercel AI SDK's useChat hook. C is wrong — there is no streamStatus property in the useChat API. D is wrong — individual message objects in the useChat messages array do not carry an isStreaming field; streaming state is tracked at the hook level.