ReasoningStrategyBase<T>
Base Classes · AiDotNet.Reasoning
Abstract base class for reasoning strategies that solve problems through structured thinking. Provides common functionality for all reasoning approaches.
Implements: IReasoningStrategy<T>
Known derived types: ChainOfThoughtStrategy<T>, SelfConsistencyStrategy<T>, TreeOfThoughtsStrategy<T>
For Beginners
This base class is like a template for creating different types of reasoning strategies. Just like AgentBase provides common functionality for all agents, ReasoningStrategyBase provides the shared foundation that all reasoning strategies need:
- Managing the language model (the “brain”)
- Tracking tools that can be used
- Recording the reasoning process
- Handling configuration and timing
Specific reasoning strategies (Chain-of-Thought, Tree-of-Thoughts, etc.) inherit from this class and implement their unique reasoning logic while getting all the common features for free.
This follows the Template Method design pattern, where the base class defines the structure and derived classes fill in the specific details.
How It Works
Example Usage:
Properties
| Property | Summary |
|---|---|
string Description { get; } |
|
string StrategyName { get; } |
Methods
| Method | Summary |
|---|---|
Task<ReasoningResult<T>> ReasonAsync(string query, ReasoningConfig config, CancellationToken cancellationToken) |