Skip to main content

Module server_config

Module server_config 

Source
Expand description

Canonical context-size resolver (5-level fallback chain).

Extracted to gglib-core so that crates which cannot depend on gglib-runtime (e.g. gglib-proxy) can still use the same resolution logic for idle-model advertisements in /v1/models.

Re-exports§

pub use crate::cache_config::CacheRamSetting;

Structs§

ServerConfigOptions
Caller-supplied overrides for resolve_context_size.

Enums§

ContextSizeSource
Which rung of the context fallback chain supplied the resolved value.
CtxSizeArg
A parsed --ctx-size CLI flag, before it is resolved against model metadata.

Constants§

CACHE_RAM_FLOOR_BYTES
Below this, a prompt cache holds too little to be worth the memory pressure, so the budget collapses to 0 (explicitly disabled).
CACHE_RAM_HEADROOM_BYTES
RAM reserved for the OS, other applications, and llama.cpp’s own compute/scratch buffers — never handed to the prompt cache.
CACHE_RAM_UNKNOWN_KV_ALLOWANCE_BYTES
KV allowance assumed when the model’s metadata doesn’t permit an estimate. Deliberately generous: over-reserving shrinks the cache (safe), whereas under-reserving risks memory pressure.

Functions§

compute_auto_cache_ram_mb
Compute the auto --cache-ram budget, in MiB.
parse_ctx_size_flag
Parse an optional raw --ctx-size flag into a CtxSizeArg.
resolve_context_size
Resolve context size using the 5-level fallback chain.
resolve_context_size_with_source
Resolve context size using the 5-level fallback chain, reporting which rung won.