tools

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileTree = FileTreeTool{
	Name:        "local_file_tree",
	Description: "List the filetree of some directory. Uses linux command 'tree'.",
	Inputs: InputSchema{
		Type: "object",
		Properties: map[string]ParameterObject{
			"directory": {
				Type:        "string",
				Description: "The directory to list the filetree of.",
			},
			"level": {
				Type:        "integer",
				Description: "The depth of the tree to display.",
			},
		},
		Required: []string{"directory"},
	},
}

Functions

func Invoke added in v1.2.7

func Invoke(call Call) string

Invoke the call, and gather both error and output in the same string

func NewValidationError added in v1.2.7

func NewValidationError(fieldsMissing []string) error

Types

type AiTool added in v1.2.7

type AiTool interface {
	// Call the AI tool with the given Input. Returns output from the tool or an error
	// if the call returned an error-like. An error-like is either exit code non-zero or
	// restful response non 2xx.
	Call(Input) (string, error)

	// Return the UserFunction, later on used
	// by text queriers to send to their respective
	// models
	UserFunction() UserFunction
}

type Call added in v1.2.7

type Call struct {
	Name   string `json:"name"`
	Inputs Input  `json:"inputs"`
}

func (Call) Json added in v1.2.7

func (c Call) Json() string

type FileTreeTool added in v1.2.7

type FileTreeTool UserFunction

func (FileTreeTool) Call added in v1.2.7

func (f FileTreeTool) Call(input Input) (string, error)

func (FileTreeTool) UserFunction added in v1.2.7

func (f FileTreeTool) UserFunction() UserFunction

type Input added in v1.2.7

type Input map[string]any

type InputSchema added in v1.2.7

type InputSchema struct {
	Type       string                     `json:"type"`
	Properties map[string]ParameterObject `json:"properties"`
	Required   []string                   `json:"required"`
}

type ParameterObject added in v1.2.7

type ParameterObject struct {
	Type        string   `json:"type"`
	Description string   `json:"description"`
	Enum        []string `json:"enum,omitempty"`
}

type UserFunction added in v1.2.7

type UserFunction struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Inputs      InputSchema `json:"input_schema"`
}

type ValidationError added in v1.2.7

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

func (ValidationError) Error added in v1.2.7

func (v ValidationError) Error() string

Jump to

Keyboard shortcuts

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