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

17 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-05-15 20:55 +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 ClustererBackend(StrEnum): 

14 """Known wiki clusterer backends.""" 

15 

16 EMBEDDING = "embedding" 

17 CONCEPTS = "concepts" 

18 

19 

20class WikiEntityMode(StrEnum): 

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

22 

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

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

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

26 extractor responsibility. 

27 """ 

28 

29 NER_ENTITIES = "ner_entities" 

30 NER_CONCEPTS_PLUS_LLM_TYPES = "ner_concepts_plus_llm_types" 

31 LLM_TAGGED = "llm_tagged" 

32 

33 

34class KvCacheType(StrEnum): 

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

36 

37 F16 = "f16" 

38 F32 = "f32" 

39 Q8_0 = "q8_0" 

40 Q4_0 = "q4_0" 

41 

42 

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

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

45KV_CACHE_TYPE_BYTES: dict[KvCacheType, int] = { 

46 KvCacheType.F16: 2, 

47 KvCacheType.F32: 4, 

48 KvCacheType.Q8_0: 1, 

49 KvCacheType.Q4_0: 1, 

50}