pub struct ModelInfo {
pub context_window: u32,
pub effective_context_window_percent: u16,
pub force_temperature: Option<f32>,
}Expand description
Per-model context facts, looked up by slug.
Eq is intentionally NOT derived: force_temperature is an f32, for which
total equality is undefined. PartialEq is enough for the table’s tests.
Fields§
§context_window: u32Maximum total tokens (prompt + generation) the model accepts.
effective_context_window_percent: u16Whole-percent fraction of context_window that is considered usable
(default 95). usable = context_window * pct / 100.
force_temperature: Option<f32>Optional forced sampling temperature for this model, overriding whatever
the caller requested. Some for models that require a fixed temperature
(e.g. GLM-4.6/4.7 want 1.0); None leaves the caller’s value alone.
Lives here — keyed by slug, with the same longest-prefix discipline as
the context window — so the pin is resolved from the per-request
model, never baked from a provider’s default_model.
Implementations§
Source§impl ModelInfo
impl ModelInfo
Sourcepub const DEFAULT_EFFECTIVE_PERCENT: u16 = 95
pub const DEFAULT_EFFECTIVE_PERCENT: u16 = 95
Default usable fraction of a model’s window — reserved headroom so the prompt never runs flush against the hard limit.
Sourcepub const fn new(context_window: u32) -> Self
pub const fn new(context_window: u32) -> Self
A catalog entry with the default effective percentage and no temperature pin.
Sourcepub const fn with_forced_temperature(self, temperature: f32) -> Self
pub const fn with_forced_temperature(self, temperature: f32) -> Self
Builder: set a forced sampling temperature (see
force_temperature).
Sourcepub const fn effective_window(self) -> u32
pub const fn effective_window(self) -> u32
floor(context_window * effective_context_window_percent / 100): the
usable token budget after reserving headroom.