pub struct RouterConfig {
pub strategy: RouterStrategyConfig,
pub thompson_state_path: Option<String>,
pub cascade: Option<CascadeConfig>,
pub reputation: Option<ReputationConfig>,
pub bandit: Option<BanditConfig>,
pub quality_gate: Option<f32>,
pub asi: Option<AsiConfig>,
pub embed_concurrency: usize,
}Expand description
Routing configuration for multi-provider setups.
Fields§
§strategy: RouterStrategyConfigRouting strategy: "ema" (default), "thompson", "cascade", or "bandit".
thompson_state_path: Option<String>Path for persisting Thompson Sampling state. Defaults to ~/.zeph/router_thompson_state.json.
§Security
This path is user-controlled. The application writes and reads a JSON file at
this location. Ensure the path is within a directory that is not world-writable
(e.g., avoid /tmp). The file is created with mode 0o600 on Unix.
cascade: Option<CascadeConfig>Cascade routing configuration. Only used when strategy = "cascade".
reputation: Option<ReputationConfig>Bayesian reputation scoring configuration (RAPS). Disabled by default.
bandit: Option<BanditConfig>PILOT bandit routing configuration. Only used when strategy = "bandit".
quality_gate: Option<f32>Embedding-based quality gate threshold for Thompson/EMA routing. Default: disabled.
When set, after provider selection, the cosine similarity between the query embedding and the response embedding is computed. If below this threshold, the next provider in the ordered list is tried. On exhaustion, the best response seen is returned.
Only applies to Thompson and EMA strategies. Cascade uses its own quality classifier. Fail-open: embedding errors disable the gate for that request.
asi: Option<AsiConfig>Agent Stability Index configuration. Disabled by default.
embed_concurrency: usizeMaximum number of concurrent embed_batch calls through the router.
Limits simultaneous embedding HTTP requests to prevent provider rate-limiting and memory pressure during indexing or high-frequency recall. Default: 4. Set to 0 to disable the semaphore (unlimited concurrency).
Trait Implementations§
Source§impl Clone for RouterConfig
impl Clone for RouterConfig
Source§fn clone(&self) -> RouterConfig
fn clone(&self) -> RouterConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouterConfig
impl Debug for RouterConfig
Source§impl<'de> Deserialize<'de> for RouterConfig
impl<'de> Deserialize<'de> for RouterConfig
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 RouterConfig
impl RefUnwindSafe for RouterConfig
impl Send for RouterConfig
impl Sync for RouterConfig
impl Unpin for RouterConfig
impl UnsafeUnpin for RouterConfig
impl UnwindSafe for RouterConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request