pub struct ChatRequest {Show 14 fields
pub model_id: String,
pub messages: Vec<ChatMessage>,
pub system_prompt: String,
pub instructions: Option<String>,
pub reasoning: ReasoningLevel,
pub temperature: f32,
pub max_tokens: usize,
pub tools: Vec<ToolDefinition>,
pub ollama_num_ctx: Option<u32>,
pub ollama_allow_ram_offload: Option<bool>,
pub resolved_context_window: Option<usize>,
pub resolved_max_output: Option<usize>,
pub output_schema: Option<Value>,
pub suppress_auto_compact: bool,
}Expand description
Inputs a model needs to generate a turn. Built by the reducer from
Session + Settings + current MERMAID.md context. Pure data —
no provider-specific knowledge here (that’s in
providers::model::*::chat).
Fields§
§model_id: String§messages: Vec<ChatMessage>§system_prompt: String§instructions: Option<String>MERMAID.md content to suffix onto the system prompt. None if
no file was loaded for this project.
reasoning: ReasoningLevel§temperature: f32§max_tokens: usize§tools: Vec<ToolDefinition>Tool definitions advertised to the model. Combination of the
built-in tool set + any advertised MCP tools from McpState.
ollama_num_ctx: Option<u32>Per-model Ollama num_ctx override (/context <n>/max), or None to
auto-fit. The one provider-specific knob that rides on the request, the
same way reasoning does — so a live /context change applies on the
next turn without rebuilding the cached provider. Ignored by non-Ollama
providers.
ollama_allow_ram_offload: Option<bool>Live Ollama RAM-offload toggle (/context offload on|off). Rides on the
request like ollama_num_ctx so a toggle applies on the next turn without
rebuilding the cached provider (whose config is frozen at startup).
None falls back to the persisted [ollama] allow_ram_offload. Ignored
by non-Ollama providers.
resolved_context_window: Option<usize>The model’s real context window, filled by the effect layer from
cache-first live discovery (resolve_context_window) just before
dispatch. The reducer always initializes it None; None at the
adapter means “unknown” (no window clamp).
resolved_max_output: Option<usize>The model’s real per-response output ceiling, filled alongside
resolved_context_window. None means unknown — adapters that
require a concrete max_tokens (Anthropic) fall back to a floor.
output_schema: Option<Value>mermaid run --output-schema: the JSON Schema the FORMATTING turn
must conform to. Set only on that dedicated turn (never during the
agentic loop — Gemini rejects tools+schema, Ollama’s format would
degrade tool calling). When Some, the request carries no tools:
the reducer sends none and the effect runner skips the built-ins.
suppress_auto_compact: boolPause automatic threshold compaction for this turn. Set from
RuntimeState::auto_compact_suppressed after an auto-compaction
failure, so a chronically failing summarizer doesn’t burn a model call
every turn. Rides on the request like ollama_num_ctx because the
effect preflight sees only the request, never RuntimeState. Cleared
by a successful compaction, a manual /compact, or a conversation
switch.
Trait Implementations§
Source§impl Clone for ChatRequest
impl Clone for ChatRequest
Source§fn clone(&self) -> ChatRequest
fn clone(&self) -> ChatRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ChatRequest
impl RefUnwindSafe for ChatRequest
impl Send for ChatRequest
impl Sync for ChatRequest
impl Unpin for ChatRequest
impl UnsafeUnpin for ChatRequest
impl UnwindSafe for ChatRequest
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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