Skip to main content

RoutingEngine

Trait RoutingEngine 

Source
pub trait RoutingEngine: Send + Sync {
    // Required methods
    fn route_request<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 RoutingContext,
    ) -> Pin<Box<dyn Future<Output = Result<RouteDecision, RoutingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute_with_routing<'life0, 'async_trait>(
        &'life0 self,
        context: RoutingContext,
        request: ModelRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponse, RoutingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn validate_policies(&self) -> Result<(), RoutingError>;
    fn get_routing_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = RoutingStatistics> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_config<'life0, 'async_trait>(
        &'life0 self,
        config: RoutingConfig,
    ) -> Pin<Box<dyn Future<Output = Result<(), RoutingError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Core routing engine trait for SLM-first architecture

Required Methods§

Source

fn route_request<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 RoutingContext, ) -> Pin<Box<dyn Future<Output = Result<RouteDecision, RoutingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Route a model request based on configured policies

Source

fn execute_with_routing<'life0, 'async_trait>( &'life0 self, context: RoutingContext, request: ModelRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelResponse, RoutingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the routing decision and handle fallbacks

Source

fn validate_policies(&self) -> Result<(), RoutingError>

Validate routing policies

Source

fn get_routing_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RoutingStatistics> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get routing statistics

Source

fn update_config<'life0, 'async_trait>( &'life0 self, config: RoutingConfig, ) -> Pin<Box<dyn Future<Output = Result<(), RoutingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update routing configuration

Implementors§