pub struct Routing {
pub free_first: bool,
pub policy: HashMap<String, String>,
pub on_budget: String,
pub auto_discover: bool,
pub preferred_provider: Option<String>,
pub preferred_model: Option<String>,
pub routing_mode: String,
}Fields§
§free_first: bool§policy: HashMap<String, String>§on_budget: String§auto_discover: boolWhen true, automatically scan /v1/models on every provider as soon as an API key is stored, and cache the results for 24h. Defaults to true.
preferred_provider: Option<String>Pin ALL routing tiers to a single provider. When set, this overrides
every entry in policy (but still respects capability hard constraints
like vision/tools). Set via sparrow route set <provider> or directly
in config.yaml under routing.preferred_provider.
preferred_model: Option<String>Pin ALL routing tiers to a single MODEL. When set with routing_mode=manual,
Sparrow uses exactly this model (e.g. "deepseek-v4-pro") and never falls
back. Set via sparrow route model <model>.
routing_mode: StringRouting mode: "auto" (tier-based policy + free_first) or "manual"
(always use preferred_provider or the model the user picked, never
auto-fallback). Set via sparrow route manual.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Routing
impl<'de> Deserialize<'de> for Routing
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Routing
impl RefUnwindSafe for Routing
impl Send for Routing
impl Sync for Routing
impl Unpin for Routing
impl UnsafeUnpin for Routing
impl UnwindSafe for Routing
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more