pub struct RouterEngine { /* private fields */ }Expand description
Client-side router engine that wraps the core routing engine
Implementations§
Source§impl RouterEngine
impl RouterEngine
Sourcepub async fn new() -> Self
pub async fn new() -> Self
Create a new router engine with default configuration and all built-in strategies
Sourcepub async fn with_limits(limits: GlobalLimits) -> Self
pub async fn with_limits(limits: GlobalLimits) -> Self
Create a new router engine with custom global limits
Sourcepub async fn load_deployments(&self, deployments: Vec<Deployment>)
pub async fn load_deployments(&self, deployments: Vec<Deployment>)
Load deployments into the routing pool
Sourcepub async fn rebuild_pool(&self, deployments: Vec<Deployment>)
pub async fn rebuild_pool(&self, deployments: Vec<Deployment>)
Rebuild the deployment pool with a fresh set
Sourcepub async fn select_deployment(
&self,
request: &ChatRequest,
) -> Result<RoutingResult, RoutingError>
pub async fn select_deployment( &self, request: &ChatRequest, ) -> Result<RoutingResult, RoutingError>
Select a deployment for a request using routing strategies
Sourcepub async fn record_success(
&self,
deployment_id: &str,
latency_ms: f64,
tokens: u64,
)
pub async fn record_success( &self, deployment_id: &str, latency_ms: f64, tokens: u64, )
Record a successful request for metrics
Sourcepub async fn record_failure(&self, deployment_id: &str)
pub async fn record_failure(&self, deployment_id: &str)
Record a failed request for metrics
Sourcepub fn inner(&self) -> &Arc<HyperInferRouterEngine> ⓘ
pub fn inner(&self) -> &Arc<HyperInferRouterEngine> ⓘ
Get the inner router engine (for advanced use)
Auto Trait Implementations§
impl !RefUnwindSafe for RouterEngine
impl !UnwindSafe for RouterEngine
impl Freeze for RouterEngine
impl Send for RouterEngine
impl Sync for RouterEngine
impl Unpin for RouterEngine
impl UnsafeUnpin for RouterEngine
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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