Documentation
¶
Index ¶
- type ChainOfThought
- func (c *ChainOfThought) Clone() core.Module
- func (c *ChainOfThought) Compose(next core.Module) core.Module
- func (c *ChainOfThought) GetSignature() core.Signature
- func (c *ChainOfThought) GetSubModules() []core.Module
- func (c *ChainOfThought) Process(ctx context.Context, inputs map[string]any, opts ...core.Option) (map[string]any, error)
- func (c *ChainOfThought) SetLLM(llm core.LLM)
- func (c *ChainOfThought) SetSubModules(modules []core.Module)
- func (c *ChainOfThought) WithDefaultOptions(opts ...core.Option) *ChainOfThought
- type Module
- type Predict
- func (p *Predict) Clone() core.Module
- func (p *Predict) FormatOutputs(outputs map[string]interface{}) map[string]interface{}
- func (p *Predict) GetDemos() []core.Example
- func (p *Predict) GetSignature() core.Signature
- func (p *Predict) Process(ctx context.Context, inputs map[string]interface{}, opts ...core.Option) (map[string]interface{}, error)
- func (p *Predict) SetDemos(demos []core.Example)
- func (p *Predict) SetLLM(llm core.LLM)
- func (p *Predict) ValidateInputs(inputs map[string]interface{}) error
- func (p *Predict) WithDefaultOptions(opts ...core.Option) *Predict
- type ReAct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainOfThought ¶
type ChainOfThought struct {
Predict *Predict
}
func NewChainOfThought ¶
func NewChainOfThought(signature core.Signature) *ChainOfThought
func (*ChainOfThought) Clone ¶
func (c *ChainOfThought) Clone() core.Module
func (*ChainOfThought) Compose ¶ added in v0.1.0
func (c *ChainOfThought) Compose(next core.Module) core.Module
func (*ChainOfThought) GetSignature ¶
func (c *ChainOfThought) GetSignature() core.Signature
func (*ChainOfThought) GetSubModules ¶ added in v0.1.0
func (c *ChainOfThought) GetSubModules() []core.Module
func (*ChainOfThought) SetLLM ¶
func (c *ChainOfThought) SetLLM(llm core.LLM)
func (*ChainOfThought) SetSubModules ¶ added in v0.1.0
func (c *ChainOfThought) SetSubModules(modules []core.Module)
func (*ChainOfThought) WithDefaultOptions ¶ added in v0.17.1
func (c *ChainOfThought) WithDefaultOptions(opts ...core.Option) *ChainOfThought
WithDefaultOptions sets default options by configuring the underlying Predict module.
type Predict ¶
type Predict struct {
core.BaseModule
Demos []core.Example
LLM core.LLM
// contains filtered or unexported fields
}
func NewPredict ¶
func (*Predict) FormatOutputs ¶
func (*Predict) GetSignature ¶
func (*Predict) ValidateInputs ¶
type ReAct ¶
type ReAct struct {
core.BaseModule
Predict *Predict
Tools []core.Tool
MaxIters int
// contains filtered or unexported fields
}
ReAct implements the ReAct agent loop (Reason, Action, Observation). It uses a Predict module to generate thoughts and actions, and executes tools.
func NewReAct ¶
NewReAct creates a new ReAct module. It takes a signature (which it modifies), a list of tools, and max iterations.
func (*ReAct) Clone ¶
Clone creates a copy of the ReAct module. Note: Tools and the Predict module are cloned, but the LLM instance is shared.
func (*ReAct) Process ¶
func (r *ReAct) Process(ctx context.Context, inputs map[string]any, opts ...core.Option) (map[string]any, error)
Process executes the ReAct loop.
Click to show internal directories.
Click to hide internal directories.