ModelSwapInjector class
Simulates model corruption or swapping to a degraded model version.
Each call to inject reduces the model quality by qualityDegradation. Once quality drops below qualityThreshold, the model is marked as degraded. The injector also applies random noise to outputs to simulate corruption.
- Implemented types
Constructors
- ModelSwapInjector({required AIModelAdapter model, double initialQuality = 1.0, double qualityDegradation = 0.1, double qualityThreshold = 0.3})
- Creates a ModelSwapInjector.
Properties
- currentQuality → double
-
Current quality level (0.0 to 1.0).
no setter
- description → String
-
Detailed description of what this injector simulates.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialQuality → double
-
Initial quality (0.0 to 1.0).
final
- injectionCount → int
-
Number of injections applied.
no setter
- isDegraded → bool
-
Whether the model is degraded.
no setter
- model → AIModelAdapter
-
The model adapter to stress.
final
- name → String
-
Short human-readable name shown in reports and logs.
no setteroverride
- qualityDegradation → double
-
Quality degradation per injection (0.0 to 1.0).
final
-
qualityHistory
→ List<
double> -
History of quality values.
no setter
- qualityThreshold → double
-
Quality threshold below which the model is degraded (0.0 to 1.0).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → FaultType
-
The FaultType category this injector belongs to.
no setteroverride
Methods
-
getStatus(
) → String - Convenience method to get the status as a readable string.
-
inject(
) → Future< void> -
Activate the fault.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → Future< void> -
Deactivate the fault and restore normal conditions.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited