pub struct ProviderConfig {
pub provider: AiProvider,
pub model: String,
pub api_key: Option<String>,
pub base_url: Option<String>,
pub temperature: f32,
pub max_tokens: u32,
}Expand description
Configuration for an AI provider.
Fields§
§provider: AiProviderThe provider to use.
model: StringModel name (provider-specific).
api_key: Option<String>API key or endpoint.
base_url: Option<String>Base URL for the API.
temperature: f32Temperature for generation.
max_tokens: u32Maximum tokens to generate.
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn new(provider: AiProvider) -> Self
pub fn new(provider: AiProvider) -> Self
Create a new config for the given provider.
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Set the model.
Sourcepub fn with_api_key(self, key: impl Into<String>) -> Self
pub fn with_api_key(self, key: impl Into<String>) -> Self
Set the API key.
Sourcepub fn with_base_url(self, url: impl Into<String>) -> Self
pub fn with_base_url(self, url: impl Into<String>) -> Self
Set the base URL.
Sourcepub fn with_temperature(self, temp: f32) -> Self
pub fn with_temperature(self, temp: f32) -> Self
Set the temperature.
Sourcepub fn get_api_key(&self) -> Result<String, Error>
pub fn get_api_key(&self) -> Result<String, Error>
Sourcepub fn get_base_url(&self) -> Option<String>
pub fn get_base_url(&self) -> Option<String>
Get the base URL from config or environment.
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
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