tools

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const SymflowerVersionRequired = "45435"

SymflowerVersionRequired holds the version of Symflower required for this revision of the evaluation.

Variables

View Source
var (
	// ErrToolVersionOutdated indicates that an installed tool is outdated.
	ErrToolVersionOutdated = errors.New("tool version mismatch")
	// ErrUnsupportedOperatingSystem indicates that the operating system is not supported by the tool.
	ErrUnsupportedOperatingSystem = errors.New("tool is not supported with the operating system")
)
View Source
var OllamaPath = "ollama" + osutil.BinaryExtension()

OllamaPath holds the file path to the Ollama binary or the command name that should be executed.

View Source
var (
	// OllamaURL holds the URL to the Ollama service.
	OllamaURL = "http://127.0.0.1:11434"
)
View Source
var SymflowerPath = "symflower" + osutil.BinaryExtension()

SymflowerPath holds the file path to the Symflower binary or the command name that should be executed.

View Source
var Tools = map[string]Tool{}

Tools holds a register of all tools.

Functions

func Install

func Install(logger *log.Logger, installPath string) (err error)

Install install all basic evaluation tools.

func InstallAll

func InstallAll(logger *log.Logger, installPath string) (err error)

InstallAll installs all tools.

func InstallEvaluation

func InstallEvaluation(logger *log.Logger, installPath string) (err error)

InstallEvaluation installs all basic evaluation tools.

func InstallPathDefault

func InstallPathDefault() (installPath string, err error)

InstallPathDefault returns the default installation path for tools.

func InstallTool

func InstallTool(logger *log.Logger, tool Tool, installPath string) (err error)

InstallTool installs the given tool to the installation path.

func OllamaCheck

func OllamaCheck(url string) (err error)

OllamaCheck checks that an Ollama service is running at the given URL.

func OllamaLoad

func OllamaLoad(ollamaURL string, modelName string) (err error)

OllamaLoad loads a model into memory.

func OllamaModels

func OllamaModels(ollamaURL string) (modelNames []string, err error)

OllamaModels returns which models are available to be queried.

func OllamaPull

func OllamaPull(logger *log.Logger, binaryPath string, url string, modelName string) (err error)

OllamaPull pulls a model.

func OllamaStart

func OllamaStart(logger *log.Logger, binaryPath string, url string) (shutdown func() (err error), err error)

OllamaStart starts an Ollama service if necessary with the given binary connected to the given URL and returns a shutdown function.

func OllamaUnload

func OllamaUnload(ollamaURL string, modelName string) (err error)

OllamaUnload unloads a model from memory.

func Register

func Register(tool Tool)

Register adds a tool to the common tool list.

Types

type Ollama

type Ollama struct{}

Ollama holds the "Ollama" tool.

func (*Ollama) BinaryName

func (*Ollama) BinaryName() string

BinaryName returns the name of the tool's binary.

func (*Ollama) BinaryPath

func (*Ollama) BinaryPath() string

BinaryPath returns the file path of the tool's binary or the command name that should be executed. The binary path might also be just the binary name in case the tool is expected to be on the system path.

func (*Ollama) CheckVersion

func (*Ollama) CheckVersion(logger *log.Logger, binaryPath string) (err error)

CheckVersion checks if the tool's version is compatible with the required version.

func (*Ollama) ID

func (*Ollama) ID() (id string)

ID returns the unique ID of this tool.

func (*Ollama) Install

func (*Ollama) Install(logger *log.Logger, installPath string) (err error)

Install installs the tool's binary to the given install path.

func (*Ollama) RequiredVersion

func (*Ollama) RequiredVersion() string

RequiredVersion returns the required version of the tool.

type Tool

type Tool interface {
	// ID returns the unique ID of this tool.
	ID() (id string)
	// BinaryName returns the name of the tool's binary.
	BinaryName() string
	// BinaryPath returns the file path of the tool's binary or the command name that should be executed.
	// The binary path might also be just the binary name in case the tool is expected to be on the system path.
	BinaryPath() string

	// CheckVersion checks if the tool's version is compatible with the required version.
	CheckVersion(logger *log.Logger, binaryPath string) error
	// RequiredVersion returns the required version of the tool.
	RequiredVersion() string

	// Install installs the tool's binary to the given install path.
	Install(logger *log.Logger, installPath string) error
}

Tool defines an external tool.

func NewOllama

func NewOllama() Tool

NewOllama returns a new Ollama tool.

func NewSymflower

func NewSymflower() Tool

NewSymflower returns a new Symflower tool.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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