Coverage for src/dataknobs_bots/reasoning/simple.py: 80%

1"""Simple reasoning strategy - direct LLM call."""

2

3 from typing import Any

4

5 from .base import ReasoningStrategy

6

7

8 class SimpleReasoning(ReasoningStrategy):

9 """Simple reasoning strategy that makes direct LLM calls.

10

11 This is the most straightforward strategy - it simply passes

12 the conversation to the LLM and returns the response without

13 any additional reasoning steps.

14

15 Use this when:

16 - You want direct, fast responses

17 - The task doesn't require complex reasoning

18 - You're using a powerful model that doesn't need guidance

19

20 Example:

21 ```python

22 strategy = SimpleReasoning()

23 response = await strategy.generate(

24 manager=conversation_manager,

25 llm=llm_provider,

26 temperature=0.7

27 )

28 ```

29 """

30

31 async def generate(

32 self,

33 manager: Any,

34 llm: Any,

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

36 **kwargs: Any,

37 ) -> Any:

38 """Generate response with a simple LLM call.

39

40 Args:

41 manager: ConversationManager instance

42 llm: LLM provider instance (not used directly)

43 tools: Optional list of tools

44 **kwargs: Generation parameters

45

46 Returns:

47 LLM response

48 """

49 # Use the conversation manager's generate method

50 # which handles the LLM call with the conversation history

51 return await manager.complete(tools=tools, **kwargs)