Coverage for slack_bot / llm / base.py: 78%

9 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-02 17:44 +0800

1from abc import ABC, abstractmethod 

2from typing import List, Dict, Any, Optional 

3 

4class BaseLLM(ABC): 

5 """Abstract base class for LLM implementations.""" 

6 

7 @abstractmethod 

8 def get_model_name(self) -> str: 

9 """Return the display name of the model.""" 

10 pass 

11 

12 @abstractmethod 

13 def generate_response( 

14 self, 

15 message: str, 

16 context: List[Dict[str, Any]], 

17 tools: Optional[List[Dict[str, Any]]] = None 

18 ) -> str: 

19 """ 

20 Generate a response for the given message and context. 

21  

22 Args: 

23 message: The user's input message. 

24 context: Conversation history (list of dicts with 'role' and 'content'). 

25 tools: Optional list of tool definitions. 

26  

27 Returns: 

28 The text response from the LLM. 

29 """ 

30 pass