Header menu logo Nao

CompletionChunk Type

One incremental piece of a streamed completion. A provider that supports streaming emits a sequence of these as the model generates: non-terminal chunks carry a text `Delta`, and the terminal chunk reports how generation finished plus token usage when the backend provides it.

Record fields

Record Field Description

Delta

Full Usage: Delta

Field type: string

Text produced since the previous chunk ("" for a terminal/usage-only chunk).

Field type: string

FinishReason

Full Usage: FinishReason

Field type: string option

Why generation stopped; set only on the terminal chunk (e.g. "stop", "length").

Field type: string option

TokensUsed

Full Usage: TokensUsed

Field type: int option

Total tokens used; set only on the terminal chunk when the provider reports it.

Field type: int option

Type something to start searching.