pub struct ModelConfig {
pub model: String,
pub temperature: f32,
pub max_tokens: usize,
pub system_prompt: Option<String>,
pub dynamic_system_suffix: Option<String>,
pub reasoning: ReasoningLevel,
pub hide_reasoning_trace: bool,
pub backend_options: HashMap<String, HashMap<String, String>>,
pub tools: Vec<Value>,
}Expand description
Unified model configuration
Fields§
§model: StringModel identifier (provider/model or just model name) Examples: “ollama/qwen3-coder:30b”, “qwen3-coder:30b”, “gpt-4”
temperature: f32Temperature (0.0-2.0, controls randomness)
max_tokens: usizeMaximum tokens to generate
system_prompt: Option<String>System prompt override (None = use default)
dynamic_system_suffix: Option<String>Project-specific instructions appended to the system prompt
(Step 5h: MERMAID.md content). Runtime-only — never persisted.
On Anthropic, this gets its own cache_control block so the
static base stays cached even when the dynamic suffix changes.
On other adapters, it’s concatenated onto the system prompt
with a --- separator.
reasoning: ReasoningLevelRequested reasoning depth. Adapters map this to provider-native
shapes via nearest_effort() against ModelCapabilities ::supports_reasoning. Defaults to Medium — the OpenAI / Anthropic
/ Gemini default and the level that produces useful chain-of-thought
without burning excessive latency for routine prompts.
hide_reasoning_trace: boolHide reasoning traces from the user-facing stream while still
allowing the model to reason server-side. Maps to Ollama’s
--hidethinking semantics and Anthropic’s thinking.display: "hidden". Internal plumbing; the reducer currently never
sets this (no UI toggle) but the adapter pipeline honors it
when a future toggle lands.
backend_options: HashMap<String, HashMap<String, String>>Backend-specific options (provider name -> key/value pairs) Example: {“ollama”: {“num_gpu”: “10”, “num_ctx”: “8192”}}
tools: Vec<Value>Tool definitions the model sees, already translated into
OpenAI-compatible {type: "function", function: {name, description, parameters}} shape. Runtime-only. Populated by
provider wrappers from ChatRequest.tools — adapters iterate
this directly, no internal registry.
Implementations§
Source§impl ModelConfig
impl ModelConfig
Sourcepub fn get_backend_option(&self, backend: &str, key: &str) -> Option<&String>
pub fn get_backend_option(&self, backend: &str, key: &str) -> Option<&String>
Get a backend-specific option
Sourcepub fn get_backend_option_i32(&self, backend: &str, key: &str) -> Option<i32>
pub fn get_backend_option_i32(&self, backend: &str, key: &str) -> Option<i32>
Get backend option as integer
Sourcepub fn get_backend_option_bool(&self, backend: &str, key: &str) -> Option<bool>
pub fn get_backend_option_bool(&self, backend: &str, key: &str) -> Option<bool>
Get backend option as boolean
Sourcepub fn set_backend_option(
&mut self,
backend: String,
key: String,
value: String,
)
pub fn set_backend_option( &mut self, backend: String, key: String, value: String, )
Set a backend-specific option
Sourcepub fn combined_system_prompt(&self) -> Option<String>
pub fn combined_system_prompt(&self) -> Option<String>
Build the system-prompt string for adapters that don’t support
per-block cache control (Gemini, OpenAI-compat, Ollama). Joins
the static base and the dynamic suffix (MERMAID.md content)
with a --- separator. Anthropic’s adapter doesn’t use this
helper — it emits two separately-cached typed-text blocks.
Returns None only when both fields are empty/unset.
Sourcepub fn from_app_config(config: &Config, model_id: &str) -> Self
pub fn from_app_config(config: &Config, model_id: &str) -> Self
Build a ModelConfig from user-facing app Config for a given model ID.
Centralizes the wiring of temperature, max_tokens, reasoning level, and Ollama hardware options that was previously scattered across orchestrator.rs and model.rs.
Reasoning resolution: per-model preference
(config.reasoning_per_model[model_id]) wins, then falls back to
the global default_model.reasoning. Set per-model via Alt+T or
/reasoning <level> while using the model in question.
Sourcepub fn ollama_options(&self) -> OllamaOptions
pub fn ollama_options(&self) -> OllamaOptions
Extract Ollama-specific options
Trait Implementations§
Source§impl Clone for ModelConfig
impl Clone for ModelConfig
Source§fn clone(&self) -> ModelConfig
fn clone(&self) -> ModelConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelConfig
impl Debug for ModelConfig
Source§impl Default for ModelConfig
impl Default for ModelConfig
Source§impl<'de> Deserialize<'de> for ModelConfig
impl<'de> Deserialize<'de> for ModelConfig
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 ModelConfig
impl RefUnwindSafe for ModelConfig
impl Send for ModelConfig
impl Sync for ModelConfig
impl Unpin for ModelConfig
impl UnsafeUnpin for ModelConfig
impl UnwindSafe for ModelConfig
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.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, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more