genai.chat makes is streamed from
the vendor, on every dialect, and assembled into the same message a plain call returns. Streaming also keeps a long
answer from running into the vendor call’s read timeout while the model is still writing.
While a call streams, the text so far can be drawn by whoever follows the session. Those pushes are partial
messages. A partial message is sent to the connections following the session, is never stored, and is never on the
event stream. When the answer is complete, the stored thread item or
object event replaces it.
Partial messages
A partial message is apartial frame. It goes to each connection that follows the session with a matching listener
(see Following partial messages), for as long as the call streams.
Each entry of
blocks holds:
Deltas are coalesced: a frame is sent at most every 250 milliseconds, about four a second. A successful answer sends no
closing frame, because the stored item or object event replaces the partial message at once. A reader that wants the
complete text reads the stored item.
A partial message is sent only when the answer is written to a place a session follows: a session
thread or a session object. An answer written to an
execution-persisted output streams nothing, because nobody can follow it. A partial message never fails the call: a
connection that cannot be reached is skipped.
What is not streamed
Tool calls and images arrive with the final message. A partial message carries onlytext and reasoning blocks.
Stop
A streamed call checks for a stop every few seconds. When the execution is being stopped, the call is abandoned: it writes nothing, its partial message ends with a frame whosestate is aborted, and the component ends on its
failure route after posting this warning:
The execution is stopping: the answer was discarded and nothing was written.
A call that fails for any other reason after it sent a partial message also ends it with aborted.
Following partial messages
A connection listener withoutbatch receives the partial messages its
filter matches: one without a types clause receives them too, and
"partial" in a types list selects them. The aliases and executions filters select them as they select events.
A listener added with batch receives none.
event of a listener/event frame, as described on
Listener. It has no event id, so it never moves a follower’s stream
cursor, and no REST route returns one.
- A follower that joins while an answer is being written sees the rest of it.
- A reader that arrives afterwards sees only what was stored.
- A follower that drew a partial message replaces it when the item with its
item_idarrives, and drops it onaborted.
partial, its conversation widget draws
the partial message at the thread’s tail and replaces it with the stored item, and a message widget bound to the
output’s alias shows it while it is open. Ordinary reads, REST and the event stream’s listing, never return a partial
message.
