Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBinary ¶
IsBinary reports whether data appears to be binary (non-text) content. It samples up to the first 8KB and checks for a high ratio of non-UTF-8 bytes or null bytes, which are reliable indicators of binary data.
func SplitLines ¶
SplitLines splits text into lines preserving newline suffixes. Trims the trailing empty element that strings.SplitAfter produces.
Types ¶
type Definition ¶
type Definition = ai.ToolDefinition
Definition is a callable tool definition exposed to a model.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds named tools and provides lookup + definitions.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates an empty tool registry. Tools are registered externally via Register().
func (*Registry) BuiltinNames ¶
BuiltinNames returns the names of all currently registered tools.
func (*Registry) Definitions ¶
func (r *Registry) Definitions() []Definition
Definitions returns all tool definitions for passing to the LLM.
type Tool ¶
type Tool interface {
Definition() Definition
Execute(ctx context.Context, args map[string]any) (string, error)
}
Tool is a tool that can be executed by the Go runner.
type TruncationResult ¶
TruncationResult holds the truncated output and metadata.
func TruncateHead ¶
func TruncateHead(output string) TruncationResult
TruncateHead keeps the first N lines / bytes (whichever limit is hit first). Suitable for file reads and search results where the beginning matters most.
func TruncateTail ¶
func TruncateTail(output string) TruncationResult
TruncateTail keeps the last N lines / bytes (whichever limit is hit first). Suitable for command output and logs where the end matters most.