tools

package
v0.0.0-...-f179465 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotAutoConvertArgSchema = fmt.Errorf("cannot auto-convert arg schema")
)
View Source
var ErrMaxRetriesExceeded = fmt.Errorf("max retries exceeded")

Functions

func ConvertToNativeFunctionSpecs

func ConvertToNativeFunctionSpecs(tool Tool) (engines.FunctionSpecs, error)

Types

type AskUser

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

func NewAskUser

func NewAskUser() *AskUser

func NewAskUserWithSource

func NewAskUserWithSource(source io.Reader) *AskUser

func (*AskUser) ArgsSchema

func (b *AskUser) ArgsSchema() json.RawMessage

func (*AskUser) CompactArgs

func (b *AskUser) CompactArgs(args json.RawMessage) json.RawMessage

func (*AskUser) Description

func (b *AskUser) Description() string

func (*AskUser) Execute

func (b *AskUser) Execute(args json.RawMessage) (json.RawMessage, error)

func (*AskUser) Name

func (b *AskUser) Name() string

func (*AskUser) WithCustomQuestionHandler

func (b *AskUser) WithCustomQuestionHandler(handler func(question string) (string, error)) *AskUser

type BashTerminal

type BashTerminal struct {
}

func NewBashTerminal

func NewBashTerminal() *BashTerminal

func (*BashTerminal) ArgsSchema

func (b *BashTerminal) ArgsSchema() json.RawMessage

func (*BashTerminal) CompactArgs

func (b *BashTerminal) CompactArgs(args json.RawMessage) json.RawMessage

func (*BashTerminal) Description

func (b *BashTerminal) Description() string

func (*BashTerminal) Execute

func (b *BashTerminal) Execute(args json.RawMessage) (json.RawMessage, error)

func (*BashTerminal) Name

func (b *BashTerminal) Name() string

type GenericTool

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

func NewGenericTool

func NewGenericTool(name, description string, argSchema json.RawMessage, handler func(args json.RawMessage) (json.RawMessage, error)) *GenericTool

func (*GenericTool) ArgsSchema

func (b *GenericTool) ArgsSchema() json.RawMessage

func (*GenericTool) CompactArgs

func (b *GenericTool) CompactArgs(args json.RawMessage) json.RawMessage

func (*GenericTool) Description

func (b *GenericTool) Description() string

func (*GenericTool) Execute

func (b *GenericTool) Execute(args json.RawMessage) (json.RawMessage, error)

func (*GenericTool) Name

func (b *GenericTool) Name() string

type IsolatedPythonREPL

type IsolatedPythonREPL struct {
}

func NewIsolatedPythonREPL

func NewIsolatedPythonREPL() *IsolatedPythonREPL

func (*IsolatedPythonREPL) ArgsSchema

func (repl *IsolatedPythonREPL) ArgsSchema() json.RawMessage

func (*IsolatedPythonREPL) CompactArgs

func (repl *IsolatedPythonREPL) CompactArgs(args json.RawMessage) json.RawMessage

func (*IsolatedPythonREPL) Description

func (repl *IsolatedPythonREPL) Description() string

func (*IsolatedPythonREPL) Execute

func (repl *IsolatedPythonREPL) Execute(arg json.RawMessage) (json.RawMessage, error)

func (*IsolatedPythonREPL) Name

func (repl *IsolatedPythonREPL) Name() string

type JSONAutoFixer

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

func NewJSONAutoFixer

func NewJSONAutoFixer(engine engines.LLM, maxRetries int) *JSONAutoFixer

func (*JSONAutoFixer) Process

func (t *JSONAutoFixer) Process(args json.RawMessage) (json.RawMessage, error)

type KeyValueStore

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

func NewKeyValueStore

func NewKeyValueStore() *KeyValueStore

func (*KeyValueStore) ArgsSchema

func (s *KeyValueStore) ArgsSchema() json.RawMessage

func (*KeyValueStore) CompactArgs

func (s *KeyValueStore) CompactArgs(args json.RawMessage) json.RawMessage

func (*KeyValueStore) Description

func (s *KeyValueStore) Description() string

func (*KeyValueStore) Execute

func (s *KeyValueStore) Execute(args json.RawMessage) (json.RawMessage, error)

func (*KeyValueStore) Name

func (s *KeyValueStore) Name() string

func (*KeyValueStore) Process

func (s *KeyValueStore) Process(args json.RawMessage) (json.RawMessage, error)

type PreprocessingTool

type PreprocessingTool interface {
	// Preprocesses the arguments before
	// they are passed to any tool.
	Process(args json.RawMessage) (json.RawMessage, error)
}

type PythonREPL

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

func NewPythonREPL

func NewPythonREPL() *PythonREPL

func NewPythonREPLWithCustomBinary

func NewPythonREPLWithCustomBinary(pythonBinary string) *PythonREPL

func (*PythonREPL) ArgsSchema

func (p *PythonREPL) ArgsSchema() json.RawMessage

func (*PythonREPL) CompactArgs

func (p *PythonREPL) CompactArgs(args json.RawMessage) json.RawMessage

func (*PythonREPL) Description

func (p *PythonREPL) Description() string

func (*PythonREPL) Execute

func (p *PythonREPL) Execute(args json.RawMessage) (json.RawMessage, error)

func (*PythonREPL) Name

func (p *PythonREPL) Name() string

type SearchResult

type SearchResult struct {
	Title string
	URL   string
}

type Tool

type Tool interface {
	// Executes the tool with the given
	// arguments. If the arguments are
	// invalid, an error should be returned
	// which will be displayed to the agent.
	Execute(args json.RawMessage) (json.RawMessage, error)
	// The name of the tool, as it will be
	// displayed to the agent.
	Name() string
	// A short description of the tool, as
	// it will be displayed to the agent.
	Description() string
	// A 'fuzzy schema' of the arguments
	// that the tool expects. This is used
	// to instruct the agent on how to
	// generate the arguments.
	ArgsSchema() json.RawMessage
	// Generates a compact representation
	// of the arguments, to be used in the
	// agent's memory.
	CompactArgs(args json.RawMessage) json.RawMessage
}

type WebSearch

type WebSearch struct {
	ServiceURL string
}

func NewGoogleSearch

func NewGoogleSearch() *WebSearch

func NewWebSearch

func NewWebSearch(serviceURL string) *WebSearch

func (*WebSearch) ArgsSchema

func (ws *WebSearch) ArgsSchema() json.RawMessage

func (*WebSearch) CompactArgs

func (ws *WebSearch) CompactArgs(args json.RawMessage) json.RawMessage

func (*WebSearch) Description

func (ws *WebSearch) Description() string

func (*WebSearch) Execute

func (ws *WebSearch) Execute(args json.RawMessage) (json.RawMessage, error)

func (*WebSearch) Name

func (ws *WebSearch) Name() string

type WebpageSummary

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

func NewWebpageSummary

func NewWebpageSummary(model engines.LLM) *WebpageSummary

func (*WebpageSummary) ArgsSchema

func (w *WebpageSummary) ArgsSchema() json.RawMessage

func (*WebpageSummary) CompactArgs

func (w *WebpageSummary) CompactArgs(args json.RawMessage) json.RawMessage

func (*WebpageSummary) Description

func (w *WebpageSummary) Description() string

func (*WebpageSummary) Execute

func (w *WebpageSummary) Execute(args json.RawMessage) (json.RawMessage, error)

func (*WebpageSummary) Name

func (w *WebpageSummary) Name() string

type WolframAlpha

type WolframAlpha struct {
	ServiceURL string
	AppID      string
}

func NewWolframAlpha

func NewWolframAlpha(appID string) *WolframAlpha

func NewWolframAlphaWithServiceURL

func NewWolframAlphaWithServiceURL(serviceURL, appID string) *WolframAlpha

func (*WolframAlpha) ArgsSchema

func (wa *WolframAlpha) ArgsSchema() json.RawMessage

func (*WolframAlpha) CompactArgs

func (wa *WolframAlpha) CompactArgs(args json.RawMessage) json.RawMessage

func (*WolframAlpha) Description

func (wa *WolframAlpha) Description() string

func (*WolframAlpha) Execute

func (wa *WolframAlpha) Execute(args json.RawMessage) (json.RawMessage, error)

func (*WolframAlpha) Name

func (wa *WolframAlpha) Name() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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