pub enum RoutingStrategy {
Fallback,
RoundRobin,
LeastLatency,
LowestCost,
InputDirected(Arc<dyn Fn(&str) -> usize + Send + Sync>),
}Expand description
Strategy for selecting which model a RouterLLM tries first.
Regardless of strategy, a failed model triggers fallback to the next candidate in the derived order until one succeeds or all fail.
Variants§
Fallback
Always try models in registration order (primary-first). Use with
RouterLLM::with_fallbacks for classic primary + backups semantics.
RoundRobin
Rotate the starting index across calls so traffic spreads evenly.
LeastLatency
Prefer the model with the lowest recent latency (exponential moving average updated after each call).
LowestCost
Prefer the model with the lowest configured cost.
InputDirected(Arc<dyn Fn(&str) -> usize + Send + Sync>)
Pick the primary index from a user-supplied closure over the input text; remaining models are tried in registration order as fallback.
Auto Trait Implementations§
impl !RefUnwindSafe for RoutingStrategy
impl !UnwindSafe for RoutingStrategy
impl Freeze for RoutingStrategy
impl Send for RoutingStrategy
impl Sync for RoutingStrategy
impl Unpin for RoutingStrategy
impl UnsafeUnpin for RoutingStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more