Streaming responsesadvanced
Waiting for a whole AI answer before showing anything feels broken; streaming sends each token as it arrives, which is why every chat UI types at you.
Paint tokens as they arrive, and make a second question cancel the first. This is the whole difference between an AI feature that feels fast and one that feels broken.
See alsoAI Streaming EndpointThe same streaming concept, graded in a second track.
Text appears within a second and keeps growing; asking again mid-answer replaces it cleanly.
Published in full, before you start — every point is one of these and there is nothing else.
Waiting for a whole AI answer before showing anything feels broken; streaming sends each token as it arrives, which is why every chat UI types at you.
Every await can reject; modelling idle, loading, success and error explicitly is what stops a slow network showing a blank screen with no explanation.
Network calls fail. Code that assumes they succeed turns a slow connection into a blank screen with no explanation.
A proxy in front of a paid API needs a rate limit or one user can spend your whole budget, and a cancellation token so a closed browser tab stops the work.