Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CoTAgent ¶
type CoTAgent struct {
*base.BaseReasoningAgent
// contains filtered or unexported fields
}
CoTAgent implements Chain-of-Thought reasoning pattern.
Chain-of-Thought (CoT) prompts the model to break down complex problems into intermediate reasoning steps, making the problem-solving process more transparent and accurate. This agent: - Encourages step-by-step reasoning - Shows intermediate calculations and logic - Improves accuracy on complex tasks - Provides interpretable reasoning traces
func NewCoTAgent ¶
NewCoTAgent creates a new Chain-of-Thought agent
type CoTConfig ¶
type CoTConfig struct {
Name string // Agent name
Description string // Agent description
LLM llm.Client // LLM client
Tools []interfaces.Tool // Available tools (optional)
MaxSteps int // Maximum reasoning steps
// CoT-specific settings
ShowStepNumbers bool // Show step numbers in reasoning
RequireJustification bool // Require justification for each step
FinalAnswerFormat string // Format for final answer
ExampleFormat string // Example CoT format to show model
// Prompting strategy
ZeroShot bool // Use zero-shot CoT ("Let's think step by step")
FewShot bool // Use few-shot CoT with examples
FewShotExamples []CoTExample // Examples for few-shot learning
}
CoTConfig configuration for Chain-of-Thought agent
type CoTExample ¶
CoTExample represents an example for few-shot Chain-of-Thought
type CoTStrategy ¶ added in v0.5.0
type CoTStrategy struct {
// contains filtered or unexported fields
}
CoTStrategy CoT推理策略实现
func (*CoTStrategy) Execute ¶ added in v0.5.0
func (s *CoTStrategy) Execute( ctx context.Context, input *agentcore.AgentInput, llmClient llm.Client, tools []interfaces.Tool, toolsByName map[string]interfaces.Tool, output *agentcore.AgentOutput, ) (result interface{}, err error)
Execute 实现ReasoningStrategy接口
func (*CoTStrategy) ExecuteWithGenerator ¶ added in v0.5.0
func (s *CoTStrategy) ExecuteWithGenerator( ctx context.Context, input *agentcore.AgentInput, llmClient llm.Client, tools []interfaces.Tool, toolsByName map[string]interfaces.Tool, output *agentcore.AgentOutput, yield func(*agentcore.AgentOutput, error) bool, startTime time.Time, ) (result interface{}, err error)
ExecuteWithGenerator 实现Generator模式执行(可选)