pub struct ProviderConfig {
pub name: String,
pub api_key: String,
pub base_url: Option<String>,
pub timeout: Duration,
pub max_retries: u32,
pub retry_delay: Duration,
pub rate_limit: Option<RateLimit>,
pub model_mapping: HashMap<String, String>,
pub headers: HashMap<String, String>,
pub enabled: bool,
pub circuit_breaker: Option<CircuitBreakerConfig>,
}Expand description
Configuration for provider instances.
This struct contains all the configuration parameters needed to create and configure a provider instance.
§Examples
use ultrafast_models_sdk::providers::ProviderConfig;
use std::time::Duration;
let config = ProviderConfig::new("openai", "your-api-key")
.with_timeout(Duration::from_secs(30))
.with_max_retries(3)
.with_base_url("https://api.openai.com/v1".to_string());Fields§
§name: StringProvider name/identifier
api_key: StringAPI key for authentication
base_url: Option<String>Optional base URL for the provider API
timeout: DurationRequest timeout duration
max_retries: u32Maximum number of retry attempts
retry_delay: DurationDelay between retry attempts
rate_limit: Option<RateLimit>Optional rate limiting configuration
model_mapping: HashMap<String, String>Model name mappings (from client model names to provider model names)
headers: HashMap<String, String>Custom HTTP headers to include in requests
enabled: boolWhether this provider is enabled
circuit_breaker: Option<CircuitBreakerConfig>Optional circuit breaker configuration
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sourcepub fn with_rate_limit(self, rate_limit: RateLimit) -> Self
pub fn with_rate_limit(self, rate_limit: RateLimit) -> Self
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§fn clone(&self) -> ProviderConfig
fn clone(&self) -> ProviderConfig
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 ProviderConfig
impl Debug for ProviderConfig
Source§impl<'de> Deserialize<'de> for ProviderConfig
impl<'de> Deserialize<'de> for ProviderConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProviderConfig
impl RefUnwindSafe for ProviderConfig
impl Send for ProviderConfig
impl Sync for ProviderConfig
impl Unpin for ProviderConfig
impl UnwindSafe for ProviderConfig
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