web

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Web tool that fetches a URL and returns its content as readable text

Index

Constants

View Source
const FetchName = "WebFetch"

Variables

This section is empty.

Functions

func Fetch

func Fetch(o Options) (tool.Tool, error)

Tool that fetches a URL, converts HTML to text and optionally answers a prompt about it

func TextFrom

func TextFrom(doc string, base *url.URL) string

Converts HTML to plain text, resolving links against base and any base element in the document

Types

type Completer

type Completer interface {
	Complete(ctx context.Context, req protocol.Request) (protocol.Response, error)
}

Answers a prompt against fetched text, satisfied by a provider

type Options

type Options struct {
	// Model that answers the prompt argument when set, naming its own model id
	Summarizer Completer
}

Settings of the fetch tool

type Page

type Page struct {
	URL         string
	FinalURL    string
	Status      int
	ContentType string
	Charset     string
	Title       string
	Text        string
	Bytes       int
	Cached      bool
	Duration    time.Duration
	// Answer the summarizer gave when a prompt was supplied
	Answer string
}

Structured outcome of a fetch

Jump to

Keyboard shortcuts

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