ModelConfig class

Configuration options passed to OnDeviceAi.loadModel.

All fields have sensible defaults and can be omitted for most use cases.

Example:

await ai.loadModel(
  'sentiment_analysis.tflite',
  config: ModelConfig(useGPU: false),
);

Constructors

ModelConfig({int maxTokens = 256, double temperature = 0.7, bool useGPU = true})
Creates a ModelConfig with the given options.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
maxTokens int
The maximum number of output tokens to generate.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
temperature double
The sampling temperature for generative models.
final
useGPU bool
Whether to attempt to delegate inference to the GPU or Neural Engine.
final

Methods

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

Operators

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