Documentation
¶
Overview ¶
Package tool provides tools that agents can use to perform various operations.
Index ¶
- func Run(ctx context.Context, t schema.Tool, input *schema.ToolInput, ...) (string, error)
- func ToFunction(t schema.Tool) (*schema.FunctionDefinition, error)
- type CurrentPage
- type ExtractText
- type HuggingFaceInjectionDetector
- func (t *HuggingFaceInjectionDetector) ArgsType() reflect.Type
- func (t *HuggingFaceInjectionDetector) Callbacks() []schema.Callback
- func (t *HuggingFaceInjectionDetector) Description() string
- func (t *HuggingFaceInjectionDetector) Name() string
- func (t *HuggingFaceInjectionDetector) Run(ctx context.Context, input any) (string, error)
- func (t *HuggingFaceInjectionDetector) Verbose() bool
- type HuggingFaceInjectionDetectorClient
- type HuggingFaceInjectionDetectorOptions
- type Human
- type HumanOptions
- type InputFunc
- type NavigateBrowser
- func (t *NavigateBrowser) ArgsType() reflect.Type
- func (t *NavigateBrowser) Callbacks() []schema.Callback
- func (t *NavigateBrowser) Description() string
- func (t *NavigateBrowser) Name() string
- func (t *NavigateBrowser) Run(ctx context.Context, input any) (string, error)
- func (t *NavigateBrowser) Verbose() bool
- type Options
- type PromptFunc
- type Retriever
- type RetrieverOptions
- type Sleep
- type Wikipedia
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
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
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 HuggingFaceInjectionDetector ¶ added in v0.0.65
type HuggingFaceInjectionDetector struct {
// contains filtered or unexported fields
}
HuggingFaceInjectionDetector represents a tool for detecting injection attacks using Hugging Face models.
func NewHuggingFaceInjectionDetector ¶ added in v0.0.65
func NewHuggingFaceInjectionDetector(token string, optFns ...func(o *HuggingFaceInjectionDetectorOptions)) *HuggingFaceInjectionDetector
NewHuggingFaceInjectionDetector creates a new instance of the HuggingFaceInjectionDetector tool.
func NewHuggingFaceInjectionDetectorFromClient ¶ added in v0.0.66
func NewHuggingFaceInjectionDetectorFromClient(client HuggingFaceInjectionDetectorClient, optFns ...func(o *HuggingFaceInjectionDetectorOptions)) *HuggingFaceInjectionDetector
NewHuggingFaceInjectionDetectorFromClient creates a new instance of the HuggingFaceInjectionDetector tool.
func (*HuggingFaceInjectionDetector) ArgsType ¶ added in v0.0.65
func (t *HuggingFaceInjectionDetector) ArgsType() reflect.Type
ArgsType returns the type of the input argument expected by the tool.
func (*HuggingFaceInjectionDetector) Callbacks ¶ added in v0.0.65
func (t *HuggingFaceInjectionDetector) Callbacks() []schema.Callback
Callbacks returns the registered callbacks of the tool.
func (*HuggingFaceInjectionDetector) Description ¶ added in v0.0.65
func (t *HuggingFaceInjectionDetector) Description() string
Description returns the description of the tool.
func (*HuggingFaceInjectionDetector) Name ¶ added in v0.0.65
func (t *HuggingFaceInjectionDetector) Name() string
Name returns the name of the tool.
func (*HuggingFaceInjectionDetector) Run ¶ added in v0.0.65
Run executes the tool with the given input and returns the output.
func (*HuggingFaceInjectionDetector) Verbose ¶ added in v0.0.65
func (t *HuggingFaceInjectionDetector) Verbose() bool
Verbose returns the verbosity setting of the tool.
type HuggingFaceInjectionDetectorClient ¶ added in v0.0.65
type HuggingFaceInjectionDetectorClient interface {
TextClassification(ctx context.Context, req *huggingface.TextClassificationRequest) (huggingface.TextClassificationResponse, error)
}
HuggingFaceInjectionDetectorClient is an interface for interacting with the Hugging Face injection detector.
type HuggingFaceInjectionDetectorOptions ¶ added in v0.0.65
type HuggingFaceInjectionDetectorOptions struct { // Model to use for injection detection. Model string // Threshold for injection detection. Threshold float32 // Options represents optional settings for the classification. Options huggingface.Options }
HuggingFaceInjectionDetectorOptions represents configuration options for the Hugging Face injection detector.
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
ArgsType returns the type of the input argument expected by the tool.
func (*Human) Description ¶ added in v0.0.35
Description returns the description 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 NavigateBrowser ¶ added in v0.0.24
type NavigateBrowser struct {
// contains filtered or unexported fields
}
func NewNavigateBrowser ¶ added in v0.0.24
func NewNavigateBrowser(browser playwright.Browser) *NavigateBrowser
func (*NavigateBrowser) ArgsType ¶ added in v0.0.29
func (t *NavigateBrowser) ArgsType() reflect.Type
ArgsType returns the type of the input argument expected by the tool.
func (*NavigateBrowser) Callbacks ¶ added in v0.0.30
func (t *NavigateBrowser) Callbacks() []schema.Callback
Callbacks returns the registered callbacks of the tool.
func (*NavigateBrowser) Description ¶ added in v0.0.24
func (t *NavigateBrowser) Description() string
Description returns the description of the tool.
func (*NavigateBrowser) Name ¶ added in v0.0.24
func (t *NavigateBrowser) Name() string
Name returns the name of the tool.
func (*NavigateBrowser) Run ¶ added in v0.0.24
Run executes the tool with the given input and returns the output.
func (*NavigateBrowser) Verbose ¶ added in v0.0.30
func (t *NavigateBrowser) Verbose() bool
Verbose returns the verbosity setting of the tool.
type PromptFunc ¶ added in v0.0.35
type PromptFunc = func(query string)
PromptFunc is a function type for displaying a prompt.
type Retriever ¶ added in v0.0.96
type Retriever struct {
// contains filtered or unexported fields
}
Retriever is a tool that utilizes a retriever to fetch documents based on a query.
func NewRetriever ¶ added in v0.0.96
func NewRetriever(retriever schema.Retriever, name, description string, optFns ...func(o *RetrieverOptions)) *Retriever
NewRetriever creates a new Retriever instance using the provided retriever, name, and description, along with optional configuration options.
func (*Retriever) ArgsType ¶ added in v0.0.96
ArgsType returns the type of the input argument expected by the tool.
func (*Retriever) Callbacks ¶ added in v0.0.96
Callbacks returns the registered callbacks of the tool.
func (*Retriever) Description ¶ added in v0.0.96
Description returns the description of the tool.
type RetrieverOptions ¶ added in v0.0.96
type RetrieverOptions struct { *schema.CallbackOptions DocumentSeparator string }
RetrieverOptions contains options for configuring the Retriever tool.
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
ArgsType returns the type of the input argument expected by the tool.
func (*Sleep) Description ¶ added in v0.0.15
Description returns the description 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
ArgsType returns the type of the input argument expected by the tool.
func (*Wikipedia) Callbacks ¶ added in v0.0.30
Callbacks returns the registered callbacks of the tool.
func (*Wikipedia) Description ¶
Description returns the description of the tool.