FinishReason enum

Why the model stopped generating a message.

Surfaced on the terminal stream event so the UI can react (for example, announcing the final text to assistive technologies once generation is complete).

Inheritance
Available extensions

Values

stop → const FinishReason

The model emitted a natural stopping point or a stop sequence.

const FinishReason('stop')
length → const FinishReason

Generation was truncated by the maximum output token limit.

const FinishReason('length')
toolCalls → const FinishReason

The model paused to call one or more tools.

const FinishReason('tool-calls')
contentFilter → const FinishReason

Output was withheld or truncated by a content filter.

const FinishReason('content-filter')
error → const FinishReason

Generation ended because of an error.

const FinishReason('error')

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
wireName String
The stable string used on the wire and in JSON.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
The wire representation of this reason.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromJson(String value) FinishReason
Parses a wireName into its FinishReason.

Constants

values → const List<FinishReason>
A constant List of the values in this enum, in order of their declaration.