pub struct ModelRouter { /* private fields */ }Available on crate feature
agent only.Expand description
Smart router for selecting optimal models.
Analyzes tasks and routes them to the most appropriate model based on complexity, cost, and latency requirements.
Implementations§
Source§impl ModelRouter
impl ModelRouter
Sourcepub fn new() -> ModelRouter
pub fn new() -> ModelRouter
Create a new router with default settings.
Sourcepub fn with_policy(policy: ModelPolicy) -> ModelRouter
pub fn with_policy(policy: ModelPolicy) -> ModelRouter
Create with custom policy.
Sourcepub fn with_thresholds(self, medium: usize, large: usize) -> ModelRouter
pub fn with_thresholds(self, medium: usize, large: usize) -> ModelRouter
Set token thresholds.
Sourcepub fn policy(&self) -> &ModelPolicy
pub fn policy(&self) -> &ModelPolicy
Get a reference to the underlying policy.
Sourcepub fn enabled(self, enabled: bool) -> ModelRouter
pub fn enabled(self, enabled: bool) -> ModelRouter
Enable or disable smart routing.
Sourcepub fn route(&self, task: &TaskAnalysis) -> RoutingDecision
pub fn route(&self, task: &TaskAnalysis) -> RoutingDecision
Route a task to the optimal model.
Returns the recommended model name.
Sourcepub fn route_simple(&self, prompt: &str) -> RoutingDecision
pub fn route_simple(&self, prompt: &str) -> RoutingDecision
Quickly route a simple prompt.
Trait Implementations§
Source§impl Clone for ModelRouter
impl Clone for ModelRouter
Source§fn clone(&self) -> ModelRouter
fn clone(&self) -> ModelRouter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelRouter
impl Debug for ModelRouter
Source§impl Default for ModelRouter
impl Default for ModelRouter
Source§fn default() -> ModelRouter
fn default() -> ModelRouter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModelRouter
impl RefUnwindSafe for ModelRouter
impl Send for ModelRouter
impl Sync for ModelRouter
impl Unpin for ModelRouter
impl UnsafeUnpin for ModelRouter
impl UnwindSafe for ModelRouter
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> 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>
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