tools

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionCall

type FunctionCall struct {
	Name      string `json:"name,omitempty"`
	Arguments string `json:"arguments,omitempty"`
}

type FunctionDefinition

type FunctionDefinition struct {
	Name         string             `json:"name"`
	Description  string             `json:"description,omitempty"`
	Strict       bool               `json:"strict,omitempty"`
	Parameters   FunctionParameters `json:"parameters"`
	Annotations  ToolAnnotation     `json:"annotations"`
	OutputSchema ToolOutputSchema   `json:"outputSchema"`
}

type FunctionParameters added in v1.5.2

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

func (FunctionParameters) MarshalJSON added in v1.5.2

func (fp FunctionParameters) MarshalJSON() ([]byte, error)

type Tool

type Tool struct {
	Function *FunctionDefinition `json:"function,omitempty"`
	Handler  ToolHandler         `json:"-"`
}

func (*Tool) DisplayName added in v0.7.0

func (t *Tool) DisplayName() string

type ToolAnnotation

type ToolAnnotation struct {
	Title           string `json:"title,omitempty"`
	ReadOnlyHint    *bool  `json:"readOnlyHint,omitempty"`
	DestructiveHint *bool  `json:"destructiveHint,omitempty"`
	IdempotentHint  *bool  `json:"idempotentHint,omitempty"`
	OpenWorldHint   *bool  `json:"openWorldHint,omitempty"`
}

type ToolCall

type ToolCall struct {
	ID       string       `json:"id,omitempty"`
	Type     ToolType     `json:"type"`
	Function FunctionCall `json:"function"`
}

type ToolCallResult

type ToolCallResult struct {
	Output string `json:"output"`
}

type ToolHandler

type ToolHandler = func(ctx context.Context, toolCall ToolCall) (*ToolCallResult, error)

type ToolOutputSchema added in v1.5.8

type ToolOutputSchema struct {
	Ref        string         `json:"$ref,omitempty"`
	Type       string         `json:"type"`
	Items      map[string]any `json:"items,omitempty"`
	Properties map[string]any `json:"properties,omitempty"`
	Required   []string       `json:"required,omitempty"`
}

func ToOutputSchemaSchema added in v1.5.14

func ToOutputSchemaSchema(valueType reflect.Type) ToolOutputSchema

type ToolSet

type ToolSet interface {
	Tools(ctx context.Context) ([]Tool, error)
	Instructions() string
	Start(ctx context.Context) error
	Stop() error
}

type ToolType

type ToolType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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