web

package
v0.2.9-alpha.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package web hosts web tools: web_search (Tavily-backed) and web_fetch (HTTP GET + readable-text extraction).

Tools hold a *config.Config pointer captured at construction so their Execute methods can read the live FETCH_MAX_BYTES / TAVILY_API_KEY (mutated by the /config form) without falling back to a global singleton.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Names

func Names() []tools.ToolName

Names lists every tool name this package contributes.

Types

type FetchTool

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

FetchTool implements web_fetch — GET a URL, render readable text. The cfg pointer is read at Execute time so runtime mutations of FetchMaxBytes via the /config form take effect on the next call.

func NewFetch

func NewFetch(cfg *config.Config) *FetchTool

NewFetch builds a fetch tool bound to cfg. cfg may be nil — Execute falls back to the default 100k byte cap.

func (*FetchTool) Description

func (t *FetchTool) Description() string

func (*FetchTool) Execute

func (t *FetchTool) Execute(ctx context.Context, logger *slog.Logger, input json.RawMessage) (tools.Result, error)

func (*FetchTool) Name

func (t *FetchTool) Name() string

func (*FetchTool) Schema

func (t *FetchTool) Schema() json.RawMessage

type SearchTool

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

SearchTool implements web_search via the Tavily API. The cfg pointer is read at Execute time so the /config form's TavilyAPIKey rotation takes effect on the next call.

func NewSearch

func NewSearch(cfg *config.Config) *SearchTool

NewSearch builds a search tool bound to cfg. cfg may be nil — Execute surfaces a "not configured" error when no API key is reachable.

func (*SearchTool) Description

func (t *SearchTool) Description() string

func (*SearchTool) Execute

func (t *SearchTool) Execute(ctx context.Context, logger *slog.Logger, input json.RawMessage) (tools.Result, error)

func (*SearchTool) Name

func (t *SearchTool) Name() string

func (*SearchTool) Schema

func (t *SearchTool) Schema() json.RawMessage

Jump to

Keyboard shortcuts

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