tool

package
v0.0.40 Latest Latest
Warning

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

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

Documentation

Overview

Package tool provides tools that agents can use to perform various operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run added in v0.0.23

func Run(ctx context.Context, t schema.Tool, input *schema.ToolInput, optFns ...func(o *Options)) (string, error)

func ToFunction added in v0.0.26

func ToFunction(t schema.Tool) (*schema.FunctionDefinition, error)

ToFunction formats a tool into a function API

Types

type CurrentPage added in v0.0.24

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

func NewCurrentPage added in v0.0.24

func NewCurrentPage(browser playwright.Browser) *CurrentPage

func (*CurrentPage) ArgsType added in v0.0.29

func (t *CurrentPage) ArgsType() reflect.Type

ArgsType returns the type of the input argument expected by the tool.

func (*CurrentPage) Callbacks added in v0.0.30

func (t *CurrentPage) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the tool.

func (*CurrentPage) Description added in v0.0.24

func (t *CurrentPage) Description() string

Description returns the description of the tool.

func (*CurrentPage) Name added in v0.0.24

func (t *CurrentPage) Name() string

Name returns the name of the tool.

func (*CurrentPage) Run added in v0.0.24

func (t *CurrentPage) Run(ctx context.Context, input any) (string, error)

Run executes the tool with the given input and returns the output.

func (*CurrentPage) Verbose added in v0.0.30

func (t *CurrentPage) Verbose() bool

Verbose returns the verbosity setting of the tool.

type ExtractText added in v0.0.24

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

func NewExtractText added in v0.0.24

func NewExtractText(browser playwright.Browser) *ExtractText

func (*ExtractText) ArgsType added in v0.0.29

func (t *ExtractText) ArgsType() reflect.Type

ArgsType returns the type of the input argument expected by the tool.

func (*ExtractText) Callbacks added in v0.0.30

func (t *ExtractText) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the tool.

func (*ExtractText) Description added in v0.0.24

func (t *ExtractText) Description() string

Description returns the description of the tool.

func (*ExtractText) Name added in v0.0.24

func (t *ExtractText) Name() string

Name returns the name of the tool.

func (*ExtractText) Run added in v0.0.24

func (t *ExtractText) Run(ctx context.Context, input any) (string, error)

Run executes the tool with the given input and returns the output.

func (*ExtractText) Verbose added in v0.0.30

func (t *ExtractText) Verbose() bool

Verbose returns the verbosity setting of the tool.

type Human added in v0.0.35

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

Human is a tool that allows interaction with a human user.

func NewHuman added in v0.0.35

func NewHuman(optFns ...func(o *HumanOptions)) *Human

NewHuman creates a new instance of the Human tool with the provided options.

func (*Human) ArgsType added in v0.0.35

func (t *Human) ArgsType() reflect.Type

ArgsType returns the type of the input argument expected by the tool.

func (*Human) Callbacks added in v0.0.35

func (t *Human) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the tool.

func (*Human) Description added in v0.0.35

func (t *Human) Description() string

Description returns the description of the tool.

func (*Human) Name added in v0.0.35

func (t *Human) Name() string

Name returns the name of the tool.

func (*Human) Run added in v0.0.35

func (t *Human) Run(ctx context.Context, input any) (string, error)

Run executes the tool with the given input and returns the output.

func (*Human) Verbose added in v0.0.35

func (t *Human) Verbose() bool

Verbose returns the verbosity setting of the tool.

type HumanOptions added in v0.0.35

type HumanOptions struct {
	// Function for displaying prompts.
	PromptFunc PromptFunc

	// Function for retrieving user input.
	InputFunc InputFunc
}

HumanOptions contains options for configuring the Human tool.

type InputFunc added in v0.0.35

type InputFunc = func() (string, error)

InputFunc is a function type for retrieving user input.

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

func NewNavigateBrowser added in v0.0.24

func NewNavigateBrowser(browser playwright.Browser) *NavigateBrowser
func (t *NavigateBrowser) ArgsType() reflect.Type

ArgsType returns the type of the input argument expected by the tool.

func (t *NavigateBrowser) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the tool.

func (t *NavigateBrowser) Description() string

Description returns the description of the tool.

func (t *NavigateBrowser) Name() string

Name returns the name of the tool.

func (t *NavigateBrowser) Run(ctx context.Context, input any) (string, error)

Run executes the tool with the given input and returns the output.

func (t *NavigateBrowser) Verbose() bool

Verbose returns the verbosity setting of the tool.

type Options added in v0.0.23

type Options struct {
	Callbacks   []schema.Callback
	ParentRunID string
}

type PromptFunc added in v0.0.35

type PromptFunc = func(query string)

PromptFunc is a function type for displaying a prompt.

type Sleep added in v0.0.15

type Sleep struct{}

Sleep is a tool that makes the agent sleep for a specified number of seconds.

func NewSleep added in v0.0.15

func NewSleep() *Sleep

NewSleep creates a new instance of the Sleep tool.

func (*Sleep) ArgsType added in v0.0.29

func (t *Sleep) ArgsType() reflect.Type

ArgsType returns the type of the input argument expected by the tool.

func (*Sleep) Callbacks added in v0.0.30

func (t *Sleep) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the tool.

func (*Sleep) Description added in v0.0.15

func (t *Sleep) Description() string

Description returns the description of the tool.

func (*Sleep) Name added in v0.0.15

func (t *Sleep) Name() string

Name returns the name of the tool.

func (*Sleep) Run added in v0.0.15

func (t *Sleep) Run(ctx context.Context, input any) (string, error)

Run executes the tool with the given input and returns the output.

func (*Sleep) Verbose added in v0.0.30

func (t *Sleep) Verbose() bool

Verbose returns the verbosity setting of the tool.

type Wikipedia

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

func NewWikipedia

func NewWikipedia(client *integration.Wikipedia) *Wikipedia

func (*Wikipedia) ArgsType added in v0.0.29

func (t *Wikipedia) ArgsType() reflect.Type

ArgsType returns the type of the input argument expected by the tool.

func (*Wikipedia) Callbacks added in v0.0.30

func (t *Wikipedia) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the tool.

func (*Wikipedia) Description

func (t *Wikipedia) Description() string

Description returns the description of the tool.

func (*Wikipedia) Name

func (t *Wikipedia) Name() string

Name returns the name of the tool.

func (*Wikipedia) Run

func (t *Wikipedia) Run(ctx context.Context, input any) (string, error)

Run executes the tool with the given input and returns the output.

func (*Wikipedia) Verbose added in v0.0.30

func (t *Wikipedia) Verbose() bool

Verbose returns the verbosity setting of the tool.

Jump to

Keyboard shortcuts

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