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, MultimodalOrder? multimodalOrder, bool? enableSpeculativeDecoding, ActivationDataType? activationDataType, int? maxConcurrentSessions, List<
int> ? loraRanks, Map<String, String> ? artifactPaths, String? language}) -
const
Properties
- activationDataType → ActivationDataType?
-
Activation type for the native LiteRT-LM engine's text decoder. Null
leaves it to the model file (except a
ModelType.functionGemmabundle that declares noprefer_activation_type, which gets float32 on its GPU attempt); when set, it overrides LiteRT-LM's own choice (float16 on GPU by default). Set ActivationDataType.float32 when a GPU writes wrong digits (LiteRT-LM#2814, #3012). The vision and audio encoders keep the model's own type; MediaPipe, ONNX, built-in AI and the web engines ignore it.final -
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?
-
The output language, for the two model kinds that have one. Null
everywhere else, and null means "the backend's own default".
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 - multimodalOrder → MultimodalOrder?
-
The order of a user message's images, audio and text. Core always sets
it:
getActiveModelresolves an omitted one with MultimodalOrder.forModelType, and a null in a config built by hand means the same. Honored by the native LiteRT-LM engine; the other engines ignore it (MediaPipe sends images, audio, then text).final - preferredAudioBackend → PreferredBackend?
-
Backend for the AUDIO encoder, independent of preferredBackend. Null
lets the engine choose, as for preferredVisionBackend, and the native
LiteRT-LM engine reports it in
InferenceModel.activeAudioBackend. Set one only where the section allows it: the published Gemma 4 and Gemma 3n audio encoders declarebackend_constraintcpu, soPreferredBackend.gpuis refused for them (readLiteRtLmBundleInfo(path).audioEncoder?.backendConstraintshows it). Ignored by MediaPipe.final - preferredBackend → PreferredBackend?
-
final
- preferredVisionBackend → PreferredBackend?
-
Backend for the VISION encoder, independent of preferredBackend (the
text/decoder backend). Null lets the engine choose: the native LiteRT-LM
engine follows the bundle — the encoder's declared
backend_constraint(the CPU when that allows it), else the NPU it is compiled for, else the CPU, because the vision encoder'sSTABLEHLO_COMPOSITEops fail to prepare on the Metal/WebGPU delegates (LiteRT-LM#2461) — and reports its choice inInferenceModel.activeVisionBackend. Set one only where the section allows it (readLiteRtLmBundleInfo(path).visionEncoderinflutter_edge_ai_litertlmshows itsbackend_constraint); a backend it excludes is refused before the model loads. 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
-
Inference: whether the model is created with audio. Embedders: as
supportImage, for audio.
final
- supportImage → bool
-
Inference: whether the model is created with vision. Embedders: the
media the caller declared (
getActiveEmbedder(supportImage:)), widened by core to everything the cached embedder already served.final - tokenizerPath → String?
-
Resolved on-disk path to the tokenizer. Used by embedding and STT
backends; null for inference, and null for a self-contained embedder
(
EmbeddingModelSpec.isSelfContained, e.g. a.litertlmbundle that carries its own tokenizer). 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