Skip to main content

ServerConfigOptions

Struct ServerConfigOptions 

Source
pub struct ServerConfigOptions {
Show 15 fields pub context_size: Option<u64>, pub model_server_ctx: Option<usize>, pub global_default_ctx: Option<u64>, pub port: Option<u16>, pub jinja: Option<bool>, pub reasoning_format: Option<String>, pub mtp_draft_n_max: Option<u32>, pub mtp_draft_p_min: Option<f32>, pub slot_save_path: Option<PathBuf>, pub cache_ram_mb: Option<u64>, pub cache_reuse: Option<u32>, pub cache_type_k: Option<KvCacheType>, pub cache_type_v: Option<KvCacheType>, pub inference_params: Option<InferenceConfig>, pub mlock: Option<bool>,
}
Expand description

Caller-supplied overrides for resolve_context_size.

All fields default to None, which means “fall through to next tier”.

Fields§

§context_size: Option<u64>

Override the context window size forwarded to llama-server. None lets llama-server use its built-in default.

§model_server_ctx: Option<usize>

Per-model server defaults context length (from Model.server_defaults.context_length). Second tier in fallback chain.

§global_default_ctx: Option<u64>

Global app setting for default context size (from Settings.default_context_size). Third tier in fallback chain.

§port: Option<u16>

Bind llama-server to a specific port instead of letting the allocator choose.

§jinja: Option<bool>

Override Jinja template support.

  • None → auto-detect: enabled when the model has the "agent" tag.
  • Some(true) → force enable regardless of tags.
  • Some(false) → force disable regardless of tags.
§reasoning_format: Option<String>

Override the reasoning format passed to llama-server.

  • None → auto-detect from model tags (e.g. "reasoning" tag).
  • Some("none") → explicitly suppress reasoning extraction even if the model has a reasoning tag.
  • Some("deepseek") / Some("deepseek-legacy") → force a specific format.
§mtp_draft_n_max: Option<u32>

Override the MTP draft token count.

  • None → auto-detect: enabled with default n=2 when the model has the "mtp" tag.
  • Some(0) → explicitly disable MTP even if the model has the "mtp" tag.
  • Some(n) → enable MTP with n draft tokens.
§mtp_draft_p_min: Option<f32>

Override the MTP acceptance probability threshold. Only meaningful when MTP is enabled. None uses the default (0.75).

§slot_save_path: Option<PathBuf>

Directory for llama-server KV cache slot persistence (--slot-save-path).

  • None — disk slot persistence disabled, no --slot-save-path flag.
  • Some(dir) — enables slot save/restore. Direct pass-through, no tag-based auto-detection (unlike jinja/MTP/reasoning). Independent of cache_ram_mb/cache_reuse below.
§cache_ram_mb: Option<u64>

RAM budget in MiB for llama-server’s own host-RAM prompt cache (--cache-ram). None leaves llama-server’s built-in default. Some(0) disables the cache. Direct pass-through, no tag-based auto-detection.

§cache_reuse: Option<u32>

Minimum chunk size in tokens for KV-shift cache reuse past the first prefix divergence point (--cache-reuse). None leaves the feature off. Direct pass-through, no tag-based auto-detection.

§cache_type_k: Option<KvCacheType>

Explicit override for the K cache element type (--cache-type-k). None resolves to the q8_0 default (see gglib_runtime::llama::args::resolve_kv_cache_types), unless GGLIB_DISABLE_KV_QUANT=1 is set.

§cache_type_v: Option<KvCacheType>

Explicit override for the V cache element type (--cache-type-v). Same resolution as Self::cache_type_k. Quantizing V additionally requires Flash Attention to be active — see gglib_runtime::llama::args::kv_cache_type module docs.

§inference_params: Option<InferenceConfig>

Inference parameter overrides (temperature, top-p, etc.) forwarded directly to llama-server.

§mlock: Option<bool>

Whether to memory-lock the model into RAM (--mlock). None defaults to false in build_server_config().

Implementations§

Source§

impl ServerConfigOptions

Source

pub fn overlay(&self, over: &Self) -> Self

Field-wise merge: every Some in over wins, every None falls through to self.

This is the single layering primitive behind both places where two sets of options meet:

  • the 3-tier cascade in UnifiedServerConfig::resolved_options, where global defaults are the base and explicit CLI/GUI overrides are over;
  • per-call launch overrides layered on top of a ProcessManager’s standing template.

Note that this merges options, not resolved values — the tier chain baked into resolve_context_size (request → per-model → global → hardcoded) still runs afterwards on the merged result, so overlaying never collapses those tiers early.

over is destructured exhaustively on purpose: adding a field to this struct then fails to compile until it is given merge semantics here, rather than being silently dropped.

Trait Implementations§

Source§

impl Clone for ServerConfigOptions

Source§

fn clone(&self) -> ServerConfigOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerConfigOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ServerConfigOptions

Source§

fn default() -> ServerConfigOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more