modules

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Index

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) Process

func (c *ChainOfThought) Process(ctx context.Context, inputs map[string]any) (map[string]any, error)

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)

type Module

type Module interface {
	Forward(inputs map[string]interface{}) (Predict, error)
}

type Predict

type Predict struct {
	core.BaseModule
	Demos []core.Example
	LLM   core.LLM
}

func NewPredict

func NewPredict(signature core.Signature) *Predict

func (*Predict) Clone

func (p *Predict) Clone() core.Module

func (*Predict) FormatOutputs

func (p *Predict) FormatOutputs(outputs map[string]interface{}) map[string]interface{}

func (*Predict) GetDemos

func (p *Predict) GetDemos() []core.Example

func (*Predict) GetSignature

func (p *Predict) GetSignature() core.Signature

func (*Predict) Process

func (p *Predict) Process(ctx context.Context, inputs map[string]interface{}) (map[string]interface{}, error)

func (*Predict) SetDemos

func (p *Predict) SetDemos(demos []core.Example)

func (*Predict) SetLLM

func (p *Predict) SetLLM(llm core.LLM)

func (*Predict) ValidateInputs

func (p *Predict) ValidateInputs(inputs map[string]interface{}) error

type ReAct

type ReAct struct {
	core.BaseModule
	Predict  *Predict
	Tools    []Tool
	MaxIters int
}

func NewReAct

func NewReAct(signature core.Signature, tools []Tool, maxIters int) *ReAct

func (*ReAct) Clone

func (r *ReAct) Clone() core.Module

func (*ReAct) Process

func (r *ReAct) Process(ctx context.Context, inputs map[string]any) (map[string]any, error)

func (*ReAct) SetLLM

func (r *ReAct) SetLLM(llm core.LLM)

type Tool

type Tool interface {
	CanHandle(action string) bool
	Execute(ctx context.Context, action string) (string, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL