pub struct CostOptimizedStrategy {
pub model_provider_pricing: HashMap<String, HashMap<String, f64>>,
pub required_vision: bool,
pub required_tools: bool,
}Expand description
A cost-optimized routing strategy that selects the cheapest qualifying model_provider from the route table based on per-provider pricing maps.
Pricing is keyed by model_provider name (the alias under
[model_providers.<model_provider>.<alias>]); each model_provider’s pricing map
holds user-defined keys (model identifiers, optionally suffixed with
.input / .output) mapped to USD-per-1M-token rates.
Fields§
§model_provider_pricing: HashMap<String, HashMap<String, f64>>Per-provider pricing data (model_provider name → user-keyed pricing map).
required_vision: boolWhether the request requires vision support.
required_tools: boolWhether the request requires native tool support.
Implementations§
Source§impl CostOptimizedStrategy
impl CostOptimizedStrategy
Sourcepub fn new(
model_provider_pricing: HashMap<String, HashMap<String, f64>>,
) -> Self
pub fn new( model_provider_pricing: HashMap<String, HashMap<String, f64>>, ) -> Self
Create a new cost-optimized strategy with the given per-provider pricing data.
Sourcepub fn with_vision(self, required: bool) -> Self
pub fn with_vision(self, required: bool) -> Self
Set whether vision support is required.
Sourcepub fn with_tools(self, required: bool) -> Self
pub fn with_tools(self, required: bool) -> Self
Set whether native tool support is required.
Trait Implementations§
Source§impl Clone for CostOptimizedStrategy
impl Clone for CostOptimizedStrategy
Source§fn clone(&self) -> CostOptimizedStrategy
fn clone(&self) -> CostOptimizedStrategy
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 moreAuto Trait Implementations§
impl Freeze for CostOptimizedStrategy
impl RefUnwindSafe for CostOptimizedStrategy
impl Send for CostOptimizedStrategy
impl Sync for CostOptimizedStrategy
impl Unpin for CostOptimizedStrategy
impl UnsafeUnpin for CostOptimizedStrategy
impl UnwindSafe for CostOptimizedStrategy
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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