pub struct ProviderConfig {
pub provider: String,
pub api_key: Option<String>,
pub model: String,
pub base_url: Option<String>,
pub timeout: Option<Duration>,
pub extra: HashMap<String, Value>,
}Expand description
Configuration for building a provider from the registry.
This struct contains common configuration fields that work across
all providers. Provider-specific options go in the extra map.
Fields§
§provider: StringProvider name (e.g., “anthropic”, “openai”, “ollama”).
api_key: Option<String>API key for authenticated providers.
model: StringModel identifier (e.g., “claude-sonnet-4-20250514”, “gpt-4o”).
base_url: Option<String>Custom base URL for the API endpoint.
timeout: Option<Duration>Request timeout.
extra: HashMap<String, Value>Provider-specific configuration options.
Use this for options that don’t fit the common fields above. Each provider documents which keys it recognizes.
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn new(provider: impl Into<String>, model: impl Into<String>) -> Self
pub fn new(provider: impl Into<String>, model: impl Into<String>) -> Self
Creates a new config with the given provider and model.
Sourcepub fn extra(self, key: impl Into<String>, value: impl Into<Value>) -> Self
pub fn extra(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Adds a provider-specific extra option.
Sourcepub fn get_extra_str(&self, key: &str) -> Option<&str>
pub fn get_extra_str(&self, key: &str) -> Option<&str>
Gets a string value from extra options.
Sourcepub fn get_extra_bool(&self, key: &str) -> Option<bool>
pub fn get_extra_bool(&self, key: &str) -> Option<bool>
Gets a bool value from extra options.
Sourcepub fn get_extra_i64(&self, key: &str) -> Option<i64>
pub fn get_extra_i64(&self, key: &str) -> Option<i64>
Gets an integer value from extra options.
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 Default for ProviderConfig
impl Default for ProviderConfig
Source§fn default() -> ProviderConfig
fn default() -> ProviderConfig
Returns the “default value” for a type. 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