beginnerChatOptions, Response Types & Streaming

Why use streaming (`Flux<String>`) instead of a single blocking call for a chat response?

A full LLM response can take several seconds to generate; streaming sends tokens to the client as they're produced, so the UI can render them progressively (like ChatGPT's typing effect) instead of showing a blank screen until the entire response is ready — this dramatically improves perceived latency even though total generation time is unchanged.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to How does Spring AI's structured output converter get an LLM (which only produces text) to return valid JSON matching a Java class?← Back to all Spring AI questions