Documentation
¶
Index ¶
- type CoTAgent
- func (c *CoTAgent) Invoke(ctx context.Context, input *agentcore.AgentInput) (*agentcore.AgentOutput, error)
- func (c *CoTAgent) Stream(ctx context.Context, input *agentcore.AgentInput) (<-chan agentcore.StreamChunk[*agentcore.AgentOutput], error)
- func (c *CoTAgent) WithCallbacks(callbacks ...agentcore.Callback) agentcore.Runnable[*agentcore.AgentInput, *agentcore.AgentOutput]
- func (c *CoTAgent) WithConfig(config agentcore.RunnableConfig) agentcore.Runnable[*agentcore.AgentInput, *agentcore.AgentOutput]
- type CoTConfig
- type CoTExample
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CoTAgent ¶
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
func (*CoTAgent) Invoke ¶
func (c *CoTAgent) Invoke(ctx context.Context, input *agentcore.AgentInput) (*agentcore.AgentOutput, error)
Invoke executes the Chain-of-Thought reasoning
func (*CoTAgent) Stream ¶
func (c *CoTAgent) Stream(ctx context.Context, input *agentcore.AgentInput) (<-chan agentcore.StreamChunk[*agentcore.AgentOutput], error)
Stream executes Chain-of-Thought with streaming
func (*CoTAgent) WithCallbacks ¶
func (c *CoTAgent) WithCallbacks(callbacks ...agentcore.Callback) agentcore.Runnable[*agentcore.AgentInput, *agentcore.AgentOutput]
WithCallbacks adds callback handlers
func (*CoTAgent) WithConfig ¶
func (c *CoTAgent) WithConfig(config agentcore.RunnableConfig) agentcore.Runnable[*agentcore.AgentInput, *agentcore.AgentOutput]
WithConfig configures the 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