agent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToolToFunctionDefinition added in v0.2.0

func ConvertToolToFunctionDefinition(tools []tool.Tool) []llm.Tool

func NewSopAgent

func NewSopAgent(opts ...Option) (schema.Agent, error)

func NewWatcherAgent

func NewWatcherAgent(opts ...Option) (schema.Agent, error)

Types

type BaseAgent

type BaseAgent struct {
	MaxIterations int
	// contains filtered or unexported fields
}

func NewBaseAgent

func NewBaseAgent(opts ...Option) (*BaseAgent, error)

func (*BaseAgent) Description

func (ba *BaseAgent) Description() string

func (*BaseAgent) Env

func (ba *BaseAgent) Env() schema.Environment

func (*BaseAgent) Name

func (ba *BaseAgent) Name() string

func (*BaseAgent) Plan

func (*BaseAgent) Run

func (ba *BaseAgent) Run(ctx context.Context,
	messages []schema.Message, opts ...llm.GenerateOption) (*schema.Generation, error)

func (*BaseAgent) Tools

func (ba *BaseAgent) Tools() []tool.Tool

func (*BaseAgent) WithEnv

func (ba *BaseAgent) WithEnv(env schema.Environment)

type Option

type Option func(opt *Options)

func WithCallback

func WithCallback(callback callback.Handler) Option

func WithDesc

func WithDesc(desc string) Option

func WithEnv

func WithEnv(env schema.Environment) Option

func WithFeedbacks

func WithFeedbacks(feedbacks ...feedback.Feedback) Option

func WithFilterMemoryFunc

func WithFilterMemoryFunc(fun func([]schema.Message) []schema.Message) Option

func WithInstruction

func WithInstruction(instruction string) Option

func WithLLM

func WithLLM(LLM llm.LLM) Option

func WithMaxIterations

func WithMaxIterations(maxIterations int) Option

func WithName

func WithName(name string) Option

func WithParseOutputFunc

func WithParseOutputFunc(fun func(string, *llm.Generation) ([]schema.StepAction, []schema.Message, error)) Option

func WithPrompt

func WithPrompt(prompt string) Option

func WithRole

func WithRole(role string) Option

func WithSuffix

func WithSuffix(suffix string) Option

func WithTools

func WithTools(actions []tool.Tool) Option

func WithUseFunctionCall added in v0.2.0

func WithUseFunctionCall(useFunctionCall bool) Option

func WithVars

func WithVars(k, v string) Option

type Options

type Options struct {
	LLM   llm.LLM
	Tools []tool.Tool

	FeedbackChain    feedback.Feedback
	Env              schema.Environment
	Callback         callback.Handler
	FilterMemoryFunc func([]schema.Message) []schema.Message
	ParseOutputFunc  func(string, *llm.Generation) ([]schema.StepAction, []schema.Message, error)
	Vars             map[string]string

	MaxIterations int
	// contains filtered or unexported fields
}

type UserProxyAgent

type UserProxyAgent struct {
	// contains filtered or unexported fields
}

func NewUserProxy

func NewUserProxy(name, desc string, command bool) *UserProxyAgent

func (*UserProxyAgent) Description

func (a *UserProxyAgent) Description() string

func (*UserProxyAgent) Env

func (*UserProxyAgent) Name

func (a *UserProxyAgent) Name() string

func (*UserProxyAgent) Run

func (a *UserProxyAgent) Run(ctx context.Context, messages []schema.Message, opts ...llm.GenerateOption) (*schema.Generation, error)

func (*UserProxyAgent) Tools

func (a *UserProxyAgent) Tools() []tool.Tool

func (*UserProxyAgent) WithEnv

func (a *UserProxyAgent) WithEnv(_ schema.Environment)

Jump to

Keyboard shortcuts

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