agents

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

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

Executor is the chain responsible for running agents.

func NewExecutor

func NewExecutor(agent llm.Agent, opts ...Option) *Executor

NewExecutor creates a new agent executor with an agent and the tools the agent can use.

func (*Executor) AgentHooks

func (e *Executor) AgentHooks() llm.AgentHooks

func (*Executor) Call

func (e *Executor) Call(ctx context.Context, inputValues map[string]any, _ ...llm.ChainOption) (map[string]any, error)

func (*Executor) InputKeys

func (e *Executor) InputKeys() []string

GetInputKeys gets the input keys the agent of the executor expects. Often "input".

func (*Executor) Memory

func (e *Executor) Memory() llm.Memory

func (*Executor) OutputKeys

func (e *Executor) OutputKeys() []string

OutputKeys gets the output keys the agent of the executor returns.

type Option

type Option func(*Options)

Option is a function type that can be used to modify the creation of the agents and executors.

func WithHooks

func WithHooks(hooks llm.Hooks) Option

WithHooks is an option for setting a callback handler to an executor.

func WithMaxIterations

func WithMaxIterations(maxIterations int) Option

WithMaxIterations is an option for setting the max number of iterations the executor will complete.

func WithMemory

func WithMemory(m llm.Memory) Option

WithMemory is an option for setting the memory of the executor.

func WithOutputKey

func WithOutputKey(outputKey string) Option

WithOutputKey is an option for setting the output key of the agent.

func WithParserErrorHandler

func WithParserErrorHandler(errorHandler *llm.ParserErrorHandler) Option

WithParserErrorHandler is an option for setting a parser error handler to an executor.

func WithPromptFormatInstructions

func WithPromptFormatInstructions(formatInstructions string) Option

WithPromptFormatInstructions is an option for setting the format instructions of the prompt used by the agent.

func WithPromptPrefix

func WithPromptPrefix(promptPrefix string) Option

WithPromptPrefix is an option for setting the prefix of the prompt used by the agent.

func WithPromptSuffix

func WithPromptSuffix(suffix string) Option

WithPromptSuffix is an option for setting the suffix of the prompt used by the agent.

func WithReturnIntermediateSteps

func WithReturnIntermediateSteps() Option

WithReturnIntermediateSteps is an option for making the executor return the intermediate steps taken.

func WithTemplate

func WithTemplate(template llm.Template) Option

WithTemplate is an option for setting the prompt template the agent will use.

type Options

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

Jump to

Keyboard shortcuts

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