agent

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package agent provides functionality for creating and managing agents that leverage Large Language Models (LLMs) to make informed decisions and take actions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownAgentType       = errors.New("unknown agent type")
	ErrAgentNoReturn          = errors.New("no actions or finish was returned by the agent")
	ErrNotFinished            = errors.New("agent not finished before max iterations")
	ErrInputNotString         = errors.New("input is not a string")
	ErrInvalidChainReturnType = errors.New("agent chain did not return a string")
	ErrUnableToParseOutput    = errors.New("unable to parse agent output")
)

Functions

This section is empty.

Types

type ConversationalReactDescription added in v0.0.15

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

func (*ConversationalReactDescription) InputKeys added in v0.0.15

func (a *ConversationalReactDescription) InputKeys() []string

func (*ConversationalReactDescription) OutputKeys added in v0.0.15

func (a *ConversationalReactDescription) OutputKeys() []string

func (*ConversationalReactDescription) Plan added in v0.0.15

func (a *ConversationalReactDescription) Plan(ctx context.Context, intermediateSteps []schema.AgentStep, inputs map[string]string) ([]*schema.AgentAction, *schema.AgentFinish, error)

type ConversationalReactDescriptionOptions added in v0.0.15

type ConversationalReactDescriptionOptions struct {
	Prefix       string
	Instructions string
	Suffix       string
	AIPrefix     string
	OutputKey    string
}

type Executor

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

Executor represents an agent executor that executes a chain of actions based on inputs and a defined agent model.

func NewConversationalReactDescription added in v0.0.15

func NewConversationalReactDescription(llm schema.Model, tools []schema.Tool) (*Executor, error)

func NewExecutor

func NewExecutor(agent schema.Agent, tools []schema.Tool) (*Executor, error)

NewExecutor creates a new instance of the Executor with the given agent and a list of available tools.

func NewOpenAIFunctions added in v0.0.27

func NewOpenAIFunctions(model schema.Model, tools []schema.Tool) (*Executor, error)

func NewReactDescription added in v0.0.24

func NewReactDescription(llm schema.Model, tools []schema.Tool) (*Executor, error)

func (Executor) Call added in v0.0.4

func (e Executor) Call(ctx context.Context, values schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)

Call executes the AgentExecutor chain with the given context and inputs. It returns the outputs of the chain or an error, if any.

func (Executor) Callbacks added in v0.0.13

func (e Executor) Callbacks() []schema.Callback

Callbacks returns the callbacks associated with the chain.

func (Executor) InputKeys

func (e Executor) InputKeys() []string

InputKeys returns the expected input keys.

func (Executor) Memory added in v0.0.13

func (e Executor) Memory() schema.Memory

Memory returns the memory associated with the chain.

func (Executor) OutputKeys

func (e Executor) OutputKeys() []string

OutputKeys returns the output keys the chain will return.

func (Executor) Type added in v0.0.13

func (e Executor) Type() string

Type returns the type of the chain.

func (Executor) Verbose added in v0.0.13

func (e Executor) Verbose() bool

Verbose returns the verbosity setting of the chain.

type ExecutorOptions added in v0.0.4

type ExecutorOptions struct {
	*schema.CallbackOptions
	MaxIterations int
	Memory        schema.Memory
}

ExecutorOptions holds configuration options for the Executor.

type OpenAIFunctions added in v0.0.27

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

func (*OpenAIFunctions) InputKeys added in v0.0.27

func (a *OpenAIFunctions) InputKeys() []string

func (*OpenAIFunctions) OutputKeys added in v0.0.27

func (a *OpenAIFunctions) OutputKeys() []string

func (*OpenAIFunctions) Plan added in v0.0.27

func (a *OpenAIFunctions) Plan(ctx context.Context, intermediateSteps []schema.AgentStep, inputs map[string]string) ([]*schema.AgentAction, *schema.AgentFinish, error)

type OpenAIFunctionsOptions added in v0.0.27

type OpenAIFunctionsOptions struct {
	OutputKey string
}

type ReactDescription added in v0.0.24

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

func (*ReactDescription) InputKeys added in v0.0.24

func (a *ReactDescription) InputKeys() []string

func (*ReactDescription) OutputKeys added in v0.0.24

func (a *ReactDescription) OutputKeys() []string

func (*ReactDescription) Plan added in v0.0.24

func (a *ReactDescription) Plan(ctx context.Context, intermediateSteps []schema.AgentStep, inputs map[string]string) ([]*schema.AgentAction, *schema.AgentFinish, error)

type ReactDescriptionOptions added in v0.0.24

type ReactDescriptionOptions struct {
	Prefix       string
	Instructions string
	Suffix       string
	OutputKey    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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