x_tools

package
v0.3.63 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

README

TOOLS

Tools are object that an agent can use to accomplish some tasks like convert PDF into text, create chunks of large text, perform web search, etc...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkTextMaxRows

func ChunkTextMaxRows(ctrlTools *ToolsFactory, progress x_commons.ProgressCallback, text string, maxRows int) (response *tool2.ToolsResponse)

func ConvertFileToText

func ConvertFileToText(ctrlTools *ToolsFactory, progress x_commons.ProgressCallback, filename string) (response *tool2.ToolsResponse)

ConvertFileToText converts the specified file to text using the provided ToolsFactory and returns the result or an error.

func ConvertToText

func ConvertToText(ctrlTools *ToolsFactory, progress x_commons.ProgressCallback, ext string, data []byte) (response *tool2.ToolsResponse)

Types

type ToolsFactory

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

ToolsFactory is a struct for managing tool creation logic with optional caching of tool constructors.

func NewToolsFactory

func NewToolsFactory(root string, logger gg_.ILogger) (instance *ToolsFactory)

func (*ToolsFactory) Add

func (instance *ToolsFactory) Add(name string, constructor tool.ToolsCtr) *ToolsFactory

func (*ToolsFactory) Contains

func (instance *ToolsFactory) Contains(name string) (response bool)

func (*ToolsFactory) Get

func (instance *ToolsFactory) Get(name string) (response tool.ITool, err error)

func (*ToolsFactory) GetUseCache

func (instance *ToolsFactory) GetUseCache() bool

func (*ToolsFactory) Prefetch

func (instance *ToolsFactory) Prefetch(name string) (err error)

Prefetch ensures that the specified tool is initialized and optionally cached by the ToolsFactory.

func (*ToolsFactory) PrefetchAll

func (instance *ToolsFactory) PrefetchAll() (response []string)

PrefetchAll initializes and populates a cache of tools by invoking all registered constructor functions.

func (*ToolsFactory) SetUseCache

func (instance *ToolsFactory) SetUseCache(useCache bool) *ToolsFactory

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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