pub struct CostOptimizationExample;Expand description
Example: Cost Optimization
This example demonstrates various cost optimization strategies including model tier selection, caching, batching, and cost tracking.
Implementations§
Source§impl CostOptimizationExample
impl CostOptimizationExample
Sourcepub async fn model_tier_selection() -> Result<()>
pub async fn model_tier_selection() -> Result<()>
Model tier selection strategies
Sourcepub async fn complexity_based_routing(
openai_key: &str,
anthropic_key: &str,
) -> Result<()>
pub async fn complexity_based_routing( openai_key: &str, anthropic_key: &str, ) -> Result<()>
Task complexity-based routing
Sourcepub async fn caching_example(_api_key: &str) -> Result<()>
pub async fn caching_example(_api_key: &str) -> Result<()>
Response caching implementation
Sourcepub async fn batching_example(_api_key: &str) -> Result<()>
pub async fn batching_example(_api_key: &str) -> Result<()>
Request batching techniques
Sourcepub async fn cost_tracking_example() -> Result<()>
pub async fn cost_tracking_example() -> Result<()>
Cost tracking and monitoring
Sourcepub async fn cost_optimization_case_study() -> Result<()>
pub async fn cost_optimization_case_study() -> Result<()>
Complete cost optimization case study
Auto Trait Implementations§
impl Freeze for CostOptimizationExample
impl RefUnwindSafe for CostOptimizationExample
impl Send for CostOptimizationExample
impl Sync for CostOptimizationExample
impl Unpin for CostOptimizationExample
impl UnwindSafe for CostOptimizationExample
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