Coverage for src / lilbee / core / config / enums.py: 100%

20 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-06-28 01:01 +0000

1"""StrEnum types used by :mod:`lilbee.config`.""" 

2 

3from enum import StrEnum 

4 

5 

6class ChatMode(StrEnum): 

7 """How chat turns route through retrieval. ``search`` uses retrieval; ``chat`` skips it.""" 

8 

9 SEARCH = "search" 

10 CHAT = "chat" 

11 

12 

13class CrawlRenderMode(StrEnum): 

14 """How a crawl fetches pages. ``http`` uses no browser; ``browser`` runs Chromium with JS.""" 

15 

16 HTTP = "http" 

17 BROWSER = "browser" 

18 

19 

20class ClustererBackend(StrEnum): 

21 """Known wiki clusterer backends.""" 

22 

23 EMBEDDING = "embedding" 

24 CONCEPTS = "concepts" 

25 

26 

27class WikiEntityMode(StrEnum): 

28 """Strategy used to extract entities for the wiki. 

29 

30 The extractor emits typed NER entities only. Concept pages are 

31 proposed by the LLM inside the per-source batched call in 

32 :mod:`lilbee.wiki.generation`. The enum values reflect that 

33 extractor responsibility. 

34 """ 

35 

36 NER_ENTITIES = "ner_entities" 

37 NER_CONCEPTS_PLUS_LLM_TYPES = "ner_concepts_plus_llm_types" 

38 LLM_TAGGED = "llm_tagged" 

39 

40 

41class KvCacheType(StrEnum): 

42 """KV cache element type. ``q8_0`` / ``q4_0`` require flash attention.""" 

43 

44 F16 = "f16" 

45 F32 = "f32" 

46 Q8_0 = "q8_0" 

47 Q4_0 = "q4_0" 

48 

49 

50# Bytes per KV element for memory budgeting. The quantized variants are 

51# ~1 byte of data plus shared scales, close enough for context-fit math. 

52KV_CACHE_TYPE_BYTES: dict[KvCacheType, int] = { 

53 KvCacheType.F16: 2, 

54 KvCacheType.F32: 4, 

55 KvCacheType.Q8_0: 1, 

56 KvCacheType.Q4_0: 1, 

57}