tool

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCall

func NewCall(id, name string, input map[string]any) *call

func NewResult

func NewResult(call llm.ToolCall, value any) llm.ToolResult

Types

type CallMeta

type CallMeta struct {
	Name  string         `json:"name"`
	Id    string         `json:"id,omitempty"`
	Input map[string]any `json:"input,omitempty"`
}

type ResultMeta

type ResultMeta struct {
	Call  llm.ToolCall `json:"call"`
	Value any          `json:"result"`
}

type ToolFunction added in v0.0.3

type ToolFunction struct {
	Type     string `json:"type"` // function
	llm.Tool `json:"function"`
}

func (ToolFunction) String added in v0.0.3

func (t ToolFunction) String() string

type ToolKit

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

ToolKit represents a toolkit of tools

func NewToolKit

func NewToolKit() *ToolKit

Create a new empty toolkit for an agent

func (*ToolKit) Register

func (kit *ToolKit) Register(v llm.Tool) error

Register a tool in the toolkit

func (*ToolKit) Run

func (kit *ToolKit) Run(ctx context.Context, calls ...llm.ToolCall) ([]llm.ToolResult, error)

Run calls a tool in the toolkit

func (*ToolKit) Tools

func (kit *ToolKit) Tools(agent llm.Agent) []llm.Tool

Return all registered tools for a specific agent

type ToolMeta

type ToolMeta struct {
	Name        string `json:"name"`
	Description string `json:"description"`

	// Variation on how schema is output
	Parameters  *ToolParameters `json:"parameters,omitempty"`
	InputSchema *ToolParameters `json:"input_schema,omitempty"`
}

type ToolParameter

type ToolParameter struct {
	Name        string   `json:"-"`
	Type        string   `json:"type"`
	Description string   `json:"description,omitempty"`
	Enum        []string `json:"enum,omitempty"`
	// contains filtered or unexported fields
}

type ToolParameters

type ToolParameters struct {
	Type       string                   `json:"type,omitempty"`
	Required   []string                 `json:"required"`
	Properties map[string]ToolParameter `json:"properties"`
}

Jump to

Keyboard shortcuts

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