tools

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddImageTool

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

AddImageTool allows agents to add images to their context

func NewAddImageTool

func NewAddImageTool(workDir string) *AddImageTool

NewAddImageTool creates a new add image tool instance

func (*AddImageTool) Description

func (t *AddImageTool) Description() string

func (*AddImageTool) Execute

func (t *AddImageTool) Execute(input string) (string, error)

func (*AddImageTool) Name

func (t *AddImageTool) Name() string

func (*AddImageTool) Parameters

func (t *AddImageTool) Parameters() map[string]core.ParameterDefinition

type BaseTool

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

BaseTool provides a base implementation of the Tool interface

func NewBaseTool

func NewBaseTool(name, description string) *BaseTool

NewBaseTool creates a new BaseTool instance

func (*BaseTool) Description

func (t *BaseTool) Description() string

Description returns a description of what the tool does

func (*BaseTool) Execute

func (t *BaseTool) Execute(input string) (string, error)

Execute executes the tool with the given input

func (*BaseTool) Name

func (t *BaseTool) Name() string

Name returns the name of the tool

func (*BaseTool) Parameters

func (t *BaseTool) Parameters() map[string]core.ParameterDefinition

Parameters returns the parameters that the tool accepts

type CacheInput

type CacheInput struct {
	Tool  string `json:"tool"`
	Input string `json:"input"`
}

type CacheTool

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

CacheTool provides direct access to the cache

func NewCacheTool

func NewCacheTool(cacheHandler *cache.CacheHandler) *CacheTool

NewCacheTool creates a new cache tool instance

func (*CacheTool) Description

func (t *CacheTool) Description() string

func (*CacheTool) Execute

func (t *CacheTool) Execute(input string) (string, error)

func (*CacheTool) Name

func (t *CacheTool) Name() string

func (*CacheTool) Parameters

func (t *CacheTool) Parameters() map[string]core.ParameterDefinition

type Calculator

type Calculator struct{}

Calculator is a tool that performs basic arithmetic operations

func (*Calculator) Description

func (t *Calculator) Description() string

func (*Calculator) Execute

func (t *Calculator) Execute(input string) (string, error)

func (*Calculator) Name

func (t *Calculator) Name() string

func (*Calculator) Parameters

func (t *Calculator) Parameters() map[string]core.ParameterDefinition

type CalculatorInput

type CalculatorInput struct {
	Operation string  `json:"operation"`
	Number1   float64 `json:"number1"`
	Number2   float64 `json:"number2"`
}

type CodeInput

type CodeInput struct {
	Language string `json:"language"`
	Code     string `json:"code"`
}

type CodeInterpreterTool

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

CodeInterpreterTool allows agents to execute code

func NewCodeInterpreterTool

func NewCodeInterpreterTool(unsafeMode bool, workDir string) *CodeInterpreterTool

NewCodeInterpreterTool creates a new code interpreter tool instance

func (*CodeInterpreterTool) Description

func (t *CodeInterpreterTool) Description() string

func (*CodeInterpreterTool) Execute

func (t *CodeInterpreterTool) Execute(input string) (string, error)

func (*CodeInterpreterTool) Name

func (t *CodeInterpreterTool) Name() string

func (*CodeInterpreterTool) Parameters

func (t *CodeInterpreterTool) Parameters() map[string]core.ParameterDefinition

type DelegationInput

type DelegationInput struct {
	AgentName      string `json:"agent_name"`
	Task           string `json:"task"`
	Context        string `json:"context,omitempty"`
	ExpectedOutput string `json:"expected_output,omitempty"`
}

type DelegationTool

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

DelegationTool allows agents to delegate tasks to other agents

func NewDelegationTool

func NewDelegationTool(team *team.Team, delegator *agents.Agent) *DelegationTool

NewDelegationTool creates a new delegation tool instance

func (*DelegationTool) Description

func (t *DelegationTool) Description() string

func (*DelegationTool) Execute

func (t *DelegationTool) Execute(input string) (string, error)

func (*DelegationTool) Name

func (t *DelegationTool) Name() string

func (*DelegationTool) Parameters

func (t *DelegationTool) Parameters() map[string]core.ParameterDefinition

type FileOperation

type FileOperation struct {
	Operation string      `json:"operation"`
	Path      string      `json:"path"`
	Content   string      `json:"content,omitempty"`
	NewPath   string      `json:"new_path,omitempty"`
	Recursive bool        `json:"recursive,omitempty"`
	Mode      os.FileMode `json:"mode,omitempty"`
}

type FileTool

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

FileTool provides file system operation capabilities

func NewFileTool

func NewFileTool(workDir string) *FileTool

NewFileTool creates a new file operations tool instance

func (*FileTool) Description

func (t *FileTool) Description() string

func (*FileTool) Execute

func (t *FileTool) Execute(input string) (string, error)

func (*FileTool) Name

func (t *FileTool) Name() string

func (*FileTool) Parameters

func (t *FileTool) Parameters() map[string]core.ParameterDefinition

type HTTPRequest

type HTTPRequest struct {
	Method  string            `json:"method"`
	URL     string            `json:"url"`
	Headers map[string]string `json:"headers,omitempty"`
	Body    interface{}       `json:"body,omitempty"`
}

type HTTPTool

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

HTTPTool provides HTTP request capabilities

func NewHTTPTool

func NewHTTPTool() *HTTPTool

NewHTTPTool creates a new HTTP tool instance

func (*HTTPTool) Description

func (t *HTTPTool) Description() string

func (*HTTPTool) Execute

func (t *HTTPTool) Execute(input string) (string, error)

func (*HTTPTool) Name

func (t *HTTPTool) Name() string

func (*HTTPTool) Parameters

func (t *HTTPTool) Parameters() map[string]core.ParameterDefinition

type HumanInputTool

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

HumanInputTool provides interactive input capabilities

func NewHumanInputTool

func NewHumanInputTool(defaultTimeout time.Duration) *HumanInputTool

NewHumanInputTool creates a new human input tool instance

func (*HumanInputTool) Description

func (t *HumanInputTool) Description() string

func (*HumanInputTool) Execute

func (t *HumanInputTool) Execute(input string) (string, error)

func (*HumanInputTool) Name

func (t *HumanInputTool) Name() string

func (*HumanInputTool) Parameters

func (t *HumanInputTool) Parameters() map[string]core.ParameterDefinition

type ImageInput

type ImageInput struct {
	Source   string `json:"source"`    // Path to image file or base64 encoded data
	IsBase64 bool   `json:"is_base64"` // Whether the source is base64 encoded
}

type InputRequest

type InputRequest struct {
	Prompt      string        `json:"prompt"`
	Validation  string        `json:"validation,omitempty"`
	Options     []string      `json:"options,omitempty"`
	Default     string        `json:"default,omitempty"`
	Timeout     time.Duration `json:"timeout,omitempty"`
	Required    bool          `json:"required,omitempty"`
	Description string        `json:"description,omitempty"`
}

type RateLimiter

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

RateLimiter implements a simple rate limiting mechanism

func NewRateLimiter

func NewRateLimiter(interval time.Duration) *RateLimiter

NewRateLimiter creates a new rate limiter with specified interval

func (*RateLimiter) Wait

func (r *RateLimiter) Wait()

Wait blocks until rate limit allows next call

type ScrapingRequest

type ScrapingRequest struct {
	URL       string            `json:"url"`
	Selectors map[string]string `json:"selectors"`
	Headers   map[string]string `json:"headers,omitempty"`
	Timeout   int               `json:"timeout,omitempty"`
}

type ScrapingResult

type ScrapingResult struct {
	URL   string            `json:"url"`
	Data  map[string]string `json:"data"`
	Title string            `json:"title,omitempty"`
	Error string            `json:"error,omitempty"`
}

type ScrapingTool

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

ScrapingTool provides web scraping capabilities

func NewScrapingTool

func NewScrapingTool(userAgent string) *ScrapingTool

NewScrapingTool creates a new web scraping tool instance

func (*ScrapingTool) Description

func (t *ScrapingTool) Description() string

func (*ScrapingTool) Execute

func (t *ScrapingTool) Execute(input string) (string, error)

func (*ScrapingTool) Name

func (t *ScrapingTool) Name() string

func (*ScrapingTool) Parameters

func (t *ScrapingTool) Parameters() map[string]core.ParameterDefinition

type SearchRequest

type SearchRequest struct {
	Query      string `json:"query"`
	NumResults int    `json:"num_results,omitempty"`
	Language   string `json:"language,omitempty"`
	SafeSearch bool   `json:"safe_search,omitempty"`
	SiteFilter string `json:"site_filter,omitempty"`
}

type SearchResult

type SearchResult struct {
	Title       string `json:"title"`
	Link        string `json:"link"`
	Snippet     string `json:"snippet"`
	DisplayLink string `json:"display_link"`
}

type SearchTool

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

SearchTool provides web search capabilities

func NewSearchTool

func NewSearchTool(apiKey, cx string) *SearchTool

NewSearchTool creates a new search tool instance

func (*SearchTool) Description

func (t *SearchTool) Description() string

func (*SearchTool) Execute

func (t *SearchTool) Execute(input string) (string, error)

func (*SearchTool) Name

func (t *SearchTool) Name() string

func (*SearchTool) Parameters

func (t *SearchTool) Parameters() map[string]core.ParameterDefinition

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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