tools

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AutoTool = Tool{
	Name: "auto",
}

AutoTool means the model can pick between generating a message or calling one or more tools

View Source
var ControlTools = []Tool{
	NoTool,
	AutoTool,
	RequiredTool,
}
View Source
var NoTool = Tool{
	Name: "none",
}

NoTool means the model will not call any tool and instead generates a message

View Source
var RequiredTool = Tool{
	Name: "required",
}

RequiredTool means the model must call one or more tools.

Functions

This section is empty.

Types

type Call added in v0.2.0

type Call struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name"`
	Argument []byte `json:"argument"`

	Ref *Tool `json:"-"`
}

type EmptyArgs

type EmptyArgs struct{}

type Function added in v0.2.0

type Function func(ctx context.Context, call Call) (response string, err error)

type Tool

type Tool struct {
	Name           string                                               `json:"name"`
	Description    string                                               `json:"description"`
	ArgumentSchema *schema.JSON                                         `json:"argument_schema,omitempty"`
	Function       func(ctx context.Context, call Call) (string, error) `json:"-"`
}

func NewTool

func NewTool(name string, options ...ToolOption) Tool

type ToolOption

type ToolOption func(tool Tool) Tool

func WithArgSchema added in v0.1.0

func WithArgSchema(arg any) ToolOption

func WithDescription

func WithDescription(description string) ToolOption

func WithFunction added in v0.2.0

func WithFunction(callback Function) ToolOption

Jump to

Keyboard shortcuts

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