Coverage for src/lilbee/core/config/keys.py: 100%
5 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-09-17 10:02 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-09-17 10:02 +0000
1"""Config-field key sets shared by the settings boundary and the engine."""
3from __future__ import annotations
5# API-key cfg field names: keep in sync with ``providers.sdk_backend.PROVIDER_KEYS``.
6PROVIDER_API_KEYS: frozenset[str] = frozenset(
7 {
8 "llm_api_key",
9 "openrouter_api_key",
10 "gemini_api_key",
11 "anthropic_api_key",
12 "openai_api_key",
13 "mistral_api_key",
14 "deepseek_api_key",
15 }
16)
18# Settings whose value is baked into a loaded model and only takes effect
19# after the worker reloads.
20LOAD_AFFECTING_KEYS: frozenset[str] = frozenset(
21 {
22 "num_ctx",
23 "num_ctx_max",
24 "chat_n_ctx_target",
25 "kv_cache_type",
26 # Baked into the llama-server argv (--n-gpu-layers, --cpu-moe, --n-cpu-moe,
27 # --flash-attn), so a change must rebuild the engine; the bind contract
28 # (role/model + pin) would otherwise adopt a running engine's old offload,
29 # cache, or flash-attention flags unchanged.
30 "n_gpu_layers",
31 "cpu_moe",
32 "n_cpu_moe",
33 "flash_attention",
34 "chat_model",
35 "embedding_model",
36 "vision_model",
37 "reranker_model",
38 "reranker_type",
39 # The embed/rerank window and the chat floor are sized from the chunk budget.
40 "chunk_size",
41 }
42)
44# Writes here require reconstructing the services singleton.
45PROVIDER_SWITCHING_KEYS: frozenset[str] = frozenset({"llm_provider"})
47# Settings that change which physical devices an engine launches on, or which of
48# them holds the model (--main-gpu). Part of the cross-process engine pin, so a
49# process with a different placement binds its own engine rather than silently
50# adopting the incumbent's GPUs. Kept out of LOAD_AFFECTING_KEYS so they do not
51# change the settings reload path (they take effect on restart), only which
52# engines are shareable.
53PLACEMENT_PIN_KEYS: frozenset[str] = frozenset({"placement", "gpu_devices", "main_gpu"})