RuntimeConfig class
Runtime config for building a model — the per-call params getActiveModel
collects, kept as a small holder so the provider contract stays stable as
params evolve.
Constructors
-
RuntimeConfig({required int maxTokens, required String modelPath, String? tokenizerPath, PreferredBackend? preferredBackend, PreferredBackend? preferredVisionBackend, PreferredBackend? preferredAudioBackend, bool supportImage = false, bool supportAudio = false, int? maxNumImages, bool? enableSpeculativeDecoding, int? maxConcurrentSessions, List<
int> ? loraRanks, Map<String, String> ? artifactPaths, String? language}) -
const
Properties
-
artifactPaths
→ Map<
String, String> ? -
filename → on-disk path for a multi-file model bundle (TTS). The bundle
backend resolves each graph/dictionary/embedding file by name from this
map. Null for single-file models (inference/embedding/STT).
final
- enableSpeculativeDecoding → bool?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- language → String?
-
TTS-only (Qwen3): the language to condition generation on — one of
flutter_gemma_speech'sqwen3SupportedLanguages, or'auto'. Null for non-TTS models, and for TTS models with no language parameter (e.g. Matcha, whose locale comes from itsTtsModelProfile.localeinstead) — the TTS backend defaults a null value to'english'. Not validated here; the TTS backend rejects an unsupported value withArgumentErrorbefore loading the model.final -
loraRanks
→ List<
int> ? -
LoRA ranks for the MediaPipe path; null falls back to the platform's
supportedLoraRanks. Carried in the config so the (cached) default-engine build closure reads it per call instead of capturing a stale local.final - maxConcurrentSessions → int?
-
final
- maxNumImages → int?
-
final
- maxTokens → int
-
final
- modelPath → String
-
Resolved on-disk path to the model file. Core's platform
createModelpreamble resolves it from the active spec via the model manager and passes it here so the engine package never touches core's file-path resolution.final - preferredAudioBackend → PreferredBackend?
-
Backend for the AUDIO encoder, independent of preferredBackend. Null
defaults to CPU in the LiteRT-LM engine as a conservative default — but,
unlike the vision encoder, the audio encoder runs fine on GPU and is often
faster there (Gemma 3n audio is ~2× CPU on Metal), so set it to
PreferredBackend.gpufor speed. Ignored by MediaPipe.final - preferredBackend → PreferredBackend?
-
final
- preferredVisionBackend → PreferredBackend?
-
Backend for the VISION encoder, independent of preferredBackend (the
text/decoder backend). Null defaults to CPU in the LiteRT-LM engine,
because the vision encoder's
STABLEHLO_COMPOSITEops fail to prepare on the Metal/WebGPU delegates (LiteRT-LM#2461). Set it (e.g. toPreferredBackend.gpu) only for a model whose vision section bakes a gpu-onlybackend_constraint. Ignored by the MediaPipe engine (whole-model backend, no per-encoder split).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportAudio → bool
-
final
- supportImage → bool
-
final
- tokenizerPath → String?
-
Resolved on-disk path to the tokenizer. Used by embedding and STT
backends; null for inference. The spec carries source identities
(network/asset/file); core
resolves them to on-disk paths via the model manager and passes the
resolved tokenizer path here (install-vs-runtime separation).
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited