ai.stream.TurnStream$stream

The raw text-delta stream of ONE model turn. Pull-based: nothing is read from the wire until `next()` or `final_turn()` is called.

Reference version

Signature

class ai.stream.TurnStream$stream

The raw text-delta stream of ONE model turn. Pull-based: nothing is read from the wire until next() or final_turn() is called.

next() yields DELTA chunks (each item is only the newly arrived text, never the accumulated prefix) and returns Done when the turn is over. final_turn() drains the rest of the stream and returns the completed turn: the accumulated text as one Text block, the folded stop_reason, and usage where the wire provided token counts.

Source:<builtin>/ai/ns_stream/stream.bamlbytes 0–0

Fields

_sse

baml.http.SseStream$stream | null

_decode

unknown | null

_chunks

string[]

_cursor

int | null

_pcursor

int | null

_text

string | null

_input_tokens

int | null

_output_tokens

int | null

_done

bool | null

_require_terminal

string | null

_saw_terminal

bool | null

_call_started

baml.time.Instant$stream | null

_ttft_from

baml.time.Instant$stream | null

_capture_sse

bool | null