pub struct CompletionConfig {
pub temperature: Option<f32>,
pub num_ctx: Option<usize>,
pub max_tokens: Option<usize>,
pub top_p: Option<f32>,
pub top_k: Option<u32>,
pub response_format: Option<ResponseFormat>,
pub reasoning_effort: Option<ReasoningEffort>,
pub reasoning_profile: Option<ReasoningProfile>,
pub preserve_reasoning: bool,
pub max_tool_iterations: usize,
}Expand description
Configuration for LLM completion.
Provider controls default to None: the provider applies its own settings.
To restore the former 2.1 defaults explicitly:
use mojentic::llm::gateway::CompletionConfig;
let config = CompletionConfig {
temperature: Some(1.0),
num_ctx: Some(32768),
max_tokens: Some(16384),
..Default::default()
};
assert_eq!(config.max_tokens, Some(16384));Fields§
§temperature: Option<f32>Sampling temperature. Unset delegates to provider settings.
num_ctx: Option<usize>Ollama context size. Other maintained providers omit this control.
max_tokens: Option<usize>Output limit: Ollama options.num_predict, OpenAI model-specific token
limit, or oMLX max_tokens. Unset sends no output limit.
top_p: Option<f32>§top_k: Option<u32>§response_format: Option<ResponseFormat>§reasoning_effort: Option<ReasoningEffort>§reasoning_profile: Option<ReasoningProfile>Explicit model capabilities. None delegates support/defaults to the provider.
preserve_reasoning: boolRetain completed assistant reasoning during broker-managed tool rounds. This does not turn reasoning on, and does not retain cancelled partial calls.
max_tool_iterations: usizeMaximum tool rounds; use with_unlimited_tool_iterations to disable the limit.
Implementations§
Source§impl CompletionConfig
impl CompletionConfig
Sourcepub fn validate_reasoning(&self) -> Result<()>
pub fn validate_reasoning(&self) -> Result<()>
Validate explicit model capabilities before sending a provider request.
Sourcepub fn with_unlimited_tool_iterations(self) -> Self
pub fn with_unlimited_tool_iterations(self) -> Self
Disable the tool-round limit while retaining the existing numeric configuration API.
usize::MAX is a symbolic unlimited value; the broker skips its limit check.
Trait Implementations§
Source§impl Clone for CompletionConfig
impl Clone for CompletionConfig
Source§fn clone(&self) -> CompletionConfig
fn clone(&self) -> CompletionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more