pub struct FallbackConfig { /* private fields */ }Expand description
Fallback configuration
Manages fallback mappings for different error types. Each model can have different fallback models configured for different scenarios.
§Thread Safety
Uses RwLock to allow concurrent reads and exclusive writes.
Implementations§
Source§impl FallbackConfig
impl FallbackConfig
Sourcepub fn add_general(self, model: &str, fallbacks: Vec<String>) -> Self
pub fn add_general(self, model: &str, fallbacks: Vec<String>) -> Self
Add general fallback models for a model (builder pattern)
General fallbacks are used when no specific fallback type matches the error.
§Panics
Panics if the internal lock is poisoned (indicates a bug in the calling code).
Sourcepub fn add_context_window(self, model: &str, fallbacks: Vec<String>) -> Self
pub fn add_context_window(self, model: &str, fallbacks: Vec<String>) -> Self
Add context window fallback models for a model (builder pattern)
Context window fallbacks are used when the input exceeds the model’s maximum context length.
§Panics
Panics if the internal lock is poisoned (indicates a bug in the calling code).
Sourcepub fn add_content_policy(self, model: &str, fallbacks: Vec<String>) -> Self
pub fn add_content_policy(self, model: &str, fallbacks: Vec<String>) -> Self
Add content policy fallback models for a model (builder pattern)
Content policy fallbacks are used when content is filtered or rejected by safety systems.
§Panics
Panics if the internal lock is poisoned (indicates a bug in the calling code).
Sourcepub fn add_rate_limit(self, model: &str, fallbacks: Vec<String>) -> Self
pub fn add_rate_limit(self, model: &str, fallbacks: Vec<String>) -> Self
Add rate limit fallback models for a model (builder pattern)
Rate limit fallbacks are used when the model’s rate limit is exceeded.
§Panics
Panics if the internal lock is poisoned (indicates a bug in the calling code).
Sourcepub fn get_fallbacks_for_type(
&self,
model_name: &str,
fallback_type: FallbackType,
) -> Vec<String>
pub fn get_fallbacks_for_type( &self, model_name: &str, fallback_type: FallbackType, ) -> Vec<String>
Get fallback models for a specific type
Returns a cloned vector of fallback model names. Returns empty vector if no fallbacks are configured for the given model and type.
§Panics
Panics if the internal lock is poisoned (indicates a bug in the calling code).
Trait Implementations§
Source§impl Debug for FallbackConfig
impl Debug for FallbackConfig
Source§impl Default for FallbackConfig
impl Default for FallbackConfig
Source§fn default() -> FallbackConfig
fn default() -> FallbackConfig
Auto Trait Implementations§
impl !Freeze for FallbackConfig
impl RefUnwindSafe for FallbackConfig
impl Send for FallbackConfig
impl Sync for FallbackConfig
impl Unpin for FallbackConfig
impl UnwindSafe for FallbackConfig
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
Source§impl<T> BudgetAwareRouting for T
impl<T> BudgetAwareRouting for T
Source§fn filter_by_budget(
&self,
providers: Vec<String>,
budget_router: &BudgetAwareRouter,
) -> Vec<String>
fn filter_by_budget( &self, providers: Vec<String>, budget_router: &BudgetAwareRouter, ) -> Vec<String>
Source§impl<T> Injectable for T
impl<T> Injectable for T
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>
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>
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