pub struct AiConfig {
pub provider: String,
pub model: String,
pub timeout_seconds: u64,
pub allow_paid_models: bool,
pub max_tokens: u32,
pub temperature: f32,
pub circuit_breaker_threshold: u32,
pub circuit_breaker_reset_seconds: u64,
pub tasks: Option<TasksConfig>,
pub fallback: Option<FallbackConfig>,
pub custom_guidance: Option<String>,
pub validation_enabled: bool,
}Expand description
AI provider settings.
Fields§
§provider: StringAI provider: “openrouter” or “ollama”.
model: StringModel identifier.
timeout_seconds: u64Request timeout in seconds.
allow_paid_models: boolAllow paid models (default: false for cost control).
max_tokens: u32Maximum tokens for API responses.
temperature: f32Temperature for API requests (0.0-1.0).
circuit_breaker_threshold: u32Circuit breaker failure threshold before opening (default: 3).
circuit_breaker_reset_seconds: u64Circuit breaker reset timeout in seconds (default: 60).
tasks: Option<TasksConfig>Task-specific model overrides.
fallback: Option<FallbackConfig>Fallback provider chain for resilience.
custom_guidance: Option<String>Custom guidance to override or extend default best practices.
Allows users to provide project-specific tooling recommendations that will be appended to the default best practices context. Useful for enforcing project-specific choices (e.g., poetry instead of uv).
validation_enabled: boolEnable pre-flight model validation with fuzzy matching (default: true).
When enabled, validates that the configured model ID exists in the cached model registry before creating an AI client. Provides helpful suggestions if an invalid model ID is detected.
Implementations§
Source§impl AiConfig
impl AiConfig
Sourcepub fn resolve_for_task(&self, task: TaskType) -> (String, String)
pub fn resolve_for_task(&self, task: TaskType) -> (String, String)
Resolve provider and model for a specific task type.
Returns a tuple of (provider, model) by checking task-specific overrides first, then falling back to the default provider and model.
§Arguments
task- The task type to resolve configuration for
§Returns
A tuple of (provider_name, model_name) strings
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AiConfig
impl<'de> Deserialize<'de> for AiConfig
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>,
Auto Trait Implementations§
impl Freeze for AiConfig
impl RefUnwindSafe for AiConfig
impl Send for AiConfig
impl Sync for AiConfig
impl Unpin for AiConfig
impl UnwindSafe for AiConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromResponse for Twhere
T: DeserializeOwned,
impl<T> FromResponse for Twhere
T: DeserializeOwned,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more