Documentation
¶
Overview ¶
Package web provides generic web tools for agentic agents: search, fetch, wikipedia, arxiv, and citation extraction. Each tool is optional — users import only what they need.
Index ¶
Constants ¶
const MaxFetchBytes = 10 * 1024 * 1024
MaxFetchBytes is the hard cap on response bodies the fetcher will read.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtractCitations ¶
type ExtractCitations struct{}
ExtractCitations pulls structured citation mentions out of a block of text. Looks for:
- "Author (Year)" style: Smith (2023)
- "Author, Year" style: Jones, 2020
- "Author et al., Year" style
- "[N]" numbered references
Returns them as a line-per-citation plain-text block.
func NewExtractCitations ¶
func NewExtractCitations() *ExtractCitations
func (*ExtractCitations) Description ¶
func (*ExtractCitations) Description() string
func (*ExtractCitations) Invoke ¶
func (e *ExtractCitations) Invoke(ctx context.Context, args json.RawMessage) (string, error)
func (*ExtractCitations) Name ¶
func (*ExtractCitations) Name() string
func (*ExtractCitations) Schema ¶
func (*ExtractCitations) Schema() json.RawMessage
type FetchPDF ¶
FetchPDF downloads a PDF, extracts its text content, and returns it. Enforces the same 10 MB cap as FetchURL.
func NewFetchPDF ¶
func NewFetchPDF() *FetchPDF
func (*FetchPDF) Description ¶
func (*FetchPDF) Schema ¶
func (*FetchPDF) Schema() json.RawMessage
type FetchURL ¶
FetchURL is a Tool that fetches a URL, validates its Content-Type, and returns its text content (HTML stripped to plain text).
func NewFetchURL ¶
func NewFetchURL() *FetchURL
NewFetchURL constructs the tool with the default HTTP client.
func (*FetchURL) Description ¶
func (*FetchURL) Schema ¶
func (*FetchURL) Schema() json.RawMessage
type SearchArxiv ¶
SearchArxiv hits the arxiv.org export API. Default base URL: http://export.arxiv.org/api
func NewSearchArxiv ¶
func NewSearchArxiv(baseURL string) *SearchArxiv
func (*SearchArxiv) Description ¶
func (*SearchArxiv) Description() string
func (*SearchArxiv) Invoke ¶
func (s *SearchArxiv) Invoke(ctx context.Context, args json.RawMessage) (string, error)
func (*SearchArxiv) Name ¶
func (*SearchArxiv) Name() string
func (*SearchArxiv) Schema ¶
func (*SearchArxiv) Schema() json.RawMessage
type SearchWebBrave ¶
type SearchWebBrave struct {
BaseURL string // default "https://api.search.brave.com/res/v1"
APIKey string // X-Subscription-Token header value
Client *http.Client // defaults to http.DefaultClient
Count int // result count (default 10, max 20)
}
SearchWebBrave is a Tool that searches the web via the Brave Search API. Free tier: 2000 queries/month, no credit card required. Sign up at https://api.search.brave.com/
func NewSearchWebBrave ¶
func NewSearchWebBrave(baseURL, apiKey string) *SearchWebBrave
NewSearchWebBrave constructs the tool. Pass "" for baseURL to use the default Brave API endpoint.
func (*SearchWebBrave) Description ¶
func (*SearchWebBrave) Description() string
func (*SearchWebBrave) Invoke ¶
func (s *SearchWebBrave) Invoke(ctx context.Context, args json.RawMessage) (string, error)
func (*SearchWebBrave) Name ¶
func (*SearchWebBrave) Name() string
func (*SearchWebBrave) Schema ¶
func (*SearchWebBrave) Schema() json.RawMessage
type SearchWikipedia ¶
SearchWikipedia hits the MediaWiki REST search endpoint. Default base URL: https://en.wikipedia.org/w/rest.php/v1
func NewSearchWikipedia ¶
func NewSearchWikipedia(baseURL string) *SearchWikipedia
func (*SearchWikipedia) Description ¶
func (*SearchWikipedia) Description() string
func (*SearchWikipedia) Invoke ¶
func (s *SearchWikipedia) Invoke(ctx context.Context, args json.RawMessage) (string, error)
func (*SearchWikipedia) Name ¶
func (*SearchWikipedia) Name() string
func (*SearchWikipedia) Schema ¶
func (*SearchWikipedia) Schema() json.RawMessage