ModelRolesRetryPolicy class final
Knobs for the rate-limit retry/fallback engine, mirroring omp's
non-compaction retry policy (retry.* settings).
Constructors
- ModelRolesRetryPolicy({int retriesPerEntry = 2, Duration baseDelay = const Duration(milliseconds: 500), Duration maxBackoff = const Duration(seconds: 8), Duration maxWait = const Duration(minutes: 5), Duration keyBackoff = const Duration(minutes: 1)})
-
Creates a retry policy; all values have omp-shaped defaults.
const
- ModelRolesRetryPolicy.fromYaml(YamlMap map)
-
Parses the optional
retry:yaml section.factory
Properties
- baseDelay → Duration
-
First backoff sleep between same-entry attempts (omp
retry.baseDelayMs).final - hashCode → int
-
The hash code for this object.
no setterinherited
- keyBackoff → Duration
-
How long a key (or chain entry) stays in backoff after a rate-limit
failure that carried no
Retry-Afterhint.final - maxBackoff → Duration
-
Cap on the exponential same-entry backoff (omp caps at 8000 ms).
final
- maxWait → Duration
-
Give-up threshold: a required sleep longer than this fails over to the
next chain entry instead of sleeping (omp
retry.maxDelayMs).final - retriesPerEntry → int
-
Same-model retries (with backoff) before the run falls to the next
chain entry. Key rotations do not consume this budget (omp switches
credentials for free before spending retries).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
backoffFor(
int attempt, double jitterFraction) → Duration -
Backoff before same-entry attempt
attempt(1-based): exponential from baseDelay, capped at maxBackoff, with 75–100% jitter (omp's Anthropic-style jitter so concurrent sessions do not retry in lockstep). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
toYaml(
) → String - Serializes to yaml (round-trips with ModelRolesRetryPolicy.fromYaml).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited