Expand description
§domain
Core domain types.
These types represent the pure domain model, independent of any infrastructure concerns (database, filesystem, etc.).
§Structure
agent- Agent loop types (AgentConfig,AgentMessage,AgentEvent, etc.)model- Model types (Model,NewModel)model_naming- Shared model-naming policy (resolve_model_name,NameSource)mcp- MCP server types (McpServer,NewMcpServer, etc.)chat- Chat conversation and message typesgguf- GGUF metadata and capability typescapabilities- Model capability detection and inferencethinking- Thinking/reasoning tag parsing and streaming accumulationkv_memory- Shape of a model’s KV memory from GGUF metadata: whether it keeps only part of the token history (kv_memory_is_partial), and how many layers hold a per-token cache at all (kv_cache_layer_count)kv_estimate- Per-token KV cache size, which takes that layer count fromkv_memoryrather than counting every block. The dependency runs one way only:kv_memoryreads metadata and knows nothing of the estimate
Modules
Re-exports§
pub use benchmark::BenchmarkEvent;pub use benchmark::BenchmarkModelResult;pub use benchmark::BenchmarkRun;pub use benchmark::BenchmarkRunStatus;pub use benchmark::BenchmarkRunType;pub use benchmark::CandidateSource;pub use benchmark::CompareConfig;pub use benchmark::GeneratedOutput;pub use benchmark::ModelBenchmarkSummary;pub use benchmark::ModelCompareResult;pub use benchmark::ModelPerfResult;pub use benchmark::PerfConfig;pub use benchmark::ScoreWeights;pub use benchmark::SweepSpec;pub use benchmark::TaskCategory;pub use benchmark::TaskSuite;pub use benchmark::TuneCandidateResult;pub use benchmark::TuneConfig;pub use benchmark::TuneTask;pub use benchmark::TuneTaskResult;pub use capability_tags::is_reasoning;pub use inference_profile::InferenceProfile;pub use inference_profile::builtin_templates;pub use recommendation::BUDGET_UTILISATION;pub use recommendation::BudgetSource;pub use recommendation::Recommendation;pub use recommendation::recommend;pub use slot_eviction::SlotFileMeta;pub use slot_eviction::compute_auto_disk_budget_bytes;pub use slot_eviction::select_evictions;pub use mcp::McpEnvEntry;pub use mcp::McpLifecycle;pub use mcp::McpServer;pub use mcp::McpServerConfig;pub use mcp::McpServerStatus;pub use mcp::McpServerType;pub use mcp::McpTool;pub use mcp::McpToolResult;pub use mcp::NewMcpServer;pub use mcp::ToolIndex;pub use chat::Conversation;pub use chat::ConversationUpdate;pub use chat::Message;pub use chat::MessageRole;pub use chat::NewConversation;pub use chat::NewMessage;pub use gguf::CapabilityFlags;pub use gguf::GgufCapabilities;pub use gguf::GgufMetadata;pub use gguf::GgufValue;pub use gguf::RawMetadata;pub use dialect::BodyCodec;pub use dialect::DialectSpec;pub use dialect::EmissionProfile;pub use agent::AGENT_EVENT_CHANNEL_CAPACITY;pub use agent::AgentConfig;pub use agent::AgentEvent;pub use agent::AgentMessage;pub use agent::AssistantContent;pub use agent::DEFAULT_MAX_ITERATIONS;pub use agent::DEFAULT_MAX_STAGNATION_STEPS;pub use agent::LlmStreamEvent;pub use agent::LoopDetector;pub use agent::MAX_ITERATIONS_CEILING;pub use agent::MAX_PARALLEL_TOOLS_CEILING;pub use agent::MAX_TOOL_TIMEOUT_MS_CEILING;pub use agent::StagnationDetector;pub use agent::ToolCall;pub use agent::ToolDefinition;pub use agent::ToolResult;pub use capabilities::capabilities_from_architecture;pub use capabilities::infer_from_chat_template;pub use capabilities::ChatMessage;pub use capabilities::MessageContent;pub use capabilities::ModelCapabilities;pub use capabilities::transform_messages_for_capabilities;
Modules§
- admission 🔒
- What the admission queue and the VRAM resident set look like right now.
- agent
- agent
- benchmark
- benchmark
- cache_
budget 🔒 - Auto-sizing math for llama-server’s host-RAM prompt cache (
--cache-ram). - capabilities
- Model capability detection, inference, and request transformation.
- capability_
tags - The capability tags gglib stores on a model, and the predicates that read them.
- chat
- Chat domain types.
- context_
fit 🔒 - How large a context this machine can actually serve.
- defect_
counts - The per-model defect counts — the data half of
super::defects. - defects
- Per-model defect counters — the Tier C signals the closed loop steers by.
- dialect
- Tool-call dialect specification.
- generation_
config 🔒 - The sampling recipe a model author publishes in
generation_config.json. - gguf
- GGUF domain types.
- inference 🔒
- Inference configuration types.
- inference_
profile - Named, cross-model sampling profiles.
- kv_
estimate 🔒 - KV-cache size estimation from GGUF metadata.
- kv_
memory 🔒 - The shape of a model’s KV memory, read from GGUF metadata: whether it retains the full token history, and how many layers hold a cache at all.
- launch_
narration 🔒 - What the runtime decided for one llama-server launch, and why.
- loop_
guard_ log - The loop guard’s log, which outlives the process.
- mcp
- mcp
- model 🔒
- Model domain types.
- model_
naming 🔒 - Shared model-naming policy.
- model_
sampling 🔒 - The sampler defaults a model carries in its own GGUF metadata.
- query 🔒
- Model list query, filter, and sort types.
- reasoning_
effort 🔒 - The
reasoning_effortlevel — how hard the model is asked to think. - recommendation
- Picking a first model that actually fits the machine it will run on.
- residency 🔒
- Whether a second model may stay resident in VRAM alongside the first.
- runtime_
capabilities 🔒 - What the engine underneath gglib can do — the mirror of
GgufCapabilities. - sampling_
discards 🔒 - Which parameters a caller named and the ladder then passed over.
- sampling_
provenance 🔒 - Which layer supplied each resolved sampling parameter.
- server_
config 🔒 - Server-level default configuration for models.
- slot_
eviction - Byte-budget selection for on-disk KV slot cache eviction.
- template_
caps 🔒 - llama-server’s per-template capability self-report, and the tri-state gglib holds it in.
Structs§
- Admission
Snapshot - Everything the admission queue and resident set look like right now.
- Field
Sources - Per-field provenance for one resolved
InferenceConfig. - FitInputs
- What
fit_contextworked from, for a person reading a launch log. - Inference
Config - Inference parameters for LLM sampling.
- KvElems
PerToken - Per-token K and V element counts, type-agnostic.
- Launch
Decision - One resolved launch decision, paired with the reason it was chosen.
- Launch
Narration - Everything the runtime decided for one llama-server launch.
- Model
- A model that exists in the system with a database ID.
- Model
File - Represents a single file (shard) belonging to a model.
- Model
Filter Options - Filter options for the model library UI.
- Model
List Query - Complete filter + sort specification for the model list.
- Model
Sampling Context - Everything about the target model that changes how sampling resolves, independent of any specific request.
- Model
Sampling Defaults - The sampler defaults one model declares.
- NewModel
- A model to be inserted into the system (no ID yet).
- NewModel
File - A model file entry to be inserted into the system (no ID yet).
- Queued
Model Snapshot - Requests waiting for one model that is not currently resident.
- Range
Values - A range of numeric values with min and max.
- Resident
Slot Snapshot - One model resident in VRAM.
- Runtime
Capabilities - What the llama-server binary underneath gglib is, and what it can do.
- Runtime
Flags - Capabilities of the llama-server binary gglib is running against.
- Secondary
Slot Status - Why the second VRAM slot is or is not in use.
- Server
Config - Server-level defaults for a specific model.
- Slot
Footprint - What one resident model is expected to occupy in VRAM.
- Template
Caps - The nine bools of
chat_template_caps, asGET /propsreports them.
Enums§
- Cache
RamHealth - How healthy a resolved
--cache-rambudget is, for user-facing display. - Defaults
Origin - Whether a model’s stored
inference_defaultswere set by the user or written automatically at import time. - Field
Issue - What reading one client-supplied sampling field did, when it was not simply “read it”.
- Model
Sampling Default - What one model’s GGUF says about one sampler field.
- Model
Sort By - The field to sort the model list by.
- Name
Source - Which naming signals are available for a model being added.
- Param
Source - Which rung of a sampling ladder supplied one resolved parameter.
- Reasoning
Effort - A reasoning-effort level gglib is willing to put on the wire.
- Sampling
Layer - The five rungs of the ladder
resolve_with_profilebuilds, in priority order. - Sampling
Override - What gglib is doing with one field’s published recommendation.
- Secondary
Slot Decision - Whether a candidate may take the second resident slot, and why not when it may not.
- Sort
Order - Direction for sorting.
- Support
- One capability’s answer, with unknown kept distinct from no.
- Template
Caps State - What gglib currently holds about a model’s template caps.
Constants§
- 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.
- MODEL_
SAMPLING_ KEYS - gglib’s wire name for a sampler field, paired with the GGUF key that can move it.
- RESIDENCY_
UTILISATION - Fraction of free VRAM a co-resident candidate is allowed to claim.
Functions§
- apply_
query - Apply a
ModelListQueryto a model list, returning a filtered and sorted copy. - classify_
cache_ ram - Classify a resolved
--cache-rambudget. - compute_
auto_ cache_ ram_ mb - Compute the auto
--cache-rambudget, in MiB. - decide_
secondary_ slot - Decide whether
candidatemay stay resident alongside what is already loaded. - declared_
name - The
general.namedeclared in the GGUF header, orNoneif absent or blank. - discarded_
from_ rung - The parameters
namedset that did not survive to the resolution. - estimate_
kv_ bytes_ for_ context - Estimate total KV cache bytes for a given context size.
- estimate_
kv_ elems_ per_ token - Estimate K and V element counts consumed per token of context.
- fit_
context - The largest context
weights_bytescan serve insidebudget_bytes. - fit_
context_ explained - The same calculation, reporting what it worked from.
- format_
gib - Format a byte count as GiB with one decimal, e.g.
17.2 GiB. - format_
mib_ as_ gib - Format a MiB count as GiB with one decimal, for the RAM cache budget.
- generation_
config_ candidates - Where to look for a
generation_config.json, best candidate first. - is_
system_ tag - Returns
truewhentagis a system tag that callers must not remove through the standard tag-mutation API. - kv_
bytes_ per_ token - Convert per-token K/V element counts to bytes at the given cache types.
- kv_
cache_ layer_ count - How many of the model’s layers hold a per-token KV cache.
- kv_
memory_ is_ partial - Whether the model’s KV memory retains only part of the token history (sliding-window, hybrid, or recurrent attention).
- parse_
generation_ config - Read a model author’s
generation_config.json. - reasoning_
effort_ support - Whether a model’s template reads
reasoning_effort, from its recorded caps. - repo_
short_ name - Strip a
HuggingFacerepo id down to its final path segment. - resolve_
model_ name - Resolve the
models.namefor a model being added. - strip_
gguf_ suffix - Strip a trailing
-GGUFmarker, case-insensitively.