Streaming
LangBot Day 7: Streaming Output — Token-by-Token Responses
reading time: 20 minutes
Recap: On Day 6, LangBot gained output parsers and now responds in two modes — chat mode returns typed LangBotResponse objects with mood and confidence, and list mode returns clean list[str] via CommaSeparatedListOutputParser. Both modes use .invoke(), which means the entire response arrives at once after the model finishes generating. Today we fix that — LangBot learns to type its replies one token at a time.
The problem: waiting for the whole answer
Every interaction so far has the same rhythm: