ai.stream.TurnDone

The provider's explicit end-of-turn marker — the decoded form of `[DONE]`, `response.completed`, `message_stop`, a chunk with `finishReason`, …

Reference version

Signature

class ai.stream.TurnDone

The provider's explicit end-of-turn marker — the decoded form of [DONE], response.completed, message_stop, a chunk with finishReason, …

A decoder for a protocol that HAS such a marker must yield TurnDone when it sees it AND its from_sse call must pass require_terminal (see the termination contract at the top of this file); the stream then reports a connection that closed early as a failure instead of a complete turn. For a protocol with no terminal marker, TurnDone is optional and a socket close still completes the turn.

Source:<builtin>/ai/ns_stream/stream.bamlbytes 49064924