Coverage for src/lilbee/modelhub/model_manager/types.py: 100%

24 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-11-06 08:17 +0000

1"""Public value types for model lifecycle management.""" 

2 

3from dataclasses import dataclass 

4from enum import Enum 

5 

6from lilbee.catalog.types import KeyStatus, ModelTask 

7from lilbee.providers.backend_names import BackendName 

8 

9 

10class ModelNotFoundError(RuntimeError): 

11 """Raised when a model ref is not found in any source or the catalog. 

12 

13 Subclasses RuntimeError so pre-existing `except RuntimeError` call 

14 sites still catch it. 

15 """ 

16 

17 

18@dataclass 

19class RemoteModel: 

20 """A model from the SDK backend with inferred task classification.""" 

21 

22 name: str 

23 task: ModelTask 

24 family: str 

25 parameter_size: str 

26 provider: str = BackendName.REMOTE 

27 

28 

29@dataclass(frozen=True) 

30class ApiModelGroup: 

31 """One hosted provider's chat models and the status of its API key.""" 

32 

33 provider: str 

34 display_name: str 

35 key_status: KeyStatus 

36 models: list[RemoteModel] 

37 

38 

39class ValidationResult(Enum): 

40 """Outcome of validating a persisted model ref against current state.""" 

41 

42 OK = "ok" 

43 NOT_INSTALLED = "not_installed" # Local ref but no GGUF on disk. 

44 NO_KEY = "no_key" # API ref but no provider key configured. 

45 INVALID_KEY = "invalid_key" # API ref whose provider rejected the key. 

46 UNKNOWN = "unknown" # Ref string is malformed or its provider is unknown.