tools

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeImageToBase64

func EncodeImageToBase64(imagePath string) (string, error)

Example function to encode an image to base64

func NewMemoryTool

func NewMemoryTool(name, description string, configuration map[string]string, logger *zap.Logger) entities.Tool

Types

type BrowserTool

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

func NewBrowserTool

func NewBrowserTool(name, description string, configuration map[string]string, logger *zap.Logger) *BrowserTool

func (*BrowserTool) Configuration

func (b *BrowserTool) Configuration() map[string]string

func (*BrowserTool) Description

func (b *BrowserTool) Description() string

func (*BrowserTool) Execute

func (b *BrowserTool) Execute(arguments string) (string, error)

func (*BrowserTool) FullDescription

func (b *BrowserTool) FullDescription() string

func (*BrowserTool) Name

func (b *BrowserTool) Name() string

func (*BrowserTool) Parameters

func (b *BrowserTool) Parameters() []entities.Parameter

func (*BrowserTool) UpdateConfiguration

func (b *BrowserTool) UpdateConfiguration(config map[string]string)

type DirectoryTool

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

func NewDirectoryTool

func NewDirectoryTool(name, description string, configuration map[string]string, logger *zap.Logger) *DirectoryTool

func (*DirectoryTool) Configuration

func (t *DirectoryTool) Configuration() map[string]string

func (*DirectoryTool) Description

func (t *DirectoryTool) Description() string

func (*DirectoryTool) Execute

func (t *DirectoryTool) Execute(arguments string) (string, error)

func (*DirectoryTool) FullDescription

func (t *DirectoryTool) FullDescription() string

func (*DirectoryTool) Name

func (t *DirectoryTool) Name() string

func (*DirectoryTool) Parameters

func (t *DirectoryTool) Parameters() []entities.Parameter

func (*DirectoryTool) UpdateConfiguration

func (t *DirectoryTool) UpdateConfiguration(config map[string]string)

type Entity

type Entity struct {
	Name         string   `json:"name" bson:"name"`
	EntityType   string   `json:"entityType" bson:"entityType"`
	Observations []string `json:"observations" bson:"observations"`
}

Entity represents a node in the knowledge graph

type FetchTool

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

func NewFetchTool

func NewFetchTool(name, description string, configuration map[string]string, logger *zap.Logger) *FetchTool

func (*FetchTool) Configuration

func (t *FetchTool) Configuration() map[string]string

func (*FetchTool) Description

func (f *FetchTool) Description() string

func (*FetchTool) Execute

func (t *FetchTool) Execute(arguments string) (string, error)

func (*FetchTool) FullDescription

func (t *FetchTool) FullDescription() string

func (*FetchTool) Name

func (f *FetchTool) Name() string

func (*FetchTool) Parameters

func (t *FetchTool) Parameters() []entities.Parameter

func (*FetchTool) UpdateConfiguration

func (t *FetchTool) UpdateConfiguration(config map[string]string)

type FileReadTool

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

func NewFileReadTool

func NewFileReadTool(name, description string, configuration map[string]string, logger *zap.Logger) *FileReadTool

func (*FileReadTool) Configuration

func (t *FileReadTool) Configuration() map[string]string

func (*FileReadTool) Description

func (t *FileReadTool) Description() string

func (*FileReadTool) Execute

func (t *FileReadTool) Execute(arguments string) (string, error)

func (*FileReadTool) FullDescription

func (t *FileReadTool) FullDescription() string

func (*FileReadTool) Name

func (t *FileReadTool) Name() string

func (*FileReadTool) Parameters

func (t *FileReadTool) Parameters() []entities.Parameter

func (*FileReadTool) UpdateConfiguration

func (t *FileReadTool) UpdateConfiguration(config map[string]string)

type FileSearchTool

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

func NewFileSearchTool

func NewFileSearchTool(name, description string, configuration map[string]string, logger *zap.Logger) *FileSearchTool

func (*FileSearchTool) Configuration

func (t *FileSearchTool) Configuration() map[string]string

func (*FileSearchTool) Description

func (t *FileSearchTool) Description() string

func (*FileSearchTool) Execute

func (t *FileSearchTool) Execute(arguments string) (string, error)

func (*FileSearchTool) FullDescription

func (t *FileSearchTool) FullDescription() string

func (*FileSearchTool) Name

func (t *FileSearchTool) Name() string

func (*FileSearchTool) Parameters

func (t *FileSearchTool) Parameters() []entities.Parameter

func (*FileSearchTool) UpdateConfiguration

func (t *FileSearchTool) UpdateConfiguration(config map[string]string)

type FileWriteTool

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

func NewFileWriteTool

func NewFileWriteTool(name, description string, configuration map[string]string, logger *zap.Logger) *FileWriteTool

func (*FileWriteTool) Configuration

func (t *FileWriteTool) Configuration() map[string]string

func (*FileWriteTool) Description

func (t *FileWriteTool) Description() string

func (*FileWriteTool) Execute

func (t *FileWriteTool) Execute(arguments string) (string, error)

func (*FileWriteTool) FullDescription

func (t *FileWriteTool) FullDescription() string

func (*FileWriteTool) Name

func (t *FileWriteTool) Name() string

func (*FileWriteTool) Parameters

func (t *FileWriteTool) Parameters() []entities.Parameter

func (*FileWriteTool) UpdateConfiguration

func (t *FileWriteTool) UpdateConfiguration(config map[string]string)

type ImageTool

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

func NewImageTool

func NewImageTool(name, description string, configuration map[string]string, logger *zap.Logger) *ImageTool

func (*ImageTool) Configuration

func (t *ImageTool) Configuration() map[string]string

func (*ImageTool) Description

func (t *ImageTool) Description() string

func (*ImageTool) Execute

func (t *ImageTool) Execute(arguments string) (string, error)

func (*ImageTool) FullDescription

func (t *ImageTool) FullDescription() string

func (*ImageTool) Name

func (t *ImageTool) Name() string

func (*ImageTool) Parameters

func (t *ImageTool) Parameters() []entities.Parameter

func (*ImageTool) UpdateConfiguration

func (t *ImageTool) UpdateConfiguration(config map[string]string)

type KnowledgeGraph

type KnowledgeGraph struct {
	Entities  []Entity   `bson:"entities"`
	Relations []Relation `bson:"relations"`
}

KnowledgeGraph represents the structure stored in MongoDB

type LineResult

type LineResult struct {
	Line int    `json:"line"`
	Text string `json:"text"`
}

type MemoryTool

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

func (*MemoryTool) Configuration

func (t *MemoryTool) Configuration() map[string]string

func (*MemoryTool) Description

func (t *MemoryTool) Description() string

func (*MemoryTool) Execute

func (t *MemoryTool) Execute(arguments string) (string, error)

func (*MemoryTool) FullDescription

func (t *MemoryTool) FullDescription() string

func (*MemoryTool) Name

func (t *MemoryTool) Name() string

func (*MemoryTool) Parameters

func (t *MemoryTool) Parameters() []entities.Parameter

func (*MemoryTool) UpdateConfiguration

func (t *MemoryTool) UpdateConfiguration(config map[string]string)

type Message

type Message struct {
	Role    string           `json:"role"`
	Content []MessageContent `json:"content"`
}

type MessageContent

type MessageContent struct {
	Type     string `json:"type"`
	Text     string `json:"text,omitempty"`
	ImageURL struct {
		URL    string `json:"url"`
		Detail string `json:"detail"`
	} `json:"image_url,omitempty"`
}

type ProcessArgs

type ProcessArgs struct {
	Command    string   `json:"command"`
	Shell      bool     `json:"shell"`
	Input      string   `json:"input"`
	Background bool     `json:"background"`
	Timeout    int      `json:"timeout"`
	Env        []string `json:"env"`
	PID        int      `json:"pid"`
	Action     string   `json:"action"`
}

type ProcessInfo added in v1.2.0

type ProcessInfo struct {
	Cmd          *exec.Cmd
	Stdin        io.WriteCloser
	Stdout       io.ReadCloser
	Stderr       io.ReadCloser
	StdoutBuffer *bytes.Buffer
	StderrBuffer *bytes.Buffer
}

type ProcessResponse

type ProcessResponse struct {
	Command string `json:"command"`
	Stdout  string `json:"stdout"`
	Stderr  string `json:"stderr"`
	PID     int    `json:"pid,omitempty"`
	Status  string `json:"status,omitempty"`
}

type ProcessTool

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

func NewProcessTool

func NewProcessTool(name, description string, configuration map[string]string, logger *zap.Logger) *ProcessTool

func (*ProcessTool) Configuration

func (t *ProcessTool) Configuration() map[string]string

func (*ProcessTool) Description

func (t *ProcessTool) Description() string

func (*ProcessTool) Execute

func (t *ProcessTool) Execute(arguments string) (string, error)

func (*ProcessTool) FullDescription

func (t *ProcessTool) FullDescription() string

func (*ProcessTool) Name

func (t *ProcessTool) Name() string

func (*ProcessTool) Parameters

func (t *ProcessTool) Parameters() []entities.Parameter

func (*ProcessTool) UpdateConfiguration

func (t *ProcessTool) UpdateConfiguration(config map[string]string)

type ProjectTool

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

func NewProjectTool

func NewProjectTool(name, description string, configuration map[string]string, logger *zap.Logger) *ProjectTool

func (*ProjectTool) Configuration

func (t *ProjectTool) Configuration() map[string]string

func (*ProjectTool) Description

func (t *ProjectTool) Description() string

func (*ProjectTool) Execute

func (t *ProjectTool) Execute(arguments string) (string, error)

func (*ProjectTool) FullDescription

func (t *ProjectTool) FullDescription() string

func (*ProjectTool) Name

func (t *ProjectTool) Name() string

func (*ProjectTool) Parameters

func (t *ProjectTool) Parameters() []entities.Parameter

func (*ProjectTool) UpdateConfiguration

func (t *ProjectTool) UpdateConfiguration(config map[string]string)

type Relation

type Relation struct {
	From         string `json:"from" bson:"from"`
	To           string `json:"to" bson:"to"`
	RelationType string `json:"relationType" bson:"relationType"`
}

Relation represents an edge between entities

type RequestBody

type RequestBody struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
}

type SwaggerEndpoint

type SwaggerEndpoint struct {
	Method      string `json:"method"`
	Path        string `json:"path"`
	Description string `json:"description,omitempty"`
}

type SwaggerResponse

type SwaggerResponse struct {
	Endpoints []SwaggerEndpoint `json:"endpoints"`
	RawSpec   string            `json:"raw_spec,omitempty"`
}

type SwaggerTool

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

func NewSwaggerTool

func NewSwaggerTool(name, description string, configuration map[string]string, logger *zap.Logger) *SwaggerTool

func (*SwaggerTool) Configuration

func (t *SwaggerTool) Configuration() map[string]string

func (*SwaggerTool) Description

func (t *SwaggerTool) Description() string

func (*SwaggerTool) Execute

func (t *SwaggerTool) Execute(arguments string) (string, error)

func (*SwaggerTool) FullDescription

func (t *SwaggerTool) FullDescription() string

func (*SwaggerTool) Name

func (t *SwaggerTool) Name() string

func (*SwaggerTool) Parameters

func (t *SwaggerTool) Parameters() []entities.Parameter

func (*SwaggerTool) UpdateConfiguration

func (t *SwaggerTool) UpdateConfiguration(config map[string]string)

type TodoItem added in v1.6.1

type TodoItem struct {
	Content   string    `json:"content"`
	Status    string    `json:"status"`   // pending, in_progress, completed, cancelled
	Priority  string    `json:"priority"` // high, medium, low
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type TodoList added in v1.6.1

type TodoList struct {
	Todos []TodoItem `json:"todos"`
}

type TodoTool added in v1.6.1

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

func NewTodoTool added in v1.6.1

func NewTodoTool(name, description string, configuration map[string]string, logger *zap.Logger) *TodoTool

func (*TodoTool) Configuration added in v1.6.1

func (t *TodoTool) Configuration() map[string]string

func (*TodoTool) Description added in v1.6.1

func (t *TodoTool) Description() string

func (*TodoTool) Execute added in v1.6.1

func (t *TodoTool) Execute(arguments string) (string, error)

func (*TodoTool) FullDescription added in v1.6.1

func (t *TodoTool) FullDescription() string

func (*TodoTool) Name added in v1.6.1

func (t *TodoTool) Name() string

func (*TodoTool) Parameters added in v1.6.1

func (t *TodoTool) Parameters() []entities.Parameter

func (*TodoTool) UpdateConfiguration added in v1.6.1

func (t *TodoTool) UpdateConfiguration(config map[string]string)

type ToolFactory

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

func NewToolFactory

func NewToolFactory() (*ToolFactory, error)

func (*ToolFactory) GetFactoryByName

func (t *ToolFactory) GetFactoryByName(name string) (*ToolFactoryEntry, error)

func (*ToolFactory) ListFactories

func (t *ToolFactory) ListFactories() ([]*ToolFactoryEntry, error)

type ToolFactoryEntry

type ToolFactoryEntry struct {
	Name        string
	Description string
	ConfigKeys  []string
	Factory     func(name, description string, configuration map[string]string, logger *zap.Logger) entities.Tool
}

type TreeEntry

type TreeEntry struct {
	Name     string      `json:"name"`
	Path     string      `json:"path"`
	Type     string      `json:"type"`
	Children []TreeEntry `json:"children,omitempty"`
}

type VisionTool

type VisionTool struct {
	NameField            string
	DescriptionField     string
	FullDescriptionField string
	ConfigurationField   map[string]string
}

func (*VisionTool) Configuration

func (v *VisionTool) Configuration() map[string]string

func (*VisionTool) Description

func (v *VisionTool) Description() string

func (*VisionTool) Execute

func (v *VisionTool) Execute(arguments string) (string, error)

func (*VisionTool) FullDescription

func (v *VisionTool) FullDescription() string

func (*VisionTool) Name

func (v *VisionTool) Name() string

func (*VisionTool) Parameters

func (v *VisionTool) Parameters() []entities.Parameter

func (*VisionTool) UpdateConfiguration

func (v *VisionTool) UpdateConfiguration(config map[string]string)

func (*VisionTool) VisionAPIRequest

func (v *VisionTool) VisionAPIRequest(messages []Message) (string, error)

type WebSearchTool

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

WebSearchTool represents a tool for searching using the Tavily API.

func NewWebSearchTool

func NewWebSearchTool(name, description string, configuration map[string]string, logger *zap.Logger) *WebSearchTool

NewWebSearchTool creates a new instance of WebSearchTool.

func (*WebSearchTool) Configuration

func (t *WebSearchTool) Configuration() map[string]string

func (*WebSearchTool) Description

func (t *WebSearchTool) Description() string

func (*WebSearchTool) Execute

func (t *WebSearchTool) Execute(arguments string) (string, error)

Execute performs the search and returns both the answer and results.

func (*WebSearchTool) FullDescription

func (t *WebSearchTool) FullDescription() string

func (*WebSearchTool) Name

func (t *WebSearchTool) Name() string

func (*WebSearchTool) Parameters

func (t *WebSearchTool) Parameters() []entities.Parameter

func (*WebSearchTool) UpdateConfiguration

func (t *WebSearchTool) UpdateConfiguration(config map[string]string)

Jump to

Keyboard shortcuts

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