pub struct ProviderConfig {
pub provider_type: ProviderType,
pub base_url: String,
pub model: String,
pub api_key: Option<String>,
pub headers: HashMap<String, String>,
pub extra_params: HashMap<String, Value>,
}
Expand description
Universal provider configuration
Fields§
§provider_type: ProviderType
Type of provider
base_url: String
Base URL for the API
model: String
Model identifier
api_key: Option<String>
API key (if required)
headers: HashMap<String, String>
Additional headers
extra_params: HashMap<String, Value>
Provider-specific parameters
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn openai(model: &str, api_key: Option<String>) -> Self
pub fn openai(model: &str, api_key: Option<String>) -> Self
Create a new OpenAI provider config
Sourcepub fn azure_openai(
resource_name: &str,
deployment_name: &str,
api_version: Option<&str>,
api_key: Option<String>,
) -> Self
pub fn azure_openai( resource_name: &str, deployment_name: &str, api_version: Option<&str>, api_key: Option<String>, ) -> Self
Create an Azure OpenAI provider config
Sourcepub fn openai_compatible(
base_url: &str,
model: &str,
api_key: Option<String>,
) -> Self
pub fn openai_compatible( base_url: &str, model: &str, api_key: Option<String>, ) -> Self
Create an OpenAI-compatible provider config (e.g., for OpenRouter, Together AI, etc.)
Sourcepub fn ollama(model: &str, base_url: Option<String>) -> Self
pub fn ollama(model: &str, base_url: Option<String>) -> Self
Create a new Ollama provider config
Sourcepub fn with_api_key(self, api_key: String) -> Self
pub fn with_api_key(self, api_key: String) -> Self
Set API key
Sourcepub fn with_header(self, key: String, value: String) -> Self
pub fn with_header(self, key: String, value: String) -> Self
Add a header
Sourcepub fn with_extra_param(self, key: String, value: Value) -> Self
pub fn with_extra_param(self, key: String, value: Value) -> Self
Add an extra parameter
Sourcepub fn with_base_url(self, base_url: String) -> Self
pub fn with_base_url(self, base_url: String) -> Self
Set base URL
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