pub struct CapabilityRouter { /* private fields */ }Expand description
A capability-aware router that selects backends based on task requirements.
Scores each available backend on a weighted combination of cost and latency, with optional requirement filters (e.g., must support multi-turn).
Implementations§
Source§impl CapabilityRouter
impl CapabilityRouter
Sourcepub fn require_multi_turn(self, require: bool) -> Self
pub fn require_multi_turn(self, require: bool) -> Self
Only route to backends that support multi-turn conversations.
Sourcepub fn cost_weight(self, weight: f32) -> Self
pub fn cost_weight(self, weight: f32) -> Self
Set the cost vs latency weight (0.0 = pure latency, 1.0 = pure cost).
Sourcepub fn with_capability(
self,
backend: BackendType,
cap: BackendCapability,
) -> Self
pub fn with_capability( self, backend: BackendType, cap: BackendCapability, ) -> Self
Override capability data for a backend.
Trait Implementations§
Source§impl BackendRouter for CapabilityRouter
impl BackendRouter for CapabilityRouter
Source§fn route<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_config: &'life1 SpawnConfig,
available: &'life2 [BackendType],
) -> Pin<Box<dyn Future<Output = Option<BackendType>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn route<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_config: &'life1 SpawnConfig,
available: &'life2 [BackendType],
) -> Pin<Box<dyn Future<Output = Option<BackendType>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Choose the optimal backend for the given config. Read more
Source§impl Debug for CapabilityRouter
impl Debug for CapabilityRouter
Auto Trait Implementations§
impl Freeze for CapabilityRouter
impl RefUnwindSafe for CapabilityRouter
impl Send for CapabilityRouter
impl Sync for CapabilityRouter
impl Unpin for CapabilityRouter
impl UnwindSafe for CapabilityRouter
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
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>
Converts
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>
Converts
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