Coverage for src / dataknobs_bots / reasoning / base.py: 100%

3 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-16 10:13 -0700

1"""Base reasoning strategy for DynaBot.""" 

2 

3from abc import ABC, abstractmethod 

4from typing import Any 

5 

6 

7class ReasoningStrategy(ABC): 

8 """Abstract base class for reasoning strategies. 

9 

10 Reasoning strategies control how the bot processes information 

11 and generates responses. Different strategies can implement 

12 different levels of reasoning complexity. 

13 

14 Examples: 

15 - Simple: Direct LLM call 

16 - Chain-of-Thought: Break down reasoning into steps 

17 - ReAct: Reason and act in a loop with tools 

18 """ 

19 

20 @abstractmethod 

21 async def generate( 

22 self, 

23 manager: Any, 

24 llm: Any, 

25 tools: list[Any] | None = None, 

26 **kwargs: Any, 

27 ) -> Any: 

28 """Generate response using this reasoning strategy. 

29 

30 Args: 

31 manager: ConversationManager instance 

32 llm: LLM provider instance 

33 tools: Optional list of available tools 

34 **kwargs: Additional generation parameters (temperature, max_tokens, etc.) 

35 

36 Returns: 

37 LLM response object 

38 

39 Example: 

40 ```python 

41 response = await strategy.generate( 

42 manager=conversation_manager, 

43 llm=llm_provider, 

44 tools=[search_tool, calculator_tool], 

45 temperature=0.7, 

46 max_tokens=1000 

47 ) 

48 ``` 

49 """ 

50 pass