pub struct ProviderManager { /* private fields */ }Expand description
Central coordinator for provider operations
Implementations§
Source§impl ProviderManager
impl ProviderManager
Sourcepub fn new(registry: ProviderRegistry, default_provider_id: String) -> Self
pub fn new(registry: ProviderRegistry, default_provider_id: String) -> Self
Create a new provider manager
Sourcepub fn with_retry_count(self, count: usize) -> Self
pub fn with_retry_count(self, count: usize) -> Self
Set the number of retries for failed requests
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the request timeout
Sourcepub fn with_health_check_cache(self, cache: Arc<HealthCheckCache>) -> Self
pub fn with_health_check_cache(self, cache: Arc<HealthCheckCache>) -> Self
Set the health check cache
Sourcepub fn default_provider(&self) -> Result<Arc<dyn Provider>, ProviderError>
pub fn default_provider(&self) -> Result<Arc<dyn Provider>, ProviderError>
Get the default provider
Sourcepub fn get_provider(
&self,
provider_id: &str,
) -> Result<Arc<dyn Provider>, ProviderError>
pub fn get_provider( &self, provider_id: &str, ) -> Result<Arc<dyn Provider>, ProviderError>
Get a specific provider
Sourcepub async fn chat(
&self,
request: ChatRequest,
) -> Result<ChatResponse, ProviderError>
pub async fn chat( &self, request: ChatRequest, ) -> Result<ChatResponse, ProviderError>
Send a chat request with retry logic
Sourcepub async fn chat_with_provider(
&self,
provider: &Arc<dyn Provider>,
request: ChatRequest,
) -> Result<ChatResponse, ProviderError>
pub async fn chat_with_provider( &self, provider: &Arc<dyn Provider>, request: ChatRequest, ) -> Result<ChatResponse, ProviderError>
Send a chat request to a specific provider with retry logic
Sourcepub async fn chat_stream(
&self,
request: ChatRequest,
) -> Result<ChatStream, ProviderError>
pub async fn chat_stream( &self, request: ChatRequest, ) -> Result<ChatStream, ProviderError>
Stream a chat response
Sourcepub async fn chat_stream_with_provider(
&self,
provider: &Arc<dyn Provider>,
request: ChatRequest,
) -> Result<ChatStream, ProviderError>
pub async fn chat_stream_with_provider( &self, provider: &Arc<dyn Provider>, request: ChatRequest, ) -> Result<ChatStream, ProviderError>
Stream a chat response from a specific provider
Sourcepub async fn health_check(
&self,
provider_id: &str,
) -> Result<bool, ProviderError>
pub async fn health_check( &self, provider_id: &str, ) -> Result<bool, ProviderError>
Check provider health with caching
Sourcepub async fn health_check_all(
&self,
) -> Vec<(String, Result<bool, ProviderError>)>
pub async fn health_check_all( &self, ) -> Vec<(String, Result<bool, ProviderError>)>
Check health of all providers with caching
Sourcepub async fn invalidate_health_check(&self, provider_id: &str)
pub async fn invalidate_health_check(&self, provider_id: &str)
Invalidate health check cache for a provider
Sourcepub async fn invalidate_all_health_checks(&self)
pub async fn invalidate_all_health_checks(&self)
Invalidate all health check cache
Sourcepub fn health_check_cache(&self) -> &Arc<HealthCheckCache>
pub fn health_check_cache(&self) -> &Arc<HealthCheckCache>
Get the health check cache
Sourcepub fn registry(&self) -> &ProviderRegistry
pub fn registry(&self) -> &ProviderRegistry
Get the registry
Sourcepub fn registry_mut(&mut self) -> &mut ProviderRegistry
pub fn registry_mut(&mut self) -> &mut ProviderRegistry
Get mutable registry
Auto Trait Implementations§
impl Freeze for ProviderManager
impl !RefUnwindSafe for ProviderManager
impl Send for ProviderManager
impl Sync for ProviderManager
impl Unpin for ProviderManager
impl !UnwindSafe for ProviderManager
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