tool

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Name        string
	Description string
	// InputSchema is the JSON Schema describing the tool's input parameters.
	InputSchema *jsonschema.Schema
}

Definition holds the metadata that describes a tool to an LLM.

type Tool

type Tool interface {
	// Definition returns the tool's metadata used by the LLM to understand and call the tool.
	Definition() Definition
	// Run executes the tool with the given arguments JSON string and returns the result as a string.
	Run(ctx context.Context, toolCallID string, arguments string) (string, error)
}

Tool is a provider-agnostic interface for tools that can be invoked by an LLM.

func WithTimeout added in v0.0.3

func WithTimeout(t Tool, d time.Duration) Tool

WithTimeout wraps t so that each Run invocation is bounded by the given timeout. The timeout is applied on top of any deadline already present in the incoming context, so the shorter of the two wins. A zero or negative duration is a no-op and returns t unchanged.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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