pub struct DefaultRoutingEngine { /* private fields */ }Expand description
Default implementation of the routing engine
Implementations§
Source§impl DefaultRoutingEngine
impl DefaultRoutingEngine
Sourcepub async fn new(
config: RoutingConfig,
model_catalog: ModelCatalog,
model_logger: Option<Arc<ModelLogger>>,
) -> Result<Self, RoutingError>
pub async fn new( config: RoutingConfig, model_catalog: ModelCatalog, model_logger: Option<Arc<ModelLogger>>, ) -> Result<Self, RoutingError>
Create a new routing engine with the given configuration
Sourcepub async fn new_with_confidence_monitor(
config: RoutingConfig,
model_catalog: ModelCatalog,
model_logger: Option<Arc<ModelLogger>>,
confidence_monitor: Box<dyn ConfidenceMonitorTrait>,
) -> Result<Self, RoutingError>
pub async fn new_with_confidence_monitor( config: RoutingConfig, model_catalog: ModelCatalog, model_logger: Option<Arc<ModelLogger>>, confidence_monitor: Box<dyn ConfidenceMonitorTrait>, ) -> Result<Self, RoutingError>
Create a new routing engine with a custom confidence monitor implementation This allows enterprise builds to inject their own confidence monitor
Trait Implementations§
Source§impl RoutingEngine for DefaultRoutingEngine
impl RoutingEngine for DefaultRoutingEngine
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,
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,
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>
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,
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,
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
Auto Trait Implementations§
impl Freeze for DefaultRoutingEngine
impl !RefUnwindSafe for DefaultRoutingEngine
impl Send for DefaultRoutingEngine
impl Sync for DefaultRoutingEngine
impl Unpin for DefaultRoutingEngine
impl !UnwindSafe for DefaultRoutingEngine
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