Coverage for src/lilbee/core/config/enums.py: 100%
34 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-08-14 11:46 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-08-14 11:46 +0000
1"""StrEnum types used by :mod:`lilbee.config`."""
3from enum import StrEnum
6class ChatMode(StrEnum):
7 """How chat turns route through retrieval. ``search`` uses retrieval; ``chat`` skips it."""
9 SEARCH = "search"
10 CHAT = "chat"
13class LlmProvider(StrEnum):
14 """Inference backend that ``create_provider`` builds.
16 ``auto`` prefix-routes: native GGUF refs to the local llama-server engine,
17 remote-prefixed refs (``ollama/``, ``openai/``, ...) to the SDK backend.
18 ``remote`` forces the SDK backend.
19 """
21 AUTO = "auto"
22 REMOTE = "remote"
25class RerankerType(StrEnum):
26 """How the reranker GGUF is served. ``auto`` detects by architecture."""
28 AUTO = "auto"
29 CROSS_ENCODER = "cross_encoder"
30 LLM = "llm"
33class CrawlRenderMode(StrEnum):
34 """How a crawl fetches pages. ``http`` uses no browser; ``browser`` runs Chromium with JS."""
36 HTTP = "http"
37 BROWSER = "browser"
40class ClustererBackend(StrEnum):
41 """Known wiki clusterer backends."""
43 EMBEDDING = "embedding"
44 CONCEPTS = "concepts"
47class WikiEntityMode(StrEnum):
48 """Strategy used to extract entities for the wiki.
50 The extractor emits typed NER entities only. Concept pages are
51 proposed by the LLM inside the per-source batched call in
52 :mod:`lilbee.wiki.generation`. The enum values reflect that
53 extractor responsibility.
54 """
56 NER_ENTITIES = "ner_entities"
57 NER_CONCEPTS_PLUS_LLM_TYPES = "ner_concepts_plus_llm_types"
58 LLM_TAGGED = "llm_tagged"
61class TableModel(StrEnum):
62 """xberg's table structure recognition model, used when layout detection is on.
64 The ``slanet_*`` variants are the docling-parity lineage; ``tatr`` is xberg's
65 older default. ``disabled`` skips structure recognition.
66 """
68 DISABLED = "disabled"
69 TATR = "tatr"
70 SLANET_AUTO = "slanet_auto"
71 SLANET_PLUS = "slanet_plus"
72 SLANET_WIRED = "slanet_wired"
73 SLANET_WIRELESS = "slanet_wireless"
76class KvCacheType(StrEnum):
77 """KV cache element type. ``q8_0`` / ``q4_0`` require flash attention."""
79 F16 = "f16"
80 F32 = "f32"
81 Q8_0 = "q8_0"
82 Q4_0 = "q4_0"
85# Bytes per KV element for memory budgeting. The quantized variants are
86# ~1 byte of data plus shared scales, close enough for context-fit math.
87KV_CACHE_TYPE_BYTES: dict[KvCacheType, int] = {
88 KvCacheType.F16: 2,
89 KvCacheType.F32: 4,
90 KvCacheType.Q8_0: 1,
91 KvCacheType.Q4_0: 1,
92}