GenerationSettings class

Controls the sampling behaviour during text generation.

All fields have sensible defaults suitable for conversational use.

const settings = GenerationSettings(
  temperature: 0.8,
  maxTokens: 256,
);
Parameter Default Description
temperature 0.7 Randomness — higher = more creative.
topK 40 Keep only the top‑K most probable tokens.
topP 0.9 Nucleus sampling probability threshold.
maxTokens 128 Maximum number of tokens to generate.
repeatPenalty 1.1 Penalise recently generated tokens.

Constructors

GenerationSettings({double temperature = 0.7, int topK = 40, double topP = 0.9, int maxTokens = 128, double repeatPenalty = 1.1})
Creates generation settings. All parameters are optional and fall back to conservative defaults.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
maxTokens int
Maximum number of tokens the model will generate per call.
final
repeatPenalty double
Penalises tokens that have already appeared, reducing repetition. 1.0 = no penalty.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
temperature double
Controls randomness. 0.0 = deterministic, > 1.0 = very creative.
final
topK int
Limits sampling to the top‑K most likely next tokens.
final
topP double
Nucleus sampling: only tokens whose cumulative probability exceeds topP are considered.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
Serialises the settings to a Map for the platform channel.
toString() String
A string representation of this object.
inherited

Operators

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