pub struct RoutingRule {
pub task: TaskClass,
pub model: String,
pub fallback: Option<Box<RoutingRule>>,
}Expand description
A routing rule: which model to use for a TaskClass, with an optional
fallback rule tried if the primary is unavailable.
The provider concept from clawdius was dropped from the core: a model key
is an opaque string that must match an entry in the pricing table (or be
estimated with placeholder pricing). Namespaced keys such as
openrouter/google/gemma-3-4b-it:free work fine.
Fields§
§task: TaskClassTask class this rule applies to.
model: StringModel key (e.g. "claude-sonnet-4-20250514").
fallback: Option<Box<RoutingRule>>Fallback rule tried if the primary model is unavailable.
Implementations§
Source§impl RoutingRule
impl RoutingRule
Sourcepub fn with_fallback(self, fallback: RoutingRule) -> Self
pub fn with_fallback(self, fallback: RoutingRule) -> Self
Attach a fallback rule (builder style).
Sourcepub fn chain(&self) -> impl Iterator<Item = &RoutingRule>
pub fn chain(&self) -> impl Iterator<Item = &RoutingRule>
Iterate this rule followed by its fallback chain, in order.
Trait Implementations§
Source§impl Clone for RoutingRule
impl Clone for RoutingRule
Source§impl Debug for RoutingRule
impl Debug for RoutingRule
impl Eq for RoutingRule
Source§impl PartialEq for RoutingRule
impl PartialEq for RoutingRule
impl StructuralPartialEq for RoutingRule
Auto Trait Implementations§
impl Freeze for RoutingRule
impl RefUnwindSafe for RoutingRule
impl Send for RoutingRule
impl Sync for RoutingRule
impl Unpin for RoutingRule
impl UnsafeUnpin for RoutingRule
impl UnwindSafe for RoutingRule
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